zigbee2mqtt-windfront 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{About-DLa2ChOB.js → About-TZ4O8QML.js} +1 -1
- package/dist/assets/About-TZ4O8QML.js.br +0 -0
- package/dist/assets/{Availability-D5KTI3Gp.js → Availability-OdCG83fY.js} +1 -1
- package/dist/assets/Availability-OdCG83fY.js.br +0 -0
- package/dist/assets/{Bind-DeXxsott.js → Bind-C5pHyzCs.js} +1 -1
- package/dist/assets/Bind-C5pHyzCs.js.br +0 -0
- package/dist/assets/Bridge-DfqzyT8-.js +1 -0
- package/dist/assets/Bridge-DfqzyT8-.js.br +0 -0
- package/dist/assets/{CheckboxField-CaA8YhTd.js → CheckboxField-TKQay1FH.js} +1 -1
- package/dist/assets/CheckboxField-TKQay1FH.js.br +0 -0
- package/dist/assets/{ClusterSinglePicker-DujI1Kk6.js → ClusterSinglePicker-Aqw2LQ44.js} +1 -1
- package/dist/assets/ClusterSinglePicker-Aqw2LQ44.js.br +0 -0
- package/dist/assets/{Clusters-BQu9HRXr.js → Clusters-D9VVrvfy.js} +1 -1
- package/dist/assets/Clusters-D9VVrvfy.js.br +0 -0
- package/dist/assets/{ContributePage-BA9f4eSk.js → ContributePage-DJztRO5j.js} +1 -1
- package/dist/assets/ContributePage-DJztRO5j.js.br +0 -0
- package/dist/assets/{Dashboard-CoQfhwxv.js → Dashboard-D0xkck4k.js} +1 -1
- package/dist/assets/Dashboard-D0xkck4k.js.br +0 -0
- package/dist/assets/{DashboardFeatureWrapper--hzUpPRy.js → DashboardFeatureWrapper-D1u5U6WW.js} +1 -1
- package/dist/assets/DashboardFeatureWrapper-D1u5U6WW.js.br +0 -0
- package/dist/assets/{DebouncedInput-DbVQn5vN.js → DebouncedInput-CZQ37jCp.js} +1 -1
- package/dist/assets/DebouncedInput-CZQ37jCp.js.br +0 -0
- package/dist/assets/DevConsole-B071OSe2.js +7 -0
- package/dist/assets/DevConsole-B071OSe2.js.br +0 -0
- package/dist/assets/{DevConsole-DmwhDq-Z.js → DevConsole-CM5GU_r3.js} +1 -1
- package/dist/assets/DevConsole-CM5GU_r3.js.br +0 -0
- package/dist/assets/{DeviceCard-0gRlLdCT.js → DeviceCard-q3ZgPcN6.js} +1 -1
- package/dist/assets/DeviceCard-q3ZgPcN6.js.br +0 -0
- package/dist/assets/{DeviceImage-DYpYz5SI.js → DeviceImage-DRzocJZB.js} +1 -1
- package/dist/assets/DeviceImage-DRzocJZB.js.br +0 -0
- package/dist/assets/{DeviceInfo-D87EewKc.js → DeviceInfo-BSWyQz7V.js} +1 -1
- package/dist/assets/DeviceInfo-BSWyQz7V.js.br +0 -0
- package/dist/assets/{DevicePage-DLJsomjN.js → DevicePage-BOd3kOIE.js} +2 -2
- package/dist/assets/DevicePage-BOd3kOIE.js.br +0 -0
- package/dist/assets/DevicePicker-DL6Fwwqj.js +1 -0
- package/dist/assets/DevicePicker-DL6Fwwqj.js.br +0 -0
- package/dist/assets/{DeviceSettings-BoV43IGa.js → DeviceSettings-CsYqb0R5.js} +1 -1
- package/dist/assets/DeviceSettings-CsYqb0R5.js.br +0 -0
- package/dist/assets/{DeviceSpecificSettings-CDSrJZtr.js → DeviceSpecificSettings-DuM9skmb.js} +1 -1
- package/dist/assets/DeviceSpecificSettings-DuM9skmb.js.br +0 -0
- package/dist/assets/{Devices-Cq8qTRUw.js → Devices-DZgF3TCb.js} +1 -1
- package/dist/assets/Devices-DZgF3TCb.js.br +0 -0
- package/dist/assets/{DevicesPage-4CZMcmpl.js → DevicesPage-CO5yT0fA.js} +1 -1
- package/dist/assets/DevicesPage-CO5yT0fA.js.br +0 -0
- package/dist/assets/{DisplayValue-ZtlRXdX7.js → DisplayValue-BXPcJFUn.js} +1 -1
- package/dist/assets/DisplayValue-BXPcJFUn.js.br +0 -0
- package/dist/assets/{EndpointPicker-B4Z6Kw3O.js → EndpointPicker-BqvSRO3P.js} +1 -1
- package/dist/assets/EndpointPicker-BqvSRO3P.js.br +0 -0
- package/dist/assets/{Exposes-Ya78B8vT.js → Exposes-D3Arxj_v.js} +1 -1
- package/dist/assets/Exposes-D3Arxj_v.js.br +0 -0
- package/dist/assets/{Feature-Cii_Ps_h.js → Feature-DfJkpvIM.js} +1 -1
- package/dist/assets/Feature-DfJkpvIM.js.br +0 -0
- package/dist/assets/{FrontendSettingsPage-BBghwioM.js → FrontendSettingsPage-DIqKe50q.js} +1 -1
- package/dist/assets/FrontendSettingsPage-DIqKe50q.js.br +0 -0
- package/dist/assets/{GroupPage-D7hwrUN6.js → GroupPage-Fmbp4n5T.js} +2 -2
- package/dist/assets/GroupPage-Fmbp4n5T.js.br +0 -0
- package/dist/assets/{GroupSettings-DSpKjl_d.js → GroupSettings-y_uEZgXf.js} +1 -1
- package/dist/assets/GroupSettings-y_uEZgXf.js.br +0 -0
- package/dist/assets/Groups-Ckbv_gZM.js +1 -0
- package/dist/assets/Groups-Ckbv_gZM.js.br +0 -0
- package/dist/assets/{GroupsPage-Dh_yPJDE.js → GroupsPage-Cepdx75I.js} +1 -1
- package/dist/assets/GroupsPage-Cepdx75I.js.br +0 -0
- package/dist/assets/{Health-DzAMijLm.js → Health-GTdH5825.js} +1 -1
- package/dist/assets/Health-GTdH5825.js.br +0 -0
- package/dist/assets/{HomePage-C-QE-boi.js → HomePage-DYcrbkJn.js} +1 -1
- package/dist/assets/HomePage-DYcrbkJn.js.br +0 -0
- package/dist/assets/{InfoAlert-CKOVoAit.js → InfoAlert-l7-IUhTc.js} +1 -1
- package/dist/assets/InfoAlert-l7-IUhTc.js.br +0 -0
- package/dist/assets/{InputField-CIKw2Xrr.js → InputField-3QxIGWSY.js} +1 -1
- package/dist/assets/InputField-3QxIGWSY.js.br +0 -0
- package/dist/assets/{Json-Bo8BBs-S.js → Json-NmlmAak6.js} +1 -1
- package/dist/assets/Json-NmlmAak6.js.br +1 -0
- package/dist/assets/{LastSeen-BEZqgdEU.js → LastSeen-hiHpltqT.js} +1 -1
- package/dist/assets/LastSeen-hiHpltqT.js.br +0 -0
- package/dist/assets/{LogsPage-DPtdg338.js → LogsPage-CZX6eShy.js} +1 -1
- package/dist/assets/LogsPage-CZX6eShy.js.br +0 -0
- package/dist/assets/Lqi-hQhbbdKy.js +1 -0
- package/dist/assets/Lqi-hQhbbdKy.js.br +0 -0
- package/dist/assets/{NetworkPage-BDAtNT4N.js → NetworkPage-DuhzBasS.js} +2 -2
- package/dist/assets/NetworkPage-DuhzBasS.js.br +0 -0
- package/dist/assets/{NumberField-Dg46yaKl.js → NumberField-C7Z2nYPV.js} +1 -1
- package/dist/assets/NumberField-C7Z2nYPV.js.br +0 -0
- package/dist/assets/{OtaPage-M46Kw5Gm.js → OtaPage-B8L5qxAf.js} +1 -1
- package/dist/assets/OtaPage-B8L5qxAf.js.br +0 -0
- package/dist/assets/{PowerSource-B3Yl2iYL.js → PowerSource-DrNt6XCf.js} +1 -1
- package/dist/assets/PowerSource-DrNt6XCf.js.br +0 -0
- package/dist/assets/{RawNetworkData-C5CQaN7e.js → RawNetworkData-CMEmn9t2.js} +1 -8
- package/dist/assets/RawNetworkData-CMEmn9t2.js.br +0 -0
- package/dist/assets/{RawNetworkMap-DOlwNOXW.js → RawNetworkMap-B8fL2eJf.js} +6 -81
- package/dist/assets/RawNetworkMap-B8fL2eJf.js.br +0 -0
- package/dist/assets/{RecallRemove-BH_4gFWm.js → RecallRemove-D-AcOQ05.js} +1 -1
- package/dist/assets/RecallRemove-D-AcOQ05.js.br +0 -0
- package/dist/assets/{RemoveDeviceModal-BE8nZkGo.js → RemoveDeviceModal-D06tjCMz.js} +1 -1
- package/dist/assets/RemoveDeviceModal-D06tjCMz.js.br +0 -0
- package/dist/assets/{Reporting-CnJfRV0g.js → Reporting-ChS4DFau.js} +1 -1
- package/dist/assets/Reporting-ChS4DFau.js.br +0 -0
- package/dist/assets/{Scene-DfhxXULb.js → Scene-Ci-hxmNQ.js} +1 -1
- package/dist/assets/Scene-Ci-hxmNQ.js.br +0 -0
- package/dist/assets/{SelectField-CyWoaAVb.js → SelectField-h9qq5MA4.js} +1 -1
- package/dist/assets/SelectField-h9qq5MA4.js.br +0 -0
- package/dist/assets/{Settings-Bgi1c_ao.js → Settings-oGktHfF9.js} +1 -1
- package/dist/assets/Settings-oGktHfF9.js.br +0 -0
- package/dist/assets/{SettingsList-CRIawtvr.js → SettingsList-CnoTXnfs.js} +1 -1
- package/dist/assets/SettingsList-CnoTXnfs.js.br +0 -0
- package/dist/assets/{SettingsPage-3-51HC4j.js → SettingsPage-DQHvc7c7.js} +2 -2
- package/dist/assets/SettingsPage-DQHvc7c7.js.br +0 -0
- package/dist/assets/State-KELhkLu0.js +1 -0
- package/dist/assets/State-KELhkLu0.js.br +0 -0
- package/dist/assets/{Table-BMOp3G4j.js → Table-SXLxKwwz.js} +1 -1
- package/dist/assets/Table-SXLxKwwz.js.br +0 -0
- package/dist/assets/{TextareaField-CbVtSljh.js → TextareaField-CjTj7XVP.js} +1 -1
- package/dist/assets/TextareaField-CjTj7XVP.js.br +0 -0
- package/dist/assets/{Tools-Bs96okeO.js → Tools-PEDwf9Q4.js} +1 -1
- package/dist/assets/Tools-PEDwf9Q4.js.br +0 -0
- package/dist/assets/{TouchlinkPage-Bb4oFPyj.js → TouchlinkPage-D9KYQZZ8.js} +1 -1
- package/dist/assets/TouchlinkPage-D9KYQZZ8.js.br +0 -0
- package/dist/assets/{VendorLink-ClL_ZY47.js → VendorLink-B-R47UWQ.js} +1 -1
- package/dist/assets/VendorLink-B-R47UWQ.js.br +1 -0
- package/dist/assets/{_createCompounder-BUW0VzD-.js → _createCompounder-BFysA5eM.js} +1 -1
- package/dist/assets/_createCompounder-BFysA5eM.js.br +0 -0
- package/dist/assets/{format-C1E149BK.js → format-b9f5a4wv.js} +1 -1
- package/dist/assets/format-b9f5a4wv.js.br +0 -0
- package/dist/assets/index-B3fqoxqX.css +1 -0
- package/dist/assets/index-B3fqoxqX.css.br +0 -0
- package/dist/assets/index-BbNbpRjN.js +579 -0
- package/dist/assets/index-BbNbpRjN.js.br +0 -0
- package/dist/assets/{index-BWCKKOXu.js → index-CQx8EJVp.js} +1 -1
- package/dist/assets/index-CQx8EJVp.js.br +0 -0
- package/dist/assets/{index-CoqysZeI.js → index-pTOKZKC7.js} +1 -1
- package/dist/assets/index-pTOKZKC7.js.br +0 -0
- package/dist/assets/{isArray-BNsEL_P3.js → isArray-BnV6Ts7z.js} +1 -1
- package/dist/assets/isArray-BnV6Ts7z.js.br +0 -0
- package/dist/assets/{jszip.min-Dbx0Xht4.js → jszip.min-E7C3THpd.js} +1 -11
- package/dist/assets/jszip.min-E7C3THpd.js.br +0 -0
- package/dist/assets/{merge-FdH4enH0.js → merge-DT0EoWv1.js} +1 -1
- package/dist/assets/merge-DT0EoWv1.js.br +0 -0
- package/dist/assets/snakeCase-DGhRQvQI.js +1 -0
- package/dist/assets/snakeCase-DGhRQvQI.js.br +0 -0
- package/dist/assets/{useColumnCount-BbLlvyFs.js → useColumnCount-CHXGP6nq.js} +1 -1
- package/dist/assets/useColumnCount-CHXGP6nq.js.br +0 -0
- package/dist/assets/{useSearch-D_JCWoke.js → useSearch-BP3fbu04.js} +1 -1
- package/dist/assets/useSearch-BP3fbu04.js.br +0 -0
- package/dist/assets/{useTable-BacTGfa3.js → useTable-5n03jm0q.js} +2 -20
- package/dist/assets/useTable-5n03jm0q.js.br +0 -0
- package/dist/index.html +2 -2
- package/dist/index.html.br +0 -0
- package/package.json +19 -19
- package/dist/assets/About-DLa2ChOB.js.br +0 -0
- package/dist/assets/Availability-D5KTI3Gp.js.br +0 -0
- package/dist/assets/Bind-DeXxsott.js.br +0 -0
- package/dist/assets/Bridge-C8xCzBvN.js +0 -1
- package/dist/assets/Bridge-C8xCzBvN.js.br +0 -0
- package/dist/assets/CheckboxField-CaA8YhTd.js.br +0 -0
- package/dist/assets/ClusterSinglePicker-DujI1Kk6.js.br +0 -0
- package/dist/assets/Clusters-BQu9HRXr.js.br +0 -0
- package/dist/assets/ContributePage-BA9f4eSk.js.br +0 -0
- package/dist/assets/Dashboard-CoQfhwxv.js.br +0 -0
- package/dist/assets/DashboardFeatureWrapper--hzUpPRy.js.br +0 -0
- package/dist/assets/DebouncedInput-DbVQn5vN.js.br +0 -0
- package/dist/assets/DevConsole-CYFUKm39.js +0 -7
- package/dist/assets/DevConsole-CYFUKm39.js.br +0 -0
- package/dist/assets/DevConsole-DmwhDq-Z.js.br +0 -0
- package/dist/assets/DeviceCard-0gRlLdCT.js.br +0 -0
- package/dist/assets/DeviceImage-DYpYz5SI.js.br +0 -0
- package/dist/assets/DeviceInfo-D87EewKc.js.br +0 -0
- package/dist/assets/DevicePage-DLJsomjN.js.br +0 -0
- package/dist/assets/DevicePicker-D8LhZO4F.js +0 -1
- package/dist/assets/DevicePicker-D8LhZO4F.js.br +0 -0
- package/dist/assets/DeviceSettings-BoV43IGa.js.br +0 -1
- package/dist/assets/DeviceSpecificSettings-CDSrJZtr.js.br +0 -0
- package/dist/assets/Devices-Cq8qTRUw.js.br +0 -0
- package/dist/assets/DevicesPage-4CZMcmpl.js.br +0 -0
- package/dist/assets/DisplayValue-ZtlRXdX7.js.br +0 -0
- package/dist/assets/EndpointPicker-B4Z6Kw3O.js.br +0 -0
- package/dist/assets/Exposes-Ya78B8vT.js.br +0 -0
- package/dist/assets/Feature-Cii_Ps_h.js.br +0 -0
- package/dist/assets/FrontendSettingsPage-BBghwioM.js.br +0 -0
- package/dist/assets/GroupPage-D7hwrUN6.js.br +0 -0
- package/dist/assets/GroupSettings-DSpKjl_d.js.br +0 -0
- package/dist/assets/Groups-Cnh2Dnq0.js +0 -1
- package/dist/assets/Groups-Cnh2Dnq0.js.br +0 -0
- package/dist/assets/GroupsPage-Dh_yPJDE.js.br +0 -0
- package/dist/assets/Health-DzAMijLm.js.br +0 -0
- package/dist/assets/HomePage-C-QE-boi.js.br +0 -0
- package/dist/assets/InfoAlert-CKOVoAit.js.br +0 -0
- package/dist/assets/InputField-CIKw2Xrr.js.br +0 -0
- package/dist/assets/Json-Bo8BBs-S.js.br +0 -1
- package/dist/assets/LastSeen-BEZqgdEU.js.br +0 -0
- package/dist/assets/LogsPage-DPtdg338.js.br +0 -0
- package/dist/assets/Lqi-DNnUR2fS.js +0 -1
- package/dist/assets/Lqi-DNnUR2fS.js.br +0 -0
- package/dist/assets/NetworkPage-BDAtNT4N.js.br +0 -0
- package/dist/assets/NumberField-Dg46yaKl.js.br +0 -0
- package/dist/assets/OtaPage-M46Kw5Gm.js.br +0 -0
- package/dist/assets/PowerSource-B3Yl2iYL.js.br +0 -0
- package/dist/assets/RawNetworkData-C5CQaN7e.js.br +0 -0
- package/dist/assets/RawNetworkMap-DOlwNOXW.js.br +0 -0
- package/dist/assets/RecallRemove-BH_4gFWm.js.br +0 -0
- package/dist/assets/RemoveDeviceModal-BE8nZkGo.js.br +0 -0
- package/dist/assets/Reporting-CnJfRV0g.js.br +0 -0
- package/dist/assets/Scene-DfhxXULb.js.br +0 -0
- package/dist/assets/SelectField-CyWoaAVb.js.br +0 -0
- package/dist/assets/Settings-Bgi1c_ao.js.br +0 -0
- package/dist/assets/SettingsList-CRIawtvr.js.br +0 -0
- package/dist/assets/SettingsPage-3-51HC4j.js.br +0 -0
- package/dist/assets/State-DY8u5Uou.js +0 -1
- package/dist/assets/State-DY8u5Uou.js.br +0 -0
- package/dist/assets/Table-BMOp3G4j.js.br +0 -0
- package/dist/assets/TextareaField-CbVtSljh.js.br +0 -0
- package/dist/assets/Tools-Bs96okeO.js.br +0 -0
- package/dist/assets/TouchlinkPage-Bb4oFPyj.js.br +0 -0
- package/dist/assets/VendorLink-ClL_ZY47.js.br +0 -0
- package/dist/assets/_createCompounder-BUW0VzD-.js.br +0 -0
- package/dist/assets/format-C1E149BK.js.br +0 -0
- package/dist/assets/index-BFQ_Rrcw.js +0 -645
- package/dist/assets/index-BFQ_Rrcw.js.br +0 -0
- package/dist/assets/index-BWCKKOXu.js.br +0 -0
- package/dist/assets/index-CoqysZeI.js.br +0 -2
- package/dist/assets/index-DZNKmczP.css +0 -1
- package/dist/assets/index-DZNKmczP.css.br +0 -0
- package/dist/assets/isArray-BNsEL_P3.js.br +0 -0
- package/dist/assets/jszip.min-Dbx0Xht4.js.br +0 -0
- package/dist/assets/merge-FdH4enH0.js.br +0 -0
- package/dist/assets/snakeCase-BilpKH8r.js +0 -1
- package/dist/assets/snakeCase-BilpKH8r.js.br +0 -0
- package/dist/assets/useColumnCount-BbLlvyFs.js.br +0 -0
- package/dist/assets/useSearch-D_JCWoke.js.br +0 -0
- package/dist/assets/useTable-BacTGfa3.js.br +0 -0
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import{aN as gA,aO as PU,au as po,aP as zU,aQ as nf,r as K,j as he,aR as FU,aS as BU,aT as kU,k as vA,b as wg,t as GU,F as Yn,$ as HU,C as Lr,aU as VU,aV as WU,a5 as XU,aW as jU,aX as qU,aY as YU,aZ as ZU,a_ as KU,a$ as JU,b0 as iu,b1 as QU,b2 as $U,b3 as eO,I as tO,b4 as kv,a as nO,s as qS,af as YS}from"./index-BFQ_Rrcw.js";import{m as iO}from"./merge-FdH4enH0.js";import{g as rO,a as sO}from"./index-CoqysZeI.js";import{E as _l,Z as hi,N as im,c as fh}from"./index-Bs7zcW7e.js";import"./envs-CSqIi4cL.js";import"./isArray-BNsEL_P3.js";import"./isObject--vsEa_js.js";var Gv={exports:{}},Qs={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-reconciler-constants.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ZS;function aO(){return ZS||(ZS=1,Qs.ConcurrentRoot=1,Qs.ContinuousEventPriority=8,Qs.DefaultEventPriority=32,Qs.DiscreteEventPriority=2,Qs.IdleEventPriority=268435456,Qs.LegacyRoot=0,Qs.NoEventPriority=0),Qs}var KS;function oO(){return KS||(KS=1,Gv.exports=aO()),Gv.exports}var rm=oO();/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2010-2025 Three.js Authors
|
|
12
|
-
* SPDX-License-Identifier: MIT
|
|
13
|
-
*/const Tg="180",yA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},lO={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},_A=0,H_=1,xA=2,cO=3,bA=0,Ag=1,rf=2,is=3,ya=0,Fi=1,zn=2,pa=0,xl=1,V_=2,W_=3,X_=4,SA=5,io=100,EA=101,MA=102,wA=103,TA=104,AA=200,CA=201,RA=202,DA=203,vm=204,ym=205,UA=206,OA=207,LA=208,IA=209,NA=210,PA=211,zA=212,FA=213,BA=214,_m=0,xm=1,bm=2,wl=3,Sm=4,Em=5,Mm=6,wm=7,Kf=0,kA=1,GA=2,Ts=0,HA=1,VA=2,WA=3,zx=4,XA=5,jA=6,qA=7,j_="attached",YA="detached",Cg=300,_a=301,co=302,xf=303,bf=304,wu=306,Sf=1e3,Fr=1001,Ef=1002,vi=1003,Fx=1004,uO=1004,Qc=1005,hO=1005,Fn=1006,sf=1007,fO=1007,Ms=1008,dO=1008,Gr=1009,Bx=1010,kx=1011,lu=1012,Rg=1013,xa=1014,Qi=1015,Tu=1016,Dg=1017,Ug=1018,cu=1020,Gx=35902,Hx=35899,Vx=1021,Wx=1022,Di=1023,uu=1026,hu=1027,Og=1028,Jf=1029,Xx=1030,Lg=1031,pO=1032,Ig=1033,af=33776,of=33777,lf=33778,cf=33779,Tm=35840,Am=35841,Cm=35842,Rm=35843,Dm=36196,Um=37492,Om=37496,Lm=37808,Im=37809,Nm=37810,Pm=37811,zm=37812,Fm=37813,Bm=37814,km=37815,Gm=37816,Hm=37817,Vm=37818,Wm=37819,Xm=37820,jm=37821,qm=36492,Ym=36494,Zm=36495,Km=36283,Jm=36284,Qm=36285,$m=36286,ZA=2200,KA=2201,JA=2202,Mf=2300,eg=2301,sm=2302,ml=2400,gl=2401,wf=2402,Ng=2500,jx=2501,mO=0,gO=1,vO=2,QA=3200,qx=3201,yO=3202,_O=3203,mo=0,$A=1,ha="",Ri="srgb",uo="srgb-linear",Tf="linear",an="srgb",xO=0,hl=7680,bO=7681,SO=7682,EO=7683,MO=34055,wO=34056,TO=5386,AO=512,CO=513,RO=514,DO=515,UO=516,OO=517,LO=518,q_=519,e2=512,t2=513,n2=514,Yx=515,i2=516,r2=517,s2=518,a2=519,Af=35044,IO=35048,NO=35040,PO=35045,zO=35049,FO=35041,BO=35046,kO=35050,GO=35042,HO="100",Y_="300 es",yr=2e3,fu=2001,VO={COMPUTE:"compute",RENDER:"render"},WO={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},XO={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};let Ds=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}};const Ti=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let JS=1234567;const bl=Math.PI/180,du=180/Math.PI;function _r(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ti[i&255]+Ti[i>>8&255]+Ti[i>>16&255]+Ti[i>>24&255]+"-"+Ti[e&255]+Ti[e>>8&255]+"-"+Ti[e>>16&15|64]+Ti[e>>24&255]+"-"+Ti[t&63|128]+Ti[t>>8&255]+"-"+Ti[t>>16&255]+Ti[t>>24&255]+Ti[n&255]+Ti[n>>8&255]+Ti[n>>16&255]+Ti[n>>24&255]).toLowerCase()}function St(i,e,t){return Math.max(e,Math.min(t,i))}function Zx(i,e){return(i%e+e)%e}function jO(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function qO(i,e,t){return i!==e?(t-i)/(e-i):0}function uf(i,e,t){return(1-t)*i+t*e}function YO(i,e,t,n){return uf(i,e,1-Math.exp(-t*n))}function ZO(i,e=1){return e-Math.abs(Zx(i,e*2)-e)}function KO(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function JO(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function QO(i,e){return i+Math.floor(Math.random()*(e-i+1))}function $O(i,e){return i+Math.random()*(e-i)}function eL(i){return i*(.5-Math.random())}function tL(i){i!==void 0&&(JS=i);let e=JS+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function nL(i){return i*bl}function iL(i){return i*du}function rL(i){return(i&i-1)===0&&i!==0}function sL(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function aL(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function oL(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),d=s((e-n)/2),p=a((e-n)/2),m=s((n-e)/2),v=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*d,l*p,o*c);break;case"YZY":i.set(l*p,o*h,l*d,o*c);break;case"ZXZ":i.set(l*d,l*p,o*h,o*c);break;case"XZX":i.set(o*h,l*v,l*m,o*c);break;case"YXY":i.set(l*m,o*h,l*v,o*c);break;case"ZYZ":i.set(l*v,l*m,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Pi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Ot(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const tg={DEG2RAD:bl,RAD2DEG:du,generateUUID:_r,clamp:St,euclideanModulo:Zx,mapLinear:jO,inverseLerp:qO,lerp:uf,damp:YO,pingpong:ZO,smoothstep:KO,smootherstep:JO,randInt:QO,randFloat:$O,randFloatSpread:eL,seededRandom:tL,degToRad:nL,radToDeg:iL,isPowerOfTwo:rL,ceilPowerOfTwo:sL,floorPowerOfTwo:aL,setQuaternionFromProperEuler:oL,normalize:Ot,denormalize:Pi};class ke{constructor(e=0,t=0){ke.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(St(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class yi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],d=n[r+3];const p=s[a+0],m=s[a+1],v=s[a+2],x=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(o===1){e[t+0]=p,e[t+1]=m,e[t+2]=v,e[t+3]=x;return}if(d!==x||l!==p||c!==m||h!==v){let _=1-o;const g=l*p+c*m+h*v+d*x,b=g>=0?1:-1,E=1-g*g;if(E>Number.EPSILON){const w=Math.sqrt(E),T=Math.atan2(w,g*b);_=Math.sin(_*T)/w,o=Math.sin(o*T)/w}const S=o*b;if(l=l*_+p*S,c=c*_+m*S,h=h*_+v*S,d=d*_+x*S,_===1-o){const w=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=w,c*=w,h*=w,d*=w}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],d=s[a],p=s[a+1],m=s[a+2],v=s[a+3];return e[t]=o*v+h*d+l*m-c*p,e[t+1]=l*v+h*p+c*d-o*m,e[t+2]=c*v+h*m+o*p-l*d,e[t+3]=h*v-o*d-l*p-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),d=o(s/2),p=l(n/2),m=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=p*h*d+c*m*v,this._y=c*m*d-p*h*v,this._z=c*h*v+p*m*d,this._w=c*h*d-p*m*v;break;case"YXZ":this._x=p*h*d+c*m*v,this._y=c*m*d-p*h*v,this._z=c*h*v-p*m*d,this._w=c*h*d+p*m*v;break;case"ZXY":this._x=p*h*d-c*m*v,this._y=c*m*d+p*h*v,this._z=c*h*v+p*m*d,this._w=c*h*d-p*m*v;break;case"ZYX":this._x=p*h*d-c*m*v,this._y=c*m*d+p*h*v,this._z=c*h*v-p*m*d,this._w=c*h*d+p*m*v;break;case"YZX":this._x=p*h*d+c*m*v,this._y=c*m*d+p*h*v,this._z=c*h*v-p*m*d,this._w=c*h*d-p*m*v;break;case"XZY":this._x=p*h*d-c*m*v,this._y=c*m*d-p*h*v,this._z=c*h*v+p*m*d,this._w=c*h*d+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],p=n+o+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>d){const m=2*Math.sqrt(1+n-o-d);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>d){const m=2*Math.sqrt(1+o-n-d);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+d-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(St(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=a*d+this._w*p,this._x=n*d+this._x*p,this._y=r*d+this._y*p,this._z=s*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{constructor(e=0,t=0,n=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(QS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(QS.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Hv.copy(this).projectOnVector(e),this.sub(Hv)}reflect(e){return this.sub(Hv.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(St(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Hv=new j,QS=new yi;class At{constructor(e,t,n,r,s,a,o,l,c){At.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],p=n[2],m=n[5],v=n[8],x=r[0],_=r[3],g=r[6],b=r[1],E=r[4],S=r[7],w=r[2],T=r[5],R=r[8];return s[0]=a*x+o*b+l*w,s[3]=a*_+o*E+l*T,s[6]=a*g+o*S+l*R,s[1]=c*x+h*b+d*w,s[4]=c*_+h*E+d*T,s[7]=c*g+h*S+d*R,s[2]=p*x+m*b+v*w,s[5]=p*_+m*E+v*T,s[8]=p*g+m*S+v*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,p=o*l-h*s,m=c*s-a*l,v=t*d+n*p+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/v;return e[0]=d*x,e[1]=(r*c-h*n)*x,e[2]=(o*n-r*a)*x,e[3]=p*x,e[4]=(h*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=m*x,e[7]=(n*l-c*t)*x,e[8]=(a*t-n*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Vv.makeScale(e,t)),this}rotate(e){return this.premultiply(Vv.makeRotation(-e)),this}translate(e,t){return this.premultiply(Vv.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Vv=new At;function o2(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}const lL={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $c(i,e){return new lL[i](e)}function Cf(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function l2(){const i=Cf("canvas");return i.style.display="block",i}const $S={};function Rf(i){i in $S||($S[i]=!0,console.warn(i))}function cL(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const eE=new At().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tE=new At().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function uL(){const i={enabled:!0,workingColorSpace:uo,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===an&&(r.r=ma(r.r),r.g=ma(r.g),r.b=ma(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===an&&(r.r=ru(r.r),r.g=ru(r.g),r.b=ru(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ha?Tf:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Rf("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Rf("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[uo]:{primaries:e,whitePoint:n,transfer:Tf,toXYZ:eE,fromXYZ:tE,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ri},outputColorSpaceConfig:{drawingBufferColorSpace:Ri}},[Ri]:{primaries:e,whitePoint:n,transfer:an,toXYZ:eE,fromXYZ:tE,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ri}}}),i}const Gt=uL();function ma(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ru(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let gc;class c2{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{gc===void 0&&(gc=Cf("canvas")),gc.width=e.width,gc.height=e.height;const r=gc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=gc}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Cf("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=ma(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(ma(t[n]/255)*255):t[n]=ma(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let hL=0;class ro{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hL++}),this.uuid=_r(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Wv(r[a].image)):s.push(Wv(r[a]))}else s=Wv(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Wv(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?c2.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let fL=0;const Xv=new j;class Dn extends Ds{constructor(e=Dn.DEFAULT_IMAGE,t=Dn.DEFAULT_MAPPING,n=Fr,r=Fr,s=Fn,a=Ms,o=Di,l=Gr,c=Dn.DEFAULT_ANISOTROPY,h=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fL++}),this.uuid=_r(),this.name="",this.source=new ro(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ke(0,0),this.repeat=new ke(1,1),this.center=new ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new At,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Xv).x}get height(){return this.source.getSize(Xv).y}get depth(){return this.source.getSize(Xv).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Cg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sf:e.x=e.x-Math.floor(e.x);break;case Fr:e.x=e.x<0?0:1;break;case Ef:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sf:e.y=e.y-Math.floor(e.y);break;case Fr:e.y=e.y<0?0:1;break;case Ef:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Dn.DEFAULT_IMAGE=null;Dn.DEFAULT_MAPPING=Cg;Dn.DEFAULT_ANISOTROPY=1;class Bt{constructor(e=0,t=0,n=0,r=1){Bt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],d=l[8],p=l[1],m=l[5],v=l[9],x=l[2],_=l[6],g=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-x)<.01&&Math.abs(v-_)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+x)<.1&&Math.abs(v+_)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,S=(m+1)/2,w=(g+1)/2,T=(h+p)/4,R=(d+x)/4,U=(v+_)/4;return E>S&&E>w?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=T/n,s=R/n):S>w?S<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),n=T/r,s=U/r):w<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),n=R/s,r=U/s),this.set(n,r,s,t),this}let b=Math.sqrt((_-v)*(_-v)+(d-x)*(d-x)+(p-h)*(p-h));return Math.abs(b)<.001&&(b=1),this.x=(_-v)/b,this.y=(d-x)/b,this.z=(p-h)/b,this.w=Math.acos((c+m+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this.w=St(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this.w=St(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Kx extends Ds{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Fn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Bt(0,0,e,t),this.scissorTest=!1,this.viewport=new Bt(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Dn(r);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:Fn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new ro(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Rs extends Kx{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Pg extends Dn{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=vi,this.minFilter=vi,this.wrapR=Fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dL extends Rs{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Pg(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class zg extends Dn{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=vi,this.minFilter=vi,this.wrapR=Fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class pL extends Rs{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new zg(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class Qn{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Kr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Kr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Kr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Kr):Kr.fromBufferAttribute(s,a),Kr.applyMatrix4(e.matrixWorld),this.expandByPoint(Kr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Xd.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Xd.copy(n.boundingBox)),Xd.applyMatrix4(e.matrixWorld),this.union(Xd)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Kr),Kr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(dh),jd.subVectors(this.max,dh),vc.subVectors(e.a,dh),yc.subVectors(e.b,dh),_c.subVectors(e.c,dh),ja.subVectors(yc,vc),qa.subVectors(_c,yc),jo.subVectors(vc,_c);let t=[0,-ja.z,ja.y,0,-qa.z,qa.y,0,-jo.z,jo.y,ja.z,0,-ja.x,qa.z,0,-qa.x,jo.z,0,-jo.x,-ja.y,ja.x,0,-qa.y,qa.x,0,-jo.y,jo.x,0];return!jv(t,vc,yc,_c,jd)||(t=[1,0,0,0,1,0,0,0,1],!jv(t,vc,yc,_c,jd))?!1:(qd.crossVectors(ja,qa),t=[qd.x,qd.y,qd.z],jv(t,vc,yc,_c,jd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:($s[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$s[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$s[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$s[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$s[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$s[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$s[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$s[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($s),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const $s=[new j,new j,new j,new j,new j,new j,new j,new j],Kr=new j,Xd=new Qn,vc=new j,yc=new j,_c=new j,ja=new j,qa=new j,jo=new j,dh=new j,jd=new j,qd=new j,qo=new j;function jv(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){qo.fromArray(i,s);const o=r.x*Math.abs(qo.x)+r.y*Math.abs(qo.y)+r.z*Math.abs(qo.z),l=e.dot(qo),c=t.dot(qo),h=n.dot(qo);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const mL=new Qn,ph=new j,qv=new j;let ri=class{constructor(e=new j,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):mL.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ph.subVectors(e,this.center);const t=ph.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ph,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(qv.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ph.copy(e.center).add(qv)),this.expandByPoint(ph.copy(e.center).sub(qv))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}};const ea=new j,Yv=new j,Yd=new j,Ya=new j,Zv=new j,Zd=new j,Kv=new j;class Au{constructor(e=new j,t=new j(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ea)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ea.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ea.copy(this.origin).addScaledVector(this.direction,t),ea.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Yv.copy(e).add(t).multiplyScalar(.5),Yd.copy(t).sub(e).normalize(),Ya.copy(this.origin).sub(Yv);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Yd),o=Ya.dot(this.direction),l=-Ya.dot(Yd),c=Ya.lengthSq(),h=Math.abs(1-a*a);let d,p,m,v;if(h>0)if(d=a*l-o,p=a*o-l,v=s*h,d>=0)if(p>=-v)if(p<=v){const x=1/h;d*=x,p*=x,m=d*(d+a*p+2*o)+p*(a*d+p+2*l)+c}else p=s,d=Math.max(0,-(a*p+o)),m=-d*d+p*(p+2*l)+c;else p=-s,d=Math.max(0,-(a*p+o)),m=-d*d+p*(p+2*l)+c;else p<=-v?(d=Math.max(0,-(-a*s+o)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c):p<=v?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(d=Math.max(0,-(a*s+o)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c);else p=a>0?-s:s,d=Math.max(0,-(a*p+o)),m=-d*d+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Yv).addScaledVector(Yd,p),m}intersectSphere(e,t){ea.subVectors(e.center,this.origin);const n=ea.dot(this.direction),r=ea.dot(ea)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),h>=0?(s=(e.min.y-p.y)*h,a=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,a=(e.min.y-p.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(o=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ea)!==null}intersectTriangle(e,t,n,r,s){Zv.subVectors(t,e),Zd.subVectors(n,e),Kv.crossVectors(Zv,Zd);let a=this.direction.dot(Kv),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ya.subVectors(this.origin,e);const l=o*this.direction.dot(Zd.crossVectors(Ya,Zd));if(l<0)return null;const c=o*this.direction.dot(Zv.cross(Ya));if(c<0||l+c>a)return null;const h=-o*Ya.dot(Kv);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class bt{constructor(e,t,n,r,s,a,o,l,c,h,d,p,m,v,x,_){bt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,d,p,m,v,x,_)}set(e,t,n,r,s,a,o,l,c,h,d,p,m,v,x,_){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=s,g[5]=a,g[9]=o,g[13]=l,g[2]=c,g[6]=h,g[10]=d,g[14]=p,g[3]=m,g[7]=v,g[11]=x,g[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new bt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/xc.setFromMatrixColumn(e,0).length(),s=1/xc.setFromMatrixColumn(e,1).length(),a=1/xc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=a*h,m=a*d,v=o*h,x=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=m+v*c,t[5]=p-x*c,t[9]=-o*l,t[2]=x-p*c,t[6]=v+m*c,t[10]=a*l}else if(e.order==="YXZ"){const p=l*h,m=l*d,v=c*h,x=c*d;t[0]=p+x*o,t[4]=v*o-m,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=m*o-v,t[6]=x+p*o,t[10]=a*l}else if(e.order==="ZXY"){const p=l*h,m=l*d,v=c*h,x=c*d;t[0]=p-x*o,t[4]=-a*d,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*h,t[9]=x-p*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const p=a*h,m=a*d,v=o*h,x=o*d;t[0]=l*h,t[4]=v*c-m,t[8]=p*c+x,t[1]=l*d,t[5]=x*c+p,t[9]=m*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const p=a*l,m=a*c,v=o*l,x=o*c;t[0]=l*h,t[4]=x-p*d,t[8]=v*d+m,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=m*d+v,t[10]=p-x*d}else if(e.order==="XZY"){const p=a*l,m=a*c,v=o*l,x=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=p*d+x,t[5]=a*h,t[9]=m*d-v,t[2]=v*d-m,t[6]=o*h,t[10]=x*d+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gL,e,vL)}lookAt(e,t,n){const r=this.elements;return mr.subVectors(e,t),mr.lengthSq()===0&&(mr.z=1),mr.normalize(),Za.crossVectors(n,mr),Za.lengthSq()===0&&(Math.abs(n.z)===1?mr.x+=1e-4:mr.z+=1e-4,mr.normalize(),Za.crossVectors(n,mr)),Za.normalize(),Kd.crossVectors(mr,Za),r[0]=Za.x,r[4]=Kd.x,r[8]=mr.x,r[1]=Za.y,r[5]=Kd.y,r[9]=mr.y,r[2]=Za.z,r[6]=Kd.z,r[10]=mr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],d=n[5],p=n[9],m=n[13],v=n[2],x=n[6],_=n[10],g=n[14],b=n[3],E=n[7],S=n[11],w=n[15],T=r[0],R=r[4],U=r[8],A=r[12],D=r[1],L=r[5],P=r[9],I=r[13],V=r[2],H=r[6],z=r[10],O=r[14],B=r[3],G=r[7],X=r[11],k=r[15];return s[0]=a*T+o*D+l*V+c*B,s[4]=a*R+o*L+l*H+c*G,s[8]=a*U+o*P+l*z+c*X,s[12]=a*A+o*I+l*O+c*k,s[1]=h*T+d*D+p*V+m*B,s[5]=h*R+d*L+p*H+m*G,s[9]=h*U+d*P+p*z+m*X,s[13]=h*A+d*I+p*O+m*k,s[2]=v*T+x*D+_*V+g*B,s[6]=v*R+x*L+_*H+g*G,s[10]=v*U+x*P+_*z+g*X,s[14]=v*A+x*I+_*O+g*k,s[3]=b*T+E*D+S*V+w*B,s[7]=b*R+E*L+S*H+w*G,s[11]=b*U+E*P+S*z+w*X,s[15]=b*A+E*I+S*O+w*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],p=e[10],m=e[14],v=e[3],x=e[7],_=e[11],g=e[15];return v*(+s*l*d-r*c*d-s*o*p+n*c*p+r*o*m-n*l*m)+x*(+t*l*m-t*c*p+s*a*p-r*a*m+r*c*h-s*l*h)+_*(+t*c*d-t*o*m-s*a*d+n*a*m+s*o*h-n*c*h)+g*(-r*o*h-t*l*d+t*o*p+r*a*d-n*a*p+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],p=e[10],m=e[11],v=e[12],x=e[13],_=e[14],g=e[15],b=d*_*c-x*p*c+x*l*m-o*_*m-d*l*g+o*p*g,E=v*p*c-h*_*c-v*l*m+a*_*m+h*l*g-a*p*g,S=h*x*c-v*d*c+v*o*m-a*x*m-h*o*g+a*d*g,w=v*d*l-h*x*l-v*o*p+a*x*p+h*o*_-a*d*_,T=t*b+n*E+r*S+s*w;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/T;return e[0]=b*R,e[1]=(x*p*s-d*_*s-x*r*m+n*_*m+d*r*g-n*p*g)*R,e[2]=(o*_*s-x*l*s+x*r*c-n*_*c-o*r*g+n*l*g)*R,e[3]=(d*l*s-o*p*s-d*r*c+n*p*c+o*r*m-n*l*m)*R,e[4]=E*R,e[5]=(h*_*s-v*p*s+v*r*m-t*_*m-h*r*g+t*p*g)*R,e[6]=(v*l*s-a*_*s-v*r*c+t*_*c+a*r*g-t*l*g)*R,e[7]=(a*p*s-h*l*s+h*r*c-t*p*c-a*r*m+t*l*m)*R,e[8]=S*R,e[9]=(v*d*s-h*x*s-v*n*m+t*x*m+h*n*g-t*d*g)*R,e[10]=(a*x*s-v*o*s+v*n*c-t*x*c-a*n*g+t*o*g)*R,e[11]=(h*o*s-a*d*s-h*n*c+t*d*c+a*n*m-t*o*m)*R,e[12]=w*R,e[13]=(h*x*r-v*d*r+v*n*p-t*x*p-h*n*_+t*d*_)*R,e[14]=(v*o*r-a*x*r-v*n*l+t*x*l+a*n*_-t*o*_)*R,e[15]=(a*d*r-h*o*r+h*n*l-t*d*l-a*n*p+t*o*p)*R,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,d=o+o,p=s*c,m=s*h,v=s*d,x=a*h,_=a*d,g=o*d,b=l*c,E=l*h,S=l*d,w=n.x,T=n.y,R=n.z;return r[0]=(1-(x+g))*w,r[1]=(m+S)*w,r[2]=(v-E)*w,r[3]=0,r[4]=(m-S)*T,r[5]=(1-(p+g))*T,r[6]=(_+b)*T,r[7]=0,r[8]=(v+E)*R,r[9]=(_-b)*R,r[10]=(1-(p+x))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=xc.set(r[0],r[1],r[2]).length();const a=xc.set(r[4],r[5],r[6]).length(),o=xc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Jr.copy(this);const c=1/s,h=1/a,d=1/o;return Jr.elements[0]*=c,Jr.elements[1]*=c,Jr.elements[2]*=c,Jr.elements[4]*=h,Jr.elements[5]*=h,Jr.elements[6]*=h,Jr.elements[8]*=d,Jr.elements[9]*=d,Jr.elements[10]*=d,t.setFromRotationMatrix(Jr),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=yr,l=!1){const c=this.elements,h=2*s/(t-e),d=2*s/(n-r),p=(t+e)/(t-e),m=(n+r)/(n-r);let v,x;if(l)v=s/(a-s),x=a*s/(a-s);else if(o===yr)v=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===fu)v=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=d,c[9]=m,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=yr,l=!1){const c=this.elements,h=2/(t-e),d=2/(n-r),p=-(t+e)/(t-e),m=-(n+r)/(n-r);let v,x;if(l)v=1/(a-s),x=a/(a-s);else if(o===yr)v=-2/(a-s),x=-(a+s)/(a-s);else if(o===fu)v=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=d,c[9]=0,c[13]=m,c[2]=0,c[6]=0,c[10]=v,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const xc=new j,Jr=new bt,gL=new j(0,0,0),vL=new j(1,1,1),Za=new j,Kd=new j,mr=new j,nE=new bt,iE=new yi;class Bi{constructor(e=0,t=0,n=0,r=Bi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(St(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-St(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(St(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-St(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(St(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-St(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return nE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(nE,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return iE.setFromEuler(this),this.setFromQuaternion(iE,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Bi.DEFAULT_ORDER="XYZ";class pu{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let yL=0;const rE=new j,bc=new yi,ta=new bt,Jd=new j,mh=new j,_L=new j,xL=new yi,sE=new j(1,0,0),aE=new j(0,1,0),oE=new j(0,0,1),lE={type:"added"},bL={type:"removed"},Sc={type:"childadded",child:null},Jv={type:"childremoved",child:null};class Xt extends Ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yL++}),this.uuid=_r(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Xt.DEFAULT_UP.clone();const e=new j,t=new Bi,n=new yi,r=new j(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new bt},normalMatrix:{value:new At}}),this.matrix=new bt,this.matrixWorld=new bt,this.matrixAutoUpdate=Xt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Xt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new pu,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return bc.setFromAxisAngle(e,t),this.quaternion.multiply(bc),this}rotateOnWorldAxis(e,t){return bc.setFromAxisAngle(e,t),this.quaternion.premultiply(bc),this}rotateX(e){return this.rotateOnAxis(sE,e)}rotateY(e){return this.rotateOnAxis(aE,e)}rotateZ(e){return this.rotateOnAxis(oE,e)}translateOnAxis(e,t){return rE.copy(e).applyQuaternion(this.quaternion),this.position.add(rE.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(sE,e)}translateY(e){return this.translateOnAxis(aE,e)}translateZ(e){return this.translateOnAxis(oE,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ta.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Jd.copy(e):Jd.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),mh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ta.lookAt(mh,Jd,this.up):ta.lookAt(Jd,mh,this.up),this.quaternion.setFromRotationMatrix(ta),r&&(ta.extractRotation(r.matrixWorld),bc.setFromRotationMatrix(ta),this.quaternion.premultiply(bc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(lE),Sc.child=e,this.dispatchEvent(Sc),Sc.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(bL),Jv.child=e,this.dispatchEvent(Jv),Jv.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ta.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ta.multiply(e.parent.matrixWorld)),e.applyMatrix4(ta),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(lE),Sc.child=e,this.dispatchEvent(Sc),Sc.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mh,e,_L),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mh,xL,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),d=a(e.shapes),p=a(e.skeletons),m=a(e.animations),v=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),v.length>0&&(n.nodes=v)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}Xt.DEFAULT_UP=new j(0,1,0);Xt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Xt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Qr=new j,na=new j,Qv=new j,ia=new j,Ec=new j,Mc=new j,cE=new j,$v=new j,ey=new j,ty=new j,ny=new Bt,iy=new Bt,ry=new Bt;class Ji{constructor(e=new j,t=new j,n=new j){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Qr.subVectors(e,t),r.cross(Qr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Qr.subVectors(r,t),na.subVectors(n,t),Qv.subVectors(e,t);const a=Qr.dot(Qr),o=Qr.dot(na),l=Qr.dot(Qv),c=na.dot(na),h=na.dot(Qv),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const p=1/d,m=(c*l-o*h)*p,v=(a*h-o*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ia)===null?!1:ia.x>=0&&ia.y>=0&&ia.x+ia.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,ia)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ia.x),l.addScaledVector(a,ia.y),l.addScaledVector(o,ia.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return ny.setScalar(0),iy.setScalar(0),ry.setScalar(0),ny.fromBufferAttribute(e,t),iy.fromBufferAttribute(e,n),ry.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ny,s.x),a.addScaledVector(iy,s.y),a.addScaledVector(ry,s.z),a}static isFrontFacing(e,t,n,r){return Qr.subVectors(n,t),na.subVectors(e,t),Qr.cross(na).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qr.subVectors(this.c,this.b),na.subVectors(this.a,this.b),Qr.cross(na).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ji.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ji.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Ji.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Ji.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ji.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Ec.subVectors(r,n),Mc.subVectors(s,n),$v.subVectors(e,n);const l=Ec.dot($v),c=Mc.dot($v);if(l<=0&&c<=0)return t.copy(n);ey.subVectors(e,r);const h=Ec.dot(ey),d=Mc.dot(ey);if(h>=0&&d<=h)return t.copy(r);const p=l*d-h*c;if(p<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Ec,a);ty.subVectors(e,s);const m=Ec.dot(ty),v=Mc.dot(ty);if(v>=0&&m<=v)return t.copy(s);const x=m*c-l*v;if(x<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(n).addScaledVector(Mc,o);const _=h*v-m*d;if(_<=0&&d-h>=0&&m-v>=0)return cE.subVectors(s,r),o=(d-h)/(d-h+(m-v)),t.copy(r).addScaledVector(cE,o);const g=1/(_+x+p);return a=x*g,o=p*g,t.copy(n).addScaledVector(Ec,a).addScaledVector(Mc,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const u2={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},Ka={h:0,s:0,l:0},Qd={h:0,s:0,l:0};function sy(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let Ye=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ri){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Gt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Gt.workingColorSpace){if(e=Zx(e,1),t=St(t,0,1),n=St(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=sy(a,s,e+1/3),this.g=sy(a,s,e),this.b=sy(a,s,e-1/3)}return Gt.colorSpaceToWorking(this,r),this}setStyle(e,t=Ri){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ri){const n=u2[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ma(e.r),this.g=ma(e.g),this.b=ma(e.b),this}copyLinearToSRGB(e){return this.r=ru(e.r),this.g=ru(e.g),this.b=ru(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ri){return Gt.workingToColorSpace(Ai.copy(this),e),Math.round(St(Ai.r*255,0,255))*65536+Math.round(St(Ai.g*255,0,255))*256+Math.round(St(Ai.b*255,0,255))}getHexString(e=Ri){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.workingToColorSpace(Ai.copy(this),t);const n=Ai.r,r=Ai.g,s=Ai.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Gt.workingColorSpace){return Gt.workingToColorSpace(Ai.copy(this),t),e.r=Ai.r,e.g=Ai.g,e.b=Ai.b,e}getStyle(e=Ri){Gt.workingToColorSpace(Ai.copy(this),e);const t=Ai.r,n=Ai.g,r=Ai.b;return e!==Ri?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Ka),this.setHSL(Ka.h+e,Ka.s+t,Ka.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ka),e.getHSL(Qd);const n=uf(Ka.h,Qd.h,t),r=uf(Ka.s,Qd.s,t),s=uf(Ka.l,Qd.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const Ai=new Ye;Ye.NAMES=u2;let SL=0;class Ui extends Ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:SL++}),this.uuid=_r(),this.name="",this.type="Material",this.blending=xl,this.side=ya,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=vm,this.blendDst=ym,this.blendEquation=io,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=wl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=q_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=hl,this.stencilZFail=hl,this.stencilZPass=hl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xl&&(n.blending=this.blending),this.side!==ya&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==vm&&(n.blendSrc=this.blendSrc),this.blendDst!==ym&&(n.blendDst=this.blendDst),this.blendEquation!==io&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==wl&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==q_&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==hl&&(n.stencilFail=this.stencilFail),this.stencilZFail!==hl&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==hl&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ea extends Ui{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const fa=EL();function EL(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function Zi(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=St(i,-65504,65504),fa.floatView[0]=i;const e=fa.uint32View[0],t=e>>23&511;return fa.baseTable[t]+((e&8388607)>>fa.shiftTable[t])}function Yh(i){const e=i>>10;return fa.uint32View[0]=fa.mantissaTable[fa.offsetTable[e]+(i&1023)]+fa.exponentTable[e],fa.floatView[0]}class ML{static toHalfFloat(e){return Zi(e)}static fromHalfFloat(e){return Yh(e)}}const qn=new j,$d=new ke;let wL=0;class $t{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:wL++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Af,this.updateRanges=[],this.gpuType=Qi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)$d.fromBufferAttribute(this,t),$d.applyMatrix3(e),this.setXY(t,$d.x,$d.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyMatrix3(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyMatrix4(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyNormalMatrix(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.transformDirection(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Pi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ot(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Pi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Pi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Pi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Pi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Af&&(e.usage=this.usage),e}}class TL extends $t{constructor(e,t,n){super(new Int8Array(e),t,n)}}class AL extends $t{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class CL extends $t{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class RL extends $t{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Jx extends $t{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class DL extends $t{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Qx extends $t{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class UL extends $t{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Yh(this.array[e*this.itemSize]);return this.normalized&&(t=Pi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=Zi(t),this}getY(e){let t=Yh(this.array[e*this.itemSize+1]);return this.normalized&&(t=Pi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=Zi(t),this}getZ(e){let t=Yh(this.array[e*this.itemSize+2]);return this.normalized&&(t=Pi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=Zi(t),this}getW(e){let t=Yh(this.array[e*this.itemSize+3]);return this.normalized&&(t=Pi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=Zi(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.array[e+0]=Zi(t),this.array[e+1]=Zi(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.array[e+0]=Zi(t),this.array[e+1]=Zi(n),this.array[e+2]=Zi(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=Zi(t),this.array[e+1]=Zi(n),this.array[e+2]=Zi(r),this.array[e+3]=Zi(s),this}}class ft extends $t{constructor(e,t,n){super(new Float32Array(e),t,n)}}let OL=0;const Ur=new bt,ay=new Xt,wc=new j,gr=new Qn,gh=new Qn,ui=new j;class Rt extends Ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:OL++}),this.uuid=_r(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(o2(e)?Qx:Jx)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new At().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ur.makeRotationFromQuaternion(e),this.applyMatrix4(Ur),this}rotateX(e){return Ur.makeRotationX(e),this.applyMatrix4(Ur),this}rotateY(e){return Ur.makeRotationY(e),this.applyMatrix4(Ur),this}rotateZ(e){return Ur.makeRotationZ(e),this.applyMatrix4(Ur),this}translate(e,t,n){return Ur.makeTranslation(e,t,n),this.applyMatrix4(Ur),this}scale(e,t,n){return Ur.makeScale(e,t,n),this.applyMatrix4(Ur),this}lookAt(e){return ay.lookAt(e),ay.updateMatrix(),this.applyMatrix4(ay.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(wc).negate(),this.translate(wc.x,wc.y,wc.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new ft(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];gr.setFromBufferAttribute(s),this.morphTargetsRelative?(ui.addVectors(this.boundingBox.min,gr.min),this.boundingBox.expandByPoint(ui),ui.addVectors(this.boundingBox.max,gr.max),this.boundingBox.expandByPoint(ui)):(this.boundingBox.expandByPoint(gr.min),this.boundingBox.expandByPoint(gr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ri);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(e){const n=this.boundingSphere.center;if(gr.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];gh.setFromBufferAttribute(o),this.morphTargetsRelative?(ui.addVectors(gr.min,gh.min),gr.expandByPoint(ui),ui.addVectors(gr.max,gh.max),gr.expandByPoint(ui)):(gr.expandByPoint(gh.min),gr.expandByPoint(gh.max))}gr.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ui.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ui));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ui.fromBufferAttribute(o,c),l&&(wc.fromBufferAttribute(e,c),ui.add(wc)),r=Math.max(r,n.distanceToSquared(ui))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new $t(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U<n.count;U++)o[U]=new j,l[U]=new j;const c=new j,h=new j,d=new j,p=new ke,m=new ke,v=new ke,x=new j,_=new j;function g(U,A,D){c.fromBufferAttribute(n,U),h.fromBufferAttribute(n,A),d.fromBufferAttribute(n,D),p.fromBufferAttribute(s,U),m.fromBufferAttribute(s,A),v.fromBufferAttribute(s,D),h.sub(c),d.sub(c),m.sub(p),v.sub(p);const L=1/(m.x*v.y-v.x*m.y);isFinite(L)&&(x.copy(h).multiplyScalar(v.y).addScaledVector(d,-m.y).multiplyScalar(L),_.copy(d).multiplyScalar(m.x).addScaledVector(h,-v.x).multiplyScalar(L),o[U].add(x),o[A].add(x),o[D].add(x),l[U].add(_),l[A].add(_),l[D].add(_))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let U=0,A=b.length;U<A;++U){const D=b[U],L=D.start,P=D.count;for(let I=L,V=L+P;I<V;I+=3)g(e.getX(I+0),e.getX(I+1),e.getX(I+2))}const E=new j,S=new j,w=new j,T=new j;function R(U){w.fromBufferAttribute(r,U),T.copy(w);const A=o[U];E.copy(A),E.sub(w.multiplyScalar(w.dot(A))).normalize(),S.crossVectors(T,A);const L=S.dot(l[U])<0?-1:1;a.setXYZW(U,E.x,E.y,E.z,L)}for(let U=0,A=b.length;U<A;++U){const D=b[U],L=D.start,P=D.count;for(let I=L,V=L+P;I<V;I+=3)R(e.getX(I+0)),R(e.getX(I+1)),R(e.getX(I+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new $t(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,m=n.count;p<m;p++)n.setXYZ(p,0,0,0);const r=new j,s=new j,a=new j,o=new j,l=new j,c=new j,h=new j,d=new j;if(e)for(let p=0,m=e.count;p<m;p+=3){const v=e.getX(p+0),x=e.getX(p+1),_=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,_),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(n,v),l.fromBufferAttribute(n,x),c.fromBufferAttribute(n,_),o.add(h),l.add(h),c.add(h),n.setXYZ(v,o.x,o.y,o.z),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(_,c.x,c.y,c.z)}else for(let p=0,m=t.count;p<m;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),a.fromBufferAttribute(t,p+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),n.setXYZ(p+0,h.x,h.y,h.z),n.setXYZ(p+1,h.x,h.y,h.z),n.setXYZ(p+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ui.fromBufferAttribute(e,t),ui.normalize(),e.setXYZ(t,ui.x,ui.y,ui.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,d=o.normalized,p=new c.constructor(l.length*h);let m=0,v=0;for(let x=0,_=l.length;x<_;x++){o.isInterleavedBufferAttribute?m=l[x]*o.data.stride+o.offset:m=l[x]*h;for(let g=0;g<h;g++)p[v++]=c[m++]}return new $t(p,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Rt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){const p=c[h],m=e(p,n);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let d=0,p=c.length;d<p;d++){const m=c[d];h.push(m.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],d=s[c];for(let p=0,m=d.length;p<m;p++)h.push(d[p].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const uE=new bt,Yo=new Au,ep=new ri,hE=new j,tp=new j,np=new j,ip=new j,oy=new j,rp=new j,fE=new j,sp=new j;class mn extends Xt{constructor(e=new Rt,t=new Ea){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){rp.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],d=s[l];h!==0&&(oy.fromBufferAttribute(d,e),a?rp.addScaledVector(oy,h):rp.addScaledVector(oy.sub(t),h))}t.add(rp)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ep.copy(n.boundingSphere),ep.applyMatrix4(s),Yo.copy(e.ray).recast(e.near),!(ep.containsPoint(Yo.origin)===!1&&(Yo.intersectSphere(ep,hE)===null||Yo.origin.distanceToSquared(hE)>(e.far-e.near)**2))&&(uE.copy(s).invert(),Yo.copy(e.ray).applyMatrix4(uE),!(n.boundingBox!==null&&Yo.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Yo)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,x=p.length;v<x;v++){const _=p[v],g=a[_.materialIndex],b=Math.max(_.start,m.start),E=Math.min(o.count,Math.min(_.start+_.count,m.start+m.count));for(let S=b,w=E;S<w;S+=3){const T=o.getX(S),R=o.getX(S+1),U=o.getX(S+2);r=ap(this,g,e,n,c,h,d,T,R,U),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),x=Math.min(o.count,m.start+m.count);for(let _=v,g=x;_<g;_+=3){const b=o.getX(_),E=o.getX(_+1),S=o.getX(_+2);r=ap(this,a,e,n,c,h,d,b,E,S),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let v=0,x=p.length;v<x;v++){const _=p[v],g=a[_.materialIndex],b=Math.max(_.start,m.start),E=Math.min(l.count,Math.min(_.start+_.count,m.start+m.count));for(let S=b,w=E;S<w;S+=3){const T=S,R=S+1,U=S+2;r=ap(this,g,e,n,c,h,d,T,R,U),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),x=Math.min(l.count,m.start+m.count);for(let _=v,g=x;_<g;_+=3){const b=_,E=_+1,S=_+2;r=ap(this,a,e,n,c,h,d,b,E,S),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}}}function LL(i,e,t,n,r,s,a,o){let l;if(e.side===Fi?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===ya,o),l===null)return null;sp.copy(o),sp.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(sp);return c<t.near||c>t.far?null:{distance:c,point:sp.clone(),object:i}}function ap(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,tp),i.getVertexPosition(l,np),i.getVertexPosition(c,ip);const h=LL(i,e,t,n,tp,np,ip,fE);if(h){const d=new j;Ji.getBarycoord(fE,tp,np,ip,d),r&&(h.uv=Ji.getInterpolatedAttribute(r,o,l,c,d,new ke)),s&&(h.uv1=Ji.getInterpolatedAttribute(s,o,l,c,d,new ke)),a&&(h.normal=Ji.getInterpolatedAttribute(a,o,l,c,d,new j),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new j,materialIndex:0};Ji.getNormal(tp,np,ip,p.normal),h.face=p,h.barycoord=d}return h}class go extends Rt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],d=[];let p=0,m=0;v("z","y","x",-1,-1,n,t,e,a,s,0),v("z","y","x",1,-1,n,t,-e,a,s,1),v("x","z","y",1,1,e,n,t,r,a,2),v("x","z","y",1,-1,e,n,-t,r,a,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new ft(c,3)),this.setAttribute("normal",new ft(h,3)),this.setAttribute("uv",new ft(d,2));function v(x,_,g,b,E,S,w,T,R,U,A){const D=S/R,L=w/U,P=S/2,I=w/2,V=T/2,H=R+1,z=U+1;let O=0,B=0;const G=new j;for(let X=0;X<z;X++){const k=X*L-I;for(let Y=0;Y<H;Y++){const Q=Y*D-P;G[x]=Q*b,G[_]=k*E,G[g]=V,c.push(G.x,G.y,G.z),G[x]=0,G[_]=0,G[g]=T>0?1:-1,h.push(G.x,G.y,G.z),d.push(Y/R),d.push(1-X/U),O+=1}}for(let X=0;X<U;X++)for(let k=0;k<R;k++){const Y=p+k+H*X,Q=p+k+H*(X+1),te=p+(k+1)+H*(X+1),ee=p+(k+1)+H*X;l.push(Y,Q,ee),l.push(Q,te,ee),B+=6}o.addGroup(m,B,A),m+=B,p+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new go(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function mu(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Ni(i){const e={};for(let t=0;t<i.length;t++){const n=mu(i[t]);for(const r in n)e[r]=n[r]}return e}function IL(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function h2(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Gt.workingColorSpace}const $x={clone:mu,merge:Ni};var NL=`void main() {
|
|
1
|
+
import{aN as gA,aO as PU,au as po,aP as zU,aQ as nf,r as K,j as he,aR as FU,aS as BU,aT as kU,k as vA,b as wg,t as GU,F as Yn,$ as HU,C as Lr,aU as VU,aV as WU,a5 as XU,aW as jU,aX as qU,aY as YU,aZ as ZU,a_ as KU,a$ as JU,b0 as iu,b1 as QU,b2 as $U,b3 as eO,I as tO,b4 as kv,a as nO,s as qS,af as YS}from"./index-BbNbpRjN.js";import{m as iO}from"./merge-DT0EoWv1.js";import{g as rO,a as sO}from"./index-pTOKZKC7.js";import{E as _l,Z as hi,N as im,c as fh}from"./index-Bs7zcW7e.js";import"./envs-CSqIi4cL.js";import"./isArray-BnV6Ts7z.js";import"./isObject--vsEa_js.js";var Gv={exports:{}},Qs={};var ZS;function aO(){return ZS||(ZS=1,Qs.ConcurrentRoot=1,Qs.ContinuousEventPriority=8,Qs.DefaultEventPriority=32,Qs.DiscreteEventPriority=2,Qs.IdleEventPriority=268435456,Qs.LegacyRoot=0,Qs.NoEventPriority=0),Qs}var KS;function oO(){return KS||(KS=1,Gv.exports=aO()),Gv.exports}var rm=oO();const Tg="180",yA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},lO={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},_A=0,H_=1,xA=2,cO=3,bA=0,Ag=1,rf=2,is=3,ya=0,Fi=1,zn=2,pa=0,xl=1,V_=2,W_=3,X_=4,SA=5,io=100,EA=101,MA=102,wA=103,TA=104,AA=200,CA=201,RA=202,DA=203,vm=204,ym=205,UA=206,OA=207,LA=208,IA=209,NA=210,PA=211,zA=212,FA=213,BA=214,_m=0,xm=1,bm=2,wl=3,Sm=4,Em=5,Mm=6,wm=7,Kf=0,kA=1,GA=2,Ts=0,HA=1,VA=2,WA=3,zx=4,XA=5,jA=6,qA=7,j_="attached",YA="detached",Cg=300,_a=301,co=302,xf=303,bf=304,wu=306,Sf=1e3,Fr=1001,Ef=1002,vi=1003,Fx=1004,uO=1004,Qc=1005,hO=1005,Fn=1006,sf=1007,fO=1007,Ms=1008,dO=1008,Gr=1009,Bx=1010,kx=1011,lu=1012,Rg=1013,xa=1014,Qi=1015,Tu=1016,Dg=1017,Ug=1018,cu=1020,Gx=35902,Hx=35899,Vx=1021,Wx=1022,Di=1023,uu=1026,hu=1027,Og=1028,Jf=1029,Xx=1030,Lg=1031,pO=1032,Ig=1033,af=33776,of=33777,lf=33778,cf=33779,Tm=35840,Am=35841,Cm=35842,Rm=35843,Dm=36196,Um=37492,Om=37496,Lm=37808,Im=37809,Nm=37810,Pm=37811,zm=37812,Fm=37813,Bm=37814,km=37815,Gm=37816,Hm=37817,Vm=37818,Wm=37819,Xm=37820,jm=37821,qm=36492,Ym=36494,Zm=36495,Km=36283,Jm=36284,Qm=36285,$m=36286,ZA=2200,KA=2201,JA=2202,Mf=2300,eg=2301,sm=2302,ml=2400,gl=2401,wf=2402,Ng=2500,jx=2501,mO=0,gO=1,vO=2,QA=3200,qx=3201,yO=3202,_O=3203,mo=0,$A=1,ha="",Ri="srgb",uo="srgb-linear",Tf="linear",an="srgb",xO=0,hl=7680,bO=7681,SO=7682,EO=7683,MO=34055,wO=34056,TO=5386,AO=512,CO=513,RO=514,DO=515,UO=516,OO=517,LO=518,q_=519,e2=512,t2=513,n2=514,Yx=515,i2=516,r2=517,s2=518,a2=519,Af=35044,IO=35048,NO=35040,PO=35045,zO=35049,FO=35041,BO=35046,kO=35050,GO=35042,HO="100",Y_="300 es",yr=2e3,fu=2001,VO={COMPUTE:"compute",RENDER:"render"},WO={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},XO={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};let Ds=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}};const Ti=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let JS=1234567;const bl=Math.PI/180,du=180/Math.PI;function _r(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ti[i&255]+Ti[i>>8&255]+Ti[i>>16&255]+Ti[i>>24&255]+"-"+Ti[e&255]+Ti[e>>8&255]+"-"+Ti[e>>16&15|64]+Ti[e>>24&255]+"-"+Ti[t&63|128]+Ti[t>>8&255]+"-"+Ti[t>>16&255]+Ti[t>>24&255]+Ti[n&255]+Ti[n>>8&255]+Ti[n>>16&255]+Ti[n>>24&255]).toLowerCase()}function St(i,e,t){return Math.max(e,Math.min(t,i))}function Zx(i,e){return(i%e+e)%e}function jO(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function qO(i,e,t){return i!==e?(t-i)/(e-i):0}function uf(i,e,t){return(1-t)*i+t*e}function YO(i,e,t,n){return uf(i,e,1-Math.exp(-t*n))}function ZO(i,e=1){return e-Math.abs(Zx(i,e*2)-e)}function KO(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function JO(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function QO(i,e){return i+Math.floor(Math.random()*(e-i+1))}function $O(i,e){return i+Math.random()*(e-i)}function eL(i){return i*(.5-Math.random())}function tL(i){i!==void 0&&(JS=i);let e=JS+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function nL(i){return i*bl}function iL(i){return i*du}function rL(i){return(i&i-1)===0&&i!==0}function sL(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function aL(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function oL(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),d=s((e-n)/2),p=a((e-n)/2),m=s((n-e)/2),v=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*d,l*p,o*c);break;case"YZY":i.set(l*p,o*h,l*d,o*c);break;case"ZXZ":i.set(l*d,l*p,o*h,o*c);break;case"XZX":i.set(o*h,l*v,l*m,o*c);break;case"YXY":i.set(l*m,o*h,l*v,o*c);break;case"ZYZ":i.set(l*v,l*m,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Pi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Ot(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const tg={DEG2RAD:bl,RAD2DEG:du,generateUUID:_r,clamp:St,euclideanModulo:Zx,mapLinear:jO,inverseLerp:qO,lerp:uf,damp:YO,pingpong:ZO,smoothstep:KO,smootherstep:JO,randInt:QO,randFloat:$O,randFloatSpread:eL,seededRandom:tL,degToRad:nL,radToDeg:iL,isPowerOfTwo:rL,ceilPowerOfTwo:sL,floorPowerOfTwo:aL,setQuaternionFromProperEuler:oL,normalize:Ot,denormalize:Pi};class ke{constructor(e=0,t=0){ke.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(St(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class yi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],d=n[r+3];const p=s[a+0],m=s[a+1],v=s[a+2],x=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(o===1){e[t+0]=p,e[t+1]=m,e[t+2]=v,e[t+3]=x;return}if(d!==x||l!==p||c!==m||h!==v){let _=1-o;const g=l*p+c*m+h*v+d*x,b=g>=0?1:-1,E=1-g*g;if(E>Number.EPSILON){const w=Math.sqrt(E),T=Math.atan2(w,g*b);_=Math.sin(_*T)/w,o=Math.sin(o*T)/w}const S=o*b;if(l=l*_+p*S,c=c*_+m*S,h=h*_+v*S,d=d*_+x*S,_===1-o){const w=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=w,c*=w,h*=w,d*=w}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],d=s[a],p=s[a+1],m=s[a+2],v=s[a+3];return e[t]=o*v+h*d+l*m-c*p,e[t+1]=l*v+h*p+c*d-o*m,e[t+2]=c*v+h*m+o*p-l*d,e[t+3]=h*v-o*d-l*p-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),d=o(s/2),p=l(n/2),m=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=p*h*d+c*m*v,this._y=c*m*d-p*h*v,this._z=c*h*v+p*m*d,this._w=c*h*d-p*m*v;break;case"YXZ":this._x=p*h*d+c*m*v,this._y=c*m*d-p*h*v,this._z=c*h*v-p*m*d,this._w=c*h*d+p*m*v;break;case"ZXY":this._x=p*h*d-c*m*v,this._y=c*m*d+p*h*v,this._z=c*h*v+p*m*d,this._w=c*h*d-p*m*v;break;case"ZYX":this._x=p*h*d-c*m*v,this._y=c*m*d+p*h*v,this._z=c*h*v-p*m*d,this._w=c*h*d+p*m*v;break;case"YZX":this._x=p*h*d+c*m*v,this._y=c*m*d+p*h*v,this._z=c*h*v-p*m*d,this._w=c*h*d-p*m*v;break;case"XZY":this._x=p*h*d-c*m*v,this._y=c*m*d-p*h*v,this._z=c*h*v+p*m*d,this._w=c*h*d+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],p=n+o+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>d){const m=2*Math.sqrt(1+n-o-d);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>d){const m=2*Math.sqrt(1+o-n-d);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+d-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(St(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=a*d+this._w*p,this._x=n*d+this._x*p,this._y=r*d+this._y*p,this._z=s*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{constructor(e=0,t=0,n=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(QS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(QS.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Hv.copy(this).projectOnVector(e),this.sub(Hv)}reflect(e){return this.sub(Hv.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(St(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Hv=new j,QS=new yi;class At{constructor(e,t,n,r,s,a,o,l,c){At.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],p=n[2],m=n[5],v=n[8],x=r[0],_=r[3],g=r[6],b=r[1],E=r[4],S=r[7],w=r[2],T=r[5],R=r[8];return s[0]=a*x+o*b+l*w,s[3]=a*_+o*E+l*T,s[6]=a*g+o*S+l*R,s[1]=c*x+h*b+d*w,s[4]=c*_+h*E+d*T,s[7]=c*g+h*S+d*R,s[2]=p*x+m*b+v*w,s[5]=p*_+m*E+v*T,s[8]=p*g+m*S+v*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,p=o*l-h*s,m=c*s-a*l,v=t*d+n*p+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/v;return e[0]=d*x,e[1]=(r*c-h*n)*x,e[2]=(o*n-r*a)*x,e[3]=p*x,e[4]=(h*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=m*x,e[7]=(n*l-c*t)*x,e[8]=(a*t-n*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Vv.makeScale(e,t)),this}rotate(e){return this.premultiply(Vv.makeRotation(-e)),this}translate(e,t){return this.premultiply(Vv.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Vv=new At;function o2(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}const lL={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $c(i,e){return new lL[i](e)}function Cf(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function l2(){const i=Cf("canvas");return i.style.display="block",i}const $S={};function Rf(i){i in $S||($S[i]=!0,console.warn(i))}function cL(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const eE=new At().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tE=new At().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function uL(){const i={enabled:!0,workingColorSpace:uo,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===an&&(r.r=ma(r.r),r.g=ma(r.g),r.b=ma(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===an&&(r.r=ru(r.r),r.g=ru(r.g),r.b=ru(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ha?Tf:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Rf("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Rf("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[uo]:{primaries:e,whitePoint:n,transfer:Tf,toXYZ:eE,fromXYZ:tE,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ri},outputColorSpaceConfig:{drawingBufferColorSpace:Ri}},[Ri]:{primaries:e,whitePoint:n,transfer:an,toXYZ:eE,fromXYZ:tE,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ri}}}),i}const Gt=uL();function ma(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ru(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let gc;class c2{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{gc===void 0&&(gc=Cf("canvas")),gc.width=e.width,gc.height=e.height;const r=gc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=gc}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Cf("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=ma(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(ma(t[n]/255)*255):t[n]=ma(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let hL=0;class ro{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hL++}),this.uuid=_r(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Wv(r[a].image)):s.push(Wv(r[a]))}else s=Wv(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Wv(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?c2.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let fL=0;const Xv=new j;class Dn extends Ds{constructor(e=Dn.DEFAULT_IMAGE,t=Dn.DEFAULT_MAPPING,n=Fr,r=Fr,s=Fn,a=Ms,o=Di,l=Gr,c=Dn.DEFAULT_ANISOTROPY,h=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fL++}),this.uuid=_r(),this.name="",this.source=new ro(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ke(0,0),this.repeat=new ke(1,1),this.center=new ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new At,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Xv).x}get height(){return this.source.getSize(Xv).y}get depth(){return this.source.getSize(Xv).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Cg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sf:e.x=e.x-Math.floor(e.x);break;case Fr:e.x=e.x<0?0:1;break;case Ef:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sf:e.y=e.y-Math.floor(e.y);break;case Fr:e.y=e.y<0?0:1;break;case Ef:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Dn.DEFAULT_IMAGE=null;Dn.DEFAULT_MAPPING=Cg;Dn.DEFAULT_ANISOTROPY=1;class Bt{constructor(e=0,t=0,n=0,r=1){Bt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],d=l[8],p=l[1],m=l[5],v=l[9],x=l[2],_=l[6],g=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-x)<.01&&Math.abs(v-_)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+x)<.1&&Math.abs(v+_)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,S=(m+1)/2,w=(g+1)/2,T=(h+p)/4,R=(d+x)/4,U=(v+_)/4;return E>S&&E>w?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=T/n,s=R/n):S>w?S<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),n=T/r,s=U/r):w<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),n=R/s,r=U/s),this.set(n,r,s,t),this}let b=Math.sqrt((_-v)*(_-v)+(d-x)*(d-x)+(p-h)*(p-h));return Math.abs(b)<.001&&(b=1),this.x=(_-v)/b,this.y=(d-x)/b,this.z=(p-h)/b,this.w=Math.acos((c+m+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this.w=St(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this.w=St(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Kx extends Ds{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Fn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Bt(0,0,e,t),this.scissorTest=!1,this.viewport=new Bt(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Dn(r);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:Fn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new ro(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Rs extends Kx{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Pg extends Dn{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=vi,this.minFilter=vi,this.wrapR=Fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dL extends Rs{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Pg(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class zg extends Dn{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=vi,this.minFilter=vi,this.wrapR=Fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class pL extends Rs{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new zg(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class Qn{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Kr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Kr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Kr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Kr):Kr.fromBufferAttribute(s,a),Kr.applyMatrix4(e.matrixWorld),this.expandByPoint(Kr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Xd.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Xd.copy(n.boundingBox)),Xd.applyMatrix4(e.matrixWorld),this.union(Xd)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Kr),Kr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(dh),jd.subVectors(this.max,dh),vc.subVectors(e.a,dh),yc.subVectors(e.b,dh),_c.subVectors(e.c,dh),ja.subVectors(yc,vc),qa.subVectors(_c,yc),jo.subVectors(vc,_c);let t=[0,-ja.z,ja.y,0,-qa.z,qa.y,0,-jo.z,jo.y,ja.z,0,-ja.x,qa.z,0,-qa.x,jo.z,0,-jo.x,-ja.y,ja.x,0,-qa.y,qa.x,0,-jo.y,jo.x,0];return!jv(t,vc,yc,_c,jd)||(t=[1,0,0,0,1,0,0,0,1],!jv(t,vc,yc,_c,jd))?!1:(qd.crossVectors(ja,qa),t=[qd.x,qd.y,qd.z],jv(t,vc,yc,_c,jd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:($s[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$s[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$s[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$s[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$s[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$s[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$s[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$s[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($s),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const $s=[new j,new j,new j,new j,new j,new j,new j,new j],Kr=new j,Xd=new Qn,vc=new j,yc=new j,_c=new j,ja=new j,qa=new j,jo=new j,dh=new j,jd=new j,qd=new j,qo=new j;function jv(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){qo.fromArray(i,s);const o=r.x*Math.abs(qo.x)+r.y*Math.abs(qo.y)+r.z*Math.abs(qo.z),l=e.dot(qo),c=t.dot(qo),h=n.dot(qo);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const mL=new Qn,ph=new j,qv=new j;let ri=class{constructor(e=new j,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):mL.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ph.subVectors(e,this.center);const t=ph.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ph,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(qv.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ph.copy(e.center).add(qv)),this.expandByPoint(ph.copy(e.center).sub(qv))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}};const ea=new j,Yv=new j,Yd=new j,Ya=new j,Zv=new j,Zd=new j,Kv=new j;class Au{constructor(e=new j,t=new j(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ea)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ea.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ea.copy(this.origin).addScaledVector(this.direction,t),ea.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Yv.copy(e).add(t).multiplyScalar(.5),Yd.copy(t).sub(e).normalize(),Ya.copy(this.origin).sub(Yv);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Yd),o=Ya.dot(this.direction),l=-Ya.dot(Yd),c=Ya.lengthSq(),h=Math.abs(1-a*a);let d,p,m,v;if(h>0)if(d=a*l-o,p=a*o-l,v=s*h,d>=0)if(p>=-v)if(p<=v){const x=1/h;d*=x,p*=x,m=d*(d+a*p+2*o)+p*(a*d+p+2*l)+c}else p=s,d=Math.max(0,-(a*p+o)),m=-d*d+p*(p+2*l)+c;else p=-s,d=Math.max(0,-(a*p+o)),m=-d*d+p*(p+2*l)+c;else p<=-v?(d=Math.max(0,-(-a*s+o)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c):p<=v?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(d=Math.max(0,-(a*s+o)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c);else p=a>0?-s:s,d=Math.max(0,-(a*p+o)),m=-d*d+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Yv).addScaledVector(Yd,p),m}intersectSphere(e,t){ea.subVectors(e.center,this.origin);const n=ea.dot(this.direction),r=ea.dot(ea)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),h>=0?(s=(e.min.y-p.y)*h,a=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,a=(e.min.y-p.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(o=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ea)!==null}intersectTriangle(e,t,n,r,s){Zv.subVectors(t,e),Zd.subVectors(n,e),Kv.crossVectors(Zv,Zd);let a=this.direction.dot(Kv),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ya.subVectors(this.origin,e);const l=o*this.direction.dot(Zd.crossVectors(Ya,Zd));if(l<0)return null;const c=o*this.direction.dot(Zv.cross(Ya));if(c<0||l+c>a)return null;const h=-o*Ya.dot(Kv);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class bt{constructor(e,t,n,r,s,a,o,l,c,h,d,p,m,v,x,_){bt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,d,p,m,v,x,_)}set(e,t,n,r,s,a,o,l,c,h,d,p,m,v,x,_){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=s,g[5]=a,g[9]=o,g[13]=l,g[2]=c,g[6]=h,g[10]=d,g[14]=p,g[3]=m,g[7]=v,g[11]=x,g[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new bt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/xc.setFromMatrixColumn(e,0).length(),s=1/xc.setFromMatrixColumn(e,1).length(),a=1/xc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=a*h,m=a*d,v=o*h,x=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=m+v*c,t[5]=p-x*c,t[9]=-o*l,t[2]=x-p*c,t[6]=v+m*c,t[10]=a*l}else if(e.order==="YXZ"){const p=l*h,m=l*d,v=c*h,x=c*d;t[0]=p+x*o,t[4]=v*o-m,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=m*o-v,t[6]=x+p*o,t[10]=a*l}else if(e.order==="ZXY"){const p=l*h,m=l*d,v=c*h,x=c*d;t[0]=p-x*o,t[4]=-a*d,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*h,t[9]=x-p*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const p=a*h,m=a*d,v=o*h,x=o*d;t[0]=l*h,t[4]=v*c-m,t[8]=p*c+x,t[1]=l*d,t[5]=x*c+p,t[9]=m*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const p=a*l,m=a*c,v=o*l,x=o*c;t[0]=l*h,t[4]=x-p*d,t[8]=v*d+m,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=m*d+v,t[10]=p-x*d}else if(e.order==="XZY"){const p=a*l,m=a*c,v=o*l,x=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=p*d+x,t[5]=a*h,t[9]=m*d-v,t[2]=v*d-m,t[6]=o*h,t[10]=x*d+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gL,e,vL)}lookAt(e,t,n){const r=this.elements;return mr.subVectors(e,t),mr.lengthSq()===0&&(mr.z=1),mr.normalize(),Za.crossVectors(n,mr),Za.lengthSq()===0&&(Math.abs(n.z)===1?mr.x+=1e-4:mr.z+=1e-4,mr.normalize(),Za.crossVectors(n,mr)),Za.normalize(),Kd.crossVectors(mr,Za),r[0]=Za.x,r[4]=Kd.x,r[8]=mr.x,r[1]=Za.y,r[5]=Kd.y,r[9]=mr.y,r[2]=Za.z,r[6]=Kd.z,r[10]=mr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],d=n[5],p=n[9],m=n[13],v=n[2],x=n[6],_=n[10],g=n[14],b=n[3],E=n[7],S=n[11],w=n[15],T=r[0],R=r[4],U=r[8],A=r[12],D=r[1],L=r[5],P=r[9],I=r[13],V=r[2],H=r[6],z=r[10],O=r[14],B=r[3],G=r[7],X=r[11],k=r[15];return s[0]=a*T+o*D+l*V+c*B,s[4]=a*R+o*L+l*H+c*G,s[8]=a*U+o*P+l*z+c*X,s[12]=a*A+o*I+l*O+c*k,s[1]=h*T+d*D+p*V+m*B,s[5]=h*R+d*L+p*H+m*G,s[9]=h*U+d*P+p*z+m*X,s[13]=h*A+d*I+p*O+m*k,s[2]=v*T+x*D+_*V+g*B,s[6]=v*R+x*L+_*H+g*G,s[10]=v*U+x*P+_*z+g*X,s[14]=v*A+x*I+_*O+g*k,s[3]=b*T+E*D+S*V+w*B,s[7]=b*R+E*L+S*H+w*G,s[11]=b*U+E*P+S*z+w*X,s[15]=b*A+E*I+S*O+w*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],p=e[10],m=e[14],v=e[3],x=e[7],_=e[11],g=e[15];return v*(+s*l*d-r*c*d-s*o*p+n*c*p+r*o*m-n*l*m)+x*(+t*l*m-t*c*p+s*a*p-r*a*m+r*c*h-s*l*h)+_*(+t*c*d-t*o*m-s*a*d+n*a*m+s*o*h-n*c*h)+g*(-r*o*h-t*l*d+t*o*p+r*a*d-n*a*p+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],p=e[10],m=e[11],v=e[12],x=e[13],_=e[14],g=e[15],b=d*_*c-x*p*c+x*l*m-o*_*m-d*l*g+o*p*g,E=v*p*c-h*_*c-v*l*m+a*_*m+h*l*g-a*p*g,S=h*x*c-v*d*c+v*o*m-a*x*m-h*o*g+a*d*g,w=v*d*l-h*x*l-v*o*p+a*x*p+h*o*_-a*d*_,T=t*b+n*E+r*S+s*w;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/T;return e[0]=b*R,e[1]=(x*p*s-d*_*s-x*r*m+n*_*m+d*r*g-n*p*g)*R,e[2]=(o*_*s-x*l*s+x*r*c-n*_*c-o*r*g+n*l*g)*R,e[3]=(d*l*s-o*p*s-d*r*c+n*p*c+o*r*m-n*l*m)*R,e[4]=E*R,e[5]=(h*_*s-v*p*s+v*r*m-t*_*m-h*r*g+t*p*g)*R,e[6]=(v*l*s-a*_*s-v*r*c+t*_*c+a*r*g-t*l*g)*R,e[7]=(a*p*s-h*l*s+h*r*c-t*p*c-a*r*m+t*l*m)*R,e[8]=S*R,e[9]=(v*d*s-h*x*s-v*n*m+t*x*m+h*n*g-t*d*g)*R,e[10]=(a*x*s-v*o*s+v*n*c-t*x*c-a*n*g+t*o*g)*R,e[11]=(h*o*s-a*d*s-h*n*c+t*d*c+a*n*m-t*o*m)*R,e[12]=w*R,e[13]=(h*x*r-v*d*r+v*n*p-t*x*p-h*n*_+t*d*_)*R,e[14]=(v*o*r-a*x*r-v*n*l+t*x*l+a*n*_-t*o*_)*R,e[15]=(a*d*r-h*o*r+h*n*l-t*d*l-a*n*p+t*o*p)*R,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,d=o+o,p=s*c,m=s*h,v=s*d,x=a*h,_=a*d,g=o*d,b=l*c,E=l*h,S=l*d,w=n.x,T=n.y,R=n.z;return r[0]=(1-(x+g))*w,r[1]=(m+S)*w,r[2]=(v-E)*w,r[3]=0,r[4]=(m-S)*T,r[5]=(1-(p+g))*T,r[6]=(_+b)*T,r[7]=0,r[8]=(v+E)*R,r[9]=(_-b)*R,r[10]=(1-(p+x))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=xc.set(r[0],r[1],r[2]).length();const a=xc.set(r[4],r[5],r[6]).length(),o=xc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Jr.copy(this);const c=1/s,h=1/a,d=1/o;return Jr.elements[0]*=c,Jr.elements[1]*=c,Jr.elements[2]*=c,Jr.elements[4]*=h,Jr.elements[5]*=h,Jr.elements[6]*=h,Jr.elements[8]*=d,Jr.elements[9]*=d,Jr.elements[10]*=d,t.setFromRotationMatrix(Jr),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=yr,l=!1){const c=this.elements,h=2*s/(t-e),d=2*s/(n-r),p=(t+e)/(t-e),m=(n+r)/(n-r);let v,x;if(l)v=s/(a-s),x=a*s/(a-s);else if(o===yr)v=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===fu)v=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=d,c[9]=m,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=yr,l=!1){const c=this.elements,h=2/(t-e),d=2/(n-r),p=-(t+e)/(t-e),m=-(n+r)/(n-r);let v,x;if(l)v=1/(a-s),x=a/(a-s);else if(o===yr)v=-2/(a-s),x=-(a+s)/(a-s);else if(o===fu)v=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=d,c[9]=0,c[13]=m,c[2]=0,c[6]=0,c[10]=v,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const xc=new j,Jr=new bt,gL=new j(0,0,0),vL=new j(1,1,1),Za=new j,Kd=new j,mr=new j,nE=new bt,iE=new yi;class Bi{constructor(e=0,t=0,n=0,r=Bi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(St(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-St(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(St(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-St(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(St(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-St(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return nE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(nE,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return iE.setFromEuler(this),this.setFromQuaternion(iE,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Bi.DEFAULT_ORDER="XYZ";class pu{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let yL=0;const rE=new j,bc=new yi,ta=new bt,Jd=new j,mh=new j,_L=new j,xL=new yi,sE=new j(1,0,0),aE=new j(0,1,0),oE=new j(0,0,1),lE={type:"added"},bL={type:"removed"},Sc={type:"childadded",child:null},Jv={type:"childremoved",child:null};class Xt extends Ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yL++}),this.uuid=_r(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Xt.DEFAULT_UP.clone();const e=new j,t=new Bi,n=new yi,r=new j(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new bt},normalMatrix:{value:new At}}),this.matrix=new bt,this.matrixWorld=new bt,this.matrixAutoUpdate=Xt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Xt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new pu,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return bc.setFromAxisAngle(e,t),this.quaternion.multiply(bc),this}rotateOnWorldAxis(e,t){return bc.setFromAxisAngle(e,t),this.quaternion.premultiply(bc),this}rotateX(e){return this.rotateOnAxis(sE,e)}rotateY(e){return this.rotateOnAxis(aE,e)}rotateZ(e){return this.rotateOnAxis(oE,e)}translateOnAxis(e,t){return rE.copy(e).applyQuaternion(this.quaternion),this.position.add(rE.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(sE,e)}translateY(e){return this.translateOnAxis(aE,e)}translateZ(e){return this.translateOnAxis(oE,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ta.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Jd.copy(e):Jd.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),mh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ta.lookAt(mh,Jd,this.up):ta.lookAt(Jd,mh,this.up),this.quaternion.setFromRotationMatrix(ta),r&&(ta.extractRotation(r.matrixWorld),bc.setFromRotationMatrix(ta),this.quaternion.premultiply(bc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(lE),Sc.child=e,this.dispatchEvent(Sc),Sc.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(bL),Jv.child=e,this.dispatchEvent(Jv),Jv.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ta.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ta.multiply(e.parent.matrixWorld)),e.applyMatrix4(ta),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(lE),Sc.child=e,this.dispatchEvent(Sc),Sc.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mh,e,_L),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mh,xL,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),d=a(e.shapes),p=a(e.skeletons),m=a(e.animations),v=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),v.length>0&&(n.nodes=v)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}Xt.DEFAULT_UP=new j(0,1,0);Xt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Xt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Qr=new j,na=new j,Qv=new j,ia=new j,Ec=new j,Mc=new j,cE=new j,$v=new j,ey=new j,ty=new j,ny=new Bt,iy=new Bt,ry=new Bt;class Ji{constructor(e=new j,t=new j,n=new j){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Qr.subVectors(e,t),r.cross(Qr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Qr.subVectors(r,t),na.subVectors(n,t),Qv.subVectors(e,t);const a=Qr.dot(Qr),o=Qr.dot(na),l=Qr.dot(Qv),c=na.dot(na),h=na.dot(Qv),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const p=1/d,m=(c*l-o*h)*p,v=(a*h-o*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ia)===null?!1:ia.x>=0&&ia.y>=0&&ia.x+ia.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,ia)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ia.x),l.addScaledVector(a,ia.y),l.addScaledVector(o,ia.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return ny.setScalar(0),iy.setScalar(0),ry.setScalar(0),ny.fromBufferAttribute(e,t),iy.fromBufferAttribute(e,n),ry.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ny,s.x),a.addScaledVector(iy,s.y),a.addScaledVector(ry,s.z),a}static isFrontFacing(e,t,n,r){return Qr.subVectors(n,t),na.subVectors(e,t),Qr.cross(na).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qr.subVectors(this.c,this.b),na.subVectors(this.a,this.b),Qr.cross(na).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ji.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ji.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Ji.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Ji.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ji.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Ec.subVectors(r,n),Mc.subVectors(s,n),$v.subVectors(e,n);const l=Ec.dot($v),c=Mc.dot($v);if(l<=0&&c<=0)return t.copy(n);ey.subVectors(e,r);const h=Ec.dot(ey),d=Mc.dot(ey);if(h>=0&&d<=h)return t.copy(r);const p=l*d-h*c;if(p<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Ec,a);ty.subVectors(e,s);const m=Ec.dot(ty),v=Mc.dot(ty);if(v>=0&&m<=v)return t.copy(s);const x=m*c-l*v;if(x<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(n).addScaledVector(Mc,o);const _=h*v-m*d;if(_<=0&&d-h>=0&&m-v>=0)return cE.subVectors(s,r),o=(d-h)/(d-h+(m-v)),t.copy(r).addScaledVector(cE,o);const g=1/(_+x+p);return a=x*g,o=p*g,t.copy(n).addScaledVector(Ec,a).addScaledVector(Mc,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const u2={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},Ka={h:0,s:0,l:0},Qd={h:0,s:0,l:0};function sy(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let Ye=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ri){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Gt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Gt.workingColorSpace){if(e=Zx(e,1),t=St(t,0,1),n=St(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=sy(a,s,e+1/3),this.g=sy(a,s,e),this.b=sy(a,s,e-1/3)}return Gt.colorSpaceToWorking(this,r),this}setStyle(e,t=Ri){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ri){const n=u2[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ma(e.r),this.g=ma(e.g),this.b=ma(e.b),this}copyLinearToSRGB(e){return this.r=ru(e.r),this.g=ru(e.g),this.b=ru(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ri){return Gt.workingToColorSpace(Ai.copy(this),e),Math.round(St(Ai.r*255,0,255))*65536+Math.round(St(Ai.g*255,0,255))*256+Math.round(St(Ai.b*255,0,255))}getHexString(e=Ri){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.workingToColorSpace(Ai.copy(this),t);const n=Ai.r,r=Ai.g,s=Ai.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Gt.workingColorSpace){return Gt.workingToColorSpace(Ai.copy(this),t),e.r=Ai.r,e.g=Ai.g,e.b=Ai.b,e}getStyle(e=Ri){Gt.workingToColorSpace(Ai.copy(this),e);const t=Ai.r,n=Ai.g,r=Ai.b;return e!==Ri?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Ka),this.setHSL(Ka.h+e,Ka.s+t,Ka.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ka),e.getHSL(Qd);const n=uf(Ka.h,Qd.h,t),r=uf(Ka.s,Qd.s,t),s=uf(Ka.l,Qd.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const Ai=new Ye;Ye.NAMES=u2;let SL=0;class Ui extends Ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:SL++}),this.uuid=_r(),this.name="",this.type="Material",this.blending=xl,this.side=ya,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=vm,this.blendDst=ym,this.blendEquation=io,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=wl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=q_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=hl,this.stencilZFail=hl,this.stencilZPass=hl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xl&&(n.blending=this.blending),this.side!==ya&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==vm&&(n.blendSrc=this.blendSrc),this.blendDst!==ym&&(n.blendDst=this.blendDst),this.blendEquation!==io&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==wl&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==q_&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==hl&&(n.stencilFail=this.stencilFail),this.stencilZFail!==hl&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==hl&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ea extends Ui{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const fa=EL();function EL(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function Zi(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=St(i,-65504,65504),fa.floatView[0]=i;const e=fa.uint32View[0],t=e>>23&511;return fa.baseTable[t]+((e&8388607)>>fa.shiftTable[t])}function Yh(i){const e=i>>10;return fa.uint32View[0]=fa.mantissaTable[fa.offsetTable[e]+(i&1023)]+fa.exponentTable[e],fa.floatView[0]}class ML{static toHalfFloat(e){return Zi(e)}static fromHalfFloat(e){return Yh(e)}}const qn=new j,$d=new ke;let wL=0;class $t{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:wL++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Af,this.updateRanges=[],this.gpuType=Qi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)$d.fromBufferAttribute(this,t),$d.applyMatrix3(e),this.setXY(t,$d.x,$d.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyMatrix3(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyMatrix4(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyNormalMatrix(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.transformDirection(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Pi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ot(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Pi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Pi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Pi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Pi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Af&&(e.usage=this.usage),e}}class TL extends $t{constructor(e,t,n){super(new Int8Array(e),t,n)}}class AL extends $t{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class CL extends $t{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class RL extends $t{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Jx extends $t{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class DL extends $t{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Qx extends $t{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class UL extends $t{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Yh(this.array[e*this.itemSize]);return this.normalized&&(t=Pi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=Zi(t),this}getY(e){let t=Yh(this.array[e*this.itemSize+1]);return this.normalized&&(t=Pi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=Zi(t),this}getZ(e){let t=Yh(this.array[e*this.itemSize+2]);return this.normalized&&(t=Pi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=Zi(t),this}getW(e){let t=Yh(this.array[e*this.itemSize+3]);return this.normalized&&(t=Pi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=Zi(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.array[e+0]=Zi(t),this.array[e+1]=Zi(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.array[e+0]=Zi(t),this.array[e+1]=Zi(n),this.array[e+2]=Zi(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=Zi(t),this.array[e+1]=Zi(n),this.array[e+2]=Zi(r),this.array[e+3]=Zi(s),this}}class ft extends $t{constructor(e,t,n){super(new Float32Array(e),t,n)}}let OL=0;const Ur=new bt,ay=new Xt,wc=new j,gr=new Qn,gh=new Qn,ui=new j;class Rt extends Ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:OL++}),this.uuid=_r(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(o2(e)?Qx:Jx)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new At().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ur.makeRotationFromQuaternion(e),this.applyMatrix4(Ur),this}rotateX(e){return Ur.makeRotationX(e),this.applyMatrix4(Ur),this}rotateY(e){return Ur.makeRotationY(e),this.applyMatrix4(Ur),this}rotateZ(e){return Ur.makeRotationZ(e),this.applyMatrix4(Ur),this}translate(e,t,n){return Ur.makeTranslation(e,t,n),this.applyMatrix4(Ur),this}scale(e,t,n){return Ur.makeScale(e,t,n),this.applyMatrix4(Ur),this}lookAt(e){return ay.lookAt(e),ay.updateMatrix(),this.applyMatrix4(ay.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(wc).negate(),this.translate(wc.x,wc.y,wc.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new ft(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];gr.setFromBufferAttribute(s),this.morphTargetsRelative?(ui.addVectors(this.boundingBox.min,gr.min),this.boundingBox.expandByPoint(ui),ui.addVectors(this.boundingBox.max,gr.max),this.boundingBox.expandByPoint(ui)):(this.boundingBox.expandByPoint(gr.min),this.boundingBox.expandByPoint(gr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ri);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(e){const n=this.boundingSphere.center;if(gr.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];gh.setFromBufferAttribute(o),this.morphTargetsRelative?(ui.addVectors(gr.min,gh.min),gr.expandByPoint(ui),ui.addVectors(gr.max,gh.max),gr.expandByPoint(ui)):(gr.expandByPoint(gh.min),gr.expandByPoint(gh.max))}gr.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ui.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ui));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ui.fromBufferAttribute(o,c),l&&(wc.fromBufferAttribute(e,c),ui.add(wc)),r=Math.max(r,n.distanceToSquared(ui))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new $t(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U<n.count;U++)o[U]=new j,l[U]=new j;const c=new j,h=new j,d=new j,p=new ke,m=new ke,v=new ke,x=new j,_=new j;function g(U,A,D){c.fromBufferAttribute(n,U),h.fromBufferAttribute(n,A),d.fromBufferAttribute(n,D),p.fromBufferAttribute(s,U),m.fromBufferAttribute(s,A),v.fromBufferAttribute(s,D),h.sub(c),d.sub(c),m.sub(p),v.sub(p);const L=1/(m.x*v.y-v.x*m.y);isFinite(L)&&(x.copy(h).multiplyScalar(v.y).addScaledVector(d,-m.y).multiplyScalar(L),_.copy(d).multiplyScalar(m.x).addScaledVector(h,-v.x).multiplyScalar(L),o[U].add(x),o[A].add(x),o[D].add(x),l[U].add(_),l[A].add(_),l[D].add(_))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let U=0,A=b.length;U<A;++U){const D=b[U],L=D.start,P=D.count;for(let I=L,V=L+P;I<V;I+=3)g(e.getX(I+0),e.getX(I+1),e.getX(I+2))}const E=new j,S=new j,w=new j,T=new j;function R(U){w.fromBufferAttribute(r,U),T.copy(w);const A=o[U];E.copy(A),E.sub(w.multiplyScalar(w.dot(A))).normalize(),S.crossVectors(T,A);const L=S.dot(l[U])<0?-1:1;a.setXYZW(U,E.x,E.y,E.z,L)}for(let U=0,A=b.length;U<A;++U){const D=b[U],L=D.start,P=D.count;for(let I=L,V=L+P;I<V;I+=3)R(e.getX(I+0)),R(e.getX(I+1)),R(e.getX(I+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new $t(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,m=n.count;p<m;p++)n.setXYZ(p,0,0,0);const r=new j,s=new j,a=new j,o=new j,l=new j,c=new j,h=new j,d=new j;if(e)for(let p=0,m=e.count;p<m;p+=3){const v=e.getX(p+0),x=e.getX(p+1),_=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,_),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(n,v),l.fromBufferAttribute(n,x),c.fromBufferAttribute(n,_),o.add(h),l.add(h),c.add(h),n.setXYZ(v,o.x,o.y,o.z),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(_,c.x,c.y,c.z)}else for(let p=0,m=t.count;p<m;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),a.fromBufferAttribute(t,p+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),n.setXYZ(p+0,h.x,h.y,h.z),n.setXYZ(p+1,h.x,h.y,h.z),n.setXYZ(p+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ui.fromBufferAttribute(e,t),ui.normalize(),e.setXYZ(t,ui.x,ui.y,ui.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,d=o.normalized,p=new c.constructor(l.length*h);let m=0,v=0;for(let x=0,_=l.length;x<_;x++){o.isInterleavedBufferAttribute?m=l[x]*o.data.stride+o.offset:m=l[x]*h;for(let g=0;g<h;g++)p[v++]=c[m++]}return new $t(p,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Rt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){const p=c[h],m=e(p,n);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let d=0,p=c.length;d<p;d++){const m=c[d];h.push(m.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],d=s[c];for(let p=0,m=d.length;p<m;p++)h.push(d[p].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const uE=new bt,Yo=new Au,ep=new ri,hE=new j,tp=new j,np=new j,ip=new j,oy=new j,rp=new j,fE=new j,sp=new j;class mn extends Xt{constructor(e=new Rt,t=new Ea){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){rp.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],d=s[l];h!==0&&(oy.fromBufferAttribute(d,e),a?rp.addScaledVector(oy,h):rp.addScaledVector(oy.sub(t),h))}t.add(rp)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ep.copy(n.boundingSphere),ep.applyMatrix4(s),Yo.copy(e.ray).recast(e.near),!(ep.containsPoint(Yo.origin)===!1&&(Yo.intersectSphere(ep,hE)===null||Yo.origin.distanceToSquared(hE)>(e.far-e.near)**2))&&(uE.copy(s).invert(),Yo.copy(e.ray).applyMatrix4(uE),!(n.boundingBox!==null&&Yo.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Yo)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,x=p.length;v<x;v++){const _=p[v],g=a[_.materialIndex],b=Math.max(_.start,m.start),E=Math.min(o.count,Math.min(_.start+_.count,m.start+m.count));for(let S=b,w=E;S<w;S+=3){const T=o.getX(S),R=o.getX(S+1),U=o.getX(S+2);r=ap(this,g,e,n,c,h,d,T,R,U),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),x=Math.min(o.count,m.start+m.count);for(let _=v,g=x;_<g;_+=3){const b=o.getX(_),E=o.getX(_+1),S=o.getX(_+2);r=ap(this,a,e,n,c,h,d,b,E,S),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let v=0,x=p.length;v<x;v++){const _=p[v],g=a[_.materialIndex],b=Math.max(_.start,m.start),E=Math.min(l.count,Math.min(_.start+_.count,m.start+m.count));for(let S=b,w=E;S<w;S+=3){const T=S,R=S+1,U=S+2;r=ap(this,g,e,n,c,h,d,T,R,U),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),x=Math.min(l.count,m.start+m.count);for(let _=v,g=x;_<g;_+=3){const b=_,E=_+1,S=_+2;r=ap(this,a,e,n,c,h,d,b,E,S),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}}}function LL(i,e,t,n,r,s,a,o){let l;if(e.side===Fi?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===ya,o),l===null)return null;sp.copy(o),sp.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(sp);return c<t.near||c>t.far?null:{distance:c,point:sp.clone(),object:i}}function ap(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,tp),i.getVertexPosition(l,np),i.getVertexPosition(c,ip);const h=LL(i,e,t,n,tp,np,ip,fE);if(h){const d=new j;Ji.getBarycoord(fE,tp,np,ip,d),r&&(h.uv=Ji.getInterpolatedAttribute(r,o,l,c,d,new ke)),s&&(h.uv1=Ji.getInterpolatedAttribute(s,o,l,c,d,new ke)),a&&(h.normal=Ji.getInterpolatedAttribute(a,o,l,c,d,new j),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new j,materialIndex:0};Ji.getNormal(tp,np,ip,p.normal),h.face=p,h.barycoord=d}return h}class go extends Rt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],d=[];let p=0,m=0;v("z","y","x",-1,-1,n,t,e,a,s,0),v("z","y","x",1,-1,n,t,-e,a,s,1),v("x","z","y",1,1,e,n,t,r,a,2),v("x","z","y",1,-1,e,n,-t,r,a,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new ft(c,3)),this.setAttribute("normal",new ft(h,3)),this.setAttribute("uv",new ft(d,2));function v(x,_,g,b,E,S,w,T,R,U,A){const D=S/R,L=w/U,P=S/2,I=w/2,V=T/2,H=R+1,z=U+1;let O=0,B=0;const G=new j;for(let X=0;X<z;X++){const k=X*L-I;for(let Y=0;Y<H;Y++){const Q=Y*D-P;G[x]=Q*b,G[_]=k*E,G[g]=V,c.push(G.x,G.y,G.z),G[x]=0,G[_]=0,G[g]=T>0?1:-1,h.push(G.x,G.y,G.z),d.push(Y/R),d.push(1-X/U),O+=1}}for(let X=0;X<U;X++)for(let k=0;k<R;k++){const Y=p+k+H*X,Q=p+k+H*(X+1),te=p+(k+1)+H*(X+1),ee=p+(k+1)+H*X;l.push(Y,Q,ee),l.push(Q,te,ee),B+=6}o.addGroup(m,B,A),m+=B,p+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new go(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function mu(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Ni(i){const e={};for(let t=0;t<i.length;t++){const n=mu(i[t]);for(const r in n)e[r]=n[r]}return e}function IL(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function h2(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Gt.workingColorSpace}const $x={clone:mu,merge:Ni};var NL=`void main() {
|
|
14
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
15
3
|
}`,PL=`void main() {
|
|
16
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -49,11 +37,7 @@ import{aN as gA,aO as PU,au as po,aP as zU,aQ as nf,r as K,j as he,aR as FU,aS a
|
|
|
49
37
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
50
38
|
|
|
51
39
|
}
|
|
52
|
-
`},r=new go(5,5,5),s=new Hr({name:"CubemapFromEquirect",uniforms:mu(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Fi,blending:pa});s.uniforms.tEquirect.value=t;const a=new mn(r,s),o=t.minFilter;return t.minFilter===Ms&&(t.minFilter=Fn),new f2(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class eu extends Xt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zL={type:"move"};class am{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new eu,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new eu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new eu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const x of e.hand.values()){const _=t.getJointPose(x,n),g=this._getHandJoint(c,x);_!==null&&(g.matrix.fromArray(_.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=_.radius),g.visible=_!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],p=h.position.distanceTo(d.position),m=.02,v=.005;c.inputState.pinching&&p>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zL)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new eu;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Bg{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ye(e),this.density=t}clone(){return new Bg(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class kg{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ye(e),this.near=t,this.far=n}clone(){return new kg(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Gg extends Xt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Bi,this.environmentIntensity=1,this.environmentRotation=new Bi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Hg{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Af,this.updateRanges=[],this.version=0,this.uuid=_r()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_r()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_r()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ii=new j;class Tl{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.applyMatrix4(e),this.setXYZ(t,Ii.x,Ii.y,Ii.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.applyNormalMatrix(e),this.setXYZ(t,Ii.x,Ii.y,Ii.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.transformDirection(e),this.setXYZ(t,Ii.x,Ii.y,Ii.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Pi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ot(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Pi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Pi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Pi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Pi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new $t(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Tl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class e1 extends Ui{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Cc;const vh=new j,Rc=new j,Dc=new j,Uc=new ke,yh=new ke,p2=new bt,op=new j,_h=new j,lp=new j,mE=new ke,ly=new ke,gE=new ke;class m2 extends Xt{constructor(e=new e1){if(super(),this.isSprite=!0,this.type="Sprite",Cc===void 0){Cc=new Rt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Hg(t,5);Cc.setIndex([0,1,2,0,2,3]),Cc.setAttribute("position",new Tl(n,3,0,!1)),Cc.setAttribute("uv",new Tl(n,2,3,!1))}this.geometry=Cc,this.material=e,this.center=new ke(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Rc.setFromMatrixScale(this.matrixWorld),p2.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Dc.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Rc.multiplyScalar(-Dc.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;cp(op.set(-.5,-.5,0),Dc,a,Rc,r,s),cp(_h.set(.5,-.5,0),Dc,a,Rc,r,s),cp(lp.set(.5,.5,0),Dc,a,Rc,r,s),mE.set(0,0),ly.set(1,0),gE.set(1,1);let o=e.ray.intersectTriangle(op,_h,lp,!1,vh);if(o===null&&(cp(_h.set(-.5,.5,0),Dc,a,Rc,r,s),ly.set(0,1),o=e.ray.intersectTriangle(op,lp,_h,!1,vh),o===null))return;const l=e.ray.origin.distanceTo(vh);l<e.near||l>e.far||t.push({distance:l,point:vh.clone(),uv:Ji.getInterpolation(vh,op,_h,lp,mE,ly,gE,new ke),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function cp(i,e,t,n,r,s){Uc.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(yh.x=s*Uc.x-r*Uc.y,yh.y=r*Uc.x+s*Uc.y):yh.copy(Uc),i.copy(e),i.x+=yh.x,i.y+=yh.y,i.applyMatrix4(p2)}const up=new j,vE=new j;class g2 extends Xt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,r=t.length;n<r;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const r=t.splice(n,1);return this.remove(r[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){up.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(up);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){up.setFromMatrixPosition(e.matrixWorld),vE.setFromMatrixPosition(this.matrixWorld);const n=up.distanceTo(vE)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let a=t[r].distance;if(t[r].object.visible&&(a-=a*t[r].hysteresis),n>=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let r=0,s=n.length;r<s;r++){const a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const yE=new j,_E=new Bt,xE=new Bt,FL=new j,bE=new bt,hp=new j,cy=new ri,SE=new bt,uy=new Au;class v2 extends mn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=j_,this.bindMatrix=new bt,this.bindMatrixInverse=new bt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Qn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,hp),this.boundingBox.expandByPoint(hp)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ri),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,hp),this.boundingSphere.expandByPoint(hp)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),cy.copy(this.boundingSphere),cy.applyMatrix4(r),e.ray.intersectsSphere(cy)!==!1&&(SE.copy(r).invert(),uy.copy(e.ray).applyMatrix4(SE),!(this.boundingBox!==null&&uy.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,uy)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Bt,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===j_?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===YA?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;_E.fromBufferAttribute(r.attributes.skinIndex,e),xE.fromBufferAttribute(r.attributes.skinWeight,e),yE.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=xE.getComponent(s);if(a!==0){const o=_E.getComponent(s);bE.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(FL.copy(yE).applyMatrix4(bE),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class t1 extends Xt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class As extends Dn{constructor(e=null,t=1,n=1,r,s,a,o,l,c=vi,h=vi,d,p){super(null,a,o,l,c,h,r,s,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const EE=new bt,BL=new bt;class Vg{constructor(e=[],t=[]){this.uuid=_r(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new bt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new bt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:BL;EE.multiplyMatrices(o,t[s]),EE.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Vg(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new As(t,e,e,Di,Qi);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new t1),this.bones.push(a),this.boneInverses.push(new bt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class Al extends $t{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Oc=new bt,ME=new bt,fp=[],wE=new Qn,kL=new bt,xh=new mn,bh=new ri;class y2 extends mn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Al(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,kL)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Qn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Oc),wE.copy(e.boundingBox).applyMatrix4(Oc),this.boundingBox.union(wE)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ri),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Oc),bh.copy(e.boundingSphere).applyMatrix4(Oc),this.boundingSphere.union(bh)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(xh.geometry=this.geometry,xh.material=this.material,xh.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),bh.copy(this.boundingSphere),bh.applyMatrix4(n),e.ray.intersectsSphere(bh)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Oc),ME.multiplyMatrices(n,Oc),xh.matrixWorld=ME,xh.raycast(e,fp);for(let a=0,o=fp.length;a<o;a++){const l=fp[a];l.instanceId=s,l.object=this,t.push(l)}fp.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Al(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new As(new Float32Array(r*this.count),r,this.count,Og,Qi));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*e;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const hy=new j,GL=new j,HL=new At;class ua{constructor(e=new j(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=hy.subVectors(n,t).cross(GL.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(hy),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||HL.getNormalMatrix(e),r=this.coplanarPoint(hy).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Zo=new ri,VL=new ke(.5,.5),dp=new j;class Ll{constructor(e=new ua,t=new ua,n=new ua,r=new ua,s=new ua,a=new ua){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=yr,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],d=s[5],p=s[6],m=s[7],v=s[8],x=s[9],_=s[10],g=s[11],b=s[12],E=s[13],S=s[14],w=s[15];if(r[0].setComponents(c-a,m-h,g-v,w-b).normalize(),r[1].setComponents(c+a,m+h,g+v,w+b).normalize(),r[2].setComponents(c+o,m+d,g+x,w+E).normalize(),r[3].setComponents(c-o,m-d,g-x,w-E).normalize(),n)r[4].setComponents(l,p,_,S).normalize(),r[5].setComponents(c-l,m-p,g-_,w-S).normalize();else if(r[4].setComponents(c-l,m-p,g-_,w-S).normalize(),t===yr)r[5].setComponents(c+l,m+p,g+_,w+S).normalize();else if(t===fu)r[5].setComponents(l,p,_,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Zo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Zo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Zo)}intersectsSprite(e){Zo.center.set(0,0,0);const t=VL.distanceTo(e.center);return Zo.radius=.7071067811865476+t,Zo.applyMatrix4(e.matrixWorld),this.intersectsSphere(Zo)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(dp.x=r.normal.x>0?e.max.x:e.min.x,dp.y=r.normal.y>0?e.max.y:e.min.y,dp.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dp)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const gs=new bt,vs=new Ll;class Wg{constructor(){this.coordinateSystem=yr}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.containsPoint(e))return!0}return!1}clone(){return new Wg}}function fy(i,e){return i-e}function WL(i,e){return i.z-e.z}function XL(i,e){return e.z-i.z}class jL{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const qi=new bt,qL=new Ye(1,1,1),TE=new Ll,YL=new Wg,pp=new Qn,Ko=new ri,Sh=new j,AE=new j,ZL=new j,dy=new jL,Ci=new mn,mp=[];function KL(i,e,t=0){const n=e.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==e.array.constructor){const r=i.count;for(let s=0;s<r;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,i.getComponent(s,a))}else e.array.set(i.array,t*n);e.needsUpdate=!0}function Jo(i,e){if(i.constructor!==e.constructor){const t=Math.min(i.length,e.length);for(let n=0;n<t;n++)e[n]=i[n]}else{const t=Math.min(i.length,e.length);e.set(new i.constructor(i.buffer,0,t))}}class _2 extends mn{constructor(e,t,n=t*2,r){super(new Rt,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new As(t,e,e,Di,Qi);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new As(t,e,e,Jf,xa);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new As(t,e,e,Di,Qi);n.colorSpace=Gt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),d=new $t(h,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new $t(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const r=e.getAttribute(n),s=t.getAttribute(n);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,qi),this.getBoundingBoxAt(s,pp).applyMatrix4(qi),e.union(pp)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ri);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,qi),this.getBoundingSphereAt(s,Ko).applyMatrix4(qi),e.union(Ko)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(fy),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=n):(r=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;qi.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(qL.toArray(a.image.data,r*4),a.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(fy),l=this._availableGeometryIds.shift(),s[l]=r):(l=this._geometryCount,this._geometryCount++,s.push(r)),this.setGeometryAt(l,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,r=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const h in n.attributes){const d=t.getAttribute(h),p=n.getAttribute(h);KL(d,p,l);const m=d.itemSize;for(let v=d.count,x=c;v<x;v++){const _=l+v;for(let g=0;g<m;g++)p.setComponent(_,g,0)}p.needsUpdate=!0,p.addUpdateRange(l*m,c*m)}if(r){const h=o.indexStart,d=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let p=0;p<a.count;p++)s.setX(h+p,l+a.getX(p));for(let p=a.count,m=d;p<m;p++)s.setX(h+p,l);s.needsUpdate=!0,s.addUpdateRange(h,o.reservedIndexCount)}return o.start=r?o.indexStart:o.vertexStart,o.count=r?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let r=0,s=n.length;r<s;r++)n[r].active&&n[r].geometryIndex===e&&this.deleteInstance(r);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,r=n.map((a,o)=>o).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),s=this.geometry;for(let a=0,o=n.length;a<o;a++){const l=r[a],c=n[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:h,vertexStart:d,reservedIndexCount:p}=c,m=s.index,v=m.array,x=e-d;for(let _=h;_<h+p;_++)v[_]=v[_]+x;m.array.copyWithin(t,h,h+p),m.addUpdateRange(t,p),c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:h,reservedVertexCount:d}=c,p=s.attributes;for(const m in p){const v=p[m],{array:x,itemSize:_}=v;x.copyWithin(e*_,h*_,(h+d)*_),v.addUpdateRange(e*_,d*_)}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new Qn,a=n.index,o=n.attributes.position;for(let l=r.start,c=r.start+r.count;l<c;l++){let h=l;a&&(h=a.getX(h)),s.expandByPoint(Sh.fromBufferAttribute(o,h))}r.boundingBox=s}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new ri;this.getBoundingBoxAt(e,pp),pp.getCenter(s.center);const a=n.index,o=n.attributes.position;let l=0;for(let c=r.start,h=r.start+r.count;c<h;c++){let d=c;a&&(d=a.getX(d)),Sh.fromBufferAttribute(o,d),l=Math.max(l,s.center.distanceToSquared(Sh))}s.radius=Math.sqrt(l),r.boundingSphere=s}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(fy);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const r=new Int32Array(e),s=new Int32Array(e);Jo(this._multiDrawCounts,r),Jo(this._multiDrawStarts,s),this._multiDrawCounts=r,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),Jo(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Jo(o.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),Jo(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Rt,this._initializeGeometry(s));const a=this.geometry;s.index&&Jo(s.index.array,a.index.array);for(const o in s.attributes)Jo(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,a=this.geometry;Ci.material=this.material,Ci.geometry.index=a.index,Ci.geometry.attributes=a.attributes,Ci.geometry.boundingBox===null&&(Ci.geometry.boundingBox=new Qn),Ci.geometry.boundingSphere===null&&(Ci.geometry.boundingSphere=new ri);for(let o=0,l=n.length;o<l;o++){if(!n[o].visible||!n[o].active)continue;const c=n[o].geometryIndex,h=r[c];Ci.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,Ci.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Ci.geometry.boundingBox),this.getBoundingSphereAt(c,Ci.geometry.boundingSphere),Ci.raycast(e,mp);for(let d=0,p=mp.length;d<p;d++){const m=mp[d];m.object=this,m.batchId=o,t.push(m)}mp.length=0}Ci.material=null,Ci.geometry.index=null,Ci.geometry.attributes={},Ci.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=r.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,d=this._geometryInfo,p=this.perObjectFrustumCulled,m=this._indirectTexture,v=m.image.data,x=n.isArrayCamera?YL:TE;p&&!n.isArrayCamera&&(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),TE.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth));let _=0;if(this.sortObjects){qi.copy(this.matrixWorld).invert(),Sh.setFromMatrixPosition(n.matrixWorld).applyMatrix4(qi),AE.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(qi);for(let E=0,S=l.length;E<S;E++)if(l[E].visible&&l[E].active){const w=l[E].geometryIndex;this.getMatrixAt(E,qi),this.getBoundingSphereAt(w,Ko).applyMatrix4(qi);let T=!1;if(p&&(T=!x.intersectsSphere(Ko,n)),!T){const R=d[w],U=ZL.subVectors(Ko.center,Sh).dot(AE);dy.push(R.start,R.count,U,E)}}const g=dy.list,b=this.customSort;b===null?g.sort(s.transparent?XL:WL):b.call(this,g,n);for(let E=0,S=g.length;E<S;E++){const w=g[E];c[_]=w.start*o,h[_]=w.count,v[_]=w.index,_++}dy.reset()}else for(let g=0,b=l.length;g<b;g++)if(l[g].visible&&l[g].active){const E=l[g].geometryIndex;let S=!1;if(p&&(this.getMatrixAt(g,qi),this.getBoundingSphereAt(E,Ko).applyMatrix4(qi),S=!x.intersectsSphere(Ko,n)),!S){const w=d[E];c[_]=w.start*o,h[_]=w.count,v[_]=g,_++}}m.needsUpdate=!0,this._multiDrawCount=_,this._visibilityChanged=!1}onBeforeShadow(e,t,n,r,s,a){this.onBeforeRender(e,null,r,s,a)}}class ki extends Ui{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ng=new j,ig=new j,CE=new bt,Eh=new Au,gp=new ri,py=new j,RE=new j;let ho=class extends Xt{constructor(e=new Rt,t=new ki){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)ng.fromBufferAttribute(t,r-1),ig.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ng.distanceTo(ig);e.setAttribute("lineDistance",new ft(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gp.copy(n.boundingSphere),gp.applyMatrix4(r),gp.radius+=s,e.ray.intersectsSphere(gp)===!1)return;CE.copy(r).invert(),Eh.copy(e.ray).applyMatrix4(CE);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,p=n.attributes.position;if(h!==null){const m=Math.max(0,a.start),v=Math.min(h.count,a.start+a.count);for(let x=m,_=v-1;x<_;x+=c){const g=h.getX(x),b=h.getX(x+1),E=vp(this,e,Eh,l,g,b,x);E&&t.push(E)}if(this.isLineLoop){const x=h.getX(v-1),_=h.getX(m),g=vp(this,e,Eh,l,x,_,v-1);g&&t.push(g)}}else{const m=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count);for(let x=m,_=v-1;x<_;x+=c){const g=vp(this,e,Eh,l,x,x+1,x);g&&t.push(g)}if(this.isLineLoop){const x=vp(this,e,Eh,l,v-1,m,v-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};function vp(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(ng.fromBufferAttribute(o,r),ig.fromBufferAttribute(o,s),t.distanceSqToSegment(ng,ig,py,RE)>n)return;py.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(py);if(!(c<e.near||c>e.far))return{distance:c,point:RE.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const DE=new j,UE=new j;class Us extends ho{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)DE.fromBufferAttribute(t,r),UE.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+DE.distanceTo(UE);e.setAttribute("lineDistance",new ft(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class x2 extends ho{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class n1 extends Ui{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const OE=new bt,Z_=new Au,yp=new ri,_p=new j;class b2 extends Xt{constructor(e=new Rt,t=new n1){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),yp.copy(n.boundingSphere),yp.applyMatrix4(r),yp.radius+=s,e.ray.intersectsSphere(yp)===!1)return;OE.copy(r).invert(),Z_.copy(e.ray).applyMatrix4(OE);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const p=Math.max(0,a.start),m=Math.min(c.count,a.start+a.count);for(let v=p,x=m;v<x;v++){const _=c.getX(v);_p.fromBufferAttribute(d,_),LE(_p,_,l,r,e,t,this)}}else{const p=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let v=p,x=m;v<x;v++)_p.fromBufferAttribute(d,v),LE(_p,v,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function LE(i,e,t,n,r,s,a){const o=Z_.distanceSqToPoint(i);if(o<t){const l=new j;Z_.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class S2 extends Dn{constructor(e,t,n,r,s=Fn,a=Fn,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function d(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class JL extends S2{constructor(e,t,n,r,s,a,o,l){super({},e,t,n,r,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class QL extends Dn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=vi,this.minFilter=vi,this.generateMipmaps=!1,this.needsUpdate=!0}}class Xg extends Dn{constructor(e,t,n,r,s,a,o,l,c,h,d,p){super(null,a,o,l,c,h,r,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class $L extends Xg{constructor(e,t,n,r,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Fr,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class eI extends Xg{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,_a),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class tI extends Dn{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class i1 extends Dn{constructor(e,t,n=xa,r,s,a,o=vi,l=vi,c,h=uu,d=1){if(h!==uu&&h!==hu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:t,depth:d};super(p,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ro(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class r1 extends Dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class jg extends Rt{constructor(e=1,t=1,n=4,r=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),s=Math.max(1,Math.floor(s));const a=[],o=[],l=[],c=[],h=t/2,d=Math.PI/2*e,p=t,m=2*d+p,v=n*2+s,x=r+1,_=new j,g=new j;for(let b=0;b<=v;b++){let E=0,S=0,w=0,T=0;if(b<=n){const A=b/n,D=A*Math.PI/2;S=-h-e*Math.cos(D),w=e*Math.sin(D),T=-e*Math.cos(D),E=A*d}else if(b<=n+s){const A=(b-n)/s;S=-h+A*t,w=e,T=0,E=d+A*p}else{const A=(b-n-s)/n,D=A*Math.PI/2;S=h+e*Math.sin(D),w=e*Math.cos(D),T=e*Math.sin(D),E=d+p+A*d}const R=Math.max(0,Math.min(1,E/m));let U=0;b===0?U=.5/r:b===v&&(U=-.5/r);for(let A=0;A<=r;A++){const D=A/r,L=D*Math.PI*2,P=Math.sin(L),I=Math.cos(L);g.x=-w*I,g.y=S,g.z=w*P,o.push(g.x,g.y,g.z),_.set(-w*I,T,w*P),_.normalize(),l.push(_.x,_.y,_.z),c.push(D+U,R)}if(b>0){const A=(b-1)*x;for(let D=0;D<r;D++){const L=A+D,P=A+D+1,I=b*x+D,V=b*x+D+1;a.push(L,P,I),a.push(P,V,I)}}}this.setIndex(a),this.setAttribute("position",new ft(o,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jg(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class qg extends Rt{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new j,h=new ke;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const m=n+d/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[p]/e+1)/2,h.y=(a[p+1]/e+1)/2,l.push(h.x,h.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new ft(a,3)),this.setAttribute("normal",new ft(o,3)),this.setAttribute("uv",new ft(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qg(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Cu extends Rt{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const h=[],d=[],p=[],m=[];let v=0;const x=[],_=n/2;let g=0;b(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(h),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(p,3)),this.setAttribute("uv",new ft(m,2));function b(){const S=new j,w=new j;let T=0;const R=(t-e)/n;for(let U=0;U<=s;U++){const A=[],D=U/s,L=D*(t-e)+e;for(let P=0;P<=r;P++){const I=P/r,V=I*l+o,H=Math.sin(V),z=Math.cos(V);w.x=L*H,w.y=-D*n+_,w.z=L*z,d.push(w.x,w.y,w.z),S.set(H,R,z).normalize(),p.push(S.x,S.y,S.z),m.push(I,1-D),A.push(v++)}x.push(A)}for(let U=0;U<r;U++)for(let A=0;A<s;A++){const D=x[A][U],L=x[A+1][U],P=x[A+1][U+1],I=x[A][U+1];(e>0||A!==0)&&(h.push(D,L,I),T+=3),(t>0||A!==s-1)&&(h.push(L,P,I),T+=3)}c.addGroup(g,T,0),g+=T}function E(S){const w=v,T=new ke,R=new j;let U=0;const A=S===!0?e:t,D=S===!0?1:-1;for(let P=1;P<=r;P++)d.push(0,_*D,0),p.push(0,D,0),m.push(.5,.5),v++;const L=v;for(let P=0;P<=r;P++){const V=P/r*l+o,H=Math.cos(V),z=Math.sin(V);R.x=A*z,R.y=_*D,R.z=A*H,d.push(R.x,R.y,R.z),p.push(0,D,0),T.x=H*.5+.5,T.y=z*.5*D+.5,m.push(T.x,T.y),v++}for(let P=0;P<r;P++){const I=w+P,V=L+P;S===!0?h.push(V,V+1,I):h.push(V+1,V,I),U+=3}c.addGroup(g,U,S===!0?1:2),g+=U}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class $f extends Cu{constructor(e=1,t=1,n=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new $f(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vo extends Rt{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const s=[],a=[];o(r),c(n),h(),this.setAttribute("position",new ft(s,3)),this.setAttribute("normal",new ft(s.slice(),3)),this.setAttribute("uv",new ft(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(b){const E=new j,S=new j,w=new j;for(let T=0;T<t.length;T+=3)m(t[T+0],E),m(t[T+1],S),m(t[T+2],w),l(E,S,w,b)}function l(b,E,S,w){const T=w+1,R=[];for(let U=0;U<=T;U++){R[U]=[];const A=b.clone().lerp(S,U/T),D=E.clone().lerp(S,U/T),L=T-U;for(let P=0;P<=L;P++)P===0&&U===T?R[U][P]=A:R[U][P]=A.clone().lerp(D,P/L)}for(let U=0;U<T;U++)for(let A=0;A<2*(T-U)-1;A++){const D=Math.floor(A/2);A%2===0?(p(R[U][D+1]),p(R[U+1][D]),p(R[U][D])):(p(R[U][D+1]),p(R[U+1][D+1]),p(R[U+1][D]))}}function c(b){const E=new j;for(let S=0;S<s.length;S+=3)E.x=s[S+0],E.y=s[S+1],E.z=s[S+2],E.normalize().multiplyScalar(b),s[S+0]=E.x,s[S+1]=E.y,s[S+2]=E.z}function h(){const b=new j;for(let E=0;E<s.length;E+=3){b.x=s[E+0],b.y=s[E+1],b.z=s[E+2];const S=_(b)/2/Math.PI+.5,w=g(b)/Math.PI+.5;a.push(S,1-w)}v(),d()}function d(){for(let b=0;b<a.length;b+=6){const E=a[b+0],S=a[b+2],w=a[b+4],T=Math.max(E,S,w),R=Math.min(E,S,w);T>.9&&R<.1&&(E<.2&&(a[b+0]+=1),S<.2&&(a[b+2]+=1),w<.2&&(a[b+4]+=1))}}function p(b){s.push(b.x,b.y,b.z)}function m(b,E){const S=b*3;E.x=e[S+0],E.y=e[S+1],E.z=e[S+2]}function v(){const b=new j,E=new j,S=new j,w=new j,T=new ke,R=new ke,U=new ke;for(let A=0,D=0;A<s.length;A+=9,D+=6){b.set(s[A+0],s[A+1],s[A+2]),E.set(s[A+3],s[A+4],s[A+5]),S.set(s[A+6],s[A+7],s[A+8]),T.set(a[D+0],a[D+1]),R.set(a[D+2],a[D+3]),U.set(a[D+4],a[D+5]),w.copy(b).add(E).add(S).divideScalar(3);const L=_(w);x(T,D+0,b,L),x(R,D+2,E,L),x(U,D+4,S,L)}}function x(b,E,S,w){w<0&&b.x===1&&(a[E]=b.x-1),S.x===0&&S.z===0&&(a[E]=w/2/Math.PI+.5)}function _(b){return Math.atan2(b.z,-b.x)}function g(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vo(e.vertices,e.indices,e.radius,e.details)}}class Yg extends vo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Yg(e.radius,e.detail)}}const xp=new j,bp=new j,my=new j,Sp=new Ji;class E2 extends Rt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(bl*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),p={},m=[];for(let v=0;v<l;v+=3){a?(c[0]=a.getX(v),c[1]=a.getX(v+1),c[2]=a.getX(v+2)):(c[0]=v,c[1]=v+1,c[2]=v+2);const{a:x,b:_,c:g}=Sp;if(x.fromBufferAttribute(o,c[0]),_.fromBufferAttribute(o,c[1]),g.fromBufferAttribute(o,c[2]),Sp.getNormal(my),d[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,d[1]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let b=0;b<3;b++){const E=(b+1)%3,S=d[b],w=d[E],T=Sp[h[b]],R=Sp[h[E]],U=`${S}_${w}`,A=`${w}_${S}`;A in p&&p[A]?(my.dot(p[A].normal)<=s&&(m.push(T.x,T.y,T.z),m.push(R.x,R.y,R.z)),p[A]=null):U in p||(p[U]={index0:c[b],index1:c[E],normal:my.clone()})}}for(const v in p)if(p[v]){const{index0:x,index1:_}=p[v];xp.fromBufferAttribute(o,x),bp.fromBufferAttribute(o,_),m.push(xp.x,xp.y,xp.z),m.push(bp.x,bp.y,bp.z)}this.setAttribute("position",new ft(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class us{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const h=n[r],p=n[r+1]-h,m=(a-h)/p;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ke:new j);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new j,r=[],s=[],a=[],o=new j,l=new bt;for(let m=0;m<=e;m++){const v=m/e;r[m]=this.getTangentAt(v,new j)}s[0]=new j,a[0]=new j;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),a[m]=a[m-1].clone(),o.crossVectors(r[m-1],r[m]),o.length()>Number.EPSILON){o.normalize();const v=Math.acos(St(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(o,v))}a[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(St(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],m*v)),a[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Zg extends us{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new ke){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=l-this.aX,m=c-this.aY;l=p*h-m*d+this.aX,c=p*d+m*h+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class M2 extends Zg{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function s1(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let p=(a-s)/c-(o-s)/(c+h)+(o-a)/h,m=(o-a)/h-(l-a)/(h+d)+(l-o)/d;p*=h,m*=h,r(a,o,p,m)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const Ep=new j,gy=new s1,vy=new s1,yy=new s1;class Kg extends us{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new j){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=r[(o-1)%s]:(Ep.subVectors(r[0],r[1]).add(r[0]),c=Ep);const d=r[o%s],p=r[(o+1)%s];if(this.closed||o+2<s?h=r[(o+2)%s]:(Ep.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=Ep),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let v=Math.pow(c.distanceToSquared(d),m),x=Math.pow(d.distanceToSquared(p),m),_=Math.pow(p.distanceToSquared(h),m);x<1e-4&&(x=1),v<1e-4&&(v=x),_<1e-4&&(_=x),gy.initNonuniformCatmullRom(c.x,d.x,p.x,h.x,v,x,_),vy.initNonuniformCatmullRom(c.y,d.y,p.y,h.y,v,x,_),yy.initNonuniformCatmullRom(c.z,d.z,p.z,h.z,v,x,_)}else this.curveType==="catmullrom"&&(gy.initCatmullRom(c.x,d.x,p.x,h.x,this.tension),vy.initCatmullRom(c.y,d.y,p.y,h.y,this.tension),yy.initCatmullRom(c.z,d.z,p.z,h.z,this.tension));return n.set(gy.calc(l),vy.calc(l),yy.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new j().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function IE(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function nI(i,e){const t=1-i;return t*t*e}function iI(i,e){return 2*(1-i)*i*e}function rI(i,e){return i*i*e}function hf(i,e,t,n){return nI(i,e)+iI(i,t)+rI(i,n)}function sI(i,e){const t=1-i;return t*t*t*e}function aI(i,e){const t=1-i;return 3*t*t*i*e}function oI(i,e){return 3*(1-i)*i*i*e}function lI(i,e){return i*i*i*e}function ff(i,e,t,n,r){return sI(i,e)+aI(i,t)+oI(i,n)+lI(i,r)}class a1 extends us{constructor(e=new ke,t=new ke,n=new ke,r=new ke){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ke){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(ff(e,r.x,s.x,a.x,o.x),ff(e,r.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class w2 extends us{constructor(e=new j,t=new j,n=new j,r=new j){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new j){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(ff(e,r.x,s.x,a.x,o.x),ff(e,r.y,s.y,a.y,o.y),ff(e,r.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class o1 extends us{constructor(e=new ke,t=new ke){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ke){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ke){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class l1 extends us{constructor(e=new j,t=new j){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new j){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new j){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class c1 extends us{constructor(e=new ke,t=new ke,n=new ke){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ke){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(hf(e,r.x,s.x,a.x),hf(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Jg extends us{constructor(e=new j,t=new j,n=new j){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new j){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(hf(e,r.x,s.x,a.x),hf(e,r.y,s.y,a.y),hf(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class u1 extends us{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ke){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],h=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(IE(o,l.x,c.x,h.x,d.x),IE(o,l.y,c.y,h.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ke().fromArray(r))}return this}}var rg=Object.freeze({__proto__:null,ArcCurve:M2,CatmullRomCurve3:Kg,CubicBezierCurve:a1,CubicBezierCurve3:w2,EllipseCurve:Zg,LineCurve:o1,LineCurve3:l1,QuadraticBezierCurve:c1,QuadraticBezierCurve3:Jg,SplineCurve:u1});class T2 extends us{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new rg[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const a=r[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const a=s[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(new rg[r.type]().fromJSON(r))}return this}}class sg extends T2{constructor(e){super(),this.type="Path",this.currentPoint=new ke,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new o1(this.currentPoint.clone(),new ke(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const s=new c1(this.currentPoint.clone(),new ke(e,t),new ke(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,a){const o=new a1(this.currentPoint.clone(),new ke(e,t),new ke(n,r),new ke(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new u1(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,r,s,a),this}absarc(e,t,n,r,s,a){return this.absellipse(e,t,n,n,r,s,a),this}ellipse(e,t,n,r,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,r,s,a,o,l),this}absellipse(e,t,n,r,s,a,o,l){const c=new Zg(e,t,n,r,s,a,o,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class oo extends sg{constructor(e){super(e),this.uuid=_r(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(new sg().fromJSON(r))}return this}}function cI(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=A2(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=pI(i,e,s,t)),i.length>80*t){o=1/0,l=1/0;let h=-1/0,d=-1/0;for(let p=t;p<r;p+=t){const m=i[p],v=i[p+1];m<o&&(o=m),v<l&&(l=v),m>h&&(h=m),v>d&&(d=v)}c=Math.max(h-o,d-l),c=c!==0?32767/c:0}return Df(s,a,t,o,l,c,0),a}function A2(i,e,t,n,r){let s;if(r===wI(i,e,t,n)>0)for(let a=e;a<t;a+=n)s=NE(a/n|0,i[a],i[a+1],s);else for(let a=t-n;a>=e;a-=n)s=NE(a/n|0,i[a],i[a+1],s);return s&&gu(s,s.next)&&(Of(s),s=s.next),s}function Cl(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(gu(t,t.next)||Tn(t.prev,t,t.next)===0)){if(Of(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Df(i,e,t,n,r,s,a){if(!i)return;!a&&s&&_I(i,n,r,s);let o=i;for(;i.prev!==i.next;){const l=i.prev,c=i.next;if(s?hI(i,n,r,s):uI(i)){e.push(l.i,i.i,c.i),Of(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=fI(Cl(i),e),Df(i,e,t,n,r,s,2)):a===2&&dI(i,e,t,n,r,s):Df(Cl(i),e,t,n,r,s,1);break}}}function uI(i){const e=i.prev,t=i,n=i.next;if(Tn(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,h=Math.min(r,s,a),d=Math.min(o,l,c),p=Math.max(r,s,a),m=Math.max(o,l,c);let v=n.next;for(;v!==e;){if(v.x>=h&&v.x<=p&&v.y>=d&&v.y<=m&&Zh(r,o,s,l,a,c,v.x,v.y)&&Tn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function hI(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Tn(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,d=s.y,p=a.y,m=Math.min(o,l,c),v=Math.min(h,d,p),x=Math.max(o,l,c),_=Math.max(h,d,p),g=K_(m,v,e,t,n),b=K_(x,_,e,t,n);let E=i.prevZ,S=i.nextZ;for(;E&&E.z>=g&&S&&S.z<=b;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=_&&E!==r&&E!==a&&Zh(o,h,l,d,c,p,E.x,E.y)&&Tn(E.prev,E,E.next)>=0||(E=E.prevZ,S.x>=m&&S.x<=x&&S.y>=v&&S.y<=_&&S!==r&&S!==a&&Zh(o,h,l,d,c,p,S.x,S.y)&&Tn(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;E&&E.z>=g;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=_&&E!==r&&E!==a&&Zh(o,h,l,d,c,p,E.x,E.y)&&Tn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;S&&S.z<=b;){if(S.x>=m&&S.x<=x&&S.y>=v&&S.y<=_&&S!==r&&S!==a&&Zh(o,h,l,d,c,p,S.x,S.y)&&Tn(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function fI(i,e){let t=i;do{const n=t.prev,r=t.next.next;!gu(n,r)&&R2(n,t,t.next,r)&&Uf(n,r)&&Uf(r,n)&&(e.push(n.i,t.i,r.i),Of(t),Of(t.next),t=i=r),t=t.next}while(t!==i);return Cl(t)}function dI(i,e,t,n,r,s){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&SI(a,o)){let l=D2(a,o);a=Cl(a,a.next),l=Cl(l,l.next),Df(a,e,t,n,r,s,0),Df(l,e,t,n,r,s,0);return}o=o.next}a=a.next}while(a!==i)}function pI(i,e,t,n){const r=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,l=s<a-1?e[s+1]*n:i.length,c=A2(i,o,l,n,!1);c===c.next&&(c.steiner=!0),r.push(bI(c))}r.sort(mI);for(let s=0;s<r.length;s++)t=gI(r[s],t);return t}function mI(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function gI(i,e){const t=vI(i,e);if(!t)return e;const n=D2(t,i);return Cl(n,n.next),Cl(t,t.next)}function vI(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,a;if(gu(i,t))return t;do{if(gu(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const d=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s&&(s=d,a=t.x<t.next.x?t:t.next,d===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=l&&n!==t.x&&C2(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){const d=Math.abs(r-t.y)/(n-t.x);Uf(t,i)&&(d<h||d===h&&(t.x>a.x||t.x===a.x&&yI(a,t)))&&(a=t,h=d)}t=t.next}while(t!==o);return a}function yI(i,e){return Tn(i.prev,i,e.prev)<0&&Tn(e.next,i,i.next)<0}function _I(i,e,t,n){let r=i;do r.z===0&&(r.z=K_(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,xI(r)}function xI(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let c=0;c<t&&(o++,a=a.nextZ,!!a);c++);let l=t;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(r=n,n=n.nextZ,o--):(r=a,a=a.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=a}s.nextZ=null,t*=2}while(e>1);return i}function K_(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function bI(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function C2(i,e,t,n,r,s,a,o){return(r-a)*(e-o)>=(i-a)*(s-o)&&(i-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(n-o)}function Zh(i,e,t,n,r,s,a,o){return!(i===a&&e===o)&&C2(i,e,t,n,r,s,a,o)}function SI(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!EI(i,e)&&(Uf(i,e)&&Uf(e,i)&&MI(i,e)&&(Tn(i.prev,i,e.prev)||Tn(i,e.prev,e))||gu(i,e)&&Tn(i.prev,i,i.next)>0&&Tn(e.prev,e,e.next)>0)}function Tn(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function gu(i,e){return i.x===e.x&&i.y===e.y}function R2(i,e,t,n){const r=wp(Tn(i,e,t)),s=wp(Tn(i,e,n)),a=wp(Tn(t,n,i)),o=wp(Tn(t,n,e));return!!(r!==s&&a!==o||r===0&&Mp(i,t,e)||s===0&&Mp(i,n,e)||a===0&&Mp(t,i,n)||o===0&&Mp(t,e,n))}function Mp(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function wp(i){return i>0?1:i<0?-1:0}function EI(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&R2(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Uf(i,e){return Tn(i.prev,i,i.next)<0?Tn(i,e,i.next)>=0&&Tn(i,i.prev,e)>=0:Tn(i,e,i.prev)<0||Tn(i,i.next,e)<0}function MI(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function D2(i,e){const t=J_(i.i,i.x,i.y),n=J_(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function NE(i,e,t,n){const r=J_(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Of(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function J_(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function wI(i,e,t,n){let r=0;for(let s=e,a=t-n;s<t;s+=n)r+=(i[a]-i[s])*(i[s+1]+i[a+1]),a=s;return r}class TI{static triangulate(e,t,n=2){return cI(e,t,n)}}class os{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return os.area(e)<0}static triangulateShape(e,t){const n=[],r=[],s=[];PE(e),zE(n,e);let a=e.length;t.forEach(PE);for(let l=0;l<t.length;l++)r.push(a),a+=t[l].length,zE(n,t[l]);const o=TI.triangulate(n,r);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function PE(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function zE(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class Qg extends Rt{constructor(e=new oo([new ke(.5,.5),new ke(-.5,.5),new ke(-.5,-.5),new ke(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new ft(r,3)),this.setAttribute("uv",new ft(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:m-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,_=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:AI;let E,S=!1,w,T,R,U;g&&(E=g.getSpacedPoints(h),S=!0,p=!1,w=g.computeFrenetFrames(h,!1),T=new j,R=new j,U=new j),p||(_=0,m=0,v=0,x=0);const A=o.extractPoints(c);let D=A.shape;const L=A.holes;if(!os.isClockWise(D)){D=D.reverse();for(let oe=0,se=L.length;oe<se;oe++){const $=L[oe];os.isClockWise($)&&(L[oe]=$.reverse())}}function I(oe){const $=10000000000000001e-36;let pe=oe[0];for(let ye=1;ye<=oe.length;ye++){const xe=ye%oe.length,be=oe[xe],ue=be.x-pe.x,He=be.y-pe.y,W=ue*ue+He*He,F=Math.max(Math.abs(be.x),Math.abs(be.y),Math.abs(pe.x),Math.abs(pe.y)),ne=$*F*F;if(W<=ne){oe.splice(xe,1),ye--;continue}pe=be}}I(D),L.forEach(I);const V=L.length,H=D;for(let oe=0;oe<V;oe++){const se=L[oe];D=D.concat(se)}function z(oe,se,$){return se||console.error("THREE.ExtrudeGeometry: vec does not exist"),oe.clone().addScaledVector(se,$)}const O=D.length;function B(oe,se,$){let pe,ye,xe;const be=oe.x-se.x,ue=oe.y-se.y,He=$.x-oe.x,W=$.y-oe.y,F=be*be+ue*ue,ne=be*W-ue*He;if(Math.abs(ne)>Number.EPSILON){const Se=Math.sqrt(F),_e=Math.sqrt(He*He+W*W),me=se.x-ue/Se,ze=se.y+be/Se,Ne=$.x-W/_e,je=$.y+He/_e,Ze=((Ne-me)*W-(je-ze)*He)/(be*W-ue*He);pe=me+be*Ze-oe.x,ye=ze+ue*Ze-oe.y;const Le=pe*pe+ye*ye;if(Le<=2)return new ke(pe,ye);xe=Math.sqrt(Le/2)}else{let Se=!1;be>Number.EPSILON?He>Number.EPSILON&&(Se=!0):be<-Number.EPSILON?He<-Number.EPSILON&&(Se=!0):Math.sign(ue)===Math.sign(W)&&(Se=!0),Se?(pe=-ue,ye=be,xe=Math.sqrt(F)):(pe=be,ye=ue,xe=Math.sqrt(F/2))}return new ke(pe/xe,ye/xe)}const G=[];for(let oe=0,se=H.length,$=se-1,pe=oe+1;oe<se;oe++,$++,pe++)$===se&&($=0),pe===se&&(pe=0),G[oe]=B(H[oe],H[$],H[pe]);const X=[];let k,Y=G.concat();for(let oe=0,se=V;oe<se;oe++){const $=L[oe];k=[];for(let pe=0,ye=$.length,xe=ye-1,be=pe+1;pe<ye;pe++,xe++,be++)xe===ye&&(xe=0),be===ye&&(be=0),k[pe]=B($[pe],$[xe],$[be]);X.push(k),Y=Y.concat(k)}let Q;if(_===0)Q=os.triangulateShape(H,L);else{const oe=[],se=[];for(let $=0;$<_;$++){const pe=$/_,ye=m*Math.cos(pe*Math.PI/2),xe=v*Math.sin(pe*Math.PI/2)+x;for(let be=0,ue=H.length;be<ue;be++){const He=z(H[be],G[be],xe);Ae(He.x,He.y,-ye),pe===0&&oe.push(He)}for(let be=0,ue=V;be<ue;be++){const He=L[be];k=X[be];const W=[];for(let F=0,ne=He.length;F<ne;F++){const Se=z(He[F],k[F],xe);Ae(Se.x,Se.y,-ye),pe===0&&W.push(Se)}pe===0&&se.push(W)}}Q=os.triangulateShape(oe,se)}const te=Q.length,ee=v+x;for(let oe=0;oe<O;oe++){const se=p?z(D[oe],Y[oe],ee):D[oe];S?(R.copy(w.normals[0]).multiplyScalar(se.x),T.copy(w.binormals[0]).multiplyScalar(se.y),U.copy(E[0]).add(R).add(T),Ae(U.x,U.y,U.z)):Ae(se.x,se.y,0)}for(let oe=1;oe<=h;oe++)for(let se=0;se<O;se++){const $=p?z(D[se],Y[se],ee):D[se];S?(R.copy(w.normals[oe]).multiplyScalar($.x),T.copy(w.binormals[oe]).multiplyScalar($.y),U.copy(E[oe]).add(R).add(T),Ae(U.x,U.y,U.z)):Ae($.x,$.y,d/h*oe)}for(let oe=_-1;oe>=0;oe--){const se=oe/_,$=m*Math.cos(se*Math.PI/2),pe=v*Math.sin(se*Math.PI/2)+x;for(let ye=0,xe=H.length;ye<xe;ye++){const be=z(H[ye],G[ye],pe);Ae(be.x,be.y,d+$)}for(let ye=0,xe=L.length;ye<xe;ye++){const be=L[ye];k=X[ye];for(let ue=0,He=be.length;ue<He;ue++){const W=z(be[ue],k[ue],pe);S?Ae(W.x,W.y+E[h-1].y,E[h-1].x+$):Ae(W.x,W.y,d+$)}}}ie(),re();function ie(){const oe=r.length/3;if(p){let se=0,$=O*se;for(let pe=0;pe<te;pe++){const ye=Q[pe];Me(ye[2]+$,ye[1]+$,ye[0]+$)}se=h+_*2,$=O*se;for(let pe=0;pe<te;pe++){const ye=Q[pe];Me(ye[0]+$,ye[1]+$,ye[2]+$)}}else{for(let se=0;se<te;se++){const $=Q[se];Me($[2],$[1],$[0])}for(let se=0;se<te;se++){const $=Q[se];Me($[0]+O*h,$[1]+O*h,$[2]+O*h)}}n.addGroup(oe,r.length/3-oe,0)}function re(){const oe=r.length/3;let se=0;de(H,se),se+=H.length;for(let $=0,pe=L.length;$<pe;$++){const ye=L[$];de(ye,se),se+=ye.length}n.addGroup(oe,r.length/3-oe,1)}function de(oe,se){let $=oe.length;for(;--$>=0;){const pe=$;let ye=$-1;ye<0&&(ye=oe.length-1);for(let xe=0,be=h+_*2;xe<be;xe++){const ue=O*xe,He=O*(xe+1),W=se+pe+ue,F=se+ye+ue,ne=se+ye+He,Se=se+pe+He;ve(W,F,ne,Se)}}}function Ae(oe,se,$){l.push(oe),l.push(se),l.push($)}function Me(oe,se,$){fe(oe),fe(se),fe($);const pe=r.length/3,ye=b.generateTopUV(n,r,pe-3,pe-2,pe-1);J(ye[0]),J(ye[1]),J(ye[2])}function ve(oe,se,$,pe){fe(oe),fe(se),fe(pe),fe(se),fe($),fe(pe);const ye=r.length/3,xe=b.generateSideWallUV(n,r,ye-6,ye-3,ye-2,ye-1);J(xe[0]),J(xe[1]),J(xe[3]),J(xe[1]),J(xe[2]),J(xe[3])}function fe(oe){r.push(l[oe*3+0]),r.push(l[oe*3+1]),r.push(l[oe*3+2])}function J(oe){s.push(oe.x),s.push(oe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return CI(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new rg[r.type]().fromJSON(r)),new Qg(n,e.options)}}const AI={generateTopUV:function(i,e,t,n,r){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[r*3],h=e[r*3+1];return[new ke(s,a),new ke(o,l),new ke(c,h)]},generateSideWallUV:function(i,e,t,n,r,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],h=e[n*3+1],d=e[n*3+2],p=e[r*3],m=e[r*3+1],v=e[r*3+2],x=e[s*3],_=e[s*3+1],g=e[s*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new ke(a,1-l),new ke(c,1-d),new ke(p,1-v),new ke(x,1-g)]:[new ke(o,1-l),new ke(h,1-d),new ke(m,1-v),new ke(_,1-g)]}};function CI(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class $g extends vo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new $g(e.radius,e.detail)}}class e0 extends Rt{constructor(e=[new ke(0,-.5),new ke(.5,0),new ke(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=St(r,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/t,d=new j,p=new ke,m=new j,v=new j,x=new j;let _=0,g=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:_=e[b+1].x-e[b].x,g=e[b+1].y-e[b].y,m.x=g*1,m.y=-_,m.z=g*0,x.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:_=e[b+1].x-e[b].x,g=e[b+1].y-e[b].y,m.x=g*1,m.y=-_,m.z=g*0,v.copy(m),m.x+=x.x,m.y+=x.y,m.z+=x.z,m.normalize(),l.push(m.x,m.y,m.z),x.copy(v)}for(let b=0;b<=t;b++){const E=n+b*h*r,S=Math.sin(E),w=Math.cos(E);for(let T=0;T<=e.length-1;T++){d.x=e[T].x*S,d.y=e[T].y,d.z=e[T].x*w,a.push(d.x,d.y,d.z),p.x=b/t,p.y=T/(e.length-1),o.push(p.x,p.y);const R=l[3*T+0]*S,U=l[3*T+1],A=l[3*T+0]*w;c.push(R,U,A)}}for(let b=0;b<t;b++)for(let E=0;E<e.length-1;E++){const S=E+b*e.length,w=S,T=S+e.length,R=S+e.length+1,U=S+1;s.push(w,T,U),s.push(R,U,T)}this.setIndex(s),this.setAttribute("position",new ft(a,3)),this.setAttribute("uv",new ft(o,2)),this.setAttribute("normal",new ft(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new e0(e.points,e.segments,e.phiStart,e.phiLength)}}class ed extends vo{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ed(e.radius,e.detail)}}class Ma extends Rt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,d=e/o,p=t/l,m=[],v=[],x=[],_=[];for(let g=0;g<h;g++){const b=g*p-a;for(let E=0;E<c;E++){const S=E*d-s;v.push(S,-b,0),x.push(0,0,1),_.push(E/o),_.push(1-g/l)}}for(let g=0;g<l;g++)for(let b=0;b<o;b++){const E=b+c*g,S=b+c*(g+1),w=b+1+c*(g+1),T=b+1+c*g;m.push(E,S,T),m.push(S,w,T)}this.setIndex(m),this.setAttribute("position",new ft(v,3)),this.setAttribute("normal",new ft(x,3)),this.setAttribute("uv",new ft(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ma(e.width,e.height,e.widthSegments,e.heightSegments)}}class t0 extends Rt{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],h=[];let d=e;const p=(t-e)/r,m=new j,v=new ke;for(let x=0;x<=r;x++){for(let _=0;_<=n;_++){const g=s+_/n*a;m.x=d*Math.cos(g),m.y=d*Math.sin(g),l.push(m.x,m.y,m.z),c.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,h.push(v.x,v.y)}d+=p}for(let x=0;x<r;x++){const _=x*(n+1);for(let g=0;g<n;g++){const b=g+_,E=b,S=b+n+1,w=b+n+2,T=b+1;o.push(E,S,T),o.push(S,w,T)}}this.setIndex(o),this.setAttribute("position",new ft(l,3)),this.setAttribute("normal",new ft(c,3)),this.setAttribute("uv",new ft(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new t0(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class n0 extends Rt{constructor(e=new oo([new ke(0,.5),new ke(-.5,-.5),new ke(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new ft(r,3)),this.setAttribute("normal",new ft(s,3)),this.setAttribute("uv",new ft(a,2));function c(h){const d=r.length/3,p=h.extractPoints(t);let m=p.shape;const v=p.holes;os.isClockWise(m)===!1&&(m=m.reverse());for(let _=0,g=v.length;_<g;_++){const b=v[_];os.isClockWise(b)===!0&&(v[_]=b.reverse())}const x=os.triangulateShape(m,v);for(let _=0,g=v.length;_<g;_++){const b=v[_];m=m.concat(b)}for(let _=0,g=m.length;_<g;_++){const b=m[_];r.push(b.x,b.y,0),s.push(0,0,1),a.push(b.x,b.y)}for(let _=0,g=x.length;_<g;_++){const b=x[_],E=b[0]+d,S=b[1]+d,w=b[2]+d;n.push(E,S,w),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return RI(t,e)}static fromJSON(e,t){const n=[];for(let r=0,s=e.shapes.length;r<s;r++){const a=t[e.shapes[r]];n.push(a)}return new n0(n,e.curveSegments)}}function RI(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const r=i[t];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e}class td extends Rt{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],d=new j,p=new j,m=[],v=[],x=[],_=[];for(let g=0;g<=n;g++){const b=[],E=g/n;let S=0;g===0&&a===0?S=.5/t:g===n&&l===Math.PI&&(S=-.5/t);for(let w=0;w<=t;w++){const T=w/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+E*o),d.y=e*Math.cos(a+E*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+E*o),v.push(d.x,d.y,d.z),p.copy(d).normalize(),x.push(p.x,p.y,p.z),_.push(T+S,1-E),b.push(c++)}h.push(b)}for(let g=0;g<n;g++)for(let b=0;b<t;b++){const E=h[g][b+1],S=h[g][b],w=h[g+1][b],T=h[g+1][b+1];(g!==0||a>0)&&m.push(E,S,T),(g!==n-1||l<Math.PI)&&m.push(S,w,T)}this.setIndex(m),this.setAttribute("position",new ft(v,3)),this.setAttribute("normal",new ft(x,3)),this.setAttribute("uv",new ft(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new td(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class i0 extends vo{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new i0(e.radius,e.detail)}}class r0 extends Rt{constructor(e=1,t=.4,n=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:s},n=Math.floor(n),r=Math.floor(r);const a=[],o=[],l=[],c=[],h=new j,d=new j,p=new j;for(let m=0;m<=n;m++)for(let v=0;v<=r;v++){const x=v/r*s,_=m/n*Math.PI*2;d.x=(e+t*Math.cos(_))*Math.cos(x),d.y=(e+t*Math.cos(_))*Math.sin(x),d.z=t*Math.sin(_),o.push(d.x,d.y,d.z),h.x=e*Math.cos(x),h.y=e*Math.sin(x),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),c.push(v/r),c.push(m/n)}for(let m=1;m<=n;m++)for(let v=1;v<=r;v++){const x=(r+1)*m+v-1,_=(r+1)*(m-1)+v-1,g=(r+1)*(m-1)+v,b=(r+1)*m+v;a.push(x,_,b),a.push(_,g,b)}this.setIndex(a),this.setAttribute("position",new ft(o,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r0(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class s0 extends Rt{constructor(e=1,t=.4,n=64,r=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:s,q:a},n=Math.floor(n),r=Math.floor(r);const o=[],l=[],c=[],h=[],d=new j,p=new j,m=new j,v=new j,x=new j,_=new j,g=new j;for(let E=0;E<=n;++E){const S=E/n*s*Math.PI*2;b(S,s,a,e,m),b(S+.01,s,a,e,v),_.subVectors(v,m),g.addVectors(v,m),x.crossVectors(_,g),g.crossVectors(x,_),x.normalize(),g.normalize();for(let w=0;w<=r;++w){const T=w/r*Math.PI*2,R=-t*Math.cos(T),U=t*Math.sin(T);d.x=m.x+(R*g.x+U*x.x),d.y=m.y+(R*g.y+U*x.y),d.z=m.z+(R*g.z+U*x.z),l.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),c.push(p.x,p.y,p.z),h.push(E/n),h.push(w/r)}}for(let E=1;E<=n;E++)for(let S=1;S<=r;S++){const w=(r+1)*(E-1)+(S-1),T=(r+1)*E+(S-1),R=(r+1)*E+S,U=(r+1)*(E-1)+S;o.push(w,T,U),o.push(T,R,U)}this.setIndex(o),this.setAttribute("position",new ft(l,3)),this.setAttribute("normal",new ft(c,3)),this.setAttribute("uv",new ft(h,2));function b(E,S,w,T,R){const U=Math.cos(E),A=Math.sin(E),D=w/S*E,L=Math.cos(D);R.x=T*(2+L)*.5*U,R.y=T*(2+L)*A*.5,R.z=T*Math.sin(D)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s0(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class fo extends Rt{constructor(e=new Jg(new j(-1,-1,0),new j(-1,1,0),new j(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new j,l=new j,c=new ke;let h=new j;const d=[],p=[],m=[],v=[];x(),this.setIndex(v),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(p,3)),this.setAttribute("uv",new ft(m,2));function x(){for(let E=0;E<t;E++)_(E);_(s===!1?t:0),b(),g()}function _(E){h=e.getPointAt(E/t,h);const S=a.normals[E],w=a.binormals[E];for(let T=0;T<=r;T++){const R=T/r*Math.PI*2,U=Math.sin(R),A=-Math.cos(R);l.x=A*S.x+U*w.x,l.y=A*S.y+U*w.y,l.z=A*S.z+U*w.z,l.normalize(),p.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,d.push(o.x,o.y,o.z)}}function g(){for(let E=1;E<=t;E++)for(let S=1;S<=r;S++){const w=(r+1)*(E-1)+(S-1),T=(r+1)*E+(S-1),R=(r+1)*E+S,U=(r+1)*(E-1)+S;v.push(w,T,U),v.push(T,R,U)}}function b(){for(let E=0;E<=t;E++)for(let S=0;S<=r;S++)c.x=E/t,c.y=S/r,m.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new fo(new rg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class U2 extends Rt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new j,s=new j;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const d=l[c],p=d.start,m=d.count;for(let v=p,x=p+m;v<x;v+=3)for(let _=0;_<3;_++){const g=o.getX(v+_),b=o.getX(v+(_+1)%3);r.fromBufferAttribute(a,g),s.fromBufferAttribute(a,b),FE(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,d=3*o+(c+1)%3;r.fromBufferAttribute(a,h),s.fromBufferAttribute(a,d),FE(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ft(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function FE(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var BE=Object.freeze({__proto__:null,BoxGeometry:go,CapsuleGeometry:jg,CircleGeometry:qg,ConeGeometry:$f,CylinderGeometry:Cu,DodecahedronGeometry:Yg,EdgesGeometry:E2,ExtrudeGeometry:Qg,IcosahedronGeometry:$g,LatheGeometry:e0,OctahedronGeometry:ed,PlaneGeometry:Ma,PolyhedronGeometry:vo,RingGeometry:t0,ShapeGeometry:n0,SphereGeometry:td,TetrahedronGeometry:i0,TorusGeometry:r0,TorusKnotGeometry:s0,TubeGeometry:fo,WireframeGeometry:U2});class O2 extends Ui{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ye(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class L2 extends Hr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class h1 extends Ui{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ye(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class I2 extends h1{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ke(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return St(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ye(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ye(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ye(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class N2 extends Ui{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ye(16777215),this.specular=new Ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class P2 extends Ui{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ye(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class z2 extends Ui{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class F2 extends Ui{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class a0 extends Ui{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=QA,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class o0 extends Ui{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class B2 extends Ui{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ye(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class k2 extends ki{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function vl(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function G2(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function H2(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Q_(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function f1(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}function DI(i,e,t,n,r=30){const s=i.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),d=[],p=[];for(let m=0;m<c.times.length;++m){const v=c.times[m]*r;if(!(v<t||v>=n)){d.push(c.times[m]);for(let x=0;x<h;++x)p.push(c.values[m*h+x])}}d.length!==0&&(c.times=vl(d,c.times.constructor),c.values=vl(p,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function UI(i,e=0,t=i,n=30){n<=0&&(n=30);const r=t.tracks.length,s=e/n;for(let a=0;a<r;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=i.tracks.find(function(g){return g.name===o.name&&g.ValueTypeName===l});if(c===void 0)continue;let h=0;const d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=d/3);let p=0;const m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);const v=o.times.length-1;let x;if(s<=o.times[0]){const g=h,b=d-h;x=o.values.slice(g,b)}else if(s>=o.times[v]){const g=v*d+h,b=g+d-h;x=o.values.slice(g,b)}else{const g=o.createInterpolant(),b=h,E=d-h;g.evaluate(s),x=g.resultBuffer.slice(b,E)}l==="quaternion"&&new yi().fromArray(x).normalize().conjugate().toArray(x);const _=c.times.length;for(let g=0;g<_;++g){const b=g*m+p;if(l==="quaternion")yi.multiplyQuaternionsFlat(c.values,b,x,0,c.values,b);else{const E=m-p*2;for(let S=0;S<E;++S)c.values[b+S]-=x[S]}}}return i.blendMode=jx,i}class OI{static convertArray(e,t){return vl(e,t)}static isTypedArray(e){return G2(e)}static getKeyframeOrder(e){return H2(e)}static sortedArray(e,t,n){return Q_(e,t,n)}static flattenJSON(e,t,n,r){f1(e,t,n,r)}static subclip(e,t,n,r,s=30){return DI(e,t,n,r,s)}static makeClipAdditive(e,t=0,n=e,r=30){return UI(e,t,n,r)}}class nd{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class V2 extends nd{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ml,endingEnd:ml}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case gl:s=e,o=2*t-n;break;case wf:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case gl:a=e,l=2*n-t;break;case wf:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,d=this._offsetNext,p=this._weightPrev,m=this._weightNext,v=(n-t)/(r-t),x=v*v,_=x*v,g=-p*_+2*p*x-p*v,b=(1+p)*_+(-1.5-2*p)*x+(-.5+p)*v+1,E=(-1-m)*_+(1.5+m)*x+.5*v,S=m*_-m*x;for(let w=0;w!==o;++w)s[w]=g*a[h+w]+b*a[c+w]+E*a[l+w]+S*a[d+w];return s}}class d1 extends nd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(r-t),d=1-h;for(let p=0;p!==o;++p)s[p]=a[c+p]*d+a[l+p]*h;return s}}class W2 extends nd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Vr{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=vl(t,this.TimeBufferType),this.values=vl(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:vl(e.times,Array),values:vl(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new W2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new d1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new V2(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Mf:t=this.InterpolantFactoryMethodDiscrete;break;case eg:t=this.InterpolantFactoryMethodLinear;break;case sm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Mf;case this.InterpolantFactoryMethodLinear:return eg;case this.InterpolantFactoryMethodSmooth:return sm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&G2(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===sm,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{const d=o*n,p=d-n,m=d+n;for(let v=0;v!==n;++v){const x=t[d+v];if(x!==t[p+v]||x!==t[m+v]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const d=o*n,p=a*n;for(let m=0;m!==n;++m)t[p+m]=t[d+m]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Vr.prototype.ValueTypeName="";Vr.prototype.TimeBufferType=Float32Array;Vr.prototype.ValueBufferType=Float32Array;Vr.prototype.DefaultInterpolation=eg;class Il extends Vr{constructor(e,t,n){super(e,t,n)}}Il.prototype.ValueTypeName="bool";Il.prototype.ValueBufferType=Array;Il.prototype.DefaultInterpolation=Mf;Il.prototype.InterpolantFactoryMethodLinear=void 0;Il.prototype.InterpolantFactoryMethodSmooth=void 0;class p1 extends Vr{constructor(e,t,n,r){super(e,t,n,r)}}p1.prototype.ValueTypeName="color";class Lf extends Vr{constructor(e,t,n,r){super(e,t,n,r)}}Lf.prototype.ValueTypeName="number";class X2 extends nd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let h=c+o;c!==h;c+=4)yi.slerpFlat(s,0,a,c-o,a,c,l);return s}}class id extends Vr{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new X2(this.times,this.values,this.getValueSize(),e)}}id.prototype.ValueTypeName="quaternion";id.prototype.InterpolantFactoryMethodSmooth=void 0;class Nl extends Vr{constructor(e,t,n){super(e,t,n)}}Nl.prototype.ValueTypeName="string";Nl.prototype.ValueBufferType=Array;Nl.prototype.DefaultInterpolation=Mf;Nl.prototype.InterpolantFactoryMethodLinear=void 0;Nl.prototype.InterpolantFactoryMethodSmooth=void 0;class If extends Vr{constructor(e,t,n,r){super(e,t,n,r)}}If.prototype.ValueTypeName="vector";class Nf{constructor(e="",t=-1,n=[],r=Ng){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=_r(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(II(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(Vr.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=H2(l);l=Q_(l,1,h),c=Q_(c,1,h),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Lf(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(s);if(h&&h.length>1){const d=h[1];let p=r[d];p||(r[d]=p=[]),p.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,p,m,v,x){if(m.length!==0){const _=[],g=[];f1(m,_,g,v),_.length!==0&&x.push(new d(p,_,g))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const p=c[d].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const m={};let v;for(v=0;v<p.length;v++)if(p[v].morphTargets)for(let x=0;x<p[v].morphTargets.length;x++)m[p[v].morphTargets[x]]=-1;for(const x in m){const _=[],g=[];for(let b=0;b!==p[v].morphTargets.length;++b){const E=p[v];_.push(E.time),g.push(E.morphTarget===x?1:0)}r.push(new Lf(".morphTargetInfluence["+x+"]",_,g))}l=m.length*a}else{const m=".bones["+t[d].name+"]";n(If,m+".position",p,"pos",r),n(id,m+".quaternion",p,"rot",r),n(If,m+".scale",p,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function LI(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Lf;case"vector":case"vector2":case"vector3":case"vector4":return If;case"color":return p1;case"quaternion":return id;case"bool":case"boolean":return Il;case"string":return Nl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function II(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=LI(i.type);if(i.times===void 0){const t=[],n=[];f1(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const ws={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class m1{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){const d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,p=c.length;d<p;d+=2){const m=c[d],v=c[d+1];if(m.global&&(m.lastIndex=0),m.test(h))return v}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const j2=new m1;class nr{constructor(e){this.manager=e!==void 0?e:j2,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}nr.DEFAULT_MATERIAL_NAME="__DEFAULT";const ra={};class NI extends Error{constructor(e,t){super(e),this.response=t}}class ba extends nr{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=ws.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(ra[e]!==void 0){ra[e].push({onLoad:t,onProgress:n,onError:r});return}ra[e]=[],ra[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=ra[e],d=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),m=p?parseInt(p):0,v=m!==0;let x=0;const _=new ReadableStream({start(g){b();function b(){d.read().then(({done:E,value:S})=>{if(E)g.close();else{x+=S.byteLength;const w=new ProgressEvent("progress",{lengthComputable:v,loaded:x,total:m});for(let T=0,R=h.length;T<R;T++){const U=h[T];U.onProgress&&U.onProgress(w)}g.enqueue(S),b()}},E=>{g.error(E)})}}});return new Response(_)}else throw new NI(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{ws.add(`file:${e}`,c);const h=ra[e];delete ra[e];for(let d=0,p=h.length;d<p;d++){const m=h[d];m.onLoad&&m.onLoad(c)}}).catch(c=>{const h=ra[e];if(h===void 0)throw this.manager.itemError(e),c;delete ra[e];for(let d=0,p=h.length;d<p;d++){const m=h[d];m.onError&&m.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class PI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new ba(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t=[];for(let n=0;n<e.length;n++){const r=Nf.parse(e[n]);t.push(r)}return t}}class zI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=[],o=new Xg,l=new ba(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(d){l.load(e[d],function(p){const m=s.parse(p,!0);a[d]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},c+=1,c===6&&(m.mipmapCount===1&&(o.minFilter=Fn),o.image=a,o.format=m.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(let d=0,p=e.length;d<p;++d)h(d);else l.load(e,function(d){const p=s.parse(d,!0);if(p.isCubemap){const m=p.mipmaps.length/p.mipmapCount;for(let v=0;v<m;v++){a[v]={mipmaps:[]};for(let x=0;x<p.mipmapCount;x++)a[v].mipmaps.push(p.mipmaps[v*p.mipmapCount+x]),a[v].format=p.format,a[v].width=p.width,a[v].height=p.height}o.image=a}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=Fn),o.format=p.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}const Lc=new WeakMap;class Pf extends nr{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ws.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let d=Lc.get(a);d===void 0&&(d=[],Lc.set(a,d)),d.push({onLoad:t,onError:r})}return a}const o=Cf("img");function l(){h(),t&&t(this);const d=Lc.get(this)||[];for(let p=0;p<d.length;p++){const m=d[p];m.onLoad&&m.onLoad(this)}Lc.delete(this),s.manager.itemEnd(e)}function c(d){h(),r&&r(d),ws.remove(`image:${e}`);const p=Lc.get(this)||[];for(let m=0;m<p.length;m++){const v=p[m];v.onError&&v.onError(d)}Lc.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),ws.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class FI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=new Qf;s.colorSpace=Ri;const a=new Pf(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class BI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new As,o=new ba(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(h){if(r!==void 0)r(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Fr,a.wrapT=c.wrapT!==void 0?c.wrapT:Fr,a.magFilter=c.magFilter!==void 0?c.magFilter:Fn,a.minFilter=c.minFilter!==void 0?c.minFilter:Fn,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Ms),c.mipmapCount===1&&(a.minFilter=Fn),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,r),a}}class q2 extends nr{constructor(e){super(e)}load(e,t,n,r){const s=new Dn,a=new Pf(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class yo extends Xt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Y2 extends yo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Xt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const _y=new bt,kE=new j,GE=new j;class g1{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ke(512,512),this.mapType=Gr,this.map=null,this.mapPass=null,this.matrix=new bt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ll,this._frameExtents=new ke(1,1),this._viewportCount=1,this._viewports=[new Bt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;kE.setFromMatrixPosition(e.matrixWorld),t.position.copy(kE),GE.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(GE),t.updateMatrixWorld(),_y.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_y,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_y)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class kI extends g1{constructor(){super(new Kn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=du*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Z2 extends yo{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Xt.DEFAULT_UP),this.updateMatrix(),this.target=new Xt,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new kI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const HE=new bt,Mh=new j,xy=new j;class GI extends g1{constructor(){super(new Kn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ke(4,2),this._viewportCount=6,this._viewports=[new Bt(2,1,1,1),new Bt(0,1,1,1),new Bt(3,1,1,1),new Bt(1,1,1,1),new Bt(3,0,1,1),new Bt(1,0,1,1)],this._cubeDirections=[new j(1,0,0),new j(-1,0,0),new j(0,0,1),new j(0,0,-1),new j(0,1,0),new j(0,-1,0)],this._cubeUps=[new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,0,1),new j(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Mh.setFromMatrixPosition(e.matrixWorld),n.position.copy(Mh),xy.copy(n.position),xy.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(xy),n.updateMatrixWorld(),r.makeTranslation(-Mh.x,-Mh.y,-Mh.z),HE.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(HE,n.coordinateSystem,n.reversedDepth)}}class K2 extends yo{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new GI}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Pl extends Fg{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class HI extends g1{constructor(){super(new Pl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class J2 extends yo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Xt.DEFAULT_UP),this.updateMatrix(),this.target=new Xt,this.shadow=new HI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Q2 extends yo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class $2 extends yo{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class eC{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new j)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*r)),t.addScaledVector(a[5],1.092548*(r*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}}class tC extends yo{constructor(e=new eC,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class l0 extends nr{constructor(e){super(e),this.textures={}}load(e,t,n,r){const s=this,a=new ba(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new Ye().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=n(a.value);break;case"c":r.uniforms[s].value=new Ye().setHex(a.value);break;case"v2":r.uniforms[s].value=new ke().fromArray(a.value);break;case"v3":r.uniforms[s].value=new j().fromArray(a.value);break;case"v4":r.uniforms[s].value=new Bt().fromArray(a.value);break;case"m3":r.uniforms[s].value=new At().fromArray(a.value);break;case"m4":r.uniforms[s].value=new bt().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new ke().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new ke().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return l0.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:O2,SpriteMaterial:e1,RawShaderMaterial:L2,ShaderMaterial:Hr,PointsMaterial:n1,MeshPhysicalMaterial:I2,MeshStandardMaterial:h1,MeshPhongMaterial:N2,MeshToonMaterial:P2,MeshNormalMaterial:z2,MeshLambertMaterial:F2,MeshDepthMaterial:a0,MeshDistanceMaterial:o0,MeshBasicMaterial:Ea,MeshMatcapMaterial:B2,LineDashedMaterial:k2,LineBasicMaterial:ki,Material:Ui};return new t[e]}}class $_{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class v1 extends Rt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class nC extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new ba(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t={},n={};function r(m,v){if(t[v]!==void 0)return t[v];const _=m.interleavedBuffers[v],g=s(m,_.buffer),b=$c(_.type,g),E=new Hg(b,_.stride);return E.uuid=_.uuid,t[v]=E,E}function s(m,v){if(n[v]!==void 0)return n[v];const _=m.arrayBuffers[v],g=new Uint32Array(_).buffer;return n[v]=g,g}const a=e.isInstancedBufferGeometry?new v1:new Rt,o=e.data.index;if(o!==void 0){const m=$c(o.type,o.array);a.setIndex(new $t(m,1))}const l=e.data.attributes;for(const m in l){const v=l[m];let x;if(v.isInterleavedBufferAttribute){const _=r(e.data,v.data);x=new Tl(_,v.itemSize,v.offset,v.normalized)}else{const _=$c(v.type,v.array),g=v.isInstancedBufferAttribute?Al:$t;x=new g(_,v.itemSize,v.normalized)}v.name!==void 0&&(x.name=v.name),v.usage!==void 0&&x.setUsage(v.usage),a.setAttribute(m,x)}const c=e.data.morphAttributes;if(c)for(const m in c){const v=c[m],x=[];for(let _=0,g=v.length;_<g;_++){const b=v[_];let E;if(b.isInterleavedBufferAttribute){const S=r(e.data,b.data);E=new Tl(S,b.itemSize,b.offset,b.normalized)}else{const S=$c(b.type,b.array);E=new $t(S,b.itemSize,b.normalized)}b.name!==void 0&&(E.name=b.name),x.push(E)}a.morphAttributes[m]=x}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let m=0,v=d.length;m!==v;++m){const x=d[m];a.addGroup(x.start,x.count,x.materialIndex)}const p=e.data.boundingSphere;return p!==void 0&&(a.boundingSphere=new ri().fromJSON(p)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class VI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=this.path===""?$_.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new ba(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,r)}async loadAsync(e,t){const n=this,r=this.path===""?$_.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new ba(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,n),h=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),t!==void 0){let d=!1;for(const p in a)if(a[p].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let n=0,r=e.length;n<r;n++){const s=new oo().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Vg().fromJSON(e[s],r);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const r=new nC;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(l);break;default:l.type in BE?o=BE[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(e,t){const n={},r={};if(e!==void 0){const s=new l0;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),r[l.uuid]=n[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const r=e[n],s=Nf.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const n=this,r={};let s;function a(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(h)}else return l.data?{data:$c(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new m1(t);s=new Pf(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c<h;c++){const d=e[c],p=d.url;if(Array.isArray(p)){const m=[];for(let v=0,x=p.length;v<x;v++){const _=p[v],g=o(_);g!==null&&(g instanceof HTMLImageElement?m.push(g):m.push(new As(g.data,g.width,g.height)))}r[d.uuid]=new ro(m)}else{const m=o(d.url);r[d.uuid]=new ro(m)}}}return r}async parseImagesAsync(e){const t=this,n={};let r;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await r.loadAsync(l)}else return a.data?{data:$c(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){r=new Pf(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const h=[];for(let d=0,p=c.length;d<p;d++){const m=c[d],v=await s(m);v!==null&&(v instanceof HTMLImageElement?h.push(v):h.push(new As(v.data,v.width,v.height)))}n[l.uuid]=new ro(h)}else{const h=await s(l.url);n[l.uuid]=new ro(h)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const r={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let h;Array.isArray(c)?(h=new Qf,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new As:h=new Dn,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,WI)),o.channel!==void 0&&(h.channel=o.channel),o.offset!==void 0&&h.offset.fromArray(o.offset),o.repeat!==void 0&&h.repeat.fromArray(o.repeat),o.center!==void 0&&h.center.fromArray(o.center),o.rotation!==void 0&&(h.rotation=o.rotation),o.wrap!==void 0&&(h.wrapS=n(o.wrap[0],VE),h.wrapT=n(o.wrap[1],VE)),o.format!==void 0&&(h.format=o.format),o.internalFormat!==void 0&&(h.internalFormat=o.internalFormat),o.type!==void 0&&(h.type=o.type),o.colorSpace!==void 0&&(h.colorSpace=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,WE)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,WE)),o.anisotropy!==void 0&&(h.anisotropy=o.anisotropy),o.flipY!==void 0&&(h.flipY=o.flipY),o.generateMipmaps!==void 0&&(h.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(h.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(h.compareFunction=o.compareFunction),o.userData!==void 0&&(h.userData=o.userData),r[o.uuid]=h}return r}parseObject(e,t,n,r,s){let a;function o(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function l(p){if(p!==void 0){if(Array.isArray(p)){const m=[];for(let v=0,x=p.length;v<x;v++){const _=p[v];n[_]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",_),m.push(n[_])}return m}return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),n[p]}}function c(p){return r[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),r[p]}let h,d;switch(e.type){case"Scene":a=new Gg,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Ye(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new kg(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Bg(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new Kn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Pl(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Q2(e.color,e.intensity);break;case"DirectionalLight":a=new J2(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new K2(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new $2(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Z2(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new Y2(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new tC().fromJSON(e);break;case"SkinnedMesh":h=o(e.geometry),d=l(e.material),a=new v2(h,d),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":h=o(e.geometry),d=l(e.material),a=new mn(h,d);break;case"InstancedMesh":h=o(e.geometry),d=l(e.material);const p=e.count,m=e.instanceMatrix,v=e.instanceColor;a=new y2(h,d,p),a.instanceMatrix=new Al(new Float32Array(m.array),16),v!==void 0&&(a.instanceColor=new Al(new Float32Array(v.array),v.itemSize));break;case"BatchedMesh":h=o(e.geometry),d=l(e.material),a=new _2(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),a.geometry=h,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(x=>{let _=null,g=null;return x.boundingBox!==void 0&&(_=new Qn().fromJSON(x.boundingBox)),x.boundingSphere!==void 0&&(g=new ri().fromJSON(x.boundingSphere)),{...x,boundingBox:_,boundingSphere:g}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new ri().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Qn().fromJSON(e.boundingBox));break;case"LOD":a=new g2;break;case"Line":a=new ho(o(e.geometry),l(e.material));break;case"LineLoop":a=new x2(o(e.geometry),l(e.material));break;case"LineSegments":a=new Us(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new b2(o(e.geometry),l(e.material));break;case"Sprite":a=new m2(l(e.material));break;case"Group":a=new eu;break;case"Bone":a=new t1;break;default:a=new Xt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let m=0;m<p.length;m++)a.add(this.parseObject(p[m],t,n,r,s))}if(e.animations!==void 0){const p=e.animations;for(let m=0;m<p.length;m++){const v=p[m];a.animations.push(s[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const p=e.levels;for(let m=0;m<p.length;m++){const v=p[m],x=a.getObjectByProperty("uuid",v.object);x!==void 0&&a.addLevel(x,v.distance,v.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const r=t[n.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(r,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,r=e.getObjectByProperty("uuid",n);r!==void 0?t.target=r:t.target=new Xt}})}}const WI={UVMapping:Cg,CubeReflectionMapping:_a,CubeRefractionMapping:co,EquirectangularReflectionMapping:xf,EquirectangularRefractionMapping:bf,CubeUVReflectionMapping:wu},VE={RepeatWrapping:Sf,ClampToEdgeWrapping:Fr,MirroredRepeatWrapping:Ef},WE={NearestFilter:vi,NearestMipmapNearestFilter:Fx,NearestMipmapLinearFilter:Qc,LinearFilter:Fn,LinearMipmapNearestFilter:sf,LinearMipmapLinearFilter:Ms},by=new WeakMap;class XI extends nr{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ws.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(by.has(a)===!0)r&&r(by.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return ws.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),by.set(l,c),ws.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});ws.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Tp;class y1{static getContext(){return Tp===void 0&&(Tp=new(window.AudioContext||window.webkitAudioContext)),Tp}static setContext(e){Tp=e}}class jI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new ba(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);y1.getContext().decodeAudioData(c,function(d){t(d)}).catch(o)}catch(c){o(c)}},n,r);function o(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const XE=new bt,jE=new bt,Qo=new bt;class qI{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Qo.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(bl*t.fov*.5)/t.zoom;let o,l;jE.elements[12]=-r,XE.elements[12]=r,o=-a*t.aspect+s,l=a*t.aspect+s,Qo.elements[0]=2*t.near/(l-o),Qo.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Qo),o=-a*t.aspect-s,l=a*t.aspect-s,Qo.elements[0]=2*t.near/(l-o),Qo.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Qo)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(jE),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(XE)}}class iC extends Kn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class _1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const $o=new j,Sy=new yi,YI=new j,el=new j,tl=new j;class ZI extends Xt{constructor(){super(),this.type="AudioListener",this.context=y1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new _1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose($o,Sy,YI),el.set(0,0,-1).applyQuaternion(Sy),tl.set(0,1,0).applyQuaternion(Sy),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime($o.x,n),t.positionY.linearRampToValueAtTime($o.y,n),t.positionZ.linearRampToValueAtTime($o.z,n),t.forwardX.linearRampToValueAtTime(el.x,n),t.forwardY.linearRampToValueAtTime(el.y,n),t.forwardZ.linearRampToValueAtTime(el.z,n),t.upX.linearRampToValueAtTime(tl.x,n),t.upY.linearRampToValueAtTime(tl.y,n),t.upZ.linearRampToValueAtTime(tl.z,n)}else t.setPosition($o.x,$o.y,$o.z),t.setOrientation(el.x,el.y,el.z,tl.x,tl.y,tl.z)}}class rC extends Xt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const nl=new j,qE=new yi,KI=new j,il=new j;class JI extends rC{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(nl,qE,KI),il.set(0,0,1).applyQuaternion(qE);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(nl.x,n),t.positionY.linearRampToValueAtTime(nl.y,n),t.positionZ.linearRampToValueAtTime(nl.z,n),t.orientationX.linearRampToValueAtTime(il.x,n),t.orientationY.linearRampToValueAtTime(il.y,n),t.orientationZ.linearRampToValueAtTime(il.z,n)}else t.setPosition(nl.x,nl.y,nl.z),t.setOrientation(il.x,il.y,il.z)}}class QI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class sC{constructor(e,t,n){this.binding=e,this.valueSize=n;let r,s,a;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:r=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,r=this.valueSize,s=e*r+r;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==r;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,r)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,r=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,r,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let s=n,a=r;s!==a;++s)t[s]=t[r+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,s){if(r>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,r){yi.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,s){const a=this._workIndex*s;yi.multiplyQuaternionsFlat(e,a,e,t,e,n),yi.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,s){const a=1-r;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*r}}_lerpAdditive(e,t,n,r,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*r}}}const x1="\\[\\]\\.:\\/",$I=new RegExp("["+x1+"]","g"),b1="[^"+x1+"]",eN="[^"+x1.replace("\\.","")+"]",tN=/((?:WC+[\/:])*)/.source.replace("WC",b1),nN=/(WCOD+)?/.source.replace("WCOD",eN),iN=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",b1),rN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",b1),sN=new RegExp("^"+tN+nN+iN+rN+"$"),aN=["material","materials","bones","map"];class oN{constructor(e,t,n){const r=n||Wt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Wt{constructor(e,t,n){this.path=t,this.parsedPath=n||Wt.parseTrackName(t),this.node=Wt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Wt.Composite(e,t,n):new Wt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($I,"")}static parseTrackName(e){const t=sN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);aN.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Wt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Wt.Composite=oN;Wt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Wt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Wt.prototype.GetterByBindingType=[Wt.prototype._getValue_direct,Wt.prototype._getValue_array,Wt.prototype._getValue_arrayElement,Wt.prototype._getValue_toArray];Wt.prototype.SetterByBindingTypeAndVersioning=[[Wt.prototype._setValue_direct,Wt.prototype._setValue_direct_setNeedsUpdate,Wt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_array,Wt.prototype._setValue_array_setNeedsUpdate,Wt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_arrayElement,Wt.prototype._setValue_arrayElement_setNeedsUpdate,Wt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_fromArray,Wt.prototype._setValue_fromArray_setNeedsUpdate,Wt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class lN{constructor(){this.isAnimationObjectGroup=!0,this.uuid=_r(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let h=0,d=arguments.length;h!==d;++h){const p=arguments[h],m=p.uuid;let v=t[m];if(v===void 0){v=l++,t[m]=v,e.push(p);for(let x=0,_=a;x!==_;++x)s[x].push(new Wt(p,n[x],r[x]))}else if(v<c){o=e[v];const x=--c,_=e[x];t[_.uuid]=v,e[v]=_,t[m]=x,e[x]=p;for(let g=0,b=a;g!==b;++g){const E=s[g],S=E[x];let w=E[v];E[v]=S,w===void 0&&(w=new Wt(p,n[g],r[g])),E[x]=w}}else e[v]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,h=t[c];if(h!==void 0&&h>=s){const d=s++,p=e[d];t[p.uuid]=h,e[h]=p,t[c]=d,e[d]=l;for(let m=0,v=r;m!==v;++m){const x=n[m],_=x[d],g=x[h];x[h]=_,x[d]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,d=t[h];if(d!==void 0)if(delete t[h],d<s){const p=--s,m=e[p],v=--a,x=e[v];t[m.uuid]=d,e[d]=m,t[x.uuid]=p,e[p]=x,e.pop();for(let _=0,g=r;_!==g;++_){const b=n[_],E=b[p],S=b[v];b[d]=E,b[p]=S,b.pop()}}else{const p=--a,m=e[p];p>0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,x=r;v!==x;++v){const _=n[v];_[d]=_[p],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,d=new Array(c);r=s.length,n[e]=r,a.push(e),o.push(t),s.push(d);for(let p=h,m=l.length;p!==m;++p){const v=l[p];d[p]=new Wt(v,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),r[n]=r[o],r.pop()}}}class aC{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:ml,endingEnd:ml};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=KA,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const r=this._clip.duration,s=e._clip.duration,a=s/r,o=r/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,s=r.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case jx:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case Ng:default:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,s=this._loopCount;const a=n===JA;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(n===ZA){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const o=Math.floor(r/t);r-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=gl,r.endingEnd=gl):(e?r.endingStart=this.zeroSlopeAtStart?gl:ml:r.endingStart=wf,t?r.endingEnd=this.zeroSlopeAtEnd?gl:ml:r.endingEnd=wf)}_scheduleFading(e,t,n){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}const cN=new Float32Array(1);class uN extends Ds{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let d=0;d!==s;++d){const p=r[d],m=p.name;let v=h[m];if(v!==void 0)++v.referenceCount,a[d]=v;else{if(v=a[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const x=t&&t._propertyBindings[d].binding.parsedPath;v=new sC(Wt.create(n,m,x),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),a[d]=v}o[d].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,n)}const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const r=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const d=o.actionByRoot,p=(e._localRoot||this._root).uuid;delete d[p],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const r=this._bindingsByRootAndName,s=this._bindings;let a=r[t];a===void 0&&(a={},r[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[r]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new d1(new Float32Array(2),new Float32Array(2),1,cN),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const r=t||this._root,s=r.uuid;let a=typeof e=="string"?Nf.findByName(r,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Ng),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new aC(this,a,t,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(e,t){const n=t||this._root,r=n.uuid,s=typeof e=="string"?Nf.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(r,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,s=r[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=h,t[h]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class hN extends Kx{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=n,this.texture=new zg(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class S1{constructor(e){this.value=e}clone(){return new S1(this.value.clone===void 0?this.value:this.value.clone())}}let fN=0;class dN extends Ds{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:fN++}),this.name="",this.usage=Af,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,r=t.length;n<r;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class pN extends Hg{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class mN{constructor(e,t,n,r,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=s,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const YE=new bt;class E1{constructor(e,t,n=0,r=1/0){this.ray=new Au(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new pu,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return YE.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(YE),this}intersectObject(e,t=!0,n=[]){return ex(e,this,n,t),n.sort(ZE),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)ex(e[r],this,n,t);return n.sort(ZE),n}}function ZE(i,e){return i.distance-e.distance}function ex(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)ex(s[a],e,t,!0)}}let gN=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=vN.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function vN(){this._document.hidden===!1&&this.reset()}class oC{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=St(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(St(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class yN{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class M1{constructor(e,t,n,r){M1.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}}const KE=new ke;class _N{constructor(e=new ke(1/0,1/0),t=new ke(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=KE.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,KE).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const JE=new j,Ap=new j,Ic=new j,Nc=new j,Ey=new j,xN=new j,bN=new j;class SN{constructor(e=new j,t=new j){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){JE.subVectors(e,this.start),Ap.subVectors(this.end,this.start);const n=Ap.dot(Ap);let s=Ap.dot(JE)/n;return t&&(s=St(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=xN,n=bN){const r=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,h=e.end;Ic.subVectors(c,o),Nc.subVectors(h,l),Ey.subVectors(o,l);const d=Ic.dot(Ic),p=Nc.dot(Nc),m=Nc.dot(Ey);if(d<=r&&p<=r)return t.copy(o),n.copy(l),t.sub(n),t.dot(t);if(d<=r)s=0,a=m/p,a=St(a,0,1);else{const v=Ic.dot(Ey);if(p<=r)a=0,s=St(-v/d,0,1);else{const x=Ic.dot(Nc),_=d*p-x*x;_!==0?s=St((x*m-v*p)/_,0,1):s=0,a=(x*s+m)/p,a<0?(a=0,s=St(-v/d,0,1)):a>1&&(a=1,s=St((x-v)/d,0,1))}}return t.copy(o).add(Ic.multiplyScalar(s)),n.copy(l).add(Nc.multiplyScalar(a)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const QE=new j;class EN extends Xt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Rt,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,h=o/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new ft(r,3));const s=new ki({fog:!1,toneMapped:!1});this.cone=new Us(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),QE.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(QE),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Qa=new j,Cp=new bt,My=new bt;class MN extends Us{constructor(e){const t=lC(e),n=new Rt,r=[],s=[];for(let c=0;c<t.length;c++){const h=t[c];h.parent&&h.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new ft(r,3)),n.setAttribute("color",new ft(s,3));const a=new ki({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new Ye(255),l=new Ye(65280);this.setColors(o,l)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");My.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Cp.multiplyMatrices(My,o.matrixWorld),Qa.setFromMatrixPosition(Cp),r.setXYZ(a,Qa.x,Qa.y,Qa.z),Cp.multiplyMatrices(My,o.parent.matrixWorld),Qa.setFromMatrixPosition(Cp),r.setXYZ(a+1,Qa.x,Qa.y,Qa.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const r=this.geometry.getAttribute("color");for(let s=0;s<r.count;s+=2)r.setXYZ(s,e.r,e.g,e.b),r.setXYZ(s+1,t.r,t.g,t.b);return r.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function lC(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...lC(i.children[t]));return e}class wN extends mn{constructor(e,t,n){const r=new td(t,4,2),s=new Ea({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const TN=new j,$E=new Ye,eM=new Ye;class AN extends Xt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const r=new ed(t);r.rotateY(Math.PI*.5),this.material=new Ea({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),a=new Float32Array(s.count*3);r.setAttribute("color",new $t(a,3)),this.add(new mn(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");$E.copy(this.light.color),eM.copy(this.light.groundColor);for(let n=0,r=t.count;n<r;n++){const s=n<r/2?$E:eM;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(TN.setFromMatrixPosition(this.light.matrixWorld).negate())}}class CN extends Us{constructor(e=10,t=10,n=4473924,r=8947848){n=new Ye(n),r=new Ye(r);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let p=0,m=0,v=-o;p<=t;p++,v+=a){l.push(-o,0,v,o,0,v),l.push(v,0,-o,v,0,o);const x=p===s?n:r;x.toArray(c,m),m+=3,x.toArray(c,m),m+=3,x.toArray(c,m),m+=3,x.toArray(c,m),m+=3}const h=new Rt;h.setAttribute("position",new ft(l,3)),h.setAttribute("color",new ft(c,3));const d=new ki({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class RN extends Us{constructor(e=10,t=16,n=8,r=64,s=4473924,a=8947848){s=new Ye(s),a=new Ye(a);const o=[],l=[];if(t>1)for(let d=0;d<t;d++){const p=d/t*(Math.PI*2),m=Math.sin(p)*e,v=Math.cos(p)*e;o.push(0,0,0),o.push(m,0,v);const x=d&1?s:a;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let d=0;d<n;d++){const p=d&1?s:a,m=e-e/n*d;for(let v=0;v<r;v++){let x=v/r*(Math.PI*2),_=Math.sin(x)*m,g=Math.cos(x)*m;o.push(_,0,g),l.push(p.r,p.g,p.b),x=(v+1)/r*(Math.PI*2),_=Math.sin(x)*m,g=Math.cos(x)*m,o.push(_,0,g),l.push(p.r,p.g,p.b)}}const c=new Rt;c.setAttribute("position",new ft(o,3)),c.setAttribute("color",new ft(l,3));const h=new ki({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const tM=new j,Rp=new j,nM=new j;class DN extends Xt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new Rt;r.setAttribute("position",new ft([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new ki({fog:!1,toneMapped:!1});this.lightPlane=new ho(r,s),this.add(this.lightPlane),r=new Rt,r.setAttribute("position",new ft([0,0,0,0,0,1],3)),this.targetLine=new ho(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),tM.setFromMatrixPosition(this.light.matrixWorld),Rp.setFromMatrixPosition(this.light.target.matrixWorld),nM.subVectors(Rp,tM),this.lightPlane.lookAt(Rp),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Rp),this.targetLine.scale.z=nM.length()}}const Dp=new j,Pn=new Fg;class UN extends Us{constructor(e){const t=new Rt,n=new ki({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(v,x){l(v),l(x)}function l(v){r.push(0,0,0),s.push(0,0,0),a[v]===void 0&&(a[v]=[]),a[v].push(r.length/3-1)}t.setAttribute("position",new ft(r,3)),t.setAttribute("color",new ft(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new Ye(16755200),h=new Ye(16711680),d=new Ye(43775),p=new Ye(16777215),m=new Ye(3355443);this.setColors(c,h,d,p,m)}setColors(e,t,n,r,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,r=1;let s,a;if(Pn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===yr)s=-1,a=1;else if(this.camera.coordinateSystem===fu)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Hn("c",t,e,Pn,0,0,s),Hn("t",t,e,Pn,0,0,a),Hn("n1",t,e,Pn,-n,-r,s),Hn("n2",t,e,Pn,n,-r,s),Hn("n3",t,e,Pn,-n,r,s),Hn("n4",t,e,Pn,n,r,s),Hn("f1",t,e,Pn,-n,-r,a),Hn("f2",t,e,Pn,n,-r,a),Hn("f3",t,e,Pn,-n,r,a),Hn("f4",t,e,Pn,n,r,a),Hn("u1",t,e,Pn,n*.7,r*1.1,s),Hn("u2",t,e,Pn,-n*.7,r*1.1,s),Hn("u3",t,e,Pn,0,r*2,s),Hn("cf1",t,e,Pn,-n,0,a),Hn("cf2",t,e,Pn,n,0,a),Hn("cf3",t,e,Pn,0,-r,a),Hn("cf4",t,e,Pn,0,r,a),Hn("cn1",t,e,Pn,-n,0,s),Hn("cn2",t,e,Pn,n,0,s),Hn("cn3",t,e,Pn,0,-r,s),Hn("cn4",t,e,Pn,0,r,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Hn(i,e,t,n,r,s,a){Dp.set(r,s,a).unproject(n);const o=e[i];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Dp.x,Dp.y,Dp.z)}}const Up=new Qn;class ON extends Us{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),s=new Rt;s.setIndex(new $t(n,1)),s.setAttribute("position",new $t(r,3)),super(s,new ki({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Up.setFromObject(this.object),Up.isEmpty())return;const e=Up.min,t=Up.max,n=this.geometry.attributes.position,r=n.array;r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=e.x,r[4]=t.y,r[5]=t.z,r[6]=e.x,r[7]=e.y,r[8]=t.z,r[9]=t.x,r[10]=e.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=e.z,r[15]=e.x,r[16]=t.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=t.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class LN extends Us{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Rt;s.setIndex(new $t(n,1)),s.setAttribute("position",new ft(r,3)),super(s,new ki({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class IN extends ho{constructor(e,t=1,n=16776960){const r=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Rt;a.setAttribute("position",new ft(s,3)),a.computeBoundingSphere(),super(a,new ki({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Rt;l.setAttribute("position",new ft(o,3)),l.computeBoundingSphere(),this.add(new mn(l,new Ea({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const iM=new j;let Op,wy;class NN extends Xt{constructor(e=new j(0,0,1),t=new j(0,0,0),n=1,r=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Op===void 0&&(Op=new Rt,Op.setAttribute("position",new ft([0,0,0,0,1,0],3)),wy=new $f(.5,1,5,1),wy.translate(0,-.5,0)),this.position.copy(t),this.line=new ho(Op,new ki({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new mn(wy,new Ea({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{iM.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(iM,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class PN extends Us{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Rt;r.setAttribute("position",new ft(t,3)),r.setAttribute("color",new ft(n,3));const s=new ki({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,n){const r=new Ye,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(n),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class zN{constructor(){this.type="ShapePath",this.color=new Ye,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new sg,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,a){return this.currentPath.bezierCurveTo(e,t,n,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const b=[];for(let E=0,S=g.length;E<S;E++){const w=g[E],T=new oo;T.curves=w.curves,b.push(T)}return b}function n(g,b){const E=b.length;let S=!1;for(let w=E-1,T=0;T<E;w=T++){let R=b[w],U=b[T],A=U.x-R.x,D=U.y-R.y;if(Math.abs(D)>Number.EPSILON){if(D<0&&(R=b[T],A=-A,U=b[w],D=-D),g.y<R.y||g.y>U.y)continue;if(g.y===R.y){if(g.x===R.x)return!0}else{const L=D*(g.x-R.x)-A*(g.y-R.y);if(L===0)return!0;if(L<0)continue;S=!S}}else{if(g.y!==R.y)continue;if(U.x<=g.x&&g.x<=R.x||R.x<=g.x&&g.x<=U.x)return!0}}return S}const r=os.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new oo,l.curves=o.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const d=[],p=[];let m=[],v=0,x;p[v]=void 0,m[v]=[];for(let g=0,b=s.length;g<b;g++)o=s[g],x=o.getPoints(),a=r(x),a=e?!a:a,a?(!h&&p[v]&&v++,p[v]={s:new oo,p:x},p[v].s.curves=o.curves,h&&v++,m[v]=[]):m[v].push({h:o,p:x[0]});if(!p[0])return t(s);if(p.length>1){let g=!1,b=0;for(let E=0,S=p.length;E<S;E++)d[E]=[];for(let E=0,S=p.length;E<S;E++){const w=m[E];for(let T=0;T<w.length;T++){const R=w[T];let U=!0;for(let A=0;A<p.length;A++)n(R.p,p[A].p)&&(E!==A&&b++,U?(U=!1,d[A].push(R)):g=!0);U&&d[E].push(R)}}b>0&&g===!1&&(m=d)}let _;for(let g=0,b=p.length;g<b;g++){l=p[g].s,c.push(l),_=m[g];for(let E=0,S=_.length;E<S;E++)l.holes.push(_[E].h)}return c}}let FN=class extends Ds{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function BN(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function kN(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function GN(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function tx(i,e,t,n){const r=HN(n);switch(t){case Vx:return i*e;case Og:return i*e/r.components*r.byteLength;case Jf:return i*e/r.components*r.byteLength;case Xx:return i*e*2/r.components*r.byteLength;case Lg:return i*e*2/r.components*r.byteLength;case Wx:return i*e*3/r.components*r.byteLength;case Di:return i*e*4/r.components*r.byteLength;case Ig:return i*e*4/r.components*r.byteLength;case af:case of:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case lf:case cf:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Am:case Rm:return Math.max(i,16)*Math.max(e,8)/4;case Tm:case Cm:return Math.max(i,8)*Math.max(e,8)/2;case Dm:case Um:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Om:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Lm:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Im:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Nm:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Pm:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case zm:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Fm:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Bm:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case km:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Gm:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Hm:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Vm:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Wm:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Xm:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case jm:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case qm:case Ym:case Zm:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Km:case Jm:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Qm:case $m:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function HN(i){switch(i){case Gr:case Bx:return{byteLength:1,components:1};case lu:case kx:case Tu:return{byteLength:2,components:1};case Dg:case Ug:return{byteLength:2,components:4};case xa:case Rg:case Qi:return{byteLength:4,components:1};case Gx:case Hx:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}class VN{static contain(e,t){return BN(e,t)}static cover(e,t){return kN(e,t)}static fill(e){return GN(e)}static getByteLength(e,t,n,r){return tx(e,t,n,r)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Tg}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Tg);/**
|
|
53
|
-
* @license
|
|
54
|
-
* Copyright 2010-2025 Three.js Authors
|
|
55
|
-
* SPDX-License-Identifier: MIT
|
|
56
|
-
*/function cC(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function WN(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,d=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)m=i.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const h=l.array,d=l.updateRanges;if(i.bindBuffer(c,o),d.length===0)i.bufferSubData(c,0,h);else{d.sort((m,v)=>m.start-v.start);let p=0;for(let m=1;m<d.length;m++){const v=d[p],x=d[m];x.start<=v.start+v.count+1?v.count=Math.max(v.count,x.start+x.count-v.start):(++p,d[p]=x)}d.length=p+1;for(let m=0,v=d.length;m<v;m++){const x=d[m];i.bufferSubData(c,x.start*h.BYTES_PER_ELEMENT,h,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var XN=`#ifdef USE_ALPHAHASH
|
|
40
|
+
`},r=new go(5,5,5),s=new Hr({name:"CubemapFromEquirect",uniforms:mu(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Fi,blending:pa});s.uniforms.tEquirect.value=t;const a=new mn(r,s),o=t.minFilter;return t.minFilter===Ms&&(t.minFilter=Fn),new f2(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class eu extends Xt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zL={type:"move"};class am{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new eu,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new eu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new eu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const x of e.hand.values()){const _=t.getJointPose(x,n),g=this._getHandJoint(c,x);_!==null&&(g.matrix.fromArray(_.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=_.radius),g.visible=_!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],p=h.position.distanceTo(d.position),m=.02,v=.005;c.inputState.pinching&&p>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zL)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new eu;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Bg{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ye(e),this.density=t}clone(){return new Bg(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class kg{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ye(e),this.near=t,this.far=n}clone(){return new kg(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Gg extends Xt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Bi,this.environmentIntensity=1,this.environmentRotation=new Bi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Hg{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Af,this.updateRanges=[],this.version=0,this.uuid=_r()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_r()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_r()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ii=new j;class Tl{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.applyMatrix4(e),this.setXYZ(t,Ii.x,Ii.y,Ii.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.applyNormalMatrix(e),this.setXYZ(t,Ii.x,Ii.y,Ii.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ii.fromBufferAttribute(this,t),Ii.transformDirection(e),this.setXYZ(t,Ii.x,Ii.y,Ii.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Pi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ot(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Pi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Pi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Pi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Pi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),n=Ot(n,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new $t(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Tl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class e1 extends Ui{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Cc;const vh=new j,Rc=new j,Dc=new j,Uc=new ke,yh=new ke,p2=new bt,op=new j,_h=new j,lp=new j,mE=new ke,ly=new ke,gE=new ke;class m2 extends Xt{constructor(e=new e1){if(super(),this.isSprite=!0,this.type="Sprite",Cc===void 0){Cc=new Rt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Hg(t,5);Cc.setIndex([0,1,2,0,2,3]),Cc.setAttribute("position",new Tl(n,3,0,!1)),Cc.setAttribute("uv",new Tl(n,2,3,!1))}this.geometry=Cc,this.material=e,this.center=new ke(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Rc.setFromMatrixScale(this.matrixWorld),p2.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Dc.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Rc.multiplyScalar(-Dc.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;cp(op.set(-.5,-.5,0),Dc,a,Rc,r,s),cp(_h.set(.5,-.5,0),Dc,a,Rc,r,s),cp(lp.set(.5,.5,0),Dc,a,Rc,r,s),mE.set(0,0),ly.set(1,0),gE.set(1,1);let o=e.ray.intersectTriangle(op,_h,lp,!1,vh);if(o===null&&(cp(_h.set(-.5,.5,0),Dc,a,Rc,r,s),ly.set(0,1),o=e.ray.intersectTriangle(op,lp,_h,!1,vh),o===null))return;const l=e.ray.origin.distanceTo(vh);l<e.near||l>e.far||t.push({distance:l,point:vh.clone(),uv:Ji.getInterpolation(vh,op,_h,lp,mE,ly,gE,new ke),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function cp(i,e,t,n,r,s){Uc.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(yh.x=s*Uc.x-r*Uc.y,yh.y=r*Uc.x+s*Uc.y):yh.copy(Uc),i.copy(e),i.x+=yh.x,i.y+=yh.y,i.applyMatrix4(p2)}const up=new j,vE=new j;class g2 extends Xt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,r=t.length;n<r;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const r=t.splice(n,1);return this.remove(r[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){up.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(up);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){up.setFromMatrixPosition(e.matrixWorld),vE.setFromMatrixPosition(this.matrixWorld);const n=up.distanceTo(vE)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let a=t[r].distance;if(t[r].object.visible&&(a-=a*t[r].hysteresis),n>=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let r=0,s=n.length;r<s;r++){const a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const yE=new j,_E=new Bt,xE=new Bt,FL=new j,bE=new bt,hp=new j,cy=new ri,SE=new bt,uy=new Au;class v2 extends mn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=j_,this.bindMatrix=new bt,this.bindMatrixInverse=new bt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Qn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,hp),this.boundingBox.expandByPoint(hp)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ri),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,hp),this.boundingSphere.expandByPoint(hp)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),cy.copy(this.boundingSphere),cy.applyMatrix4(r),e.ray.intersectsSphere(cy)!==!1&&(SE.copy(r).invert(),uy.copy(e.ray).applyMatrix4(SE),!(this.boundingBox!==null&&uy.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,uy)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Bt,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===j_?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===YA?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;_E.fromBufferAttribute(r.attributes.skinIndex,e),xE.fromBufferAttribute(r.attributes.skinWeight,e),yE.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=xE.getComponent(s);if(a!==0){const o=_E.getComponent(s);bE.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(FL.copy(yE).applyMatrix4(bE),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class t1 extends Xt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class As extends Dn{constructor(e=null,t=1,n=1,r,s,a,o,l,c=vi,h=vi,d,p){super(null,a,o,l,c,h,r,s,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const EE=new bt,BL=new bt;class Vg{constructor(e=[],t=[]){this.uuid=_r(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new bt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new bt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:BL;EE.multiplyMatrices(o,t[s]),EE.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Vg(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new As(t,e,e,Di,Qi);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new t1),this.bones.push(a),this.boneInverses.push(new bt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class Al extends $t{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Oc=new bt,ME=new bt,fp=[],wE=new Qn,kL=new bt,xh=new mn,bh=new ri;class y2 extends mn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Al(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,kL)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Qn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Oc),wE.copy(e.boundingBox).applyMatrix4(Oc),this.boundingBox.union(wE)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ri),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Oc),bh.copy(e.boundingSphere).applyMatrix4(Oc),this.boundingSphere.union(bh)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(xh.geometry=this.geometry,xh.material=this.material,xh.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),bh.copy(this.boundingSphere),bh.applyMatrix4(n),e.ray.intersectsSphere(bh)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Oc),ME.multiplyMatrices(n,Oc),xh.matrixWorld=ME,xh.raycast(e,fp);for(let a=0,o=fp.length;a<o;a++){const l=fp[a];l.instanceId=s,l.object=this,t.push(l)}fp.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Al(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new As(new Float32Array(r*this.count),r,this.count,Og,Qi));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*e;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const hy=new j,GL=new j,HL=new At;class ua{constructor(e=new j(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=hy.subVectors(n,t).cross(GL.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(hy),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||HL.getNormalMatrix(e),r=this.coplanarPoint(hy).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Zo=new ri,VL=new ke(.5,.5),dp=new j;class Ll{constructor(e=new ua,t=new ua,n=new ua,r=new ua,s=new ua,a=new ua){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=yr,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],d=s[5],p=s[6],m=s[7],v=s[8],x=s[9],_=s[10],g=s[11],b=s[12],E=s[13],S=s[14],w=s[15];if(r[0].setComponents(c-a,m-h,g-v,w-b).normalize(),r[1].setComponents(c+a,m+h,g+v,w+b).normalize(),r[2].setComponents(c+o,m+d,g+x,w+E).normalize(),r[3].setComponents(c-o,m-d,g-x,w-E).normalize(),n)r[4].setComponents(l,p,_,S).normalize(),r[5].setComponents(c-l,m-p,g-_,w-S).normalize();else if(r[4].setComponents(c-l,m-p,g-_,w-S).normalize(),t===yr)r[5].setComponents(c+l,m+p,g+_,w+S).normalize();else if(t===fu)r[5].setComponents(l,p,_,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Zo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Zo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Zo)}intersectsSprite(e){Zo.center.set(0,0,0);const t=VL.distanceTo(e.center);return Zo.radius=.7071067811865476+t,Zo.applyMatrix4(e.matrixWorld),this.intersectsSphere(Zo)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(dp.x=r.normal.x>0?e.max.x:e.min.x,dp.y=r.normal.y>0?e.max.y:e.min.y,dp.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dp)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const gs=new bt,vs=new Ll;class Wg{constructor(){this.coordinateSystem=yr}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(gs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),vs.setFromProjectionMatrix(gs,r.coordinateSystem,r.reversedDepth),vs.containsPoint(e))return!0}return!1}clone(){return new Wg}}function fy(i,e){return i-e}function WL(i,e){return i.z-e.z}function XL(i,e){return e.z-i.z}class jL{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const qi=new bt,qL=new Ye(1,1,1),TE=new Ll,YL=new Wg,pp=new Qn,Ko=new ri,Sh=new j,AE=new j,ZL=new j,dy=new jL,Ci=new mn,mp=[];function KL(i,e,t=0){const n=e.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==e.array.constructor){const r=i.count;for(let s=0;s<r;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,i.getComponent(s,a))}else e.array.set(i.array,t*n);e.needsUpdate=!0}function Jo(i,e){if(i.constructor!==e.constructor){const t=Math.min(i.length,e.length);for(let n=0;n<t;n++)e[n]=i[n]}else{const t=Math.min(i.length,e.length);e.set(new i.constructor(i.buffer,0,t))}}class _2 extends mn{constructor(e,t,n=t*2,r){super(new Rt,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new As(t,e,e,Di,Qi);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new As(t,e,e,Jf,xa);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new As(t,e,e,Di,Qi);n.colorSpace=Gt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),d=new $t(h,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new $t(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const r=e.getAttribute(n),s=t.getAttribute(n);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,qi),this.getBoundingBoxAt(s,pp).applyMatrix4(qi),e.union(pp)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ri);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,qi),this.getBoundingSphereAt(s,Ko).applyMatrix4(qi),e.union(Ko)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(fy),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=n):(r=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;qi.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(qL.toArray(a.image.data,r*4),a.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(fy),l=this._availableGeometryIds.shift(),s[l]=r):(l=this._geometryCount,this._geometryCount++,s.push(r)),this.setGeometryAt(l,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,r=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const h in n.attributes){const d=t.getAttribute(h),p=n.getAttribute(h);KL(d,p,l);const m=d.itemSize;for(let v=d.count,x=c;v<x;v++){const _=l+v;for(let g=0;g<m;g++)p.setComponent(_,g,0)}p.needsUpdate=!0,p.addUpdateRange(l*m,c*m)}if(r){const h=o.indexStart,d=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let p=0;p<a.count;p++)s.setX(h+p,l+a.getX(p));for(let p=a.count,m=d;p<m;p++)s.setX(h+p,l);s.needsUpdate=!0,s.addUpdateRange(h,o.reservedIndexCount)}return o.start=r?o.indexStart:o.vertexStart,o.count=r?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let r=0,s=n.length;r<s;r++)n[r].active&&n[r].geometryIndex===e&&this.deleteInstance(r);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,r=n.map((a,o)=>o).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),s=this.geometry;for(let a=0,o=n.length;a<o;a++){const l=r[a],c=n[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:h,vertexStart:d,reservedIndexCount:p}=c,m=s.index,v=m.array,x=e-d;for(let _=h;_<h+p;_++)v[_]=v[_]+x;m.array.copyWithin(t,h,h+p),m.addUpdateRange(t,p),c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:h,reservedVertexCount:d}=c,p=s.attributes;for(const m in p){const v=p[m],{array:x,itemSize:_}=v;x.copyWithin(e*_,h*_,(h+d)*_),v.addUpdateRange(e*_,d*_)}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new Qn,a=n.index,o=n.attributes.position;for(let l=r.start,c=r.start+r.count;l<c;l++){let h=l;a&&(h=a.getX(h)),s.expandByPoint(Sh.fromBufferAttribute(o,h))}r.boundingBox=s}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new ri;this.getBoundingBoxAt(e,pp),pp.getCenter(s.center);const a=n.index,o=n.attributes.position;let l=0;for(let c=r.start,h=r.start+r.count;c<h;c++){let d=c;a&&(d=a.getX(d)),Sh.fromBufferAttribute(o,d),l=Math.max(l,s.center.distanceToSquared(Sh))}s.radius=Math.sqrt(l),r.boundingSphere=s}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(fy);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const r=new Int32Array(e),s=new Int32Array(e);Jo(this._multiDrawCounts,r),Jo(this._multiDrawStarts,s),this._multiDrawCounts=r,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),Jo(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Jo(o.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),Jo(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Rt,this._initializeGeometry(s));const a=this.geometry;s.index&&Jo(s.index.array,a.index.array);for(const o in s.attributes)Jo(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,a=this.geometry;Ci.material=this.material,Ci.geometry.index=a.index,Ci.geometry.attributes=a.attributes,Ci.geometry.boundingBox===null&&(Ci.geometry.boundingBox=new Qn),Ci.geometry.boundingSphere===null&&(Ci.geometry.boundingSphere=new ri);for(let o=0,l=n.length;o<l;o++){if(!n[o].visible||!n[o].active)continue;const c=n[o].geometryIndex,h=r[c];Ci.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,Ci.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Ci.geometry.boundingBox),this.getBoundingSphereAt(c,Ci.geometry.boundingSphere),Ci.raycast(e,mp);for(let d=0,p=mp.length;d<p;d++){const m=mp[d];m.object=this,m.batchId=o,t.push(m)}mp.length=0}Ci.material=null,Ci.geometry.index=null,Ci.geometry.attributes={},Ci.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=r.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,d=this._geometryInfo,p=this.perObjectFrustumCulled,m=this._indirectTexture,v=m.image.data,x=n.isArrayCamera?YL:TE;p&&!n.isArrayCamera&&(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),TE.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth));let _=0;if(this.sortObjects){qi.copy(this.matrixWorld).invert(),Sh.setFromMatrixPosition(n.matrixWorld).applyMatrix4(qi),AE.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(qi);for(let E=0,S=l.length;E<S;E++)if(l[E].visible&&l[E].active){const w=l[E].geometryIndex;this.getMatrixAt(E,qi),this.getBoundingSphereAt(w,Ko).applyMatrix4(qi);let T=!1;if(p&&(T=!x.intersectsSphere(Ko,n)),!T){const R=d[w],U=ZL.subVectors(Ko.center,Sh).dot(AE);dy.push(R.start,R.count,U,E)}}const g=dy.list,b=this.customSort;b===null?g.sort(s.transparent?XL:WL):b.call(this,g,n);for(let E=0,S=g.length;E<S;E++){const w=g[E];c[_]=w.start*o,h[_]=w.count,v[_]=w.index,_++}dy.reset()}else for(let g=0,b=l.length;g<b;g++)if(l[g].visible&&l[g].active){const E=l[g].geometryIndex;let S=!1;if(p&&(this.getMatrixAt(g,qi),this.getBoundingSphereAt(E,Ko).applyMatrix4(qi),S=!x.intersectsSphere(Ko,n)),!S){const w=d[E];c[_]=w.start*o,h[_]=w.count,v[_]=g,_++}}m.needsUpdate=!0,this._multiDrawCount=_,this._visibilityChanged=!1}onBeforeShadow(e,t,n,r,s,a){this.onBeforeRender(e,null,r,s,a)}}class ki extends Ui{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ng=new j,ig=new j,CE=new bt,Eh=new Au,gp=new ri,py=new j,RE=new j;let ho=class extends Xt{constructor(e=new Rt,t=new ki){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)ng.fromBufferAttribute(t,r-1),ig.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ng.distanceTo(ig);e.setAttribute("lineDistance",new ft(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gp.copy(n.boundingSphere),gp.applyMatrix4(r),gp.radius+=s,e.ray.intersectsSphere(gp)===!1)return;CE.copy(r).invert(),Eh.copy(e.ray).applyMatrix4(CE);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,p=n.attributes.position;if(h!==null){const m=Math.max(0,a.start),v=Math.min(h.count,a.start+a.count);for(let x=m,_=v-1;x<_;x+=c){const g=h.getX(x),b=h.getX(x+1),E=vp(this,e,Eh,l,g,b,x);E&&t.push(E)}if(this.isLineLoop){const x=h.getX(v-1),_=h.getX(m),g=vp(this,e,Eh,l,x,_,v-1);g&&t.push(g)}}else{const m=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count);for(let x=m,_=v-1;x<_;x+=c){const g=vp(this,e,Eh,l,x,x+1,x);g&&t.push(g)}if(this.isLineLoop){const x=vp(this,e,Eh,l,v-1,m,v-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};function vp(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(ng.fromBufferAttribute(o,r),ig.fromBufferAttribute(o,s),t.distanceSqToSegment(ng,ig,py,RE)>n)return;py.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(py);if(!(c<e.near||c>e.far))return{distance:c,point:RE.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const DE=new j,UE=new j;class Us extends ho{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)DE.fromBufferAttribute(t,r),UE.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+DE.distanceTo(UE);e.setAttribute("lineDistance",new ft(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class x2 extends ho{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class n1 extends Ui{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const OE=new bt,Z_=new Au,yp=new ri,_p=new j;class b2 extends Xt{constructor(e=new Rt,t=new n1){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),yp.copy(n.boundingSphere),yp.applyMatrix4(r),yp.radius+=s,e.ray.intersectsSphere(yp)===!1)return;OE.copy(r).invert(),Z_.copy(e.ray).applyMatrix4(OE);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const p=Math.max(0,a.start),m=Math.min(c.count,a.start+a.count);for(let v=p,x=m;v<x;v++){const _=c.getX(v);_p.fromBufferAttribute(d,_),LE(_p,_,l,r,e,t,this)}}else{const p=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let v=p,x=m;v<x;v++)_p.fromBufferAttribute(d,v),LE(_p,v,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function LE(i,e,t,n,r,s,a){const o=Z_.distanceSqToPoint(i);if(o<t){const l=new j;Z_.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class S2 extends Dn{constructor(e,t,n,r,s=Fn,a=Fn,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function d(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class JL extends S2{constructor(e,t,n,r,s,a,o,l){super({},e,t,n,r,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class QL extends Dn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=vi,this.minFilter=vi,this.generateMipmaps=!1,this.needsUpdate=!0}}class Xg extends Dn{constructor(e,t,n,r,s,a,o,l,c,h,d,p){super(null,a,o,l,c,h,r,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class $L extends Xg{constructor(e,t,n,r,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Fr,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class eI extends Xg{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,_a),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class tI extends Dn{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class i1 extends Dn{constructor(e,t,n=xa,r,s,a,o=vi,l=vi,c,h=uu,d=1){if(h!==uu&&h!==hu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:t,depth:d};super(p,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ro(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class r1 extends Dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class jg extends Rt{constructor(e=1,t=1,n=4,r=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),s=Math.max(1,Math.floor(s));const a=[],o=[],l=[],c=[],h=t/2,d=Math.PI/2*e,p=t,m=2*d+p,v=n*2+s,x=r+1,_=new j,g=new j;for(let b=0;b<=v;b++){let E=0,S=0,w=0,T=0;if(b<=n){const A=b/n,D=A*Math.PI/2;S=-h-e*Math.cos(D),w=e*Math.sin(D),T=-e*Math.cos(D),E=A*d}else if(b<=n+s){const A=(b-n)/s;S=-h+A*t,w=e,T=0,E=d+A*p}else{const A=(b-n-s)/n,D=A*Math.PI/2;S=h+e*Math.sin(D),w=e*Math.cos(D),T=e*Math.sin(D),E=d+p+A*d}const R=Math.max(0,Math.min(1,E/m));let U=0;b===0?U=.5/r:b===v&&(U=-.5/r);for(let A=0;A<=r;A++){const D=A/r,L=D*Math.PI*2,P=Math.sin(L),I=Math.cos(L);g.x=-w*I,g.y=S,g.z=w*P,o.push(g.x,g.y,g.z),_.set(-w*I,T,w*P),_.normalize(),l.push(_.x,_.y,_.z),c.push(D+U,R)}if(b>0){const A=(b-1)*x;for(let D=0;D<r;D++){const L=A+D,P=A+D+1,I=b*x+D,V=b*x+D+1;a.push(L,P,I),a.push(P,V,I)}}}this.setIndex(a),this.setAttribute("position",new ft(o,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jg(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class qg extends Rt{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new j,h=new ke;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const m=n+d/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[p]/e+1)/2,h.y=(a[p+1]/e+1)/2,l.push(h.x,h.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new ft(a,3)),this.setAttribute("normal",new ft(o,3)),this.setAttribute("uv",new ft(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qg(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Cu extends Rt{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const h=[],d=[],p=[],m=[];let v=0;const x=[],_=n/2;let g=0;b(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(h),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(p,3)),this.setAttribute("uv",new ft(m,2));function b(){const S=new j,w=new j;let T=0;const R=(t-e)/n;for(let U=0;U<=s;U++){const A=[],D=U/s,L=D*(t-e)+e;for(let P=0;P<=r;P++){const I=P/r,V=I*l+o,H=Math.sin(V),z=Math.cos(V);w.x=L*H,w.y=-D*n+_,w.z=L*z,d.push(w.x,w.y,w.z),S.set(H,R,z).normalize(),p.push(S.x,S.y,S.z),m.push(I,1-D),A.push(v++)}x.push(A)}for(let U=0;U<r;U++)for(let A=0;A<s;A++){const D=x[A][U],L=x[A+1][U],P=x[A+1][U+1],I=x[A][U+1];(e>0||A!==0)&&(h.push(D,L,I),T+=3),(t>0||A!==s-1)&&(h.push(L,P,I),T+=3)}c.addGroup(g,T,0),g+=T}function E(S){const w=v,T=new ke,R=new j;let U=0;const A=S===!0?e:t,D=S===!0?1:-1;for(let P=1;P<=r;P++)d.push(0,_*D,0),p.push(0,D,0),m.push(.5,.5),v++;const L=v;for(let P=0;P<=r;P++){const V=P/r*l+o,H=Math.cos(V),z=Math.sin(V);R.x=A*z,R.y=_*D,R.z=A*H,d.push(R.x,R.y,R.z),p.push(0,D,0),T.x=H*.5+.5,T.y=z*.5*D+.5,m.push(T.x,T.y),v++}for(let P=0;P<r;P++){const I=w+P,V=L+P;S===!0?h.push(V,V+1,I):h.push(V+1,V,I),U+=3}c.addGroup(g,U,S===!0?1:2),g+=U}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class $f extends Cu{constructor(e=1,t=1,n=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new $f(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vo extends Rt{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const s=[],a=[];o(r),c(n),h(),this.setAttribute("position",new ft(s,3)),this.setAttribute("normal",new ft(s.slice(),3)),this.setAttribute("uv",new ft(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(b){const E=new j,S=new j,w=new j;for(let T=0;T<t.length;T+=3)m(t[T+0],E),m(t[T+1],S),m(t[T+2],w),l(E,S,w,b)}function l(b,E,S,w){const T=w+1,R=[];for(let U=0;U<=T;U++){R[U]=[];const A=b.clone().lerp(S,U/T),D=E.clone().lerp(S,U/T),L=T-U;for(let P=0;P<=L;P++)P===0&&U===T?R[U][P]=A:R[U][P]=A.clone().lerp(D,P/L)}for(let U=0;U<T;U++)for(let A=0;A<2*(T-U)-1;A++){const D=Math.floor(A/2);A%2===0?(p(R[U][D+1]),p(R[U+1][D]),p(R[U][D])):(p(R[U][D+1]),p(R[U+1][D+1]),p(R[U+1][D]))}}function c(b){const E=new j;for(let S=0;S<s.length;S+=3)E.x=s[S+0],E.y=s[S+1],E.z=s[S+2],E.normalize().multiplyScalar(b),s[S+0]=E.x,s[S+1]=E.y,s[S+2]=E.z}function h(){const b=new j;for(let E=0;E<s.length;E+=3){b.x=s[E+0],b.y=s[E+1],b.z=s[E+2];const S=_(b)/2/Math.PI+.5,w=g(b)/Math.PI+.5;a.push(S,1-w)}v(),d()}function d(){for(let b=0;b<a.length;b+=6){const E=a[b+0],S=a[b+2],w=a[b+4],T=Math.max(E,S,w),R=Math.min(E,S,w);T>.9&&R<.1&&(E<.2&&(a[b+0]+=1),S<.2&&(a[b+2]+=1),w<.2&&(a[b+4]+=1))}}function p(b){s.push(b.x,b.y,b.z)}function m(b,E){const S=b*3;E.x=e[S+0],E.y=e[S+1],E.z=e[S+2]}function v(){const b=new j,E=new j,S=new j,w=new j,T=new ke,R=new ke,U=new ke;for(let A=0,D=0;A<s.length;A+=9,D+=6){b.set(s[A+0],s[A+1],s[A+2]),E.set(s[A+3],s[A+4],s[A+5]),S.set(s[A+6],s[A+7],s[A+8]),T.set(a[D+0],a[D+1]),R.set(a[D+2],a[D+3]),U.set(a[D+4],a[D+5]),w.copy(b).add(E).add(S).divideScalar(3);const L=_(w);x(T,D+0,b,L),x(R,D+2,E,L),x(U,D+4,S,L)}}function x(b,E,S,w){w<0&&b.x===1&&(a[E]=b.x-1),S.x===0&&S.z===0&&(a[E]=w/2/Math.PI+.5)}function _(b){return Math.atan2(b.z,-b.x)}function g(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vo(e.vertices,e.indices,e.radius,e.details)}}class Yg extends vo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Yg(e.radius,e.detail)}}const xp=new j,bp=new j,my=new j,Sp=new Ji;class E2 extends Rt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(bl*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),p={},m=[];for(let v=0;v<l;v+=3){a?(c[0]=a.getX(v),c[1]=a.getX(v+1),c[2]=a.getX(v+2)):(c[0]=v,c[1]=v+1,c[2]=v+2);const{a:x,b:_,c:g}=Sp;if(x.fromBufferAttribute(o,c[0]),_.fromBufferAttribute(o,c[1]),g.fromBufferAttribute(o,c[2]),Sp.getNormal(my),d[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,d[1]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let b=0;b<3;b++){const E=(b+1)%3,S=d[b],w=d[E],T=Sp[h[b]],R=Sp[h[E]],U=`${S}_${w}`,A=`${w}_${S}`;A in p&&p[A]?(my.dot(p[A].normal)<=s&&(m.push(T.x,T.y,T.z),m.push(R.x,R.y,R.z)),p[A]=null):U in p||(p[U]={index0:c[b],index1:c[E],normal:my.clone()})}}for(const v in p)if(p[v]){const{index0:x,index1:_}=p[v];xp.fromBufferAttribute(o,x),bp.fromBufferAttribute(o,_),m.push(xp.x,xp.y,xp.z),m.push(bp.x,bp.y,bp.z)}this.setAttribute("position",new ft(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class us{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const h=n[r],p=n[r+1]-h,m=(a-h)/p;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ke:new j);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new j,r=[],s=[],a=[],o=new j,l=new bt;for(let m=0;m<=e;m++){const v=m/e;r[m]=this.getTangentAt(v,new j)}s[0]=new j,a[0]=new j;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),a[m]=a[m-1].clone(),o.crossVectors(r[m-1],r[m]),o.length()>Number.EPSILON){o.normalize();const v=Math.acos(St(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(o,v))}a[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(St(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],m*v)),a[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Zg extends us{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new ke){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=l-this.aX,m=c-this.aY;l=p*h-m*d+this.aX,c=p*d+m*h+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class M2 extends Zg{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function s1(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let p=(a-s)/c-(o-s)/(c+h)+(o-a)/h,m=(o-a)/h-(l-a)/(h+d)+(l-o)/d;p*=h,m*=h,r(a,o,p,m)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const Ep=new j,gy=new s1,vy=new s1,yy=new s1;class Kg extends us{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new j){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=r[(o-1)%s]:(Ep.subVectors(r[0],r[1]).add(r[0]),c=Ep);const d=r[o%s],p=r[(o+1)%s];if(this.closed||o+2<s?h=r[(o+2)%s]:(Ep.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=Ep),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let v=Math.pow(c.distanceToSquared(d),m),x=Math.pow(d.distanceToSquared(p),m),_=Math.pow(p.distanceToSquared(h),m);x<1e-4&&(x=1),v<1e-4&&(v=x),_<1e-4&&(_=x),gy.initNonuniformCatmullRom(c.x,d.x,p.x,h.x,v,x,_),vy.initNonuniformCatmullRom(c.y,d.y,p.y,h.y,v,x,_),yy.initNonuniformCatmullRom(c.z,d.z,p.z,h.z,v,x,_)}else this.curveType==="catmullrom"&&(gy.initCatmullRom(c.x,d.x,p.x,h.x,this.tension),vy.initCatmullRom(c.y,d.y,p.y,h.y,this.tension),yy.initCatmullRom(c.z,d.z,p.z,h.z,this.tension));return n.set(gy.calc(l),vy.calc(l),yy.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new j().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function IE(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function nI(i,e){const t=1-i;return t*t*e}function iI(i,e){return 2*(1-i)*i*e}function rI(i,e){return i*i*e}function hf(i,e,t,n){return nI(i,e)+iI(i,t)+rI(i,n)}function sI(i,e){const t=1-i;return t*t*t*e}function aI(i,e){const t=1-i;return 3*t*t*i*e}function oI(i,e){return 3*(1-i)*i*i*e}function lI(i,e){return i*i*i*e}function ff(i,e,t,n,r){return sI(i,e)+aI(i,t)+oI(i,n)+lI(i,r)}class a1 extends us{constructor(e=new ke,t=new ke,n=new ke,r=new ke){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ke){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(ff(e,r.x,s.x,a.x,o.x),ff(e,r.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class w2 extends us{constructor(e=new j,t=new j,n=new j,r=new j){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new j){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(ff(e,r.x,s.x,a.x,o.x),ff(e,r.y,s.y,a.y,o.y),ff(e,r.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class o1 extends us{constructor(e=new ke,t=new ke){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ke){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ke){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class l1 extends us{constructor(e=new j,t=new j){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new j){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new j){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class c1 extends us{constructor(e=new ke,t=new ke,n=new ke){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ke){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(hf(e,r.x,s.x,a.x),hf(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Jg extends us{constructor(e=new j,t=new j,n=new j){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new j){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(hf(e,r.x,s.x,a.x),hf(e,r.y,s.y,a.y),hf(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class u1 extends us{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ke){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],h=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(IE(o,l.x,c.x,h.x,d.x),IE(o,l.y,c.y,h.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ke().fromArray(r))}return this}}var rg=Object.freeze({__proto__:null,ArcCurve:M2,CatmullRomCurve3:Kg,CubicBezierCurve:a1,CubicBezierCurve3:w2,EllipseCurve:Zg,LineCurve:o1,LineCurve3:l1,QuadraticBezierCurve:c1,QuadraticBezierCurve3:Jg,SplineCurve:u1});class T2 extends us{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new rg[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const a=r[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const a=s[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(new rg[r.type]().fromJSON(r))}return this}}class sg extends T2{constructor(e){super(),this.type="Path",this.currentPoint=new ke,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new o1(this.currentPoint.clone(),new ke(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const s=new c1(this.currentPoint.clone(),new ke(e,t),new ke(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,a){const o=new a1(this.currentPoint.clone(),new ke(e,t),new ke(n,r),new ke(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new u1(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,r,s,a),this}absarc(e,t,n,r,s,a){return this.absellipse(e,t,n,n,r,s,a),this}ellipse(e,t,n,r,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,r,s,a,o,l),this}absellipse(e,t,n,r,s,a,o,l){const c=new Zg(e,t,n,r,s,a,o,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class oo extends sg{constructor(e){super(e),this.uuid=_r(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(new sg().fromJSON(r))}return this}}function cI(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=A2(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=pI(i,e,s,t)),i.length>80*t){o=1/0,l=1/0;let h=-1/0,d=-1/0;for(let p=t;p<r;p+=t){const m=i[p],v=i[p+1];m<o&&(o=m),v<l&&(l=v),m>h&&(h=m),v>d&&(d=v)}c=Math.max(h-o,d-l),c=c!==0?32767/c:0}return Df(s,a,t,o,l,c,0),a}function A2(i,e,t,n,r){let s;if(r===wI(i,e,t,n)>0)for(let a=e;a<t;a+=n)s=NE(a/n|0,i[a],i[a+1],s);else for(let a=t-n;a>=e;a-=n)s=NE(a/n|0,i[a],i[a+1],s);return s&&gu(s,s.next)&&(Of(s),s=s.next),s}function Cl(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(gu(t,t.next)||Tn(t.prev,t,t.next)===0)){if(Of(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Df(i,e,t,n,r,s,a){if(!i)return;!a&&s&&_I(i,n,r,s);let o=i;for(;i.prev!==i.next;){const l=i.prev,c=i.next;if(s?hI(i,n,r,s):uI(i)){e.push(l.i,i.i,c.i),Of(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=fI(Cl(i),e),Df(i,e,t,n,r,s,2)):a===2&&dI(i,e,t,n,r,s):Df(Cl(i),e,t,n,r,s,1);break}}}function uI(i){const e=i.prev,t=i,n=i.next;if(Tn(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,h=Math.min(r,s,a),d=Math.min(o,l,c),p=Math.max(r,s,a),m=Math.max(o,l,c);let v=n.next;for(;v!==e;){if(v.x>=h&&v.x<=p&&v.y>=d&&v.y<=m&&Zh(r,o,s,l,a,c,v.x,v.y)&&Tn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function hI(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Tn(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,d=s.y,p=a.y,m=Math.min(o,l,c),v=Math.min(h,d,p),x=Math.max(o,l,c),_=Math.max(h,d,p),g=K_(m,v,e,t,n),b=K_(x,_,e,t,n);let E=i.prevZ,S=i.nextZ;for(;E&&E.z>=g&&S&&S.z<=b;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=_&&E!==r&&E!==a&&Zh(o,h,l,d,c,p,E.x,E.y)&&Tn(E.prev,E,E.next)>=0||(E=E.prevZ,S.x>=m&&S.x<=x&&S.y>=v&&S.y<=_&&S!==r&&S!==a&&Zh(o,h,l,d,c,p,S.x,S.y)&&Tn(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;E&&E.z>=g;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=_&&E!==r&&E!==a&&Zh(o,h,l,d,c,p,E.x,E.y)&&Tn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;S&&S.z<=b;){if(S.x>=m&&S.x<=x&&S.y>=v&&S.y<=_&&S!==r&&S!==a&&Zh(o,h,l,d,c,p,S.x,S.y)&&Tn(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function fI(i,e){let t=i;do{const n=t.prev,r=t.next.next;!gu(n,r)&&R2(n,t,t.next,r)&&Uf(n,r)&&Uf(r,n)&&(e.push(n.i,t.i,r.i),Of(t),Of(t.next),t=i=r),t=t.next}while(t!==i);return Cl(t)}function dI(i,e,t,n,r,s){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&SI(a,o)){let l=D2(a,o);a=Cl(a,a.next),l=Cl(l,l.next),Df(a,e,t,n,r,s,0),Df(l,e,t,n,r,s,0);return}o=o.next}a=a.next}while(a!==i)}function pI(i,e,t,n){const r=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,l=s<a-1?e[s+1]*n:i.length,c=A2(i,o,l,n,!1);c===c.next&&(c.steiner=!0),r.push(bI(c))}r.sort(mI);for(let s=0;s<r.length;s++)t=gI(r[s],t);return t}function mI(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function gI(i,e){const t=vI(i,e);if(!t)return e;const n=D2(t,i);return Cl(n,n.next),Cl(t,t.next)}function vI(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,a;if(gu(i,t))return t;do{if(gu(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const d=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s&&(s=d,a=t.x<t.next.x?t:t.next,d===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=l&&n!==t.x&&C2(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){const d=Math.abs(r-t.y)/(n-t.x);Uf(t,i)&&(d<h||d===h&&(t.x>a.x||t.x===a.x&&yI(a,t)))&&(a=t,h=d)}t=t.next}while(t!==o);return a}function yI(i,e){return Tn(i.prev,i,e.prev)<0&&Tn(e.next,i,i.next)<0}function _I(i,e,t,n){let r=i;do r.z===0&&(r.z=K_(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,xI(r)}function xI(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let c=0;c<t&&(o++,a=a.nextZ,!!a);c++);let l=t;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(r=n,n=n.nextZ,o--):(r=a,a=a.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=a}s.nextZ=null,t*=2}while(e>1);return i}function K_(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function bI(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function C2(i,e,t,n,r,s,a,o){return(r-a)*(e-o)>=(i-a)*(s-o)&&(i-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(n-o)}function Zh(i,e,t,n,r,s,a,o){return!(i===a&&e===o)&&C2(i,e,t,n,r,s,a,o)}function SI(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!EI(i,e)&&(Uf(i,e)&&Uf(e,i)&&MI(i,e)&&(Tn(i.prev,i,e.prev)||Tn(i,e.prev,e))||gu(i,e)&&Tn(i.prev,i,i.next)>0&&Tn(e.prev,e,e.next)>0)}function Tn(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function gu(i,e){return i.x===e.x&&i.y===e.y}function R2(i,e,t,n){const r=wp(Tn(i,e,t)),s=wp(Tn(i,e,n)),a=wp(Tn(t,n,i)),o=wp(Tn(t,n,e));return!!(r!==s&&a!==o||r===0&&Mp(i,t,e)||s===0&&Mp(i,n,e)||a===0&&Mp(t,i,n)||o===0&&Mp(t,e,n))}function Mp(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function wp(i){return i>0?1:i<0?-1:0}function EI(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&R2(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Uf(i,e){return Tn(i.prev,i,i.next)<0?Tn(i,e,i.next)>=0&&Tn(i,i.prev,e)>=0:Tn(i,e,i.prev)<0||Tn(i,i.next,e)<0}function MI(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function D2(i,e){const t=J_(i.i,i.x,i.y),n=J_(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function NE(i,e,t,n){const r=J_(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Of(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function J_(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function wI(i,e,t,n){let r=0;for(let s=e,a=t-n;s<t;s+=n)r+=(i[a]-i[s])*(i[s+1]+i[a+1]),a=s;return r}class TI{static triangulate(e,t,n=2){return cI(e,t,n)}}class os{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return os.area(e)<0}static triangulateShape(e,t){const n=[],r=[],s=[];PE(e),zE(n,e);let a=e.length;t.forEach(PE);for(let l=0;l<t.length;l++)r.push(a),a+=t[l].length,zE(n,t[l]);const o=TI.triangulate(n,r);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function PE(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function zE(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class Qg extends Rt{constructor(e=new oo([new ke(.5,.5),new ke(-.5,.5),new ke(-.5,-.5),new ke(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new ft(r,3)),this.setAttribute("uv",new ft(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:m-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,_=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:AI;let E,S=!1,w,T,R,U;g&&(E=g.getSpacedPoints(h),S=!0,p=!1,w=g.computeFrenetFrames(h,!1),T=new j,R=new j,U=new j),p||(_=0,m=0,v=0,x=0);const A=o.extractPoints(c);let D=A.shape;const L=A.holes;if(!os.isClockWise(D)){D=D.reverse();for(let oe=0,se=L.length;oe<se;oe++){const $=L[oe];os.isClockWise($)&&(L[oe]=$.reverse())}}function I(oe){const $=10000000000000001e-36;let pe=oe[0];for(let ye=1;ye<=oe.length;ye++){const xe=ye%oe.length,be=oe[xe],ue=be.x-pe.x,He=be.y-pe.y,W=ue*ue+He*He,F=Math.max(Math.abs(be.x),Math.abs(be.y),Math.abs(pe.x),Math.abs(pe.y)),ne=$*F*F;if(W<=ne){oe.splice(xe,1),ye--;continue}pe=be}}I(D),L.forEach(I);const V=L.length,H=D;for(let oe=0;oe<V;oe++){const se=L[oe];D=D.concat(se)}function z(oe,se,$){return se||console.error("THREE.ExtrudeGeometry: vec does not exist"),oe.clone().addScaledVector(se,$)}const O=D.length;function B(oe,se,$){let pe,ye,xe;const be=oe.x-se.x,ue=oe.y-se.y,He=$.x-oe.x,W=$.y-oe.y,F=be*be+ue*ue,ne=be*W-ue*He;if(Math.abs(ne)>Number.EPSILON){const Se=Math.sqrt(F),_e=Math.sqrt(He*He+W*W),me=se.x-ue/Se,ze=se.y+be/Se,Ne=$.x-W/_e,je=$.y+He/_e,Ze=((Ne-me)*W-(je-ze)*He)/(be*W-ue*He);pe=me+be*Ze-oe.x,ye=ze+ue*Ze-oe.y;const Le=pe*pe+ye*ye;if(Le<=2)return new ke(pe,ye);xe=Math.sqrt(Le/2)}else{let Se=!1;be>Number.EPSILON?He>Number.EPSILON&&(Se=!0):be<-Number.EPSILON?He<-Number.EPSILON&&(Se=!0):Math.sign(ue)===Math.sign(W)&&(Se=!0),Se?(pe=-ue,ye=be,xe=Math.sqrt(F)):(pe=be,ye=ue,xe=Math.sqrt(F/2))}return new ke(pe/xe,ye/xe)}const G=[];for(let oe=0,se=H.length,$=se-1,pe=oe+1;oe<se;oe++,$++,pe++)$===se&&($=0),pe===se&&(pe=0),G[oe]=B(H[oe],H[$],H[pe]);const X=[];let k,Y=G.concat();for(let oe=0,se=V;oe<se;oe++){const $=L[oe];k=[];for(let pe=0,ye=$.length,xe=ye-1,be=pe+1;pe<ye;pe++,xe++,be++)xe===ye&&(xe=0),be===ye&&(be=0),k[pe]=B($[pe],$[xe],$[be]);X.push(k),Y=Y.concat(k)}let Q;if(_===0)Q=os.triangulateShape(H,L);else{const oe=[],se=[];for(let $=0;$<_;$++){const pe=$/_,ye=m*Math.cos(pe*Math.PI/2),xe=v*Math.sin(pe*Math.PI/2)+x;for(let be=0,ue=H.length;be<ue;be++){const He=z(H[be],G[be],xe);Ae(He.x,He.y,-ye),pe===0&&oe.push(He)}for(let be=0,ue=V;be<ue;be++){const He=L[be];k=X[be];const W=[];for(let F=0,ne=He.length;F<ne;F++){const Se=z(He[F],k[F],xe);Ae(Se.x,Se.y,-ye),pe===0&&W.push(Se)}pe===0&&se.push(W)}}Q=os.triangulateShape(oe,se)}const te=Q.length,ee=v+x;for(let oe=0;oe<O;oe++){const se=p?z(D[oe],Y[oe],ee):D[oe];S?(R.copy(w.normals[0]).multiplyScalar(se.x),T.copy(w.binormals[0]).multiplyScalar(se.y),U.copy(E[0]).add(R).add(T),Ae(U.x,U.y,U.z)):Ae(se.x,se.y,0)}for(let oe=1;oe<=h;oe++)for(let se=0;se<O;se++){const $=p?z(D[se],Y[se],ee):D[se];S?(R.copy(w.normals[oe]).multiplyScalar($.x),T.copy(w.binormals[oe]).multiplyScalar($.y),U.copy(E[oe]).add(R).add(T),Ae(U.x,U.y,U.z)):Ae($.x,$.y,d/h*oe)}for(let oe=_-1;oe>=0;oe--){const se=oe/_,$=m*Math.cos(se*Math.PI/2),pe=v*Math.sin(se*Math.PI/2)+x;for(let ye=0,xe=H.length;ye<xe;ye++){const be=z(H[ye],G[ye],pe);Ae(be.x,be.y,d+$)}for(let ye=0,xe=L.length;ye<xe;ye++){const be=L[ye];k=X[ye];for(let ue=0,He=be.length;ue<He;ue++){const W=z(be[ue],k[ue],pe);S?Ae(W.x,W.y+E[h-1].y,E[h-1].x+$):Ae(W.x,W.y,d+$)}}}ie(),re();function ie(){const oe=r.length/3;if(p){let se=0,$=O*se;for(let pe=0;pe<te;pe++){const ye=Q[pe];Me(ye[2]+$,ye[1]+$,ye[0]+$)}se=h+_*2,$=O*se;for(let pe=0;pe<te;pe++){const ye=Q[pe];Me(ye[0]+$,ye[1]+$,ye[2]+$)}}else{for(let se=0;se<te;se++){const $=Q[se];Me($[2],$[1],$[0])}for(let se=0;se<te;se++){const $=Q[se];Me($[0]+O*h,$[1]+O*h,$[2]+O*h)}}n.addGroup(oe,r.length/3-oe,0)}function re(){const oe=r.length/3;let se=0;de(H,se),se+=H.length;for(let $=0,pe=L.length;$<pe;$++){const ye=L[$];de(ye,se),se+=ye.length}n.addGroup(oe,r.length/3-oe,1)}function de(oe,se){let $=oe.length;for(;--$>=0;){const pe=$;let ye=$-1;ye<0&&(ye=oe.length-1);for(let xe=0,be=h+_*2;xe<be;xe++){const ue=O*xe,He=O*(xe+1),W=se+pe+ue,F=se+ye+ue,ne=se+ye+He,Se=se+pe+He;ve(W,F,ne,Se)}}}function Ae(oe,se,$){l.push(oe),l.push(se),l.push($)}function Me(oe,se,$){fe(oe),fe(se),fe($);const pe=r.length/3,ye=b.generateTopUV(n,r,pe-3,pe-2,pe-1);J(ye[0]),J(ye[1]),J(ye[2])}function ve(oe,se,$,pe){fe(oe),fe(se),fe(pe),fe(se),fe($),fe(pe);const ye=r.length/3,xe=b.generateSideWallUV(n,r,ye-6,ye-3,ye-2,ye-1);J(xe[0]),J(xe[1]),J(xe[3]),J(xe[1]),J(xe[2]),J(xe[3])}function fe(oe){r.push(l[oe*3+0]),r.push(l[oe*3+1]),r.push(l[oe*3+2])}function J(oe){s.push(oe.x),s.push(oe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return CI(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new rg[r.type]().fromJSON(r)),new Qg(n,e.options)}}const AI={generateTopUV:function(i,e,t,n,r){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[r*3],h=e[r*3+1];return[new ke(s,a),new ke(o,l),new ke(c,h)]},generateSideWallUV:function(i,e,t,n,r,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],h=e[n*3+1],d=e[n*3+2],p=e[r*3],m=e[r*3+1],v=e[r*3+2],x=e[s*3],_=e[s*3+1],g=e[s*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new ke(a,1-l),new ke(c,1-d),new ke(p,1-v),new ke(x,1-g)]:[new ke(o,1-l),new ke(h,1-d),new ke(m,1-v),new ke(_,1-g)]}};function CI(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class $g extends vo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new $g(e.radius,e.detail)}}class e0 extends Rt{constructor(e=[new ke(0,-.5),new ke(.5,0),new ke(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=St(r,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/t,d=new j,p=new ke,m=new j,v=new j,x=new j;let _=0,g=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:_=e[b+1].x-e[b].x,g=e[b+1].y-e[b].y,m.x=g*1,m.y=-_,m.z=g*0,x.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:_=e[b+1].x-e[b].x,g=e[b+1].y-e[b].y,m.x=g*1,m.y=-_,m.z=g*0,v.copy(m),m.x+=x.x,m.y+=x.y,m.z+=x.z,m.normalize(),l.push(m.x,m.y,m.z),x.copy(v)}for(let b=0;b<=t;b++){const E=n+b*h*r,S=Math.sin(E),w=Math.cos(E);for(let T=0;T<=e.length-1;T++){d.x=e[T].x*S,d.y=e[T].y,d.z=e[T].x*w,a.push(d.x,d.y,d.z),p.x=b/t,p.y=T/(e.length-1),o.push(p.x,p.y);const R=l[3*T+0]*S,U=l[3*T+1],A=l[3*T+0]*w;c.push(R,U,A)}}for(let b=0;b<t;b++)for(let E=0;E<e.length-1;E++){const S=E+b*e.length,w=S,T=S+e.length,R=S+e.length+1,U=S+1;s.push(w,T,U),s.push(R,U,T)}this.setIndex(s),this.setAttribute("position",new ft(a,3)),this.setAttribute("uv",new ft(o,2)),this.setAttribute("normal",new ft(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new e0(e.points,e.segments,e.phiStart,e.phiLength)}}class ed extends vo{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ed(e.radius,e.detail)}}class Ma extends Rt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,d=e/o,p=t/l,m=[],v=[],x=[],_=[];for(let g=0;g<h;g++){const b=g*p-a;for(let E=0;E<c;E++){const S=E*d-s;v.push(S,-b,0),x.push(0,0,1),_.push(E/o),_.push(1-g/l)}}for(let g=0;g<l;g++)for(let b=0;b<o;b++){const E=b+c*g,S=b+c*(g+1),w=b+1+c*(g+1),T=b+1+c*g;m.push(E,S,T),m.push(S,w,T)}this.setIndex(m),this.setAttribute("position",new ft(v,3)),this.setAttribute("normal",new ft(x,3)),this.setAttribute("uv",new ft(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ma(e.width,e.height,e.widthSegments,e.heightSegments)}}class t0 extends Rt{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],h=[];let d=e;const p=(t-e)/r,m=new j,v=new ke;for(let x=0;x<=r;x++){for(let _=0;_<=n;_++){const g=s+_/n*a;m.x=d*Math.cos(g),m.y=d*Math.sin(g),l.push(m.x,m.y,m.z),c.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,h.push(v.x,v.y)}d+=p}for(let x=0;x<r;x++){const _=x*(n+1);for(let g=0;g<n;g++){const b=g+_,E=b,S=b+n+1,w=b+n+2,T=b+1;o.push(E,S,T),o.push(S,w,T)}}this.setIndex(o),this.setAttribute("position",new ft(l,3)),this.setAttribute("normal",new ft(c,3)),this.setAttribute("uv",new ft(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new t0(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class n0 extends Rt{constructor(e=new oo([new ke(0,.5),new ke(-.5,-.5),new ke(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new ft(r,3)),this.setAttribute("normal",new ft(s,3)),this.setAttribute("uv",new ft(a,2));function c(h){const d=r.length/3,p=h.extractPoints(t);let m=p.shape;const v=p.holes;os.isClockWise(m)===!1&&(m=m.reverse());for(let _=0,g=v.length;_<g;_++){const b=v[_];os.isClockWise(b)===!0&&(v[_]=b.reverse())}const x=os.triangulateShape(m,v);for(let _=0,g=v.length;_<g;_++){const b=v[_];m=m.concat(b)}for(let _=0,g=m.length;_<g;_++){const b=m[_];r.push(b.x,b.y,0),s.push(0,0,1),a.push(b.x,b.y)}for(let _=0,g=x.length;_<g;_++){const b=x[_],E=b[0]+d,S=b[1]+d,w=b[2]+d;n.push(E,S,w),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return RI(t,e)}static fromJSON(e,t){const n=[];for(let r=0,s=e.shapes.length;r<s;r++){const a=t[e.shapes[r]];n.push(a)}return new n0(n,e.curveSegments)}}function RI(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const r=i[t];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e}class td extends Rt{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],d=new j,p=new j,m=[],v=[],x=[],_=[];for(let g=0;g<=n;g++){const b=[],E=g/n;let S=0;g===0&&a===0?S=.5/t:g===n&&l===Math.PI&&(S=-.5/t);for(let w=0;w<=t;w++){const T=w/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+E*o),d.y=e*Math.cos(a+E*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+E*o),v.push(d.x,d.y,d.z),p.copy(d).normalize(),x.push(p.x,p.y,p.z),_.push(T+S,1-E),b.push(c++)}h.push(b)}for(let g=0;g<n;g++)for(let b=0;b<t;b++){const E=h[g][b+1],S=h[g][b],w=h[g+1][b],T=h[g+1][b+1];(g!==0||a>0)&&m.push(E,S,T),(g!==n-1||l<Math.PI)&&m.push(S,w,T)}this.setIndex(m),this.setAttribute("position",new ft(v,3)),this.setAttribute("normal",new ft(x,3)),this.setAttribute("uv",new ft(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new td(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class i0 extends vo{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new i0(e.radius,e.detail)}}class r0 extends Rt{constructor(e=1,t=.4,n=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:s},n=Math.floor(n),r=Math.floor(r);const a=[],o=[],l=[],c=[],h=new j,d=new j,p=new j;for(let m=0;m<=n;m++)for(let v=0;v<=r;v++){const x=v/r*s,_=m/n*Math.PI*2;d.x=(e+t*Math.cos(_))*Math.cos(x),d.y=(e+t*Math.cos(_))*Math.sin(x),d.z=t*Math.sin(_),o.push(d.x,d.y,d.z),h.x=e*Math.cos(x),h.y=e*Math.sin(x),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),c.push(v/r),c.push(m/n)}for(let m=1;m<=n;m++)for(let v=1;v<=r;v++){const x=(r+1)*m+v-1,_=(r+1)*(m-1)+v-1,g=(r+1)*(m-1)+v,b=(r+1)*m+v;a.push(x,_,b),a.push(_,g,b)}this.setIndex(a),this.setAttribute("position",new ft(o,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r0(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class s0 extends Rt{constructor(e=1,t=.4,n=64,r=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:s,q:a},n=Math.floor(n),r=Math.floor(r);const o=[],l=[],c=[],h=[],d=new j,p=new j,m=new j,v=new j,x=new j,_=new j,g=new j;for(let E=0;E<=n;++E){const S=E/n*s*Math.PI*2;b(S,s,a,e,m),b(S+.01,s,a,e,v),_.subVectors(v,m),g.addVectors(v,m),x.crossVectors(_,g),g.crossVectors(x,_),x.normalize(),g.normalize();for(let w=0;w<=r;++w){const T=w/r*Math.PI*2,R=-t*Math.cos(T),U=t*Math.sin(T);d.x=m.x+(R*g.x+U*x.x),d.y=m.y+(R*g.y+U*x.y),d.z=m.z+(R*g.z+U*x.z),l.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),c.push(p.x,p.y,p.z),h.push(E/n),h.push(w/r)}}for(let E=1;E<=n;E++)for(let S=1;S<=r;S++){const w=(r+1)*(E-1)+(S-1),T=(r+1)*E+(S-1),R=(r+1)*E+S,U=(r+1)*(E-1)+S;o.push(w,T,U),o.push(T,R,U)}this.setIndex(o),this.setAttribute("position",new ft(l,3)),this.setAttribute("normal",new ft(c,3)),this.setAttribute("uv",new ft(h,2));function b(E,S,w,T,R){const U=Math.cos(E),A=Math.sin(E),D=w/S*E,L=Math.cos(D);R.x=T*(2+L)*.5*U,R.y=T*(2+L)*A*.5,R.z=T*Math.sin(D)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s0(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class fo extends Rt{constructor(e=new Jg(new j(-1,-1,0),new j(-1,1,0),new j(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new j,l=new j,c=new ke;let h=new j;const d=[],p=[],m=[],v=[];x(),this.setIndex(v),this.setAttribute("position",new ft(d,3)),this.setAttribute("normal",new ft(p,3)),this.setAttribute("uv",new ft(m,2));function x(){for(let E=0;E<t;E++)_(E);_(s===!1?t:0),b(),g()}function _(E){h=e.getPointAt(E/t,h);const S=a.normals[E],w=a.binormals[E];for(let T=0;T<=r;T++){const R=T/r*Math.PI*2,U=Math.sin(R),A=-Math.cos(R);l.x=A*S.x+U*w.x,l.y=A*S.y+U*w.y,l.z=A*S.z+U*w.z,l.normalize(),p.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,d.push(o.x,o.y,o.z)}}function g(){for(let E=1;E<=t;E++)for(let S=1;S<=r;S++){const w=(r+1)*(E-1)+(S-1),T=(r+1)*E+(S-1),R=(r+1)*E+S,U=(r+1)*(E-1)+S;v.push(w,T,U),v.push(T,R,U)}}function b(){for(let E=0;E<=t;E++)for(let S=0;S<=r;S++)c.x=E/t,c.y=S/r,m.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new fo(new rg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class U2 extends Rt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new j,s=new j;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const d=l[c],p=d.start,m=d.count;for(let v=p,x=p+m;v<x;v+=3)for(let _=0;_<3;_++){const g=o.getX(v+_),b=o.getX(v+(_+1)%3);r.fromBufferAttribute(a,g),s.fromBufferAttribute(a,b),FE(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,d=3*o+(c+1)%3;r.fromBufferAttribute(a,h),s.fromBufferAttribute(a,d),FE(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ft(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function FE(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var BE=Object.freeze({__proto__:null,BoxGeometry:go,CapsuleGeometry:jg,CircleGeometry:qg,ConeGeometry:$f,CylinderGeometry:Cu,DodecahedronGeometry:Yg,EdgesGeometry:E2,ExtrudeGeometry:Qg,IcosahedronGeometry:$g,LatheGeometry:e0,OctahedronGeometry:ed,PlaneGeometry:Ma,PolyhedronGeometry:vo,RingGeometry:t0,ShapeGeometry:n0,SphereGeometry:td,TetrahedronGeometry:i0,TorusGeometry:r0,TorusKnotGeometry:s0,TubeGeometry:fo,WireframeGeometry:U2});class O2 extends Ui{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ye(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class L2 extends Hr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class h1 extends Ui{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ye(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class I2 extends h1{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ke(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return St(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ye(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ye(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ye(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class N2 extends Ui{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ye(16777215),this.specular=new Ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class P2 extends Ui{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ye(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class z2 extends Ui{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class F2 extends Ui{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class a0 extends Ui{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=QA,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class o0 extends Ui{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class B2 extends Ui{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ye(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mo,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class k2 extends ki{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function vl(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function G2(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function H2(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Q_(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function f1(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}function DI(i,e,t,n,r=30){const s=i.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),d=[],p=[];for(let m=0;m<c.times.length;++m){const v=c.times[m]*r;if(!(v<t||v>=n)){d.push(c.times[m]);for(let x=0;x<h;++x)p.push(c.values[m*h+x])}}d.length!==0&&(c.times=vl(d,c.times.constructor),c.values=vl(p,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function UI(i,e=0,t=i,n=30){n<=0&&(n=30);const r=t.tracks.length,s=e/n;for(let a=0;a<r;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=i.tracks.find(function(g){return g.name===o.name&&g.ValueTypeName===l});if(c===void 0)continue;let h=0;const d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=d/3);let p=0;const m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);const v=o.times.length-1;let x;if(s<=o.times[0]){const g=h,b=d-h;x=o.values.slice(g,b)}else if(s>=o.times[v]){const g=v*d+h,b=g+d-h;x=o.values.slice(g,b)}else{const g=o.createInterpolant(),b=h,E=d-h;g.evaluate(s),x=g.resultBuffer.slice(b,E)}l==="quaternion"&&new yi().fromArray(x).normalize().conjugate().toArray(x);const _=c.times.length;for(let g=0;g<_;++g){const b=g*m+p;if(l==="quaternion")yi.multiplyQuaternionsFlat(c.values,b,x,0,c.values,b);else{const E=m-p*2;for(let S=0;S<E;++S)c.values[b+S]-=x[S]}}}return i.blendMode=jx,i}class OI{static convertArray(e,t){return vl(e,t)}static isTypedArray(e){return G2(e)}static getKeyframeOrder(e){return H2(e)}static sortedArray(e,t,n){return Q_(e,t,n)}static flattenJSON(e,t,n,r){f1(e,t,n,r)}static subclip(e,t,n,r,s=30){return DI(e,t,n,r,s)}static makeClipAdditive(e,t=0,n=e,r=30){return UI(e,t,n,r)}}class nd{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class V2 extends nd{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ml,endingEnd:ml}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case gl:s=e,o=2*t-n;break;case wf:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case gl:a=e,l=2*n-t;break;case wf:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,d=this._offsetNext,p=this._weightPrev,m=this._weightNext,v=(n-t)/(r-t),x=v*v,_=x*v,g=-p*_+2*p*x-p*v,b=(1+p)*_+(-1.5-2*p)*x+(-.5+p)*v+1,E=(-1-m)*_+(1.5+m)*x+.5*v,S=m*_-m*x;for(let w=0;w!==o;++w)s[w]=g*a[h+w]+b*a[c+w]+E*a[l+w]+S*a[d+w];return s}}class d1 extends nd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(r-t),d=1-h;for(let p=0;p!==o;++p)s[p]=a[c+p]*d+a[l+p]*h;return s}}class W2 extends nd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Vr{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=vl(t,this.TimeBufferType),this.values=vl(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:vl(e.times,Array),values:vl(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new W2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new d1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new V2(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Mf:t=this.InterpolantFactoryMethodDiscrete;break;case eg:t=this.InterpolantFactoryMethodLinear;break;case sm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Mf;case this.InterpolantFactoryMethodLinear:return eg;case this.InterpolantFactoryMethodSmooth:return sm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&G2(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===sm,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{const d=o*n,p=d-n,m=d+n;for(let v=0;v!==n;++v){const x=t[d+v];if(x!==t[p+v]||x!==t[m+v]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const d=o*n,p=a*n;for(let m=0;m!==n;++m)t[p+m]=t[d+m]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Vr.prototype.ValueTypeName="";Vr.prototype.TimeBufferType=Float32Array;Vr.prototype.ValueBufferType=Float32Array;Vr.prototype.DefaultInterpolation=eg;class Il extends Vr{constructor(e,t,n){super(e,t,n)}}Il.prototype.ValueTypeName="bool";Il.prototype.ValueBufferType=Array;Il.prototype.DefaultInterpolation=Mf;Il.prototype.InterpolantFactoryMethodLinear=void 0;Il.prototype.InterpolantFactoryMethodSmooth=void 0;class p1 extends Vr{constructor(e,t,n,r){super(e,t,n,r)}}p1.prototype.ValueTypeName="color";class Lf extends Vr{constructor(e,t,n,r){super(e,t,n,r)}}Lf.prototype.ValueTypeName="number";class X2 extends nd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let h=c+o;c!==h;c+=4)yi.slerpFlat(s,0,a,c-o,a,c,l);return s}}class id extends Vr{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new X2(this.times,this.values,this.getValueSize(),e)}}id.prototype.ValueTypeName="quaternion";id.prototype.InterpolantFactoryMethodSmooth=void 0;class Nl extends Vr{constructor(e,t,n){super(e,t,n)}}Nl.prototype.ValueTypeName="string";Nl.prototype.ValueBufferType=Array;Nl.prototype.DefaultInterpolation=Mf;Nl.prototype.InterpolantFactoryMethodLinear=void 0;Nl.prototype.InterpolantFactoryMethodSmooth=void 0;class If extends Vr{constructor(e,t,n,r){super(e,t,n,r)}}If.prototype.ValueTypeName="vector";class Nf{constructor(e="",t=-1,n=[],r=Ng){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=_r(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(II(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(Vr.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=H2(l);l=Q_(l,1,h),c=Q_(c,1,h),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Lf(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(s);if(h&&h.length>1){const d=h[1];let p=r[d];p||(r[d]=p=[]),p.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,p,m,v,x){if(m.length!==0){const _=[],g=[];f1(m,_,g,v),_.length!==0&&x.push(new d(p,_,g))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const p=c[d].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const m={};let v;for(v=0;v<p.length;v++)if(p[v].morphTargets)for(let x=0;x<p[v].morphTargets.length;x++)m[p[v].morphTargets[x]]=-1;for(const x in m){const _=[],g=[];for(let b=0;b!==p[v].morphTargets.length;++b){const E=p[v];_.push(E.time),g.push(E.morphTarget===x?1:0)}r.push(new Lf(".morphTargetInfluence["+x+"]",_,g))}l=m.length*a}else{const m=".bones["+t[d].name+"]";n(If,m+".position",p,"pos",r),n(id,m+".quaternion",p,"rot",r),n(If,m+".scale",p,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function LI(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Lf;case"vector":case"vector2":case"vector3":case"vector4":return If;case"color":return p1;case"quaternion":return id;case"bool":case"boolean":return Il;case"string":return Nl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function II(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=LI(i.type);if(i.times===void 0){const t=[],n=[];f1(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const ws={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class m1{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){const d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,p=c.length;d<p;d+=2){const m=c[d],v=c[d+1];if(m.global&&(m.lastIndex=0),m.test(h))return v}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const j2=new m1;class nr{constructor(e){this.manager=e!==void 0?e:j2,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}nr.DEFAULT_MATERIAL_NAME="__DEFAULT";const ra={};class NI extends Error{constructor(e,t){super(e),this.response=t}}class ba extends nr{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=ws.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(ra[e]!==void 0){ra[e].push({onLoad:t,onProgress:n,onError:r});return}ra[e]=[],ra[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=ra[e],d=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),m=p?parseInt(p):0,v=m!==0;let x=0;const _=new ReadableStream({start(g){b();function b(){d.read().then(({done:E,value:S})=>{if(E)g.close();else{x+=S.byteLength;const w=new ProgressEvent("progress",{lengthComputable:v,loaded:x,total:m});for(let T=0,R=h.length;T<R;T++){const U=h[T];U.onProgress&&U.onProgress(w)}g.enqueue(S),b()}},E=>{g.error(E)})}}});return new Response(_)}else throw new NI(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{ws.add(`file:${e}`,c);const h=ra[e];delete ra[e];for(let d=0,p=h.length;d<p;d++){const m=h[d];m.onLoad&&m.onLoad(c)}}).catch(c=>{const h=ra[e];if(h===void 0)throw this.manager.itemError(e),c;delete ra[e];for(let d=0,p=h.length;d<p;d++){const m=h[d];m.onError&&m.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class PI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new ba(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t=[];for(let n=0;n<e.length;n++){const r=Nf.parse(e[n]);t.push(r)}return t}}class zI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=[],o=new Xg,l=new ba(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(d){l.load(e[d],function(p){const m=s.parse(p,!0);a[d]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},c+=1,c===6&&(m.mipmapCount===1&&(o.minFilter=Fn),o.image=a,o.format=m.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(let d=0,p=e.length;d<p;++d)h(d);else l.load(e,function(d){const p=s.parse(d,!0);if(p.isCubemap){const m=p.mipmaps.length/p.mipmapCount;for(let v=0;v<m;v++){a[v]={mipmaps:[]};for(let x=0;x<p.mipmapCount;x++)a[v].mipmaps.push(p.mipmaps[v*p.mipmapCount+x]),a[v].format=p.format,a[v].width=p.width,a[v].height=p.height}o.image=a}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=Fn),o.format=p.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}const Lc=new WeakMap;class Pf extends nr{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ws.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let d=Lc.get(a);d===void 0&&(d=[],Lc.set(a,d)),d.push({onLoad:t,onError:r})}return a}const o=Cf("img");function l(){h(),t&&t(this);const d=Lc.get(this)||[];for(let p=0;p<d.length;p++){const m=d[p];m.onLoad&&m.onLoad(this)}Lc.delete(this),s.manager.itemEnd(e)}function c(d){h(),r&&r(d),ws.remove(`image:${e}`);const p=Lc.get(this)||[];for(let m=0;m<p.length;m++){const v=p[m];v.onError&&v.onError(d)}Lc.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),ws.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class FI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=new Qf;s.colorSpace=Ri;const a=new Pf(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class BI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new As,o=new ba(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(h){if(r!==void 0)r(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Fr,a.wrapT=c.wrapT!==void 0?c.wrapT:Fr,a.magFilter=c.magFilter!==void 0?c.magFilter:Fn,a.minFilter=c.minFilter!==void 0?c.minFilter:Fn,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Ms),c.mipmapCount===1&&(a.minFilter=Fn),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,r),a}}class q2 extends nr{constructor(e){super(e)}load(e,t,n,r){const s=new Dn,a=new Pf(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class yo extends Xt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Y2 extends yo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Xt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const _y=new bt,kE=new j,GE=new j;class g1{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ke(512,512),this.mapType=Gr,this.map=null,this.mapPass=null,this.matrix=new bt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ll,this._frameExtents=new ke(1,1),this._viewportCount=1,this._viewports=[new Bt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;kE.setFromMatrixPosition(e.matrixWorld),t.position.copy(kE),GE.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(GE),t.updateMatrixWorld(),_y.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_y,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_y)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class kI extends g1{constructor(){super(new Kn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=du*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Z2 extends yo{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Xt.DEFAULT_UP),this.updateMatrix(),this.target=new Xt,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new kI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const HE=new bt,Mh=new j,xy=new j;class GI extends g1{constructor(){super(new Kn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ke(4,2),this._viewportCount=6,this._viewports=[new Bt(2,1,1,1),new Bt(0,1,1,1),new Bt(3,1,1,1),new Bt(1,1,1,1),new Bt(3,0,1,1),new Bt(1,0,1,1)],this._cubeDirections=[new j(1,0,0),new j(-1,0,0),new j(0,0,1),new j(0,0,-1),new j(0,1,0),new j(0,-1,0)],this._cubeUps=[new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,0,1),new j(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Mh.setFromMatrixPosition(e.matrixWorld),n.position.copy(Mh),xy.copy(n.position),xy.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(xy),n.updateMatrixWorld(),r.makeTranslation(-Mh.x,-Mh.y,-Mh.z),HE.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(HE,n.coordinateSystem,n.reversedDepth)}}class K2 extends yo{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new GI}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Pl extends Fg{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class HI extends g1{constructor(){super(new Pl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class J2 extends yo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Xt.DEFAULT_UP),this.updateMatrix(),this.target=new Xt,this.shadow=new HI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Q2 extends yo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class $2 extends yo{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class eC{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new j)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*r)),t.addScaledVector(a[5],1.092548*(r*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}}class tC extends yo{constructor(e=new eC,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class l0 extends nr{constructor(e){super(e),this.textures={}}load(e,t,n,r){const s=this,a=new ba(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new Ye().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=n(a.value);break;case"c":r.uniforms[s].value=new Ye().setHex(a.value);break;case"v2":r.uniforms[s].value=new ke().fromArray(a.value);break;case"v3":r.uniforms[s].value=new j().fromArray(a.value);break;case"v4":r.uniforms[s].value=new Bt().fromArray(a.value);break;case"m3":r.uniforms[s].value=new At().fromArray(a.value);break;case"m4":r.uniforms[s].value=new bt().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new ke().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new ke().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return l0.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:O2,SpriteMaterial:e1,RawShaderMaterial:L2,ShaderMaterial:Hr,PointsMaterial:n1,MeshPhysicalMaterial:I2,MeshStandardMaterial:h1,MeshPhongMaterial:N2,MeshToonMaterial:P2,MeshNormalMaterial:z2,MeshLambertMaterial:F2,MeshDepthMaterial:a0,MeshDistanceMaterial:o0,MeshBasicMaterial:Ea,MeshMatcapMaterial:B2,LineDashedMaterial:k2,LineBasicMaterial:ki,Material:Ui};return new t[e]}}class $_{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class v1 extends Rt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class nC extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new ba(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t={},n={};function r(m,v){if(t[v]!==void 0)return t[v];const _=m.interleavedBuffers[v],g=s(m,_.buffer),b=$c(_.type,g),E=new Hg(b,_.stride);return E.uuid=_.uuid,t[v]=E,E}function s(m,v){if(n[v]!==void 0)return n[v];const _=m.arrayBuffers[v],g=new Uint32Array(_).buffer;return n[v]=g,g}const a=e.isInstancedBufferGeometry?new v1:new Rt,o=e.data.index;if(o!==void 0){const m=$c(o.type,o.array);a.setIndex(new $t(m,1))}const l=e.data.attributes;for(const m in l){const v=l[m];let x;if(v.isInterleavedBufferAttribute){const _=r(e.data,v.data);x=new Tl(_,v.itemSize,v.offset,v.normalized)}else{const _=$c(v.type,v.array),g=v.isInstancedBufferAttribute?Al:$t;x=new g(_,v.itemSize,v.normalized)}v.name!==void 0&&(x.name=v.name),v.usage!==void 0&&x.setUsage(v.usage),a.setAttribute(m,x)}const c=e.data.morphAttributes;if(c)for(const m in c){const v=c[m],x=[];for(let _=0,g=v.length;_<g;_++){const b=v[_];let E;if(b.isInterleavedBufferAttribute){const S=r(e.data,b.data);E=new Tl(S,b.itemSize,b.offset,b.normalized)}else{const S=$c(b.type,b.array);E=new $t(S,b.itemSize,b.normalized)}b.name!==void 0&&(E.name=b.name),x.push(E)}a.morphAttributes[m]=x}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let m=0,v=d.length;m!==v;++m){const x=d[m];a.addGroup(x.start,x.count,x.materialIndex)}const p=e.data.boundingSphere;return p!==void 0&&(a.boundingSphere=new ri().fromJSON(p)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class VI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=this.path===""?$_.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new ba(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,r)}async loadAsync(e,t){const n=this,r=this.path===""?$_.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new ba(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,n),h=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),t!==void 0){let d=!1;for(const p in a)if(a[p].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let n=0,r=e.length;n<r;n++){const s=new oo().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Vg().fromJSON(e[s],r);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const r=new nC;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(l);break;default:l.type in BE?o=BE[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(e,t){const n={},r={};if(e!==void 0){const s=new l0;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),r[l.uuid]=n[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const r=e[n],s=Nf.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const n=this,r={};let s;function a(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(h)}else return l.data?{data:$c(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new m1(t);s=new Pf(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c<h;c++){const d=e[c],p=d.url;if(Array.isArray(p)){const m=[];for(let v=0,x=p.length;v<x;v++){const _=p[v],g=o(_);g!==null&&(g instanceof HTMLImageElement?m.push(g):m.push(new As(g.data,g.width,g.height)))}r[d.uuid]=new ro(m)}else{const m=o(d.url);r[d.uuid]=new ro(m)}}}return r}async parseImagesAsync(e){const t=this,n={};let r;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await r.loadAsync(l)}else return a.data?{data:$c(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){r=new Pf(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const h=[];for(let d=0,p=c.length;d<p;d++){const m=c[d],v=await s(m);v!==null&&(v instanceof HTMLImageElement?h.push(v):h.push(new As(v.data,v.width,v.height)))}n[l.uuid]=new ro(h)}else{const h=await s(l.url);n[l.uuid]=new ro(h)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const r={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let h;Array.isArray(c)?(h=new Qf,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new As:h=new Dn,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,WI)),o.channel!==void 0&&(h.channel=o.channel),o.offset!==void 0&&h.offset.fromArray(o.offset),o.repeat!==void 0&&h.repeat.fromArray(o.repeat),o.center!==void 0&&h.center.fromArray(o.center),o.rotation!==void 0&&(h.rotation=o.rotation),o.wrap!==void 0&&(h.wrapS=n(o.wrap[0],VE),h.wrapT=n(o.wrap[1],VE)),o.format!==void 0&&(h.format=o.format),o.internalFormat!==void 0&&(h.internalFormat=o.internalFormat),o.type!==void 0&&(h.type=o.type),o.colorSpace!==void 0&&(h.colorSpace=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,WE)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,WE)),o.anisotropy!==void 0&&(h.anisotropy=o.anisotropy),o.flipY!==void 0&&(h.flipY=o.flipY),o.generateMipmaps!==void 0&&(h.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(h.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(h.compareFunction=o.compareFunction),o.userData!==void 0&&(h.userData=o.userData),r[o.uuid]=h}return r}parseObject(e,t,n,r,s){let a;function o(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function l(p){if(p!==void 0){if(Array.isArray(p)){const m=[];for(let v=0,x=p.length;v<x;v++){const _=p[v];n[_]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",_),m.push(n[_])}return m}return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),n[p]}}function c(p){return r[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),r[p]}let h,d;switch(e.type){case"Scene":a=new Gg,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Ye(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new kg(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Bg(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new Kn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Pl(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Q2(e.color,e.intensity);break;case"DirectionalLight":a=new J2(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new K2(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new $2(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Z2(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new Y2(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new tC().fromJSON(e);break;case"SkinnedMesh":h=o(e.geometry),d=l(e.material),a=new v2(h,d),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":h=o(e.geometry),d=l(e.material),a=new mn(h,d);break;case"InstancedMesh":h=o(e.geometry),d=l(e.material);const p=e.count,m=e.instanceMatrix,v=e.instanceColor;a=new y2(h,d,p),a.instanceMatrix=new Al(new Float32Array(m.array),16),v!==void 0&&(a.instanceColor=new Al(new Float32Array(v.array),v.itemSize));break;case"BatchedMesh":h=o(e.geometry),d=l(e.material),a=new _2(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),a.geometry=h,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(x=>{let _=null,g=null;return x.boundingBox!==void 0&&(_=new Qn().fromJSON(x.boundingBox)),x.boundingSphere!==void 0&&(g=new ri().fromJSON(x.boundingSphere)),{...x,boundingBox:_,boundingSphere:g}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new ri().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Qn().fromJSON(e.boundingBox));break;case"LOD":a=new g2;break;case"Line":a=new ho(o(e.geometry),l(e.material));break;case"LineLoop":a=new x2(o(e.geometry),l(e.material));break;case"LineSegments":a=new Us(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new b2(o(e.geometry),l(e.material));break;case"Sprite":a=new m2(l(e.material));break;case"Group":a=new eu;break;case"Bone":a=new t1;break;default:a=new Xt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let m=0;m<p.length;m++)a.add(this.parseObject(p[m],t,n,r,s))}if(e.animations!==void 0){const p=e.animations;for(let m=0;m<p.length;m++){const v=p[m];a.animations.push(s[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const p=e.levels;for(let m=0;m<p.length;m++){const v=p[m],x=a.getObjectByProperty("uuid",v.object);x!==void 0&&a.addLevel(x,v.distance,v.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const r=t[n.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(r,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,r=e.getObjectByProperty("uuid",n);r!==void 0?t.target=r:t.target=new Xt}})}}const WI={UVMapping:Cg,CubeReflectionMapping:_a,CubeRefractionMapping:co,EquirectangularReflectionMapping:xf,EquirectangularRefractionMapping:bf,CubeUVReflectionMapping:wu},VE={RepeatWrapping:Sf,ClampToEdgeWrapping:Fr,MirroredRepeatWrapping:Ef},WE={NearestFilter:vi,NearestMipmapNearestFilter:Fx,NearestMipmapLinearFilter:Qc,LinearFilter:Fn,LinearMipmapNearestFilter:sf,LinearMipmapLinearFilter:Ms},by=new WeakMap;class XI extends nr{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ws.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(by.has(a)===!0)r&&r(by.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return ws.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),by.set(l,c),ws.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});ws.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Tp;class y1{static getContext(){return Tp===void 0&&(Tp=new(window.AudioContext||window.webkitAudioContext)),Tp}static setContext(e){Tp=e}}class jI extends nr{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new ba(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);y1.getContext().decodeAudioData(c,function(d){t(d)}).catch(o)}catch(c){o(c)}},n,r);function o(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const XE=new bt,jE=new bt,Qo=new bt;class qI{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Qo.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(bl*t.fov*.5)/t.zoom;let o,l;jE.elements[12]=-r,XE.elements[12]=r,o=-a*t.aspect+s,l=a*t.aspect+s,Qo.elements[0]=2*t.near/(l-o),Qo.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Qo),o=-a*t.aspect-s,l=a*t.aspect-s,Qo.elements[0]=2*t.near/(l-o),Qo.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Qo)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(jE),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(XE)}}class iC extends Kn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class _1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const $o=new j,Sy=new yi,YI=new j,el=new j,tl=new j;class ZI extends Xt{constructor(){super(),this.type="AudioListener",this.context=y1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new _1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose($o,Sy,YI),el.set(0,0,-1).applyQuaternion(Sy),tl.set(0,1,0).applyQuaternion(Sy),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime($o.x,n),t.positionY.linearRampToValueAtTime($o.y,n),t.positionZ.linearRampToValueAtTime($o.z,n),t.forwardX.linearRampToValueAtTime(el.x,n),t.forwardY.linearRampToValueAtTime(el.y,n),t.forwardZ.linearRampToValueAtTime(el.z,n),t.upX.linearRampToValueAtTime(tl.x,n),t.upY.linearRampToValueAtTime(tl.y,n),t.upZ.linearRampToValueAtTime(tl.z,n)}else t.setPosition($o.x,$o.y,$o.z),t.setOrientation(el.x,el.y,el.z,tl.x,tl.y,tl.z)}}class rC extends Xt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const nl=new j,qE=new yi,KI=new j,il=new j;class JI extends rC{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(nl,qE,KI),il.set(0,0,1).applyQuaternion(qE);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(nl.x,n),t.positionY.linearRampToValueAtTime(nl.y,n),t.positionZ.linearRampToValueAtTime(nl.z,n),t.orientationX.linearRampToValueAtTime(il.x,n),t.orientationY.linearRampToValueAtTime(il.y,n),t.orientationZ.linearRampToValueAtTime(il.z,n)}else t.setPosition(nl.x,nl.y,nl.z),t.setOrientation(il.x,il.y,il.z)}}class QI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class sC{constructor(e,t,n){this.binding=e,this.valueSize=n;let r,s,a;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:r=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,r=this.valueSize,s=e*r+r;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==r;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,r)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,r=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,r,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let s=n,a=r;s!==a;++s)t[s]=t[r+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,s){if(r>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,r){yi.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,s){const a=this._workIndex*s;yi.multiplyQuaternionsFlat(e,a,e,t,e,n),yi.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,s){const a=1-r;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*r}}_lerpAdditive(e,t,n,r,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*r}}}const x1="\\[\\]\\.:\\/",$I=new RegExp("["+x1+"]","g"),b1="[^"+x1+"]",eN="[^"+x1.replace("\\.","")+"]",tN=/((?:WC+[\/:])*)/.source.replace("WC",b1),nN=/(WCOD+)?/.source.replace("WCOD",eN),iN=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",b1),rN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",b1),sN=new RegExp("^"+tN+nN+iN+rN+"$"),aN=["material","materials","bones","map"];class oN{constructor(e,t,n){const r=n||Wt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Wt{constructor(e,t,n){this.path=t,this.parsedPath=n||Wt.parseTrackName(t),this.node=Wt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Wt.Composite(e,t,n):new Wt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($I,"")}static parseTrackName(e){const t=sN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);aN.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Wt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Wt.Composite=oN;Wt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Wt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Wt.prototype.GetterByBindingType=[Wt.prototype._getValue_direct,Wt.prototype._getValue_array,Wt.prototype._getValue_arrayElement,Wt.prototype._getValue_toArray];Wt.prototype.SetterByBindingTypeAndVersioning=[[Wt.prototype._setValue_direct,Wt.prototype._setValue_direct_setNeedsUpdate,Wt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_array,Wt.prototype._setValue_array_setNeedsUpdate,Wt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_arrayElement,Wt.prototype._setValue_arrayElement_setNeedsUpdate,Wt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_fromArray,Wt.prototype._setValue_fromArray_setNeedsUpdate,Wt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class lN{constructor(){this.isAnimationObjectGroup=!0,this.uuid=_r(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let h=0,d=arguments.length;h!==d;++h){const p=arguments[h],m=p.uuid;let v=t[m];if(v===void 0){v=l++,t[m]=v,e.push(p);for(let x=0,_=a;x!==_;++x)s[x].push(new Wt(p,n[x],r[x]))}else if(v<c){o=e[v];const x=--c,_=e[x];t[_.uuid]=v,e[v]=_,t[m]=x,e[x]=p;for(let g=0,b=a;g!==b;++g){const E=s[g],S=E[x];let w=E[v];E[v]=S,w===void 0&&(w=new Wt(p,n[g],r[g])),E[x]=w}}else e[v]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,h=t[c];if(h!==void 0&&h>=s){const d=s++,p=e[d];t[p.uuid]=h,e[h]=p,t[c]=d,e[d]=l;for(let m=0,v=r;m!==v;++m){const x=n[m],_=x[d],g=x[h];x[h]=_,x[d]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,d=t[h];if(d!==void 0)if(delete t[h],d<s){const p=--s,m=e[p],v=--a,x=e[v];t[m.uuid]=d,e[d]=m,t[x.uuid]=p,e[p]=x,e.pop();for(let _=0,g=r;_!==g;++_){const b=n[_],E=b[p],S=b[v];b[d]=E,b[p]=S,b.pop()}}else{const p=--a,m=e[p];p>0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,x=r;v!==x;++v){const _=n[v];_[d]=_[p],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,d=new Array(c);r=s.length,n[e]=r,a.push(e),o.push(t),s.push(d);for(let p=h,m=l.length;p!==m;++p){const v=l[p];d[p]=new Wt(v,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),r[n]=r[o],r.pop()}}}class aC{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:ml,endingEnd:ml};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=KA,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const r=this._clip.duration,s=e._clip.duration,a=s/r,o=r/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,s=r.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case jx:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case Ng:default:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,s=this._loopCount;const a=n===JA;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(n===ZA){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const o=Math.floor(r/t);r-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=gl,r.endingEnd=gl):(e?r.endingStart=this.zeroSlopeAtStart?gl:ml:r.endingStart=wf,t?r.endingEnd=this.zeroSlopeAtEnd?gl:ml:r.endingEnd=wf)}_scheduleFading(e,t,n){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}const cN=new Float32Array(1);class uN extends Ds{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let d=0;d!==s;++d){const p=r[d],m=p.name;let v=h[m];if(v!==void 0)++v.referenceCount,a[d]=v;else{if(v=a[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const x=t&&t._propertyBindings[d].binding.parsedPath;v=new sC(Wt.create(n,m,x),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),a[d]=v}o[d].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,n)}const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const r=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const d=o.actionByRoot,p=(e._localRoot||this._root).uuid;delete d[p],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const r=this._bindingsByRootAndName,s=this._bindings;let a=r[t];a===void 0&&(a={},r[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[r]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new d1(new Float32Array(2),new Float32Array(2),1,cN),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const r=t||this._root,s=r.uuid;let a=typeof e=="string"?Nf.findByName(r,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Ng),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new aC(this,a,t,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(e,t){const n=t||this._root,r=n.uuid,s=typeof e=="string"?Nf.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(r,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,s=r[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=h,t[h]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class hN extends Kx{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=n,this.texture=new zg(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class S1{constructor(e){this.value=e}clone(){return new S1(this.value.clone===void 0?this.value:this.value.clone())}}let fN=0;class dN extends Ds{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:fN++}),this.name="",this.usage=Af,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,r=t.length;n<r;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class pN extends Hg{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class mN{constructor(e,t,n,r,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=s,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const YE=new bt;class E1{constructor(e,t,n=0,r=1/0){this.ray=new Au(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new pu,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return YE.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(YE),this}intersectObject(e,t=!0,n=[]){return ex(e,this,n,t),n.sort(ZE),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)ex(e[r],this,n,t);return n.sort(ZE),n}}function ZE(i,e){return i.distance-e.distance}function ex(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)ex(s[a],e,t,!0)}}let gN=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=vN.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function vN(){this._document.hidden===!1&&this.reset()}class oC{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=St(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(St(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class yN{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class M1{constructor(e,t,n,r){M1.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}}const KE=new ke;class _N{constructor(e=new ke(1/0,1/0),t=new ke(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=KE.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,KE).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const JE=new j,Ap=new j,Ic=new j,Nc=new j,Ey=new j,xN=new j,bN=new j;class SN{constructor(e=new j,t=new j){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){JE.subVectors(e,this.start),Ap.subVectors(this.end,this.start);const n=Ap.dot(Ap);let s=Ap.dot(JE)/n;return t&&(s=St(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=xN,n=bN){const r=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,h=e.end;Ic.subVectors(c,o),Nc.subVectors(h,l),Ey.subVectors(o,l);const d=Ic.dot(Ic),p=Nc.dot(Nc),m=Nc.dot(Ey);if(d<=r&&p<=r)return t.copy(o),n.copy(l),t.sub(n),t.dot(t);if(d<=r)s=0,a=m/p,a=St(a,0,1);else{const v=Ic.dot(Ey);if(p<=r)a=0,s=St(-v/d,0,1);else{const x=Ic.dot(Nc),_=d*p-x*x;_!==0?s=St((x*m-v*p)/_,0,1):s=0,a=(x*s+m)/p,a<0?(a=0,s=St(-v/d,0,1)):a>1&&(a=1,s=St((x-v)/d,0,1))}}return t.copy(o).add(Ic.multiplyScalar(s)),n.copy(l).add(Nc.multiplyScalar(a)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const QE=new j;class EN extends Xt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Rt,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,h=o/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new ft(r,3));const s=new ki({fog:!1,toneMapped:!1});this.cone=new Us(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),QE.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(QE),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Qa=new j,Cp=new bt,My=new bt;class MN extends Us{constructor(e){const t=lC(e),n=new Rt,r=[],s=[];for(let c=0;c<t.length;c++){const h=t[c];h.parent&&h.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new ft(r,3)),n.setAttribute("color",new ft(s,3));const a=new ki({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new Ye(255),l=new Ye(65280);this.setColors(o,l)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");My.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Cp.multiplyMatrices(My,o.matrixWorld),Qa.setFromMatrixPosition(Cp),r.setXYZ(a,Qa.x,Qa.y,Qa.z),Cp.multiplyMatrices(My,o.parent.matrixWorld),Qa.setFromMatrixPosition(Cp),r.setXYZ(a+1,Qa.x,Qa.y,Qa.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const r=this.geometry.getAttribute("color");for(let s=0;s<r.count;s+=2)r.setXYZ(s,e.r,e.g,e.b),r.setXYZ(s+1,t.r,t.g,t.b);return r.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function lC(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...lC(i.children[t]));return e}class wN extends mn{constructor(e,t,n){const r=new td(t,4,2),s=new Ea({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const TN=new j,$E=new Ye,eM=new Ye;class AN extends Xt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const r=new ed(t);r.rotateY(Math.PI*.5),this.material=new Ea({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),a=new Float32Array(s.count*3);r.setAttribute("color",new $t(a,3)),this.add(new mn(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");$E.copy(this.light.color),eM.copy(this.light.groundColor);for(let n=0,r=t.count;n<r;n++){const s=n<r/2?$E:eM;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(TN.setFromMatrixPosition(this.light.matrixWorld).negate())}}class CN extends Us{constructor(e=10,t=10,n=4473924,r=8947848){n=new Ye(n),r=new Ye(r);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let p=0,m=0,v=-o;p<=t;p++,v+=a){l.push(-o,0,v,o,0,v),l.push(v,0,-o,v,0,o);const x=p===s?n:r;x.toArray(c,m),m+=3,x.toArray(c,m),m+=3,x.toArray(c,m),m+=3,x.toArray(c,m),m+=3}const h=new Rt;h.setAttribute("position",new ft(l,3)),h.setAttribute("color",new ft(c,3));const d=new ki({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class RN extends Us{constructor(e=10,t=16,n=8,r=64,s=4473924,a=8947848){s=new Ye(s),a=new Ye(a);const o=[],l=[];if(t>1)for(let d=0;d<t;d++){const p=d/t*(Math.PI*2),m=Math.sin(p)*e,v=Math.cos(p)*e;o.push(0,0,0),o.push(m,0,v);const x=d&1?s:a;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let d=0;d<n;d++){const p=d&1?s:a,m=e-e/n*d;for(let v=0;v<r;v++){let x=v/r*(Math.PI*2),_=Math.sin(x)*m,g=Math.cos(x)*m;o.push(_,0,g),l.push(p.r,p.g,p.b),x=(v+1)/r*(Math.PI*2),_=Math.sin(x)*m,g=Math.cos(x)*m,o.push(_,0,g),l.push(p.r,p.g,p.b)}}const c=new Rt;c.setAttribute("position",new ft(o,3)),c.setAttribute("color",new ft(l,3));const h=new ki({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const tM=new j,Rp=new j,nM=new j;class DN extends Xt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new Rt;r.setAttribute("position",new ft([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new ki({fog:!1,toneMapped:!1});this.lightPlane=new ho(r,s),this.add(this.lightPlane),r=new Rt,r.setAttribute("position",new ft([0,0,0,0,0,1],3)),this.targetLine=new ho(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),tM.setFromMatrixPosition(this.light.matrixWorld),Rp.setFromMatrixPosition(this.light.target.matrixWorld),nM.subVectors(Rp,tM),this.lightPlane.lookAt(Rp),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Rp),this.targetLine.scale.z=nM.length()}}const Dp=new j,Pn=new Fg;class UN extends Us{constructor(e){const t=new Rt,n=new ki({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(v,x){l(v),l(x)}function l(v){r.push(0,0,0),s.push(0,0,0),a[v]===void 0&&(a[v]=[]),a[v].push(r.length/3-1)}t.setAttribute("position",new ft(r,3)),t.setAttribute("color",new ft(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new Ye(16755200),h=new Ye(16711680),d=new Ye(43775),p=new Ye(16777215),m=new Ye(3355443);this.setColors(c,h,d,p,m)}setColors(e,t,n,r,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,r=1;let s,a;if(Pn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===yr)s=-1,a=1;else if(this.camera.coordinateSystem===fu)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Hn("c",t,e,Pn,0,0,s),Hn("t",t,e,Pn,0,0,a),Hn("n1",t,e,Pn,-n,-r,s),Hn("n2",t,e,Pn,n,-r,s),Hn("n3",t,e,Pn,-n,r,s),Hn("n4",t,e,Pn,n,r,s),Hn("f1",t,e,Pn,-n,-r,a),Hn("f2",t,e,Pn,n,-r,a),Hn("f3",t,e,Pn,-n,r,a),Hn("f4",t,e,Pn,n,r,a),Hn("u1",t,e,Pn,n*.7,r*1.1,s),Hn("u2",t,e,Pn,-n*.7,r*1.1,s),Hn("u3",t,e,Pn,0,r*2,s),Hn("cf1",t,e,Pn,-n,0,a),Hn("cf2",t,e,Pn,n,0,a),Hn("cf3",t,e,Pn,0,-r,a),Hn("cf4",t,e,Pn,0,r,a),Hn("cn1",t,e,Pn,-n,0,s),Hn("cn2",t,e,Pn,n,0,s),Hn("cn3",t,e,Pn,0,-r,s),Hn("cn4",t,e,Pn,0,r,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Hn(i,e,t,n,r,s,a){Dp.set(r,s,a).unproject(n);const o=e[i];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Dp.x,Dp.y,Dp.z)}}const Up=new Qn;class ON extends Us{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),s=new Rt;s.setIndex(new $t(n,1)),s.setAttribute("position",new $t(r,3)),super(s,new ki({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Up.setFromObject(this.object),Up.isEmpty())return;const e=Up.min,t=Up.max,n=this.geometry.attributes.position,r=n.array;r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=e.x,r[4]=t.y,r[5]=t.z,r[6]=e.x,r[7]=e.y,r[8]=t.z,r[9]=t.x,r[10]=e.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=e.z,r[15]=e.x,r[16]=t.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=t.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class LN extends Us{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Rt;s.setIndex(new $t(n,1)),s.setAttribute("position",new ft(r,3)),super(s,new ki({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class IN extends ho{constructor(e,t=1,n=16776960){const r=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Rt;a.setAttribute("position",new ft(s,3)),a.computeBoundingSphere(),super(a,new ki({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Rt;l.setAttribute("position",new ft(o,3)),l.computeBoundingSphere(),this.add(new mn(l,new Ea({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const iM=new j;let Op,wy;class NN extends Xt{constructor(e=new j(0,0,1),t=new j(0,0,0),n=1,r=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Op===void 0&&(Op=new Rt,Op.setAttribute("position",new ft([0,0,0,0,1,0],3)),wy=new $f(.5,1,5,1),wy.translate(0,-.5,0)),this.position.copy(t),this.line=new ho(Op,new ki({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new mn(wy,new Ea({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{iM.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(iM,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class PN extends Us{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Rt;r.setAttribute("position",new ft(t,3)),r.setAttribute("color",new ft(n,3));const s=new ki({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,n){const r=new Ye,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(n),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class zN{constructor(){this.type="ShapePath",this.color=new Ye,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new sg,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,a){return this.currentPath.bezierCurveTo(e,t,n,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const b=[];for(let E=0,S=g.length;E<S;E++){const w=g[E],T=new oo;T.curves=w.curves,b.push(T)}return b}function n(g,b){const E=b.length;let S=!1;for(let w=E-1,T=0;T<E;w=T++){let R=b[w],U=b[T],A=U.x-R.x,D=U.y-R.y;if(Math.abs(D)>Number.EPSILON){if(D<0&&(R=b[T],A=-A,U=b[w],D=-D),g.y<R.y||g.y>U.y)continue;if(g.y===R.y){if(g.x===R.x)return!0}else{const L=D*(g.x-R.x)-A*(g.y-R.y);if(L===0)return!0;if(L<0)continue;S=!S}}else{if(g.y!==R.y)continue;if(U.x<=g.x&&g.x<=R.x||R.x<=g.x&&g.x<=U.x)return!0}}return S}const r=os.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new oo,l.curves=o.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const d=[],p=[];let m=[],v=0,x;p[v]=void 0,m[v]=[];for(let g=0,b=s.length;g<b;g++)o=s[g],x=o.getPoints(),a=r(x),a=e?!a:a,a?(!h&&p[v]&&v++,p[v]={s:new oo,p:x},p[v].s.curves=o.curves,h&&v++,m[v]=[]):m[v].push({h:o,p:x[0]});if(!p[0])return t(s);if(p.length>1){let g=!1,b=0;for(let E=0,S=p.length;E<S;E++)d[E]=[];for(let E=0,S=p.length;E<S;E++){const w=m[E];for(let T=0;T<w.length;T++){const R=w[T];let U=!0;for(let A=0;A<p.length;A++)n(R.p,p[A].p)&&(E!==A&&b++,U?(U=!1,d[A].push(R)):g=!0);U&&d[E].push(R)}}b>0&&g===!1&&(m=d)}let _;for(let g=0,b=p.length;g<b;g++){l=p[g].s,c.push(l),_=m[g];for(let E=0,S=_.length;E<S;E++)l.holes.push(_[E].h)}return c}}let FN=class extends Ds{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function BN(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function kN(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function GN(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function tx(i,e,t,n){const r=HN(n);switch(t){case Vx:return i*e;case Og:return i*e/r.components*r.byteLength;case Jf:return i*e/r.components*r.byteLength;case Xx:return i*e*2/r.components*r.byteLength;case Lg:return i*e*2/r.components*r.byteLength;case Wx:return i*e*3/r.components*r.byteLength;case Di:return i*e*4/r.components*r.byteLength;case Ig:return i*e*4/r.components*r.byteLength;case af:case of:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case lf:case cf:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Am:case Rm:return Math.max(i,16)*Math.max(e,8)/4;case Tm:case Cm:return Math.max(i,8)*Math.max(e,8)/2;case Dm:case Um:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Om:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Lm:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Im:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Nm:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Pm:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case zm:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Fm:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Bm:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case km:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Gm:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Hm:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Vm:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Wm:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Xm:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case jm:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case qm:case Ym:case Zm:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Km:case Jm:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Qm:case $m:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function HN(i){switch(i){case Gr:case Bx:return{byteLength:1,components:1};case lu:case kx:case Tu:return{byteLength:2,components:1};case Dg:case Ug:return{byteLength:2,components:4};case xa:case Rg:case Qi:return{byteLength:4,components:1};case Gx:case Hx:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}class VN{static contain(e,t){return BN(e,t)}static cover(e,t){return kN(e,t)}static fill(e){return GN(e)}static getByteLength(e,t,n,r){return tx(e,t,n,r)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Tg}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Tg);function cC(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function WN(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,d=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)m=i.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const h=l.array,d=l.updateRanges;if(i.bindBuffer(c,o),d.length===0)i.bufferSubData(c,0,h);else{d.sort((m,v)=>m.start-v.start);let p=0;for(let m=1;m<d.length;m++){const v=d[p],x=d[m];x.start<=v.start+v.count+1?v.count=Math.max(v.count,x.start+x.count-v.start):(++p,d[p]=x)}d.length=p+1;for(let m=0,v=d.length;m<v;m++){const x=d[m];i.bufferSubData(c,x.start*h.BYTES_PER_ELEMENT,h,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var XN=`#ifdef USE_ALPHAHASH
|
|
57
41
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
58
42
|
#endif`,jN=`#ifdef USE_ALPHAHASH
|
|
59
43
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -3845,31 +3829,7 @@ void main() {
|
|
|
3845
3829
|
|
|
3846
3830
|
}
|
|
3847
3831
|
|
|
3848
|
-
}`;class _4{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new r1(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Hr({vertexShader:v4,fragmentShader:y4,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new mn(new Ma(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class x4 extends Ds{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,p=null,m=null,v=null;const x=typeof XRWebGLBinding<"u",_=new _4,g={},b=t.getContextAttributes();let E=null,S=null;const w=[],T=[],R=new ke;let U=null;const A=new Kn;A.viewport=new Bt;const D=new Kn;D.viewport=new Bt;const L=[A,D],P=new iC;let I=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let re=w[ie];return re===void 0&&(re=new am,w[ie]=re),re.getTargetRaySpace()},this.getControllerGrip=function(ie){let re=w[ie];return re===void 0&&(re=new am,w[ie]=re),re.getGripSpace()},this.getHand=function(ie){let re=w[ie];return re===void 0&&(re=new am,w[ie]=re),re.getHandSpace()};function H(ie){const re=T.indexOf(ie.inputSource);if(re===-1)return;const de=w[re];de!==void 0&&(de.update(ie.inputSource,ie.frame,c||a),de.dispatchEvent({type:ie.type,data:ie.inputSource}))}function z(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",z),r.removeEventListener("inputsourceschange",O);for(let ie=0;ie<w.length;ie++){const re=T[ie];re!==null&&(T[ie]=null,w[ie].disconnect(re))}I=null,V=null,_.reset();for(const ie in g)delete g[ie];e.setRenderTarget(E),m=null,p=null,d=null,r=null,S=null,ee.stop(),n.isPresenting=!1,e.setPixelRatio(U),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){s=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return d===null&&x&&(d=new XRWebGLBinding(r,t)),d},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",z),r.addEventListener("inputsourceschange",O),b.xrCompatible!==!0&&await t.makeXRCompatible(),U=e.getPixelRatio(),e.getSize(R),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let de=null,Ae=null,Me=null;b.depth&&(Me=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,de=b.stencil?hu:uu,Ae=b.stencil?cu:xa);const ve={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};d=this.getBinding(),p=d.createProjectionLayer(ve),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),S=new Rs(p.textureWidth,p.textureHeight,{format:Di,type:Gr,depthTexture:new i1(p.textureWidth,p.textureHeight,Ae,void 0,void 0,void 0,void 0,void 0,void 0,de),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const de={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,de),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),S=new Rs(m.framebufferWidth,m.framebufferHeight,{format:Di,type:Gr,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),ee.setContext(r),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function O(ie){for(let re=0;re<ie.removed.length;re++){const de=ie.removed[re],Ae=T.indexOf(de);Ae>=0&&(T[Ae]=null,w[Ae].disconnect(de))}for(let re=0;re<ie.added.length;re++){const de=ie.added[re];let Ae=T.indexOf(de);if(Ae===-1){for(let ve=0;ve<w.length;ve++)if(ve>=T.length){T.push(de),Ae=ve;break}else if(T[ve]===null){T[ve]=de,Ae=ve;break}if(Ae===-1)break}const Me=w[Ae];Me&&Me.connect(de)}}const B=new j,G=new j;function X(ie,re,de){B.setFromMatrixPosition(re.matrixWorld),G.setFromMatrixPosition(de.matrixWorld);const Ae=B.distanceTo(G),Me=re.projectionMatrix.elements,ve=de.projectionMatrix.elements,fe=Me[14]/(Me[10]-1),J=Me[14]/(Me[10]+1),oe=(Me[9]+1)/Me[5],se=(Me[9]-1)/Me[5],$=(Me[8]-1)/Me[0],pe=(ve[8]+1)/ve[0],ye=fe*$,xe=fe*pe,be=Ae/(-$+pe),ue=be*-$;if(re.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(ue),ie.translateZ(be),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),Me[10]===-1)ie.projectionMatrix.copy(re.projectionMatrix),ie.projectionMatrixInverse.copy(re.projectionMatrixInverse);else{const He=fe+be,W=J+be,F=ye-ue,ne=xe+(Ae-ue),Se=oe*J/W*He,_e=se*J/W*He;ie.projectionMatrix.makePerspective(F,ne,Se,_e,He,W),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function k(ie,re){re===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(re.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;let re=ie.near,de=ie.far;_.texture!==null&&(_.depthNear>0&&(re=_.depthNear),_.depthFar>0&&(de=_.depthFar)),P.near=D.near=A.near=re,P.far=D.far=A.far=de,(I!==P.near||V!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),I=P.near,V=P.far),P.layers.mask=ie.layers.mask|6,A.layers.mask=P.layers.mask&3,D.layers.mask=P.layers.mask&5;const Ae=ie.parent,Me=P.cameras;k(P,Ae);for(let ve=0;ve<Me.length;ve++)k(Me[ve],Ae);Me.length===2?X(P,A,D):P.projectionMatrix.copy(A.projectionMatrix),Y(ie,P,Ae)};function Y(ie,re,de){de===null?ie.matrix.copy(re.matrixWorld):(ie.matrix.copy(de.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(re.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(re.projectionMatrix),ie.projectionMatrixInverse.copy(re.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=du*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return P},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(ie){l=ie,p!==null&&(p.fixedFoveation=ie),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=ie)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(P)},this.getCameraTexture=function(ie){return g[ie]};let Q=null;function te(ie,re){if(h=re.getViewerPose(c||a),v=re,h!==null){const de=h.views;m!==null&&(e.setRenderTargetFramebuffer(S,m.framebuffer),e.setRenderTarget(S));let Ae=!1;de.length!==P.cameras.length&&(P.cameras.length=0,Ae=!0);for(let J=0;J<de.length;J++){const oe=de[J];let se=null;if(m!==null)se=m.getViewport(oe);else{const pe=d.getViewSubImage(p,oe);se=pe.viewport,J===0&&(e.setRenderTargetTextures(S,pe.colorTexture,pe.depthStencilTexture),e.setRenderTarget(S))}let $=L[J];$===void 0&&($=new Kn,$.layers.enable(J),$.viewport=new Bt,L[J]=$),$.matrix.fromArray(oe.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(oe.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(se.x,se.y,se.width,se.height),J===0&&(P.matrix.copy($.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale)),Ae===!0&&P.cameras.push($)}const Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){d=n.getBinding();const J=d.getDepthInformation(de[0]);J&&J.isValid&&J.texture&&_.init(J,r.renderState)}if(Me&&Me.includes("camera-access")&&x){e.state.unbindTexture(),d=n.getBinding();for(let J=0;J<de.length;J++){const oe=de[J].camera;if(oe){let se=g[oe];se||(se=new r1,g[oe]=se);const $=d.getCameraImage(oe);se.sourceTexture=$}}}}for(let de=0;de<w.length;de++){const Ae=T[de],Me=w[de];Ae!==null&&Me!==void 0&&Me.update(Ae,re,c||a)}Q&&Q(ie,re),re.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:re}),v=null}const ee=new cC;ee.setAnimationLoop(te),this.setAnimationLoop=function(ie){Q=ie},this.dispose=function(){}}}const sl=new Bi,b4=new bt;function S4(i,e){function t(_,g){_.matrixAutoUpdate===!0&&_.updateMatrix(),g.value.copy(_.matrix)}function n(_,g){g.color.getRGB(_.fogColor.value,h2(i)),g.isFog?(_.fogNear.value=g.near,_.fogFar.value=g.far):g.isFogExp2&&(_.fogDensity.value=g.density)}function r(_,g,b,E,S){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(_,g):g.isMeshToonMaterial?(s(_,g),d(_,g)):g.isMeshPhongMaterial?(s(_,g),h(_,g)):g.isMeshStandardMaterial?(s(_,g),p(_,g),g.isMeshPhysicalMaterial&&m(_,g,S)):g.isMeshMatcapMaterial?(s(_,g),v(_,g)):g.isMeshDepthMaterial?s(_,g):g.isMeshDistanceMaterial?(s(_,g),x(_,g)):g.isMeshNormalMaterial?s(_,g):g.isLineBasicMaterial?(a(_,g),g.isLineDashedMaterial&&o(_,g)):g.isPointsMaterial?l(_,g,b,E):g.isSpriteMaterial?c(_,g):g.isShadowMaterial?(_.color.value.copy(g.color),_.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(_,g){_.opacity.value=g.opacity,g.color&&_.diffuse.value.copy(g.color),g.emissive&&_.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.bumpMap&&(_.bumpMap.value=g.bumpMap,t(g.bumpMap,_.bumpMapTransform),_.bumpScale.value=g.bumpScale,g.side===Fi&&(_.bumpScale.value*=-1)),g.normalMap&&(_.normalMap.value=g.normalMap,t(g.normalMap,_.normalMapTransform),_.normalScale.value.copy(g.normalScale),g.side===Fi&&_.normalScale.value.negate()),g.displacementMap&&(_.displacementMap.value=g.displacementMap,t(g.displacementMap,_.displacementMapTransform),_.displacementScale.value=g.displacementScale,_.displacementBias.value=g.displacementBias),g.emissiveMap&&(_.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,_.emissiveMapTransform)),g.specularMap&&(_.specularMap.value=g.specularMap,t(g.specularMap,_.specularMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);const b=e.get(g),E=b.envMap,S=b.envMapRotation;E&&(_.envMap.value=E,sl.copy(S),sl.x*=-1,sl.y*=-1,sl.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(sl.y*=-1,sl.z*=-1),_.envMapRotation.value.setFromMatrix4(b4.makeRotationFromEuler(sl)),_.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap&&(_.lightMap.value=g.lightMap,_.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,_.lightMapTransform)),g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,_.aoMapTransform))}function a(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform))}function o(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function l(_,g,b,E){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*b,_.scale.value=E*.5,g.map&&(_.map.value=g.map,t(g.map,_.uvTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function c(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function h(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function d(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function p(_,g){_.metalness.value=g.metalness,g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,_.metalnessMapTransform)),_.roughness.value=g.roughness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,_.roughnessMapTransform)),g.envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function m(_,g,b){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,_.sheenColorMapTransform)),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,_.sheenRoughnessMapTransform))),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,_.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(_.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Fi&&_.clearcoatNormalScale.value.negate())),g.dispersion>0&&(_.dispersion.value=g.dispersion),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,_.iridescenceMapTransform)),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=b.texture,_.transmissionSamplerSize.value.set(b.width,b.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,_.transmissionMapTransform)),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(_.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(_.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,_.specularColorMapTransform)),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,_.specularIntensityMapTransform))}function v(_,g){g.matcap&&(_.matcap.value=g.matcap)}function x(_,g){const b=e.get(g).light;_.referencePosition.value.setFromMatrixPosition(b.matrixWorld),_.nearDistance.value=b.shadow.camera.near,_.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function E4(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,E){const S=E.program;n.uniformBlockBinding(b,S)}function c(b,E){let S=r[b.id];S===void 0&&(v(b),S=h(b),r[b.id]=S,b.addEventListener("dispose",_));const w=E.program;n.updateUBOMapping(b,w);const T=e.render.frame;s[b.id]!==T&&(p(b),s[b.id]=T)}function h(b){const E=d();b.__bindingPointIndex=E;const S=i.createBuffer(),w=b.__size,T=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,w,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,S),S}function d(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(b){const E=r[b.id],S=b.uniforms,w=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let T=0,R=S.length;T<R;T++){const U=Array.isArray(S[T])?S[T]:[S[T]];for(let A=0,D=U.length;A<D;A++){const L=U[A];if(m(L,T,A,w)===!0){const P=L.__offset,I=Array.isArray(L.value)?L.value:[L.value];let V=0;for(let H=0;H<I.length;H++){const z=I[H],O=x(z);typeof z=="number"||typeof z=="boolean"?(L.__data[0]=z,i.bufferSubData(i.UNIFORM_BUFFER,P+V,L.__data)):z.isMatrix3?(L.__data[0]=z.elements[0],L.__data[1]=z.elements[1],L.__data[2]=z.elements[2],L.__data[3]=0,L.__data[4]=z.elements[3],L.__data[5]=z.elements[4],L.__data[6]=z.elements[5],L.__data[7]=0,L.__data[8]=z.elements[6],L.__data[9]=z.elements[7],L.__data[10]=z.elements[8],L.__data[11]=0):(z.toArray(L.__data,V),V+=O.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,P,L.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(b,E,S,w){const T=b.value,R=E+"_"+S;if(w[R]===void 0)return typeof T=="number"||typeof T=="boolean"?w[R]=T:w[R]=T.clone(),!0;{const U=w[R];if(typeof T=="number"||typeof T=="boolean"){if(U!==T)return w[R]=T,!0}else if(U.equals(T)===!1)return U.copy(T),!0}return!1}function v(b){const E=b.uniforms;let S=0;const w=16;for(let R=0,U=E.length;R<U;R++){const A=Array.isArray(E[R])?E[R]:[E[R]];for(let D=0,L=A.length;D<L;D++){const P=A[D],I=Array.isArray(P.value)?P.value:[P.value];for(let V=0,H=I.length;V<H;V++){const z=I[V],O=x(z),B=S%w,G=B%O.boundary,X=B+G;S+=G,X!==0&&w-X<O.storage&&(S+=w-X),P.__data=new Float32Array(O.storage/Float32Array.BYTES_PER_ELEMENT),P.__offset=S,S+=O.storage}}}const T=S%w;return T>0&&(S+=w-T),b.__size=S,b.__cache={},this}function x(b){const E={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(E.boundary=4,E.storage=4):b.isVector2?(E.boundary=8,E.storage=8):b.isVector3||b.isColor?(E.boundary=16,E.storage=12):b.isVector4?(E.boundary=16,E.storage=16):b.isMatrix3?(E.boundary=48,E.storage=48):b.isMatrix4?(E.boundary=64,E.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),E}function _(b){const E=b.target;E.removeEventListener("dispose",_);const S=a.indexOf(E.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function g(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:g}}class mC{constructor(e={}){const{canvas:t=l2(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=a;const v=new Uint32Array(4),x=new Int32Array(4);let _=null,g=null;const b=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ts,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let w=!1;this._outputColorSpace=Ri;let T=0,R=0,U=null,A=-1,D=null;const L=new Bt,P=new Bt;let I=null;const V=new Ye(0);let H=0,z=t.width,O=t.height,B=1,G=null,X=null;const k=new Bt(0,0,z,O),Y=new Bt(0,0,z,O);let Q=!1;const te=new Ll;let ee=!1,ie=!1;const re=new bt,de=new j,Ae=new Bt,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ve=!1;function fe(){return U===null?B:1}let J=n;function oe(q,ge){return t.getContext(q,ge)}try{const q={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Tg}`),t.addEventListener("webglcontextlost",Ge,!1),t.addEventListener("webglcontextrestored",rt,!1),t.addEventListener("webglcontextcreationerror",Pe,!1),J===null){const ge="webgl2";if(J=oe(ge,q),J===null)throw oe(ge)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let se,$,pe,ye,xe,be,ue,He,W,F,ne,Se,_e,me,ze,Ne,je,Ze,Le,Be,Ve,Je,We,dt;function ce(){se=new NF(J),se.init(),Je=new pC(J,se),$=new CF(J,se,e,Je),pe=new m4(J,se),$.reversedDepthBuffer&&p&&pe.buffers.depth.setReversed(!0),ye=new FF(J),xe=new n4,be=new g4(J,se,pe,xe,$,Je,ye),ue=new DF(S),He=new IF(S),W=new WN(J),We=new TF(J,W),F=new PF(J,W,ye,We),ne=new kF(J,F,W,ye),Le=new BF(J,$,be),Ne=new RF(xe),Se=new t4(S,ue,He,se,$,We,Ne),_e=new S4(S,xe),me=new r4,ze=new u4(se),Ze=new wF(S,ue,He,pe,ne,m,l),je=new d4(S,ne,$),dt=new E4(J,ye,$,pe),Be=new AF(J,se,ye),Ve=new zF(J,se,ye),ye.programs=Se.programs,S.capabilities=$,S.extensions=se,S.properties=xe,S.renderLists=me,S.shadowMap=je,S.state=pe,S.info=ye}ce();const Ie=new x4(S,J);this.xr=Ie,this.getContext=function(){return J},this.getContextAttributes=function(){return J.getContextAttributes()},this.forceContextLoss=function(){const q=se.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){const q=se.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(q){q!==void 0&&(B=q,this.setSize(z,O,!1))},this.getSize=function(q){return q.set(z,O)},this.setSize=function(q,ge,Te=!0){if(Ie.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=q,O=ge,t.width=Math.floor(q*B),t.height=Math.floor(ge*B),Te===!0&&(t.style.width=q+"px",t.style.height=ge+"px"),this.setViewport(0,0,q,ge)},this.getDrawingBufferSize=function(q){return q.set(z*B,O*B).floor()},this.setDrawingBufferSize=function(q,ge,Te){z=q,O=ge,B=Te,t.width=Math.floor(q*Te),t.height=Math.floor(ge*Te),this.setViewport(0,0,q,ge)},this.getCurrentViewport=function(q){return q.copy(L)},this.getViewport=function(q){return q.copy(k)},this.setViewport=function(q,ge,Te,Ue){q.isVector4?k.set(q.x,q.y,q.z,q.w):k.set(q,ge,Te,Ue),pe.viewport(L.copy(k).multiplyScalar(B).round())},this.getScissor=function(q){return q.copy(Y)},this.setScissor=function(q,ge,Te,Ue){q.isVector4?Y.set(q.x,q.y,q.z,q.w):Y.set(q,ge,Te,Ue),pe.scissor(P.copy(Y).multiplyScalar(B).round())},this.getScissorTest=function(){return Q},this.setScissorTest=function(q){pe.setScissorTest(Q=q)},this.setOpaqueSort=function(q){G=q},this.setTransparentSort=function(q){X=q},this.getClearColor=function(q){return q.copy(Ze.getClearColor())},this.setClearColor=function(){Ze.setClearColor(...arguments)},this.getClearAlpha=function(){return Ze.getClearAlpha()},this.setClearAlpha=function(){Ze.setClearAlpha(...arguments)},this.clear=function(q=!0,ge=!0,Te=!0){let Ue=0;if(q){let ae=!1;if(U!==null){const Xe=U.texture.format;ae=Xe===Ig||Xe===Lg||Xe===Jf}if(ae){const Xe=U.texture.type,$e=Xe===Gr||Xe===xa||Xe===lu||Xe===cu||Xe===Dg||Xe===Ug,lt=Ze.getClearColor(),at=Ze.getClearAlpha(),vt=lt.r,_t=lt.g,pt=lt.b;$e?(v[0]=vt,v[1]=_t,v[2]=pt,v[3]=at,J.clearBufferuiv(J.COLOR,0,v)):(x[0]=vt,x[1]=_t,x[2]=pt,x[3]=at,J.clearBufferiv(J.COLOR,0,x))}else Ue|=J.COLOR_BUFFER_BIT}ge&&(Ue|=J.DEPTH_BUFFER_BIT),Te&&(Ue|=J.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),J.clear(Ue)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ge,!1),t.removeEventListener("webglcontextrestored",rt,!1),t.removeEventListener("webglcontextcreationerror",Pe,!1),Ze.dispose(),me.dispose(),ze.dispose(),xe.dispose(),ue.dispose(),He.dispose(),ne.dispose(),We.dispose(),dt.dispose(),Se.dispose(),Ie.dispose(),Ie.removeEventListener("sessionstart",en),Ie.removeEventListener("sessionend",gn),bn.stop()};function Ge(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function rt(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const q=ye.autoReset,ge=je.enabled,Te=je.autoUpdate,Ue=je.needsUpdate,ae=je.type;ce(),ye.autoReset=q,je.enabled=ge,je.autoUpdate=Te,je.needsUpdate=Ue,je.type=ae}function Pe(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function De(q){const ge=q.target;ge.removeEventListener("dispose",De),Qe(ge)}function Qe(q){ot(q),xe.remove(q)}function ot(q){const ge=xe.get(q).programs;ge!==void 0&&(ge.forEach(function(Te){Se.releaseProgram(Te)}),q.isShaderMaterial&&Se.releaseShaderCache(q))}this.renderBufferDirect=function(q,ge,Te,Ue,ae,Xe){ge===null&&(ge=Me);const $e=ae.isMesh&&ae.matrixWorld.determinant()<0,lt=Ls(q,ge,Te,Ue,ae);pe.setMaterial(Ue,$e);let at=Te.index,vt=1;if(Ue.wireframe===!0){if(at=F.getWireframeAttribute(Te),at===void 0)return;vt=2}const _t=Te.drawRange,pt=Te.attributes.position;let Tt=_t.start*vt,Ht=(_t.start+_t.count)*vt;Xe!==null&&(Tt=Math.max(Tt,Xe.start*vt),Ht=Math.min(Ht,(Xe.start+Xe.count)*vt)),at!==null?(Tt=Math.max(Tt,0),Ht=Math.min(Ht,at.count)):pt!=null&&(Tt=Math.max(Tt,0),Ht=Math.min(Ht,pt.count));const tn=Ht-Tt;if(tn<0||tn===1/0)return;We.setup(ae,Ue,lt,Te,at);let Jt,kt=Be;if(at!==null&&(Jt=W.get(at),kt=Ve,kt.setIndex(Jt)),ae.isMesh)Ue.wireframe===!0?(pe.setLineWidth(Ue.wireframeLinewidth*fe()),kt.setMode(J.LINES)):kt.setMode(J.TRIANGLES);else if(ae.isLine){let gt=Ue.linewidth;gt===void 0&&(gt=1),pe.setLineWidth(gt*fe()),ae.isLineSegments?kt.setMode(J.LINES):ae.isLineLoop?kt.setMode(J.LINE_LOOP):kt.setMode(J.LINE_STRIP)}else ae.isPoints?kt.setMode(J.POINTS):ae.isSprite&&kt.setMode(J.TRIANGLES);if(ae.isBatchedMesh)if(ae._multiDrawInstances!==null)Rf("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),kt.renderMultiDrawInstances(ae._multiDrawStarts,ae._multiDrawCounts,ae._multiDrawCount,ae._multiDrawInstances);else if(se.get("WEBGL_multi_draw"))kt.renderMultiDraw(ae._multiDrawStarts,ae._multiDrawCounts,ae._multiDrawCount);else{const gt=ae._multiDrawStarts,Qt=ae._multiDrawCounts,It=ae._multiDrawCount,Sn=at?W.get(at).bytesPerElement:1,rr=xe.get(Ue).currentProgram.getUniforms();for(let Gn=0;Gn<It;Gn++)rr.setValue(J,"_gl_DrawID",Gn),kt.render(gt[Gn]/Sn,Qt[Gn])}else if(ae.isInstancedMesh)kt.renderInstances(Tt,tn,ae.count);else if(Te.isInstancedBufferGeometry){const gt=Te._maxInstanceCount!==void 0?Te._maxInstanceCount:1/0,Qt=Math.min(Te.instanceCount,gt);kt.renderInstances(Tt,tn,Qt)}else kt.render(Tt,tn)};function st(q,ge,Te){q.transparent===!0&&q.side===zn&&q.forceSinglePass===!1?(q.side=Fi,q.needsUpdate=!0,vn(q,ge,Te),q.side=ya,q.needsUpdate=!0,vn(q,ge,Te),q.side=zn):vn(q,ge,Te)}this.compile=function(q,ge,Te=null){Te===null&&(Te=q),g=ze.get(Te),g.init(ge),E.push(g),Te.traverseVisible(function(ae){ae.isLight&&ae.layers.test(ge.layers)&&(g.pushLight(ae),ae.castShadow&&g.pushShadow(ae))}),q!==Te&&q.traverseVisible(function(ae){ae.isLight&&ae.layers.test(ge.layers)&&(g.pushLight(ae),ae.castShadow&&g.pushShadow(ae))}),g.setupLights();const Ue=new Set;return q.traverse(function(ae){if(!(ae.isMesh||ae.isPoints||ae.isLine||ae.isSprite))return;const Xe=ae.material;if(Xe)if(Array.isArray(Xe))for(let $e=0;$e<Xe.length;$e++){const lt=Xe[$e];st(lt,Te,ae),Ue.add(lt)}else st(Xe,Te,ae),Ue.add(Xe)}),g=E.pop(),Ue},this.compileAsync=function(q,ge,Te=null){const Ue=this.compile(q,ge,Te);return new Promise(ae=>{function Xe(){if(Ue.forEach(function($e){xe.get($e).currentProgram.isReady()&&Ue.delete($e)}),Ue.size===0){ae(q);return}setTimeout(Xe,10)}se.get("KHR_parallel_shader_compile")!==null?Xe():setTimeout(Xe,10)})};let mt=null;function on(q){mt&&mt(q)}function en(){bn.stop()}function gn(){bn.start()}const bn=new cC;bn.setAnimationLoop(on),typeof self<"u"&&bn.setContext(self),this.setAnimationLoop=function(q){mt=q,Ie.setAnimationLoop(q),q===null?bn.stop():bn.start()},Ie.addEventListener("sessionstart",en),Ie.addEventListener("sessionend",gn),this.render=function(q,ge){if(ge!==void 0&&ge.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;if(q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ge.parent===null&&ge.matrixWorldAutoUpdate===!0&&ge.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(ge),ge=Ie.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,ge,U),g=ze.get(q,E.length),g.init(ge),E.push(g),re.multiplyMatrices(ge.projectionMatrix,ge.matrixWorldInverse),te.setFromProjectionMatrix(re,yr,ge.reversedDepth),ie=this.localClippingEnabled,ee=Ne.init(this.clippingPlanes,ie),_=me.get(q,b.length),_.init(),b.push(_),Ie.enabled===!0&&Ie.isPresenting===!0){const Xe=S.xr.getDepthSensingMesh();Xe!==null&&xi(Xe,ge,-1/0,S.sortObjects)}xi(q,ge,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(G,X),ve=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,ve&&Ze.addToRenderList(_,q),this.info.render.frame++,ee===!0&&Ne.beginShadows();const Te=g.state.shadowsArray;je.render(Te,q,ge),ee===!0&&Ne.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ue=_.opaque,ae=_.transmissive;if(g.setupLights(),ge.isArrayCamera){const Xe=ge.cameras;if(ae.length>0)for(let $e=0,lt=Xe.length;$e<lt;$e++){const at=Xe[$e];Hi(Ue,ae,q,at)}ve&&Ze.render(q);for(let $e=0,lt=Xe.length;$e<lt;$e++){const at=Xe[$e];Bn(_,q,at,at.viewport)}}else ae.length>0&&Hi(Ue,ae,q,ge),ve&&Ze.render(q),Bn(_,q,ge);U!==null&&R===0&&(be.updateMultisampleRenderTarget(U),be.updateRenderTargetMipmap(U)),q.isScene===!0&&q.onAfterRender(S,q,ge),We.resetDefaultState(),A=-1,D=null,E.pop(),E.length>0?(g=E[E.length-1],ee===!0&&Ne.setGlobalState(S.clippingPlanes,g.state.camera)):g=null,b.pop(),b.length>0?_=b[b.length-1]:_=null};function xi(q,ge,Te,Ue){if(q.visible===!1)return;if(q.layers.test(ge.layers)){if(q.isGroup)Te=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(ge);else if(q.isLight)g.pushLight(q),q.castShadow&&g.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||te.intersectsSprite(q)){Ue&&Ae.setFromMatrixPosition(q.matrixWorld).applyMatrix4(re);const $e=ne.update(q),lt=q.material;lt.visible&&_.push(q,$e,lt,Te,Ae.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||te.intersectsObject(q))){const $e=ne.update(q),lt=q.material;if(Ue&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Ae.copy(q.boundingSphere.center)):($e.boundingSphere===null&&$e.computeBoundingSphere(),Ae.copy($e.boundingSphere.center)),Ae.applyMatrix4(q.matrixWorld).applyMatrix4(re)),Array.isArray(lt)){const at=$e.groups;for(let vt=0,_t=at.length;vt<_t;vt++){const pt=at[vt],Tt=lt[pt.materialIndex];Tt&&Tt.visible&&_.push(q,$e,Tt,Te,Ae.z,pt)}}else lt.visible&&_.push(q,$e,lt,Te,Ae.z,null)}}const Xe=q.children;for(let $e=0,lt=Xe.length;$e<lt;$e++)xi(Xe[$e],ge,Te,Ue)}function Bn(q,ge,Te,Ue){const ae=q.opaque,Xe=q.transmissive,$e=q.transparent;g.setupLightsView(Te),ee===!0&&Ne.setGlobalState(S.clippingPlanes,Te),Ue&&pe.viewport(L.copy(Ue)),ae.length>0&&kn(ae,ge,Te),Xe.length>0&&kn(Xe,ge,Te),$e.length>0&&kn($e,ge,Te),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function Hi(q,ge,Te,Ue){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[Ue.id]===void 0&&(g.state.transmissionRenderTarget[Ue.id]=new Rs(1,1,{generateMipmaps:!0,type:se.has("EXT_color_buffer_half_float")||se.has("EXT_color_buffer_float")?Tu:Gr,minFilter:Ms,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Gt.workingColorSpace}));const Xe=g.state.transmissionRenderTarget[Ue.id],$e=Ue.viewport||L;Xe.setSize($e.z*S.transmissionResolutionScale,$e.w*S.transmissionResolutionScale);const lt=S.getRenderTarget(),at=S.getActiveCubeFace(),vt=S.getActiveMipmapLevel();S.setRenderTarget(Xe),S.getClearColor(V),H=S.getClearAlpha(),H<1&&S.setClearColor(16777215,.5),S.clear(),ve&&Ze.render(Te);const _t=S.toneMapping;S.toneMapping=Ts;const pt=Ue.viewport;if(Ue.viewport!==void 0&&(Ue.viewport=void 0),g.setupLightsView(Ue),ee===!0&&Ne.setGlobalState(S.clippingPlanes,Ue),kn(q,Te,Ue),be.updateMultisampleRenderTarget(Xe),be.updateRenderTargetMipmap(Xe),se.has("WEBGL_multisampled_render_to_texture")===!1){let Tt=!1;for(let Ht=0,tn=ge.length;Ht<tn;Ht++){const Jt=ge[Ht],kt=Jt.object,gt=Jt.geometry,Qt=Jt.material,It=Jt.group;if(Qt.side===zn&&kt.layers.test(Ue.layers)){const Sn=Qt.side;Qt.side=Fi,Qt.needsUpdate=!0,Un(kt,Te,Ue,gt,Qt,It),Qt.side=Sn,Qt.needsUpdate=!0,Tt=!0}}Tt===!0&&(be.updateMultisampleRenderTarget(Xe),be.updateRenderTargetMipmap(Xe))}S.setRenderTarget(lt,at,vt),S.setClearColor(V,H),pt!==void 0&&(Ue.viewport=pt),S.toneMapping=_t}function kn(q,ge,Te){const Ue=ge.isScene===!0?ge.overrideMaterial:null;for(let ae=0,Xe=q.length;ae<Xe;ae++){const $e=q[ae],lt=$e.object,at=$e.geometry,vt=$e.group;let _t=$e.material;_t.allowOverride===!0&&Ue!==null&&(_t=Ue),lt.layers.test(Te.layers)&&Un(lt,ge,Te,at,_t,vt)}}function Un(q,ge,Te,Ue,ae,Xe){q.onBeforeRender(S,ge,Te,Ue,ae,Xe),q.modelViewMatrix.multiplyMatrices(Te.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ae.onBeforeRender(S,ge,Te,Ue,q,Xe),ae.transparent===!0&&ae.side===zn&&ae.forceSinglePass===!1?(ae.side=Fi,ae.needsUpdate=!0,S.renderBufferDirect(Te,ge,Ue,ae,q,Xe),ae.side=ya,ae.needsUpdate=!0,S.renderBufferDirect(Te,ge,Ue,ae,q,Xe),ae.side=zn):S.renderBufferDirect(Te,ge,Ue,ae,q,Xe),q.onAfterRender(S,ge,Te,Ue,ae,Xe)}function vn(q,ge,Te){ge.isScene!==!0&&(ge=Me);const Ue=xe.get(q),ae=g.state.lights,Xe=g.state.shadowsArray,$e=ae.state.version,lt=Se.getParameters(q,ae.state,Xe,ge,Te),at=Se.getProgramCacheKey(lt);let vt=Ue.programs;Ue.environment=q.isMeshStandardMaterial?ge.environment:null,Ue.fog=ge.fog,Ue.envMap=(q.isMeshStandardMaterial?He:ue).get(q.envMap||Ue.environment),Ue.envMapRotation=Ue.environment!==null&&q.envMap===null?ge.environmentRotation:q.envMapRotation,vt===void 0&&(q.addEventListener("dispose",De),vt=new Map,Ue.programs=vt);let _t=vt.get(at);if(_t!==void 0){if(Ue.currentProgram===_t&&Ue.lightsStateVersion===$e)return Os(q,lt),_t}else lt.uniforms=Se.getUniforms(q),q.onBeforeCompile(lt,S),_t=Se.acquireProgram(lt,at),vt.set(at,_t),Ue.uniforms=lt.uniforms;const pt=Ue.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(pt.clippingPlanes=Ne.uniform),Os(q,lt),Ue.needsLights=_o(q),Ue.lightsStateVersion=$e,Ue.needsLights&&(pt.ambientLightColor.value=ae.state.ambient,pt.lightProbe.value=ae.state.probe,pt.directionalLights.value=ae.state.directional,pt.directionalLightShadows.value=ae.state.directionalShadow,pt.spotLights.value=ae.state.spot,pt.spotLightShadows.value=ae.state.spotShadow,pt.rectAreaLights.value=ae.state.rectArea,pt.ltc_1.value=ae.state.rectAreaLTC1,pt.ltc_2.value=ae.state.rectAreaLTC2,pt.pointLights.value=ae.state.point,pt.pointLightShadows.value=ae.state.pointShadow,pt.hemisphereLights.value=ae.state.hemi,pt.directionalShadowMap.value=ae.state.directionalShadowMap,pt.directionalShadowMatrix.value=ae.state.directionalShadowMatrix,pt.spotShadowMap.value=ae.state.spotShadowMap,pt.spotLightMatrix.value=ae.state.spotLightMatrix,pt.spotLightMap.value=ae.state.spotLightMap,pt.pointShadowMap.value=ae.state.pointShadowMap,pt.pointShadowMatrix.value=ae.state.pointShadowMatrix),Ue.currentProgram=_t,Ue.uniformsList=null,_t}function jt(q){if(q.uniformsList===null){const ge=q.currentProgram.getUniforms();q.uniformsList=om.seqWithValue(ge.seq,q.uniforms)}return q.uniformsList}function Os(q,ge){const Te=xe.get(q);Te.outputColorSpace=ge.outputColorSpace,Te.batching=ge.batching,Te.batchingColor=ge.batchingColor,Te.instancing=ge.instancing,Te.instancingColor=ge.instancingColor,Te.instancingMorph=ge.instancingMorph,Te.skinning=ge.skinning,Te.morphTargets=ge.morphTargets,Te.morphNormals=ge.morphNormals,Te.morphColors=ge.morphColors,Te.morphTargetsCount=ge.morphTargetsCount,Te.numClippingPlanes=ge.numClippingPlanes,Te.numIntersection=ge.numClipIntersection,Te.vertexAlphas=ge.vertexAlphas,Te.vertexTangents=ge.vertexTangents,Te.toneMapping=ge.toneMapping}function Ls(q,ge,Te,Ue,ae){ge.isScene!==!0&&(ge=Me),be.resetTextureUnits();const Xe=ge.fog,$e=Ue.isMeshStandardMaterial?ge.environment:null,lt=U===null?S.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:uo,at=(Ue.isMeshStandardMaterial?He:ue).get(Ue.envMap||$e),vt=Ue.vertexColors===!0&&!!Te.attributes.color&&Te.attributes.color.itemSize===4,_t=!!Te.attributes.tangent&&(!!Ue.normalMap||Ue.anisotropy>0),pt=!!Te.morphAttributes.position,Tt=!!Te.morphAttributes.normal,Ht=!!Te.morphAttributes.color;let tn=Ts;Ue.toneMapped&&(U===null||U.isXRRenderTarget===!0)&&(tn=S.toneMapping);const Jt=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,kt=Jt!==void 0?Jt.length:0,gt=xe.get(Ue),Qt=g.state.lights;if(ee===!0&&(ie===!0||q!==D)){const xn=q===D&&Ue.id===A;Ne.setState(Ue,q,xn)}let It=!1;Ue.version===gt.__version?(gt.needsLights&>.lightsStateVersion!==Qt.state.version||gt.outputColorSpace!==lt||ae.isBatchedMesh&>.batching===!1||!ae.isBatchedMesh&>.batching===!0||ae.isBatchedMesh&>.batchingColor===!0&&ae.colorTexture===null||ae.isBatchedMesh&>.batchingColor===!1&&ae.colorTexture!==null||ae.isInstancedMesh&>.instancing===!1||!ae.isInstancedMesh&>.instancing===!0||ae.isSkinnedMesh&>.skinning===!1||!ae.isSkinnedMesh&>.skinning===!0||ae.isInstancedMesh&>.instancingColor===!0&&ae.instanceColor===null||ae.isInstancedMesh&>.instancingColor===!1&&ae.instanceColor!==null||ae.isInstancedMesh&>.instancingMorph===!0&&ae.morphTexture===null||ae.isInstancedMesh&>.instancingMorph===!1&&ae.morphTexture!==null||gt.envMap!==at||Ue.fog===!0&>.fog!==Xe||gt.numClippingPlanes!==void 0&&(gt.numClippingPlanes!==Ne.numPlanes||gt.numIntersection!==Ne.numIntersection)||gt.vertexAlphas!==vt||gt.vertexTangents!==_t||gt.morphTargets!==pt||gt.morphNormals!==Tt||gt.morphColors!==Ht||gt.toneMapping!==tn||gt.morphTargetsCount!==kt)&&(It=!0):(It=!0,gt.__version=Ue.version);let Sn=gt.currentProgram;It===!0&&(Sn=vn(Ue,ge,ae));let rr=!1,Gn=!1,xr=!1;const Pt=Sn.getUniforms(),fi=gt.uniforms;if(pe.useProgram(Sn.program)&&(rr=!0,Gn=!0,xr=!0),Ue.id!==A&&(A=Ue.id,Gn=!0),rr||D!==q){pe.buffers.depth.getReversed()&&q.reversedDepth!==!0&&(q._reversedDepth=!0,q.updateProjectionMatrix()),Pt.setValue(J,"projectionMatrix",q.projectionMatrix),Pt.setValue(J,"viewMatrix",q.matrixWorldInverse);const $n=Pt.map.cameraPosition;$n!==void 0&&$n.setValue(J,de.setFromMatrixPosition(q.matrixWorld)),$.logarithmicDepthBuffer&&Pt.setValue(J,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(Ue.isMeshPhongMaterial||Ue.isMeshToonMaterial||Ue.isMeshLambertMaterial||Ue.isMeshBasicMaterial||Ue.isMeshStandardMaterial||Ue.isShaderMaterial)&&Pt.setValue(J,"isOrthographic",q.isOrthographicCamera===!0),D!==q&&(D=q,Gn=!0,xr=!0)}if(ae.isSkinnedMesh){Pt.setOptional(J,ae,"bindMatrix"),Pt.setOptional(J,ae,"bindMatrixInverse");const xn=ae.skeleton;xn&&(xn.boneTexture===null&&xn.computeBoneTexture(),Pt.setValue(J,"boneTexture",xn.boneTexture,be))}ae.isBatchedMesh&&(Pt.setOptional(J,ae,"batchingTexture"),Pt.setValue(J,"batchingTexture",ae._matricesTexture,be),Pt.setOptional(J,ae,"batchingIdTexture"),Pt.setValue(J,"batchingIdTexture",ae._indirectTexture,be),Pt.setOptional(J,ae,"batchingColorTexture"),ae._colorsTexture!==null&&Pt.setValue(J,"batchingColorTexture",ae._colorsTexture,be));const Vn=Te.morphAttributes;if((Vn.position!==void 0||Vn.normal!==void 0||Vn.color!==void 0)&&Le.update(ae,Te,Sn),(Gn||gt.receiveShadow!==ae.receiveShadow)&&(gt.receiveShadow=ae.receiveShadow,Pt.setValue(J,"receiveShadow",ae.receiveShadow)),Ue.isMeshGouraudMaterial&&Ue.envMap!==null&&(fi.envMap.value=at,fi.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Ue.isMeshStandardMaterial&&Ue.envMap===null&&ge.environment!==null&&(fi.envMapIntensity.value=ge.environmentIntensity),Gn&&(Pt.setValue(J,"toneMappingExposure",S.toneMappingExposure),gt.needsLights&&Bl(fi,xr),Xe&&Ue.fog===!0&&_e.refreshFogUniforms(fi,Xe),_e.refreshMaterialUniforms(fi,Ue,B,O,g.state.transmissionRenderTarget[q.id]),om.upload(J,jt(gt),fi,be)),Ue.isShaderMaterial&&Ue.uniformsNeedUpdate===!0&&(om.upload(J,jt(gt),fi,be),Ue.uniformsNeedUpdate=!1),Ue.isSpriteMaterial&&Pt.setValue(J,"center",ae.center),Pt.setValue(J,"modelViewMatrix",ae.modelViewMatrix),Pt.setValue(J,"normalMatrix",ae.normalMatrix),Pt.setValue(J,"modelMatrix",ae.matrixWorld),Ue.isShaderMaterial||Ue.isRawShaderMaterial){const xn=Ue.uniformsGroups;for(let $n=0,Wr=xn.length;$n<Wr;$n++){const ei=xn[$n];dt.update(ei,Sn),dt.bind(ei,Sn)}}return Sn}function Bl(q,ge){q.ambientLightColor.needsUpdate=ge,q.lightProbe.needsUpdate=ge,q.directionalLights.needsUpdate=ge,q.directionalLightShadows.needsUpdate=ge,q.pointLights.needsUpdate=ge,q.pointLightShadows.needsUpdate=ge,q.spotLights.needsUpdate=ge,q.spotLightShadows.needsUpdate=ge,q.rectAreaLights.needsUpdate=ge,q.hemisphereLights.needsUpdate=ge}function _o(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(q,ge,Te){const Ue=xe.get(q);Ue.__autoAllocateDepthBuffer=q.resolveDepthBuffer===!1,Ue.__autoAllocateDepthBuffer===!1&&(Ue.__useRenderToTexture=!1),xe.get(q.texture).__webglTexture=ge,xe.get(q.depthTexture).__webglTexture=Ue.__autoAllocateDepthBuffer?void 0:Te,Ue.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(q,ge){const Te=xe.get(q);Te.__webglFramebuffer=ge,Te.__useDefaultFramebuffer=ge===void 0};const Aa=J.createFramebuffer();this.setRenderTarget=function(q,ge=0,Te=0){U=q,T=ge,R=Te;let Ue=!0,ae=null,Xe=!1,$e=!1;if(q){const at=xe.get(q);if(at.__useDefaultFramebuffer!==void 0)pe.bindFramebuffer(J.FRAMEBUFFER,null),Ue=!1;else if(at.__webglFramebuffer===void 0)be.setupRenderTarget(q);else if(at.__hasExternalTextures)be.rebindTextures(q,xe.get(q.texture).__webglTexture,xe.get(q.depthTexture).__webglTexture);else if(q.depthBuffer){const pt=q.depthTexture;if(at.__boundDepthTexture!==pt){if(pt!==null&&xe.has(pt)&&(q.width!==pt.image.width||q.height!==pt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");be.setupDepthRenderbuffer(q)}}const vt=q.texture;(vt.isData3DTexture||vt.isDataArrayTexture||vt.isCompressedArrayTexture)&&($e=!0);const _t=xe.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(_t[ge])?ae=_t[ge][Te]:ae=_t[ge],Xe=!0):q.samples>0&&be.useMultisampledRTT(q)===!1?ae=xe.get(q).__webglMultisampledFramebuffer:Array.isArray(_t)?ae=_t[Te]:ae=_t,L.copy(q.viewport),P.copy(q.scissor),I=q.scissorTest}else L.copy(k).multiplyScalar(B).floor(),P.copy(Y).multiplyScalar(B).floor(),I=Q;if(Te!==0&&(ae=Aa),pe.bindFramebuffer(J.FRAMEBUFFER,ae)&&Ue&&pe.drawBuffers(q,ae),pe.viewport(L),pe.scissor(P),pe.setScissorTest(I),Xe){const at=xe.get(q.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+ge,at.__webglTexture,Te)}else if($e){const at=ge;for(let vt=0;vt<q.textures.length;vt++){const _t=xe.get(q.textures[vt]);J.framebufferTextureLayer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+vt,_t.__webglTexture,Te,at)}}else if(q!==null&&Te!==0){const at=xe.get(q.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,at.__webglTexture,Te)}A=-1},this.readRenderTargetPixels=function(q,ge,Te,Ue,ae,Xe,$e,lt=0){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let at=xe.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&$e!==void 0&&(at=at[$e]),at){pe.bindFramebuffer(J.FRAMEBUFFER,at);try{const vt=q.textures[lt],_t=vt.format,pt=vt.type;if(!$.textureFormatReadable(_t)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!$.textureTypeReadable(pt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=q.width-Ue&&Te>=0&&Te<=q.height-ae&&(q.textures.length>1&&J.readBuffer(J.COLOR_ATTACHMENT0+lt),J.readPixels(ge,Te,Ue,ae,Je.convert(_t),Je.convert(pt),Xe))}finally{const vt=U!==null?xe.get(U).__webglFramebuffer:null;pe.bindFramebuffer(J.FRAMEBUFFER,vt)}}},this.readRenderTargetPixelsAsync=async function(q,ge,Te,Ue,ae,Xe,$e,lt=0){if(!(q&&q.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let at=xe.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&$e!==void 0&&(at=at[$e]),at)if(ge>=0&&ge<=q.width-Ue&&Te>=0&&Te<=q.height-ae){pe.bindFramebuffer(J.FRAMEBUFFER,at);const vt=q.textures[lt],_t=vt.format,pt=vt.type;if(!$.textureFormatReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!$.textureTypeReadable(pt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Tt=J.createBuffer();J.bindBuffer(J.PIXEL_PACK_BUFFER,Tt),J.bufferData(J.PIXEL_PACK_BUFFER,Xe.byteLength,J.STREAM_READ),q.textures.length>1&&J.readBuffer(J.COLOR_ATTACHMENT0+lt),J.readPixels(ge,Te,Ue,ae,Je.convert(_t),Je.convert(pt),0);const Ht=U!==null?xe.get(U).__webglFramebuffer:null;pe.bindFramebuffer(J.FRAMEBUFFER,Ht);const tn=J.fenceSync(J.SYNC_GPU_COMMANDS_COMPLETE,0);return J.flush(),await cL(J,tn,4),J.bindBuffer(J.PIXEL_PACK_BUFFER,Tt),J.getBufferSubData(J.PIXEL_PACK_BUFFER,0,Xe),J.deleteBuffer(Tt),J.deleteSync(tn),Xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(q,ge=null,Te=0){const Ue=Math.pow(2,-Te),ae=Math.floor(q.image.width*Ue),Xe=Math.floor(q.image.height*Ue),$e=ge!==null?ge.x:0,lt=ge!==null?ge.y:0;be.setTexture2D(q,0),J.copyTexSubImage2D(J.TEXTURE_2D,Te,0,0,$e,lt,ae,Xe),pe.unbindTexture()};const Is=J.createFramebuffer(),xo=J.createFramebuffer();this.copyTextureToTexture=function(q,ge,Te=null,Ue=null,ae=0,Xe=null){Xe===null&&(ae!==0?(Rf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Xe=ae,ae=0):Xe=0);let $e,lt,at,vt,_t,pt,Tt,Ht,tn;const Jt=q.isCompressedTexture?q.mipmaps[Xe]:q.image;if(Te!==null)$e=Te.max.x-Te.min.x,lt=Te.max.y-Te.min.y,at=Te.isBox3?Te.max.z-Te.min.z:1,vt=Te.min.x,_t=Te.min.y,pt=Te.isBox3?Te.min.z:0;else{const Vn=Math.pow(2,-ae);$e=Math.floor(Jt.width*Vn),lt=Math.floor(Jt.height*Vn),q.isDataArrayTexture?at=Jt.depth:q.isData3DTexture?at=Math.floor(Jt.depth*Vn):at=1,vt=0,_t=0,pt=0}Ue!==null?(Tt=Ue.x,Ht=Ue.y,tn=Ue.z):(Tt=0,Ht=0,tn=0);const kt=Je.convert(ge.format),gt=Je.convert(ge.type);let Qt;ge.isData3DTexture?(be.setTexture3D(ge,0),Qt=J.TEXTURE_3D):ge.isDataArrayTexture||ge.isCompressedArrayTexture?(be.setTexture2DArray(ge,0),Qt=J.TEXTURE_2D_ARRAY):(be.setTexture2D(ge,0),Qt=J.TEXTURE_2D),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,ge.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ge.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,ge.unpackAlignment);const It=J.getParameter(J.UNPACK_ROW_LENGTH),Sn=J.getParameter(J.UNPACK_IMAGE_HEIGHT),rr=J.getParameter(J.UNPACK_SKIP_PIXELS),Gn=J.getParameter(J.UNPACK_SKIP_ROWS),xr=J.getParameter(J.UNPACK_SKIP_IMAGES);J.pixelStorei(J.UNPACK_ROW_LENGTH,Jt.width),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,Jt.height),J.pixelStorei(J.UNPACK_SKIP_PIXELS,vt),J.pixelStorei(J.UNPACK_SKIP_ROWS,_t),J.pixelStorei(J.UNPACK_SKIP_IMAGES,pt);const Pt=q.isDataArrayTexture||q.isData3DTexture,fi=ge.isDataArrayTexture||ge.isData3DTexture;if(q.isDepthTexture){const Vn=xe.get(q),xn=xe.get(ge),$n=xe.get(Vn.__renderTarget),Wr=xe.get(xn.__renderTarget);pe.bindFramebuffer(J.READ_FRAMEBUFFER,$n.__webglFramebuffer),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,Wr.__webglFramebuffer);for(let ei=0;ei<at;ei++)Pt&&(J.framebufferTextureLayer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,xe.get(q).__webglTexture,ae,pt+ei),J.framebufferTextureLayer(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,xe.get(ge).__webglTexture,Xe,tn+ei)),J.blitFramebuffer(vt,_t,$e,lt,Tt,Ht,$e,lt,J.DEPTH_BUFFER_BIT,J.NEAREST);pe.bindFramebuffer(J.READ_FRAMEBUFFER,null),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,null)}else if(ae!==0||q.isRenderTargetTexture||xe.has(q)){const Vn=xe.get(q),xn=xe.get(ge);pe.bindFramebuffer(J.READ_FRAMEBUFFER,Is),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,xo);for(let $n=0;$n<at;$n++)Pt?J.framebufferTextureLayer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,Vn.__webglTexture,ae,pt+$n):J.framebufferTexture2D(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,Vn.__webglTexture,ae),fi?J.framebufferTextureLayer(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,xn.__webglTexture,Xe,tn+$n):J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,xn.__webglTexture,Xe),ae!==0?J.blitFramebuffer(vt,_t,$e,lt,Tt,Ht,$e,lt,J.COLOR_BUFFER_BIT,J.NEAREST):fi?J.copyTexSubImage3D(Qt,Xe,Tt,Ht,tn+$n,vt,_t,$e,lt):J.copyTexSubImage2D(Qt,Xe,Tt,Ht,vt,_t,$e,lt);pe.bindFramebuffer(J.READ_FRAMEBUFFER,null),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,null)}else fi?q.isDataTexture||q.isData3DTexture?J.texSubImage3D(Qt,Xe,Tt,Ht,tn,$e,lt,at,kt,gt,Jt.data):ge.isCompressedArrayTexture?J.compressedTexSubImage3D(Qt,Xe,Tt,Ht,tn,$e,lt,at,kt,Jt.data):J.texSubImage3D(Qt,Xe,Tt,Ht,tn,$e,lt,at,kt,gt,Jt):q.isDataTexture?J.texSubImage2D(J.TEXTURE_2D,Xe,Tt,Ht,$e,lt,kt,gt,Jt.data):q.isCompressedTexture?J.compressedTexSubImage2D(J.TEXTURE_2D,Xe,Tt,Ht,Jt.width,Jt.height,kt,Jt.data):J.texSubImage2D(J.TEXTURE_2D,Xe,Tt,Ht,$e,lt,kt,gt,Jt);J.pixelStorei(J.UNPACK_ROW_LENGTH,It),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,Sn),J.pixelStorei(J.UNPACK_SKIP_PIXELS,rr),J.pixelStorei(J.UNPACK_SKIP_ROWS,Gn),J.pixelStorei(J.UNPACK_SKIP_IMAGES,xr),Xe===0&&ge.generateMipmaps&&J.generateMipmap(Qt),pe.unbindTexture()},this.initRenderTarget=function(q){xe.get(q).__webglFramebuffer===void 0&&be.setupRenderTarget(q)},this.initTexture=function(q){q.isCubeTexture?be.setTextureCube(q,0):q.isData3DTexture?be.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?be.setTexture2DArray(q,0):be.setTexture2D(q,0),pe.unbindTexture()},this.resetState=function(){T=0,R=0,U=null,pe.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return yr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Gt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Gt._getUnpackColorSpace()}}const gC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:zx,AddEquation:io,AddOperation:GA,AdditiveAnimationBlendMode:jx,AdditiveBlending:V_,AgXToneMapping:jA,AlphaFormat:Vx,AlwaysCompare:a2,AlwaysDepth:xm,AlwaysStencilFunc:q_,AmbientLight:Q2,AnimationAction:aC,AnimationClip:Nf,AnimationLoader:PI,AnimationMixer:uN,AnimationObjectGroup:lN,AnimationUtils:OI,ArcCurve:M2,ArrayCamera:iC,ArrowHelper:NN,AttachedBindMode:j_,Audio:rC,AudioAnalyser:QI,AudioContext:y1,AudioListener:ZI,AudioLoader:jI,AxesHelper:PN,BackSide:Fi,BasicDepthPacking:QA,BasicShadowMap:bA,BatchedMesh:_2,Bone:t1,BooleanKeyframeTrack:Il,Box2:_N,Box3:Qn,Box3Helper:LN,BoxGeometry:go,BoxHelper:ON,BufferAttribute:$t,BufferGeometry:Rt,BufferGeometryLoader:nC,ByteType:Bx,Cache:ws,Camera:Fg,CameraHelper:UN,CanvasTexture:tI,CapsuleGeometry:jg,CatmullRomCurve3:Kg,CineonToneMapping:WA,CircleGeometry:qg,ClampToEdgeWrapping:Fr,Clock:_1,Color:Ye,ColorKeyframeTrack:p1,ColorManagement:Gt,CompressedArrayTexture:$L,CompressedCubeTexture:eI,CompressedTexture:Xg,CompressedTextureLoader:zI,ConeGeometry:$f,ConstantAlphaFactor:FA,ConstantColorFactor:PA,Controls:FN,CubeCamera:f2,CubeReflectionMapping:_a,CubeRefractionMapping:co,CubeTexture:Qf,CubeTextureLoader:FI,CubeUVReflectionMapping:wu,CubicBezierCurve:a1,CubicBezierCurve3:w2,CubicInterpolant:V2,CullFaceBack:H_,CullFaceFront:xA,CullFaceFrontBack:cO,CullFaceNone:_A,Curve:us,CurvePath:T2,CustomBlending:SA,CustomToneMapping:XA,CylinderGeometry:Cu,Cylindrical:yN,Data3DTexture:zg,DataArrayTexture:Pg,DataTexture:As,DataTextureLoader:BI,DataUtils:ML,DecrementStencilOp:EO,DecrementWrapStencilOp:wO,DefaultLoadingManager:j2,DepthFormat:uu,DepthStencilFormat:hu,DepthTexture:i1,DetachedBindMode:YA,DirectionalLight:J2,DirectionalLightHelper:DN,DiscreteInterpolant:W2,DodecahedronGeometry:Yg,DoubleSide:zn,DstAlphaFactor:UA,DstColorFactor:LA,DynamicCopyUsage:kO,DynamicDrawUsage:IO,DynamicReadUsage:zO,EdgesGeometry:E2,EllipseCurve:Zg,EqualCompare:n2,EqualDepth:Sm,EqualStencilFunc:RO,EquirectangularReflectionMapping:xf,EquirectangularRefractionMapping:bf,Euler:Bi,EventDispatcher:Ds,ExternalTexture:r1,ExtrudeGeometry:Qg,FileLoader:ba,Float16BufferAttribute:UL,Float32BufferAttribute:ft,FloatType:Qi,Fog:kg,FogExp2:Bg,FramebufferTexture:QL,FrontSide:ya,Frustum:Ll,FrustumArray:Wg,GLBufferAttribute:mN,GLSL1:HO,GLSL3:Y_,GreaterCompare:i2,GreaterDepth:Mm,GreaterEqualCompare:s2,GreaterEqualDepth:Em,GreaterEqualStencilFunc:LO,GreaterStencilFunc:UO,GridHelper:CN,Group:eu,HalfFloatType:Tu,HemisphereLight:Y2,HemisphereLightHelper:AN,IcosahedronGeometry:$g,ImageBitmapLoader:XI,ImageLoader:Pf,ImageUtils:c2,IncrementStencilOp:SO,IncrementWrapStencilOp:MO,InstancedBufferAttribute:Al,InstancedBufferGeometry:v1,InstancedInterleavedBuffer:pN,InstancedMesh:y2,Int16BufferAttribute:RL,Int32BufferAttribute:DL,Int8BufferAttribute:TL,IntType:Rg,InterleavedBuffer:Hg,InterleavedBufferAttribute:Tl,Interpolant:nd,InterpolateDiscrete:Mf,InterpolateLinear:eg,InterpolateSmooth:sm,InterpolationSamplingMode:XO,InterpolationSamplingType:WO,InvertStencilOp:TO,KeepStencilOp:hl,KeyframeTrack:Vr,LOD:g2,LatheGeometry:e0,Layers:pu,LessCompare:t2,LessDepth:bm,LessEqualCompare:Yx,LessEqualDepth:wl,LessEqualStencilFunc:DO,LessStencilFunc:CO,Light:yo,LightProbe:tC,Line:ho,Line3:SN,LineBasicMaterial:ki,LineCurve:o1,LineCurve3:l1,LineDashedMaterial:k2,LineLoop:x2,LineSegments:Us,LinearFilter:Fn,LinearInterpolant:d1,LinearMipMapLinearFilter:dO,LinearMipMapNearestFilter:fO,LinearMipmapLinearFilter:Ms,LinearMipmapNearestFilter:sf,LinearSRGBColorSpace:uo,LinearToneMapping:HA,LinearTransfer:Tf,Loader:nr,LoaderUtils:$_,LoadingManager:m1,LoopOnce:ZA,LoopPingPong:JA,LoopRepeat:KA,MOUSE:yA,Material:Ui,MaterialLoader:l0,MathUtils:tg,Matrix2:M1,Matrix3:At,Matrix4:bt,MaxEquation:TA,Mesh:mn,MeshBasicMaterial:Ea,MeshDepthMaterial:a0,MeshDistanceMaterial:o0,MeshLambertMaterial:F2,MeshMatcapMaterial:B2,MeshNormalMaterial:z2,MeshPhongMaterial:N2,MeshPhysicalMaterial:I2,MeshStandardMaterial:h1,MeshToonMaterial:P2,MinEquation:wA,MirroredRepeatWrapping:Ef,MixOperation:kA,MultiplyBlending:X_,MultiplyOperation:Kf,NearestFilter:vi,NearestMipMapLinearFilter:hO,NearestMipMapNearestFilter:uO,NearestMipmapLinearFilter:Qc,NearestMipmapNearestFilter:Fx,NeutralToneMapping:qA,NeverCompare:e2,NeverDepth:_m,NeverStencilFunc:AO,NoBlending:pa,NoColorSpace:ha,NoToneMapping:Ts,NormalAnimationBlendMode:Ng,NormalBlending:xl,NotEqualCompare:r2,NotEqualDepth:wm,NotEqualStencilFunc:OO,NumberKeyframeTrack:Lf,Object3D:Xt,ObjectLoader:VI,ObjectSpaceNormalMap:$A,OctahedronGeometry:ed,OneFactor:CA,OneMinusConstantAlphaFactor:BA,OneMinusConstantColorFactor:zA,OneMinusDstAlphaFactor:OA,OneMinusDstColorFactor:IA,OneMinusSrcAlphaFactor:ym,OneMinusSrcColorFactor:DA,OrthographicCamera:Pl,PCFShadowMap:Ag,PCFSoftShadowMap:rf,PMREMGenerator:nx,Path:sg,PerspectiveCamera:Kn,Plane:ua,PlaneGeometry:Ma,PlaneHelper:IN,PointLight:K2,PointLightHelper:wN,Points:b2,PointsMaterial:n1,PolarGridHelper:RN,PolyhedronGeometry:vo,PositionalAudio:JI,PropertyBinding:Wt,PropertyMixer:sC,QuadraticBezierCurve:c1,QuadraticBezierCurve3:Jg,Quaternion:yi,QuaternionKeyframeTrack:id,QuaternionLinearInterpolant:X2,RED_GREEN_RGTC2_Format:Qm,RED_RGTC1_Format:Km,REVISION:Tg,RGBADepthPacking:qx,RGBAFormat:Di,RGBAIntegerFormat:Ig,RGBA_ASTC_10x10_Format:Wm,RGBA_ASTC_10x5_Format:Gm,RGBA_ASTC_10x6_Format:Hm,RGBA_ASTC_10x8_Format:Vm,RGBA_ASTC_12x10_Format:Xm,RGBA_ASTC_12x12_Format:jm,RGBA_ASTC_4x4_Format:Lm,RGBA_ASTC_5x4_Format:Im,RGBA_ASTC_5x5_Format:Nm,RGBA_ASTC_6x5_Format:Pm,RGBA_ASTC_6x6_Format:zm,RGBA_ASTC_8x5_Format:Fm,RGBA_ASTC_8x6_Format:Bm,RGBA_ASTC_8x8_Format:km,RGBA_BPTC_Format:qm,RGBA_ETC2_EAC_Format:Om,RGBA_PVRTC_2BPPV1_Format:Rm,RGBA_PVRTC_4BPPV1_Format:Cm,RGBA_S3TC_DXT1_Format:of,RGBA_S3TC_DXT3_Format:lf,RGBA_S3TC_DXT5_Format:cf,RGBDepthPacking:yO,RGBFormat:Wx,RGBIntegerFormat:pO,RGB_BPTC_SIGNED_Format:Ym,RGB_BPTC_UNSIGNED_Format:Zm,RGB_ETC1_Format:Dm,RGB_ETC2_Format:Um,RGB_PVRTC_2BPPV1_Format:Am,RGB_PVRTC_4BPPV1_Format:Tm,RGB_S3TC_DXT1_Format:af,RGDepthPacking:_O,RGFormat:Xx,RGIntegerFormat:Lg,RawShaderMaterial:L2,Ray:Au,Raycaster:E1,RectAreaLight:$2,RedFormat:Og,RedIntegerFormat:Jf,ReinhardToneMapping:VA,RenderTarget:Kx,RenderTarget3D:hN,RepeatWrapping:Sf,ReplaceStencilOp:bO,ReverseSubtractEquation:MA,RingGeometry:t0,SIGNED_RED_GREEN_RGTC2_Format:$m,SIGNED_RED_RGTC1_Format:Jm,SRGBColorSpace:Ri,SRGBTransfer:an,Scene:Gg,ShaderChunk:Ut,ShaderLib:rs,ShaderMaterial:Hr,ShadowMaterial:O2,Shape:oo,ShapeGeometry:n0,ShapePath:zN,ShapeUtils:os,ShortType:kx,Skeleton:Vg,SkeletonHelper:MN,SkinnedMesh:v2,Source:ro,Sphere:ri,SphereGeometry:td,Spherical:oC,SphericalHarmonics3:eC,SplineCurve:u1,SpotLight:Z2,SpotLightHelper:EN,Sprite:m2,SpriteMaterial:e1,SrcAlphaFactor:vm,SrcAlphaSaturateFactor:NA,SrcColorFactor:RA,StaticCopyUsage:BO,StaticDrawUsage:Af,StaticReadUsage:PO,StereoCamera:qI,StreamCopyUsage:GO,StreamDrawUsage:NO,StreamReadUsage:FO,StringKeyframeTrack:Nl,SubtractEquation:EA,SubtractiveBlending:W_,TOUCH:lO,TangentSpaceNormalMap:mo,TetrahedronGeometry:i0,Texture:Dn,TextureLoader:q2,TextureUtils:VN,Timer:gN,TimestampQuery:VO,TorusGeometry:r0,TorusKnotGeometry:s0,Triangle:Ji,TriangleFanDrawMode:vO,TriangleStripDrawMode:gO,TrianglesDrawMode:mO,TubeGeometry:fo,UVMapping:Cg,Uint16BufferAttribute:Jx,Uint32BufferAttribute:Qx,Uint8BufferAttribute:AL,Uint8ClampedBufferAttribute:CL,Uniform:S1,UniformsGroup:dN,UniformsLib:it,UniformsUtils:$x,UnsignedByteType:Gr,UnsignedInt101111Type:Hx,UnsignedInt248Type:cu,UnsignedInt5999Type:Gx,UnsignedIntType:xa,UnsignedShort4444Type:Dg,UnsignedShort5551Type:Ug,UnsignedShortType:lu,VSMShadowMap:is,Vector2:ke,Vector3:j,Vector4:Bt,VectorKeyframeTrack:If,VideoFrameTexture:JL,VideoTexture:S2,WebGL3DRenderTarget:pL,WebGLArrayRenderTarget:dL,WebGLCoordinateSystem:yr,WebGLCubeRenderTarget:d2,WebGLRenderTarget:Rs,WebGLRenderer:mC,WebGLUtils:pC,WebGPUCoordinateSystem:fu,WebXRController:am,WireframeGeometry:U2,WrapAroundEnding:wf,ZeroCurvatureEnding:ml,ZeroFactor:AA,ZeroSlopeEnding:gl,ZeroStencilOp:xO,createCanvasElement:l2},Symbol.toStringTag,{value:"Module"}));var Oy={exports:{}},Ly={};/**
|
|
3849
|
-
* @license React
|
|
3850
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
3851
|
-
*
|
|
3852
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3853
|
-
*
|
|
3854
|
-
* This source code is licensed under the MIT license found in the
|
|
3855
|
-
* LICENSE file in the root directory of this source tree.
|
|
3856
|
-
*/var AM;function M4(){if(AM)return Ly;AM=1;var i=gA(),e=PU();function t(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,s=i.useRef,a=i.useEffect,o=i.useMemo,l=i.useDebugValue;return Ly.useSyncExternalStoreWithSelector=function(c,h,d,p,m){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=o(function(){function g(T){if(!b){if(b=!0,E=T,T=p(T),m!==void 0&&x.hasValue){var R=x.value;if(m(R,T))return S=R}return S=T}if(R=S,n(E,T))return R;var U=p(T);return m!==void 0&&m(R,U)?(E=T,R):(E=T,S=U)}var b=!1,E,S,w=d===void 0?null:d;return[function(){return g(h())},w===null?void 0:function(){return g(w())}]},[h,d,p,m]);var _=r(c,v[0],v[1]);return a(function(){x.hasValue=!0,x.value=_},[_]),l(_),_},Ly}var CM;function w4(){return CM||(CM=1,Oy.exports=M4()),Oy.exports}var T4=w4();const A4=po(T4),{useSyncExternalStoreWithSelector:C4}=A4,R4=i=>i;function D4(i,e=R4,t){const n=C4(i.subscribe,i.getState,i.getInitialState,e,t);return nf.useDebugValue(n),n}const RM=(i,e)=>{const t=zU(i),n=(r,s=e)=>D4(t,r,s);return Object.assign(n,t),n},U4=((i,e)=>i?RM(i,e):RM),O4=i=>typeof i=="object"&&typeof i.then=="function",Pp=[];function L4(i,e,t=(n,r)=>n===r){if(i===e)return!0;if(!i||!e)return!1;const n=i.length;if(e.length!==n)return!1;for(let r=0;r<n;r++)if(!t(i[r],e[r]))return!1;return!0}function I4(i,e=null,t=!1,n={}){e===null&&(e=[i]);for(const s of Pp)if(L4(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return n.lifespan&&n.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:n.equal,remove:()=>{const s=Pp.indexOf(r);s!==-1&&Pp.splice(s,1)},promise:(O4(i)?i:i(...e)).then(s=>{r.response=s,n.lifespan&&n.lifespan>0&&(r.timeout=setTimeout(r.remove,n.lifespan))}).catch(s=>r.error=s)};if(Pp.push(r),!t)throw r.promise}const N4=(i,e,t)=>I4(i,e,!1,t);var Iy={exports:{}},Ny={exports:{}},Py={exports:{}},zy={};/**
|
|
3857
|
-
* @license React
|
|
3858
|
-
* scheduler.production.js
|
|
3859
|
-
*
|
|
3860
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3861
|
-
*
|
|
3862
|
-
* This source code is licensed under the MIT license found in the
|
|
3863
|
-
* LICENSE file in the root directory of this source tree.
|
|
3864
|
-
*/var DM;function P4(){return DM||(DM=1,(function(i){function e(z,O){var B=z.length;z.push(O);e:for(;0<B;){var G=B-1>>>1,X=z[G];if(0<r(X,O))z[G]=O,z[B]=X,B=G;else break e}}function t(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var O=z[0],B=z.pop();if(B!==O){z[0]=B;e:for(var G=0,X=z.length,k=X>>>1;G<k;){var Y=2*(G+1)-1,Q=z[Y],te=Y+1,ee=z[te];if(0>r(Q,B))te<X&&0>r(ee,Q)?(z[G]=ee,z[te]=B,G=te):(z[G]=Q,z[Y]=B,G=Y);else if(te<X&&0>r(ee,B))z[G]=ee,z[te]=B,G=te;else break e}}return O}function r(z,O){var B=z.sortIndex-O.sortIndex;return B!==0?B:z.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;i.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();i.unstable_now=function(){return a.now()-o}}var l=[],c=[],h=1,d=null,p=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function E(z){for(var O=t(c);O!==null;){if(O.callback===null)n(c);else if(O.startTime<=z)n(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(z){if(x=!1,E(z),!v)if(t(l)!==null)v=!0,V();else{var O=t(c);O!==null&&H(S,O.startTime-z)}}var w=!1,T=-1,R=5,U=-1;function A(){return!(i.unstable_now()-U<R)}function D(){if(w){var z=i.unstable_now();U=z;var O=!0;try{e:{v=!1,x&&(x=!1,g(T),T=-1),m=!0;var B=p;try{t:{for(E(z),d=t(l);d!==null&&!(d.expirationTime>z&&A());){var G=d.callback;if(typeof G=="function"){d.callback=null,p=d.priorityLevel;var X=G(d.expirationTime<=z);if(z=i.unstable_now(),typeof X=="function"){d.callback=X,E(z),O=!0;break t}d===t(l)&&n(l),E(z)}else n(l);d=t(l)}if(d!==null)O=!0;else{var k=t(c);k!==null&&H(S,k.startTime-z),O=!1}}break e}finally{d=null,p=B,m=!1}O=void 0}}finally{O?L():w=!1}}}var L;if(typeof b=="function")L=function(){b(D)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,I=P.port2;P.port1.onmessage=D,L=function(){I.postMessage(null)}}else L=function(){_(D,0)};function V(){w||(w=!0,L())}function H(z,O){T=_(function(){z(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(z){z.callback=null},i.unstable_continueExecution=function(){v||m||(v=!0,V())},i.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<z?Math.floor(1e3/z):5},i.unstable_getCurrentPriorityLevel=function(){return p},i.unstable_getFirstCallbackNode=function(){return t(l)},i.unstable_next=function(z){switch(p){case 1:case 2:case 3:var O=3;break;default:O=p}var B=p;p=O;try{return z()}finally{p=B}},i.unstable_pauseExecution=function(){},i.unstable_requestPaint=function(){},i.unstable_runWithPriority=function(z,O){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=p;p=z;try{return O()}finally{p=B}},i.unstable_scheduleCallback=function(z,O,B){var G=i.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?G+B:G):B=G,z){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=B+X,z={id:h++,callback:O,priorityLevel:z,startTime:B,expirationTime:X,sortIndex:-1},B>G?(z.sortIndex=B,e(c,z),t(l)===null&&z===t(c)&&(x?(g(T),T=-1):x=!0,H(S,B-G))):(z.sortIndex=X,e(l,z),v||m||(v=!0,V())),z},i.unstable_shouldYield=A,i.unstable_wrapCallback=function(z){var O=p;return function(){var B=p;p=O;try{return z.apply(this,arguments)}finally{p=B}}}})(zy)),zy}var UM;function z4(){return UM||(UM=1,Py.exports=P4()),Py.exports}/**
|
|
3865
|
-
* @license React
|
|
3866
|
-
* react-reconciler.production.js
|
|
3867
|
-
*
|
|
3868
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3869
|
-
*
|
|
3870
|
-
* This source code is licensed under the MIT license found in the
|
|
3871
|
-
* LICENSE file in the root directory of this source tree.
|
|
3872
|
-
*/var OM;function F4(){return OM||(OM=1,(function(i){i.exports=function(e){function t(u,f,y,M){return new $D(u,f,y,M)}function n(){}function r(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)f+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(u){return u===null||typeof u!="object"?null:(u=dS&&u[dS]||u["@@iterator"],typeof u=="function"?u:null)}function a(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===s3?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case Jl:return"Fragment";case Kl:return"Portal";case ov:return"Profiler";case uS:return"StrictMode";case cv:return"Suspense";case uv:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case Pa:return(u.displayName||"Context")+".Provider";case hS:return(u._context.displayName||"Context")+".Consumer";case lv:var f=u.render;return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case hv:return f=u.displayName||null,f!==null?f:a(u.type)||"Memo";case za:f=u._payload,u=u._init;try{return a(u(f))}catch{}}return null}function o(u){if(fv===void 0)try{throw Error()}catch(y){var f=y.stack.trim().match(/\n( *(at )?)/);fv=f&&f[1]||"",pS=-1<y.stack.indexOf(`
|
|
3832
|
+
}`;class _4{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new r1(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Hr({vertexShader:v4,fragmentShader:y4,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new mn(new Ma(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class x4 extends Ds{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,p=null,m=null,v=null;const x=typeof XRWebGLBinding<"u",_=new _4,g={},b=t.getContextAttributes();let E=null,S=null;const w=[],T=[],R=new ke;let U=null;const A=new Kn;A.viewport=new Bt;const D=new Kn;D.viewport=new Bt;const L=[A,D],P=new iC;let I=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let re=w[ie];return re===void 0&&(re=new am,w[ie]=re),re.getTargetRaySpace()},this.getControllerGrip=function(ie){let re=w[ie];return re===void 0&&(re=new am,w[ie]=re),re.getGripSpace()},this.getHand=function(ie){let re=w[ie];return re===void 0&&(re=new am,w[ie]=re),re.getHandSpace()};function H(ie){const re=T.indexOf(ie.inputSource);if(re===-1)return;const de=w[re];de!==void 0&&(de.update(ie.inputSource,ie.frame,c||a),de.dispatchEvent({type:ie.type,data:ie.inputSource}))}function z(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",z),r.removeEventListener("inputsourceschange",O);for(let ie=0;ie<w.length;ie++){const re=T[ie];re!==null&&(T[ie]=null,w[ie].disconnect(re))}I=null,V=null,_.reset();for(const ie in g)delete g[ie];e.setRenderTarget(E),m=null,p=null,d=null,r=null,S=null,ee.stop(),n.isPresenting=!1,e.setPixelRatio(U),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){s=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return d===null&&x&&(d=new XRWebGLBinding(r,t)),d},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",z),r.addEventListener("inputsourceschange",O),b.xrCompatible!==!0&&await t.makeXRCompatible(),U=e.getPixelRatio(),e.getSize(R),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let de=null,Ae=null,Me=null;b.depth&&(Me=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,de=b.stencil?hu:uu,Ae=b.stencil?cu:xa);const ve={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};d=this.getBinding(),p=d.createProjectionLayer(ve),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),S=new Rs(p.textureWidth,p.textureHeight,{format:Di,type:Gr,depthTexture:new i1(p.textureWidth,p.textureHeight,Ae,void 0,void 0,void 0,void 0,void 0,void 0,de),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const de={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,de),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),S=new Rs(m.framebufferWidth,m.framebufferHeight,{format:Di,type:Gr,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),ee.setContext(r),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function O(ie){for(let re=0;re<ie.removed.length;re++){const de=ie.removed[re],Ae=T.indexOf(de);Ae>=0&&(T[Ae]=null,w[Ae].disconnect(de))}for(let re=0;re<ie.added.length;re++){const de=ie.added[re];let Ae=T.indexOf(de);if(Ae===-1){for(let ve=0;ve<w.length;ve++)if(ve>=T.length){T.push(de),Ae=ve;break}else if(T[ve]===null){T[ve]=de,Ae=ve;break}if(Ae===-1)break}const Me=w[Ae];Me&&Me.connect(de)}}const B=new j,G=new j;function X(ie,re,de){B.setFromMatrixPosition(re.matrixWorld),G.setFromMatrixPosition(de.matrixWorld);const Ae=B.distanceTo(G),Me=re.projectionMatrix.elements,ve=de.projectionMatrix.elements,fe=Me[14]/(Me[10]-1),J=Me[14]/(Me[10]+1),oe=(Me[9]+1)/Me[5],se=(Me[9]-1)/Me[5],$=(Me[8]-1)/Me[0],pe=(ve[8]+1)/ve[0],ye=fe*$,xe=fe*pe,be=Ae/(-$+pe),ue=be*-$;if(re.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(ue),ie.translateZ(be),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),Me[10]===-1)ie.projectionMatrix.copy(re.projectionMatrix),ie.projectionMatrixInverse.copy(re.projectionMatrixInverse);else{const He=fe+be,W=J+be,F=ye-ue,ne=xe+(Ae-ue),Se=oe*J/W*He,_e=se*J/W*He;ie.projectionMatrix.makePerspective(F,ne,Se,_e,He,W),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function k(ie,re){re===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(re.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;let re=ie.near,de=ie.far;_.texture!==null&&(_.depthNear>0&&(re=_.depthNear),_.depthFar>0&&(de=_.depthFar)),P.near=D.near=A.near=re,P.far=D.far=A.far=de,(I!==P.near||V!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),I=P.near,V=P.far),P.layers.mask=ie.layers.mask|6,A.layers.mask=P.layers.mask&3,D.layers.mask=P.layers.mask&5;const Ae=ie.parent,Me=P.cameras;k(P,Ae);for(let ve=0;ve<Me.length;ve++)k(Me[ve],Ae);Me.length===2?X(P,A,D):P.projectionMatrix.copy(A.projectionMatrix),Y(ie,P,Ae)};function Y(ie,re,de){de===null?ie.matrix.copy(re.matrixWorld):(ie.matrix.copy(de.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(re.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(re.projectionMatrix),ie.projectionMatrixInverse.copy(re.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=du*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return P},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(ie){l=ie,p!==null&&(p.fixedFoveation=ie),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=ie)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(P)},this.getCameraTexture=function(ie){return g[ie]};let Q=null;function te(ie,re){if(h=re.getViewerPose(c||a),v=re,h!==null){const de=h.views;m!==null&&(e.setRenderTargetFramebuffer(S,m.framebuffer),e.setRenderTarget(S));let Ae=!1;de.length!==P.cameras.length&&(P.cameras.length=0,Ae=!0);for(let J=0;J<de.length;J++){const oe=de[J];let se=null;if(m!==null)se=m.getViewport(oe);else{const pe=d.getViewSubImage(p,oe);se=pe.viewport,J===0&&(e.setRenderTargetTextures(S,pe.colorTexture,pe.depthStencilTexture),e.setRenderTarget(S))}let $=L[J];$===void 0&&($=new Kn,$.layers.enable(J),$.viewport=new Bt,L[J]=$),$.matrix.fromArray(oe.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(oe.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(se.x,se.y,se.width,se.height),J===0&&(P.matrix.copy($.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale)),Ae===!0&&P.cameras.push($)}const Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){d=n.getBinding();const J=d.getDepthInformation(de[0]);J&&J.isValid&&J.texture&&_.init(J,r.renderState)}if(Me&&Me.includes("camera-access")&&x){e.state.unbindTexture(),d=n.getBinding();for(let J=0;J<de.length;J++){const oe=de[J].camera;if(oe){let se=g[oe];se||(se=new r1,g[oe]=se);const $=d.getCameraImage(oe);se.sourceTexture=$}}}}for(let de=0;de<w.length;de++){const Ae=T[de],Me=w[de];Ae!==null&&Me!==void 0&&Me.update(Ae,re,c||a)}Q&&Q(ie,re),re.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:re}),v=null}const ee=new cC;ee.setAnimationLoop(te),this.setAnimationLoop=function(ie){Q=ie},this.dispose=function(){}}}const sl=new Bi,b4=new bt;function S4(i,e){function t(_,g){_.matrixAutoUpdate===!0&&_.updateMatrix(),g.value.copy(_.matrix)}function n(_,g){g.color.getRGB(_.fogColor.value,h2(i)),g.isFog?(_.fogNear.value=g.near,_.fogFar.value=g.far):g.isFogExp2&&(_.fogDensity.value=g.density)}function r(_,g,b,E,S){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(_,g):g.isMeshToonMaterial?(s(_,g),d(_,g)):g.isMeshPhongMaterial?(s(_,g),h(_,g)):g.isMeshStandardMaterial?(s(_,g),p(_,g),g.isMeshPhysicalMaterial&&m(_,g,S)):g.isMeshMatcapMaterial?(s(_,g),v(_,g)):g.isMeshDepthMaterial?s(_,g):g.isMeshDistanceMaterial?(s(_,g),x(_,g)):g.isMeshNormalMaterial?s(_,g):g.isLineBasicMaterial?(a(_,g),g.isLineDashedMaterial&&o(_,g)):g.isPointsMaterial?l(_,g,b,E):g.isSpriteMaterial?c(_,g):g.isShadowMaterial?(_.color.value.copy(g.color),_.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(_,g){_.opacity.value=g.opacity,g.color&&_.diffuse.value.copy(g.color),g.emissive&&_.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.bumpMap&&(_.bumpMap.value=g.bumpMap,t(g.bumpMap,_.bumpMapTransform),_.bumpScale.value=g.bumpScale,g.side===Fi&&(_.bumpScale.value*=-1)),g.normalMap&&(_.normalMap.value=g.normalMap,t(g.normalMap,_.normalMapTransform),_.normalScale.value.copy(g.normalScale),g.side===Fi&&_.normalScale.value.negate()),g.displacementMap&&(_.displacementMap.value=g.displacementMap,t(g.displacementMap,_.displacementMapTransform),_.displacementScale.value=g.displacementScale,_.displacementBias.value=g.displacementBias),g.emissiveMap&&(_.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,_.emissiveMapTransform)),g.specularMap&&(_.specularMap.value=g.specularMap,t(g.specularMap,_.specularMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);const b=e.get(g),E=b.envMap,S=b.envMapRotation;E&&(_.envMap.value=E,sl.copy(S),sl.x*=-1,sl.y*=-1,sl.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(sl.y*=-1,sl.z*=-1),_.envMapRotation.value.setFromMatrix4(b4.makeRotationFromEuler(sl)),_.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap&&(_.lightMap.value=g.lightMap,_.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,_.lightMapTransform)),g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,_.aoMapTransform))}function a(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform))}function o(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function l(_,g,b,E){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*b,_.scale.value=E*.5,g.map&&(_.map.value=g.map,t(g.map,_.uvTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function c(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function h(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function d(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function p(_,g){_.metalness.value=g.metalness,g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,_.metalnessMapTransform)),_.roughness.value=g.roughness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,_.roughnessMapTransform)),g.envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function m(_,g,b){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,_.sheenColorMapTransform)),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,_.sheenRoughnessMapTransform))),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,_.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(_.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Fi&&_.clearcoatNormalScale.value.negate())),g.dispersion>0&&(_.dispersion.value=g.dispersion),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,_.iridescenceMapTransform)),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=b.texture,_.transmissionSamplerSize.value.set(b.width,b.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,_.transmissionMapTransform)),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(_.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(_.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,_.specularColorMapTransform)),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,_.specularIntensityMapTransform))}function v(_,g){g.matcap&&(_.matcap.value=g.matcap)}function x(_,g){const b=e.get(g).light;_.referencePosition.value.setFromMatrixPosition(b.matrixWorld),_.nearDistance.value=b.shadow.camera.near,_.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function E4(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,E){const S=E.program;n.uniformBlockBinding(b,S)}function c(b,E){let S=r[b.id];S===void 0&&(v(b),S=h(b),r[b.id]=S,b.addEventListener("dispose",_));const w=E.program;n.updateUBOMapping(b,w);const T=e.render.frame;s[b.id]!==T&&(p(b),s[b.id]=T)}function h(b){const E=d();b.__bindingPointIndex=E;const S=i.createBuffer(),w=b.__size,T=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,w,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,S),S}function d(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(b){const E=r[b.id],S=b.uniforms,w=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let T=0,R=S.length;T<R;T++){const U=Array.isArray(S[T])?S[T]:[S[T]];for(let A=0,D=U.length;A<D;A++){const L=U[A];if(m(L,T,A,w)===!0){const P=L.__offset,I=Array.isArray(L.value)?L.value:[L.value];let V=0;for(let H=0;H<I.length;H++){const z=I[H],O=x(z);typeof z=="number"||typeof z=="boolean"?(L.__data[0]=z,i.bufferSubData(i.UNIFORM_BUFFER,P+V,L.__data)):z.isMatrix3?(L.__data[0]=z.elements[0],L.__data[1]=z.elements[1],L.__data[2]=z.elements[2],L.__data[3]=0,L.__data[4]=z.elements[3],L.__data[5]=z.elements[4],L.__data[6]=z.elements[5],L.__data[7]=0,L.__data[8]=z.elements[6],L.__data[9]=z.elements[7],L.__data[10]=z.elements[8],L.__data[11]=0):(z.toArray(L.__data,V),V+=O.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,P,L.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(b,E,S,w){const T=b.value,R=E+"_"+S;if(w[R]===void 0)return typeof T=="number"||typeof T=="boolean"?w[R]=T:w[R]=T.clone(),!0;{const U=w[R];if(typeof T=="number"||typeof T=="boolean"){if(U!==T)return w[R]=T,!0}else if(U.equals(T)===!1)return U.copy(T),!0}return!1}function v(b){const E=b.uniforms;let S=0;const w=16;for(let R=0,U=E.length;R<U;R++){const A=Array.isArray(E[R])?E[R]:[E[R]];for(let D=0,L=A.length;D<L;D++){const P=A[D],I=Array.isArray(P.value)?P.value:[P.value];for(let V=0,H=I.length;V<H;V++){const z=I[V],O=x(z),B=S%w,G=B%O.boundary,X=B+G;S+=G,X!==0&&w-X<O.storage&&(S+=w-X),P.__data=new Float32Array(O.storage/Float32Array.BYTES_PER_ELEMENT),P.__offset=S,S+=O.storage}}}const T=S%w;return T>0&&(S+=w-T),b.__size=S,b.__cache={},this}function x(b){const E={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(E.boundary=4,E.storage=4):b.isVector2?(E.boundary=8,E.storage=8):b.isVector3||b.isColor?(E.boundary=16,E.storage=12):b.isVector4?(E.boundary=16,E.storage=16):b.isMatrix3?(E.boundary=48,E.storage=48):b.isMatrix4?(E.boundary=64,E.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),E}function _(b){const E=b.target;E.removeEventListener("dispose",_);const S=a.indexOf(E.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function g(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:g}}class mC{constructor(e={}){const{canvas:t=l2(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=a;const v=new Uint32Array(4),x=new Int32Array(4);let _=null,g=null;const b=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ts,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let w=!1;this._outputColorSpace=Ri;let T=0,R=0,U=null,A=-1,D=null;const L=new Bt,P=new Bt;let I=null;const V=new Ye(0);let H=0,z=t.width,O=t.height,B=1,G=null,X=null;const k=new Bt(0,0,z,O),Y=new Bt(0,0,z,O);let Q=!1;const te=new Ll;let ee=!1,ie=!1;const re=new bt,de=new j,Ae=new Bt,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ve=!1;function fe(){return U===null?B:1}let J=n;function oe(q,ge){return t.getContext(q,ge)}try{const q={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Tg}`),t.addEventListener("webglcontextlost",Ge,!1),t.addEventListener("webglcontextrestored",rt,!1),t.addEventListener("webglcontextcreationerror",Pe,!1),J===null){const ge="webgl2";if(J=oe(ge,q),J===null)throw oe(ge)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let se,$,pe,ye,xe,be,ue,He,W,F,ne,Se,_e,me,ze,Ne,je,Ze,Le,Be,Ve,Je,We,dt;function ce(){se=new NF(J),se.init(),Je=new pC(J,se),$=new CF(J,se,e,Je),pe=new m4(J,se),$.reversedDepthBuffer&&p&&pe.buffers.depth.setReversed(!0),ye=new FF(J),xe=new n4,be=new g4(J,se,pe,xe,$,Je,ye),ue=new DF(S),He=new IF(S),W=new WN(J),We=new TF(J,W),F=new PF(J,W,ye,We),ne=new kF(J,F,W,ye),Le=new BF(J,$,be),Ne=new RF(xe),Se=new t4(S,ue,He,se,$,We,Ne),_e=new S4(S,xe),me=new r4,ze=new u4(se),Ze=new wF(S,ue,He,pe,ne,m,l),je=new d4(S,ne,$),dt=new E4(J,ye,$,pe),Be=new AF(J,se,ye),Ve=new zF(J,se,ye),ye.programs=Se.programs,S.capabilities=$,S.extensions=se,S.properties=xe,S.renderLists=me,S.shadowMap=je,S.state=pe,S.info=ye}ce();const Ie=new x4(S,J);this.xr=Ie,this.getContext=function(){return J},this.getContextAttributes=function(){return J.getContextAttributes()},this.forceContextLoss=function(){const q=se.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){const q=se.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(q){q!==void 0&&(B=q,this.setSize(z,O,!1))},this.getSize=function(q){return q.set(z,O)},this.setSize=function(q,ge,Te=!0){if(Ie.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=q,O=ge,t.width=Math.floor(q*B),t.height=Math.floor(ge*B),Te===!0&&(t.style.width=q+"px",t.style.height=ge+"px"),this.setViewport(0,0,q,ge)},this.getDrawingBufferSize=function(q){return q.set(z*B,O*B).floor()},this.setDrawingBufferSize=function(q,ge,Te){z=q,O=ge,B=Te,t.width=Math.floor(q*Te),t.height=Math.floor(ge*Te),this.setViewport(0,0,q,ge)},this.getCurrentViewport=function(q){return q.copy(L)},this.getViewport=function(q){return q.copy(k)},this.setViewport=function(q,ge,Te,Ue){q.isVector4?k.set(q.x,q.y,q.z,q.w):k.set(q,ge,Te,Ue),pe.viewport(L.copy(k).multiplyScalar(B).round())},this.getScissor=function(q){return q.copy(Y)},this.setScissor=function(q,ge,Te,Ue){q.isVector4?Y.set(q.x,q.y,q.z,q.w):Y.set(q,ge,Te,Ue),pe.scissor(P.copy(Y).multiplyScalar(B).round())},this.getScissorTest=function(){return Q},this.setScissorTest=function(q){pe.setScissorTest(Q=q)},this.setOpaqueSort=function(q){G=q},this.setTransparentSort=function(q){X=q},this.getClearColor=function(q){return q.copy(Ze.getClearColor())},this.setClearColor=function(){Ze.setClearColor(...arguments)},this.getClearAlpha=function(){return Ze.getClearAlpha()},this.setClearAlpha=function(){Ze.setClearAlpha(...arguments)},this.clear=function(q=!0,ge=!0,Te=!0){let Ue=0;if(q){let ae=!1;if(U!==null){const Xe=U.texture.format;ae=Xe===Ig||Xe===Lg||Xe===Jf}if(ae){const Xe=U.texture.type,$e=Xe===Gr||Xe===xa||Xe===lu||Xe===cu||Xe===Dg||Xe===Ug,lt=Ze.getClearColor(),at=Ze.getClearAlpha(),vt=lt.r,_t=lt.g,pt=lt.b;$e?(v[0]=vt,v[1]=_t,v[2]=pt,v[3]=at,J.clearBufferuiv(J.COLOR,0,v)):(x[0]=vt,x[1]=_t,x[2]=pt,x[3]=at,J.clearBufferiv(J.COLOR,0,x))}else Ue|=J.COLOR_BUFFER_BIT}ge&&(Ue|=J.DEPTH_BUFFER_BIT),Te&&(Ue|=J.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),J.clear(Ue)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ge,!1),t.removeEventListener("webglcontextrestored",rt,!1),t.removeEventListener("webglcontextcreationerror",Pe,!1),Ze.dispose(),me.dispose(),ze.dispose(),xe.dispose(),ue.dispose(),He.dispose(),ne.dispose(),We.dispose(),dt.dispose(),Se.dispose(),Ie.dispose(),Ie.removeEventListener("sessionstart",en),Ie.removeEventListener("sessionend",gn),bn.stop()};function Ge(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function rt(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const q=ye.autoReset,ge=je.enabled,Te=je.autoUpdate,Ue=je.needsUpdate,ae=je.type;ce(),ye.autoReset=q,je.enabled=ge,je.autoUpdate=Te,je.needsUpdate=Ue,je.type=ae}function Pe(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function De(q){const ge=q.target;ge.removeEventListener("dispose",De),Qe(ge)}function Qe(q){ot(q),xe.remove(q)}function ot(q){const ge=xe.get(q).programs;ge!==void 0&&(ge.forEach(function(Te){Se.releaseProgram(Te)}),q.isShaderMaterial&&Se.releaseShaderCache(q))}this.renderBufferDirect=function(q,ge,Te,Ue,ae,Xe){ge===null&&(ge=Me);const $e=ae.isMesh&&ae.matrixWorld.determinant()<0,lt=Ls(q,ge,Te,Ue,ae);pe.setMaterial(Ue,$e);let at=Te.index,vt=1;if(Ue.wireframe===!0){if(at=F.getWireframeAttribute(Te),at===void 0)return;vt=2}const _t=Te.drawRange,pt=Te.attributes.position;let Tt=_t.start*vt,Ht=(_t.start+_t.count)*vt;Xe!==null&&(Tt=Math.max(Tt,Xe.start*vt),Ht=Math.min(Ht,(Xe.start+Xe.count)*vt)),at!==null?(Tt=Math.max(Tt,0),Ht=Math.min(Ht,at.count)):pt!=null&&(Tt=Math.max(Tt,0),Ht=Math.min(Ht,pt.count));const tn=Ht-Tt;if(tn<0||tn===1/0)return;We.setup(ae,Ue,lt,Te,at);let Jt,kt=Be;if(at!==null&&(Jt=W.get(at),kt=Ve,kt.setIndex(Jt)),ae.isMesh)Ue.wireframe===!0?(pe.setLineWidth(Ue.wireframeLinewidth*fe()),kt.setMode(J.LINES)):kt.setMode(J.TRIANGLES);else if(ae.isLine){let gt=Ue.linewidth;gt===void 0&&(gt=1),pe.setLineWidth(gt*fe()),ae.isLineSegments?kt.setMode(J.LINES):ae.isLineLoop?kt.setMode(J.LINE_LOOP):kt.setMode(J.LINE_STRIP)}else ae.isPoints?kt.setMode(J.POINTS):ae.isSprite&&kt.setMode(J.TRIANGLES);if(ae.isBatchedMesh)if(ae._multiDrawInstances!==null)Rf("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),kt.renderMultiDrawInstances(ae._multiDrawStarts,ae._multiDrawCounts,ae._multiDrawCount,ae._multiDrawInstances);else if(se.get("WEBGL_multi_draw"))kt.renderMultiDraw(ae._multiDrawStarts,ae._multiDrawCounts,ae._multiDrawCount);else{const gt=ae._multiDrawStarts,Qt=ae._multiDrawCounts,It=ae._multiDrawCount,Sn=at?W.get(at).bytesPerElement:1,rr=xe.get(Ue).currentProgram.getUniforms();for(let Gn=0;Gn<It;Gn++)rr.setValue(J,"_gl_DrawID",Gn),kt.render(gt[Gn]/Sn,Qt[Gn])}else if(ae.isInstancedMesh)kt.renderInstances(Tt,tn,ae.count);else if(Te.isInstancedBufferGeometry){const gt=Te._maxInstanceCount!==void 0?Te._maxInstanceCount:1/0,Qt=Math.min(Te.instanceCount,gt);kt.renderInstances(Tt,tn,Qt)}else kt.render(Tt,tn)};function st(q,ge,Te){q.transparent===!0&&q.side===zn&&q.forceSinglePass===!1?(q.side=Fi,q.needsUpdate=!0,vn(q,ge,Te),q.side=ya,q.needsUpdate=!0,vn(q,ge,Te),q.side=zn):vn(q,ge,Te)}this.compile=function(q,ge,Te=null){Te===null&&(Te=q),g=ze.get(Te),g.init(ge),E.push(g),Te.traverseVisible(function(ae){ae.isLight&&ae.layers.test(ge.layers)&&(g.pushLight(ae),ae.castShadow&&g.pushShadow(ae))}),q!==Te&&q.traverseVisible(function(ae){ae.isLight&&ae.layers.test(ge.layers)&&(g.pushLight(ae),ae.castShadow&&g.pushShadow(ae))}),g.setupLights();const Ue=new Set;return q.traverse(function(ae){if(!(ae.isMesh||ae.isPoints||ae.isLine||ae.isSprite))return;const Xe=ae.material;if(Xe)if(Array.isArray(Xe))for(let $e=0;$e<Xe.length;$e++){const lt=Xe[$e];st(lt,Te,ae),Ue.add(lt)}else st(Xe,Te,ae),Ue.add(Xe)}),g=E.pop(),Ue},this.compileAsync=function(q,ge,Te=null){const Ue=this.compile(q,ge,Te);return new Promise(ae=>{function Xe(){if(Ue.forEach(function($e){xe.get($e).currentProgram.isReady()&&Ue.delete($e)}),Ue.size===0){ae(q);return}setTimeout(Xe,10)}se.get("KHR_parallel_shader_compile")!==null?Xe():setTimeout(Xe,10)})};let mt=null;function on(q){mt&&mt(q)}function en(){bn.stop()}function gn(){bn.start()}const bn=new cC;bn.setAnimationLoop(on),typeof self<"u"&&bn.setContext(self),this.setAnimationLoop=function(q){mt=q,Ie.setAnimationLoop(q),q===null?bn.stop():bn.start()},Ie.addEventListener("sessionstart",en),Ie.addEventListener("sessionend",gn),this.render=function(q,ge){if(ge!==void 0&&ge.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;if(q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ge.parent===null&&ge.matrixWorldAutoUpdate===!0&&ge.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(ge),ge=Ie.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,ge,U),g=ze.get(q,E.length),g.init(ge),E.push(g),re.multiplyMatrices(ge.projectionMatrix,ge.matrixWorldInverse),te.setFromProjectionMatrix(re,yr,ge.reversedDepth),ie=this.localClippingEnabled,ee=Ne.init(this.clippingPlanes,ie),_=me.get(q,b.length),_.init(),b.push(_),Ie.enabled===!0&&Ie.isPresenting===!0){const Xe=S.xr.getDepthSensingMesh();Xe!==null&&xi(Xe,ge,-1/0,S.sortObjects)}xi(q,ge,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(G,X),ve=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,ve&&Ze.addToRenderList(_,q),this.info.render.frame++,ee===!0&&Ne.beginShadows();const Te=g.state.shadowsArray;je.render(Te,q,ge),ee===!0&&Ne.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ue=_.opaque,ae=_.transmissive;if(g.setupLights(),ge.isArrayCamera){const Xe=ge.cameras;if(ae.length>0)for(let $e=0,lt=Xe.length;$e<lt;$e++){const at=Xe[$e];Hi(Ue,ae,q,at)}ve&&Ze.render(q);for(let $e=0,lt=Xe.length;$e<lt;$e++){const at=Xe[$e];Bn(_,q,at,at.viewport)}}else ae.length>0&&Hi(Ue,ae,q,ge),ve&&Ze.render(q),Bn(_,q,ge);U!==null&&R===0&&(be.updateMultisampleRenderTarget(U),be.updateRenderTargetMipmap(U)),q.isScene===!0&&q.onAfterRender(S,q,ge),We.resetDefaultState(),A=-1,D=null,E.pop(),E.length>0?(g=E[E.length-1],ee===!0&&Ne.setGlobalState(S.clippingPlanes,g.state.camera)):g=null,b.pop(),b.length>0?_=b[b.length-1]:_=null};function xi(q,ge,Te,Ue){if(q.visible===!1)return;if(q.layers.test(ge.layers)){if(q.isGroup)Te=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(ge);else if(q.isLight)g.pushLight(q),q.castShadow&&g.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||te.intersectsSprite(q)){Ue&&Ae.setFromMatrixPosition(q.matrixWorld).applyMatrix4(re);const $e=ne.update(q),lt=q.material;lt.visible&&_.push(q,$e,lt,Te,Ae.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||te.intersectsObject(q))){const $e=ne.update(q),lt=q.material;if(Ue&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Ae.copy(q.boundingSphere.center)):($e.boundingSphere===null&&$e.computeBoundingSphere(),Ae.copy($e.boundingSphere.center)),Ae.applyMatrix4(q.matrixWorld).applyMatrix4(re)),Array.isArray(lt)){const at=$e.groups;for(let vt=0,_t=at.length;vt<_t;vt++){const pt=at[vt],Tt=lt[pt.materialIndex];Tt&&Tt.visible&&_.push(q,$e,Tt,Te,Ae.z,pt)}}else lt.visible&&_.push(q,$e,lt,Te,Ae.z,null)}}const Xe=q.children;for(let $e=0,lt=Xe.length;$e<lt;$e++)xi(Xe[$e],ge,Te,Ue)}function Bn(q,ge,Te,Ue){const ae=q.opaque,Xe=q.transmissive,$e=q.transparent;g.setupLightsView(Te),ee===!0&&Ne.setGlobalState(S.clippingPlanes,Te),Ue&&pe.viewport(L.copy(Ue)),ae.length>0&&kn(ae,ge,Te),Xe.length>0&&kn(Xe,ge,Te),$e.length>0&&kn($e,ge,Te),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function Hi(q,ge,Te,Ue){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[Ue.id]===void 0&&(g.state.transmissionRenderTarget[Ue.id]=new Rs(1,1,{generateMipmaps:!0,type:se.has("EXT_color_buffer_half_float")||se.has("EXT_color_buffer_float")?Tu:Gr,minFilter:Ms,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Gt.workingColorSpace}));const Xe=g.state.transmissionRenderTarget[Ue.id],$e=Ue.viewport||L;Xe.setSize($e.z*S.transmissionResolutionScale,$e.w*S.transmissionResolutionScale);const lt=S.getRenderTarget(),at=S.getActiveCubeFace(),vt=S.getActiveMipmapLevel();S.setRenderTarget(Xe),S.getClearColor(V),H=S.getClearAlpha(),H<1&&S.setClearColor(16777215,.5),S.clear(),ve&&Ze.render(Te);const _t=S.toneMapping;S.toneMapping=Ts;const pt=Ue.viewport;if(Ue.viewport!==void 0&&(Ue.viewport=void 0),g.setupLightsView(Ue),ee===!0&&Ne.setGlobalState(S.clippingPlanes,Ue),kn(q,Te,Ue),be.updateMultisampleRenderTarget(Xe),be.updateRenderTargetMipmap(Xe),se.has("WEBGL_multisampled_render_to_texture")===!1){let Tt=!1;for(let Ht=0,tn=ge.length;Ht<tn;Ht++){const Jt=ge[Ht],kt=Jt.object,gt=Jt.geometry,Qt=Jt.material,It=Jt.group;if(Qt.side===zn&&kt.layers.test(Ue.layers)){const Sn=Qt.side;Qt.side=Fi,Qt.needsUpdate=!0,Un(kt,Te,Ue,gt,Qt,It),Qt.side=Sn,Qt.needsUpdate=!0,Tt=!0}}Tt===!0&&(be.updateMultisampleRenderTarget(Xe),be.updateRenderTargetMipmap(Xe))}S.setRenderTarget(lt,at,vt),S.setClearColor(V,H),pt!==void 0&&(Ue.viewport=pt),S.toneMapping=_t}function kn(q,ge,Te){const Ue=ge.isScene===!0?ge.overrideMaterial:null;for(let ae=0,Xe=q.length;ae<Xe;ae++){const $e=q[ae],lt=$e.object,at=$e.geometry,vt=$e.group;let _t=$e.material;_t.allowOverride===!0&&Ue!==null&&(_t=Ue),lt.layers.test(Te.layers)&&Un(lt,ge,Te,at,_t,vt)}}function Un(q,ge,Te,Ue,ae,Xe){q.onBeforeRender(S,ge,Te,Ue,ae,Xe),q.modelViewMatrix.multiplyMatrices(Te.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ae.onBeforeRender(S,ge,Te,Ue,q,Xe),ae.transparent===!0&&ae.side===zn&&ae.forceSinglePass===!1?(ae.side=Fi,ae.needsUpdate=!0,S.renderBufferDirect(Te,ge,Ue,ae,q,Xe),ae.side=ya,ae.needsUpdate=!0,S.renderBufferDirect(Te,ge,Ue,ae,q,Xe),ae.side=zn):S.renderBufferDirect(Te,ge,Ue,ae,q,Xe),q.onAfterRender(S,ge,Te,Ue,ae,Xe)}function vn(q,ge,Te){ge.isScene!==!0&&(ge=Me);const Ue=xe.get(q),ae=g.state.lights,Xe=g.state.shadowsArray,$e=ae.state.version,lt=Se.getParameters(q,ae.state,Xe,ge,Te),at=Se.getProgramCacheKey(lt);let vt=Ue.programs;Ue.environment=q.isMeshStandardMaterial?ge.environment:null,Ue.fog=ge.fog,Ue.envMap=(q.isMeshStandardMaterial?He:ue).get(q.envMap||Ue.environment),Ue.envMapRotation=Ue.environment!==null&&q.envMap===null?ge.environmentRotation:q.envMapRotation,vt===void 0&&(q.addEventListener("dispose",De),vt=new Map,Ue.programs=vt);let _t=vt.get(at);if(_t!==void 0){if(Ue.currentProgram===_t&&Ue.lightsStateVersion===$e)return Os(q,lt),_t}else lt.uniforms=Se.getUniforms(q),q.onBeforeCompile(lt,S),_t=Se.acquireProgram(lt,at),vt.set(at,_t),Ue.uniforms=lt.uniforms;const pt=Ue.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(pt.clippingPlanes=Ne.uniform),Os(q,lt),Ue.needsLights=_o(q),Ue.lightsStateVersion=$e,Ue.needsLights&&(pt.ambientLightColor.value=ae.state.ambient,pt.lightProbe.value=ae.state.probe,pt.directionalLights.value=ae.state.directional,pt.directionalLightShadows.value=ae.state.directionalShadow,pt.spotLights.value=ae.state.spot,pt.spotLightShadows.value=ae.state.spotShadow,pt.rectAreaLights.value=ae.state.rectArea,pt.ltc_1.value=ae.state.rectAreaLTC1,pt.ltc_2.value=ae.state.rectAreaLTC2,pt.pointLights.value=ae.state.point,pt.pointLightShadows.value=ae.state.pointShadow,pt.hemisphereLights.value=ae.state.hemi,pt.directionalShadowMap.value=ae.state.directionalShadowMap,pt.directionalShadowMatrix.value=ae.state.directionalShadowMatrix,pt.spotShadowMap.value=ae.state.spotShadowMap,pt.spotLightMatrix.value=ae.state.spotLightMatrix,pt.spotLightMap.value=ae.state.spotLightMap,pt.pointShadowMap.value=ae.state.pointShadowMap,pt.pointShadowMatrix.value=ae.state.pointShadowMatrix),Ue.currentProgram=_t,Ue.uniformsList=null,_t}function jt(q){if(q.uniformsList===null){const ge=q.currentProgram.getUniforms();q.uniformsList=om.seqWithValue(ge.seq,q.uniforms)}return q.uniformsList}function Os(q,ge){const Te=xe.get(q);Te.outputColorSpace=ge.outputColorSpace,Te.batching=ge.batching,Te.batchingColor=ge.batchingColor,Te.instancing=ge.instancing,Te.instancingColor=ge.instancingColor,Te.instancingMorph=ge.instancingMorph,Te.skinning=ge.skinning,Te.morphTargets=ge.morphTargets,Te.morphNormals=ge.morphNormals,Te.morphColors=ge.morphColors,Te.morphTargetsCount=ge.morphTargetsCount,Te.numClippingPlanes=ge.numClippingPlanes,Te.numIntersection=ge.numClipIntersection,Te.vertexAlphas=ge.vertexAlphas,Te.vertexTangents=ge.vertexTangents,Te.toneMapping=ge.toneMapping}function Ls(q,ge,Te,Ue,ae){ge.isScene!==!0&&(ge=Me),be.resetTextureUnits();const Xe=ge.fog,$e=Ue.isMeshStandardMaterial?ge.environment:null,lt=U===null?S.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:uo,at=(Ue.isMeshStandardMaterial?He:ue).get(Ue.envMap||$e),vt=Ue.vertexColors===!0&&!!Te.attributes.color&&Te.attributes.color.itemSize===4,_t=!!Te.attributes.tangent&&(!!Ue.normalMap||Ue.anisotropy>0),pt=!!Te.morphAttributes.position,Tt=!!Te.morphAttributes.normal,Ht=!!Te.morphAttributes.color;let tn=Ts;Ue.toneMapped&&(U===null||U.isXRRenderTarget===!0)&&(tn=S.toneMapping);const Jt=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,kt=Jt!==void 0?Jt.length:0,gt=xe.get(Ue),Qt=g.state.lights;if(ee===!0&&(ie===!0||q!==D)){const xn=q===D&&Ue.id===A;Ne.setState(Ue,q,xn)}let It=!1;Ue.version===gt.__version?(gt.needsLights&>.lightsStateVersion!==Qt.state.version||gt.outputColorSpace!==lt||ae.isBatchedMesh&>.batching===!1||!ae.isBatchedMesh&>.batching===!0||ae.isBatchedMesh&>.batchingColor===!0&&ae.colorTexture===null||ae.isBatchedMesh&>.batchingColor===!1&&ae.colorTexture!==null||ae.isInstancedMesh&>.instancing===!1||!ae.isInstancedMesh&>.instancing===!0||ae.isSkinnedMesh&>.skinning===!1||!ae.isSkinnedMesh&>.skinning===!0||ae.isInstancedMesh&>.instancingColor===!0&&ae.instanceColor===null||ae.isInstancedMesh&>.instancingColor===!1&&ae.instanceColor!==null||ae.isInstancedMesh&>.instancingMorph===!0&&ae.morphTexture===null||ae.isInstancedMesh&>.instancingMorph===!1&&ae.morphTexture!==null||gt.envMap!==at||Ue.fog===!0&>.fog!==Xe||gt.numClippingPlanes!==void 0&&(gt.numClippingPlanes!==Ne.numPlanes||gt.numIntersection!==Ne.numIntersection)||gt.vertexAlphas!==vt||gt.vertexTangents!==_t||gt.morphTargets!==pt||gt.morphNormals!==Tt||gt.morphColors!==Ht||gt.toneMapping!==tn||gt.morphTargetsCount!==kt)&&(It=!0):(It=!0,gt.__version=Ue.version);let Sn=gt.currentProgram;It===!0&&(Sn=vn(Ue,ge,ae));let rr=!1,Gn=!1,xr=!1;const Pt=Sn.getUniforms(),fi=gt.uniforms;if(pe.useProgram(Sn.program)&&(rr=!0,Gn=!0,xr=!0),Ue.id!==A&&(A=Ue.id,Gn=!0),rr||D!==q){pe.buffers.depth.getReversed()&&q.reversedDepth!==!0&&(q._reversedDepth=!0,q.updateProjectionMatrix()),Pt.setValue(J,"projectionMatrix",q.projectionMatrix),Pt.setValue(J,"viewMatrix",q.matrixWorldInverse);const $n=Pt.map.cameraPosition;$n!==void 0&&$n.setValue(J,de.setFromMatrixPosition(q.matrixWorld)),$.logarithmicDepthBuffer&&Pt.setValue(J,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(Ue.isMeshPhongMaterial||Ue.isMeshToonMaterial||Ue.isMeshLambertMaterial||Ue.isMeshBasicMaterial||Ue.isMeshStandardMaterial||Ue.isShaderMaterial)&&Pt.setValue(J,"isOrthographic",q.isOrthographicCamera===!0),D!==q&&(D=q,Gn=!0,xr=!0)}if(ae.isSkinnedMesh){Pt.setOptional(J,ae,"bindMatrix"),Pt.setOptional(J,ae,"bindMatrixInverse");const xn=ae.skeleton;xn&&(xn.boneTexture===null&&xn.computeBoneTexture(),Pt.setValue(J,"boneTexture",xn.boneTexture,be))}ae.isBatchedMesh&&(Pt.setOptional(J,ae,"batchingTexture"),Pt.setValue(J,"batchingTexture",ae._matricesTexture,be),Pt.setOptional(J,ae,"batchingIdTexture"),Pt.setValue(J,"batchingIdTexture",ae._indirectTexture,be),Pt.setOptional(J,ae,"batchingColorTexture"),ae._colorsTexture!==null&&Pt.setValue(J,"batchingColorTexture",ae._colorsTexture,be));const Vn=Te.morphAttributes;if((Vn.position!==void 0||Vn.normal!==void 0||Vn.color!==void 0)&&Le.update(ae,Te,Sn),(Gn||gt.receiveShadow!==ae.receiveShadow)&&(gt.receiveShadow=ae.receiveShadow,Pt.setValue(J,"receiveShadow",ae.receiveShadow)),Ue.isMeshGouraudMaterial&&Ue.envMap!==null&&(fi.envMap.value=at,fi.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Ue.isMeshStandardMaterial&&Ue.envMap===null&&ge.environment!==null&&(fi.envMapIntensity.value=ge.environmentIntensity),Gn&&(Pt.setValue(J,"toneMappingExposure",S.toneMappingExposure),gt.needsLights&&Bl(fi,xr),Xe&&Ue.fog===!0&&_e.refreshFogUniforms(fi,Xe),_e.refreshMaterialUniforms(fi,Ue,B,O,g.state.transmissionRenderTarget[q.id]),om.upload(J,jt(gt),fi,be)),Ue.isShaderMaterial&&Ue.uniformsNeedUpdate===!0&&(om.upload(J,jt(gt),fi,be),Ue.uniformsNeedUpdate=!1),Ue.isSpriteMaterial&&Pt.setValue(J,"center",ae.center),Pt.setValue(J,"modelViewMatrix",ae.modelViewMatrix),Pt.setValue(J,"normalMatrix",ae.normalMatrix),Pt.setValue(J,"modelMatrix",ae.matrixWorld),Ue.isShaderMaterial||Ue.isRawShaderMaterial){const xn=Ue.uniformsGroups;for(let $n=0,Wr=xn.length;$n<Wr;$n++){const ei=xn[$n];dt.update(ei,Sn),dt.bind(ei,Sn)}}return Sn}function Bl(q,ge){q.ambientLightColor.needsUpdate=ge,q.lightProbe.needsUpdate=ge,q.directionalLights.needsUpdate=ge,q.directionalLightShadows.needsUpdate=ge,q.pointLights.needsUpdate=ge,q.pointLightShadows.needsUpdate=ge,q.spotLights.needsUpdate=ge,q.spotLightShadows.needsUpdate=ge,q.rectAreaLights.needsUpdate=ge,q.hemisphereLights.needsUpdate=ge}function _o(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(q,ge,Te){const Ue=xe.get(q);Ue.__autoAllocateDepthBuffer=q.resolveDepthBuffer===!1,Ue.__autoAllocateDepthBuffer===!1&&(Ue.__useRenderToTexture=!1),xe.get(q.texture).__webglTexture=ge,xe.get(q.depthTexture).__webglTexture=Ue.__autoAllocateDepthBuffer?void 0:Te,Ue.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(q,ge){const Te=xe.get(q);Te.__webglFramebuffer=ge,Te.__useDefaultFramebuffer=ge===void 0};const Aa=J.createFramebuffer();this.setRenderTarget=function(q,ge=0,Te=0){U=q,T=ge,R=Te;let Ue=!0,ae=null,Xe=!1,$e=!1;if(q){const at=xe.get(q);if(at.__useDefaultFramebuffer!==void 0)pe.bindFramebuffer(J.FRAMEBUFFER,null),Ue=!1;else if(at.__webglFramebuffer===void 0)be.setupRenderTarget(q);else if(at.__hasExternalTextures)be.rebindTextures(q,xe.get(q.texture).__webglTexture,xe.get(q.depthTexture).__webglTexture);else if(q.depthBuffer){const pt=q.depthTexture;if(at.__boundDepthTexture!==pt){if(pt!==null&&xe.has(pt)&&(q.width!==pt.image.width||q.height!==pt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");be.setupDepthRenderbuffer(q)}}const vt=q.texture;(vt.isData3DTexture||vt.isDataArrayTexture||vt.isCompressedArrayTexture)&&($e=!0);const _t=xe.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(_t[ge])?ae=_t[ge][Te]:ae=_t[ge],Xe=!0):q.samples>0&&be.useMultisampledRTT(q)===!1?ae=xe.get(q).__webglMultisampledFramebuffer:Array.isArray(_t)?ae=_t[Te]:ae=_t,L.copy(q.viewport),P.copy(q.scissor),I=q.scissorTest}else L.copy(k).multiplyScalar(B).floor(),P.copy(Y).multiplyScalar(B).floor(),I=Q;if(Te!==0&&(ae=Aa),pe.bindFramebuffer(J.FRAMEBUFFER,ae)&&Ue&&pe.drawBuffers(q,ae),pe.viewport(L),pe.scissor(P),pe.setScissorTest(I),Xe){const at=xe.get(q.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+ge,at.__webglTexture,Te)}else if($e){const at=ge;for(let vt=0;vt<q.textures.length;vt++){const _t=xe.get(q.textures[vt]);J.framebufferTextureLayer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+vt,_t.__webglTexture,Te,at)}}else if(q!==null&&Te!==0){const at=xe.get(q.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,at.__webglTexture,Te)}A=-1},this.readRenderTargetPixels=function(q,ge,Te,Ue,ae,Xe,$e,lt=0){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let at=xe.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&$e!==void 0&&(at=at[$e]),at){pe.bindFramebuffer(J.FRAMEBUFFER,at);try{const vt=q.textures[lt],_t=vt.format,pt=vt.type;if(!$.textureFormatReadable(_t)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!$.textureTypeReadable(pt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=q.width-Ue&&Te>=0&&Te<=q.height-ae&&(q.textures.length>1&&J.readBuffer(J.COLOR_ATTACHMENT0+lt),J.readPixels(ge,Te,Ue,ae,Je.convert(_t),Je.convert(pt),Xe))}finally{const vt=U!==null?xe.get(U).__webglFramebuffer:null;pe.bindFramebuffer(J.FRAMEBUFFER,vt)}}},this.readRenderTargetPixelsAsync=async function(q,ge,Te,Ue,ae,Xe,$e,lt=0){if(!(q&&q.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let at=xe.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&$e!==void 0&&(at=at[$e]),at)if(ge>=0&&ge<=q.width-Ue&&Te>=0&&Te<=q.height-ae){pe.bindFramebuffer(J.FRAMEBUFFER,at);const vt=q.textures[lt],_t=vt.format,pt=vt.type;if(!$.textureFormatReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!$.textureTypeReadable(pt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Tt=J.createBuffer();J.bindBuffer(J.PIXEL_PACK_BUFFER,Tt),J.bufferData(J.PIXEL_PACK_BUFFER,Xe.byteLength,J.STREAM_READ),q.textures.length>1&&J.readBuffer(J.COLOR_ATTACHMENT0+lt),J.readPixels(ge,Te,Ue,ae,Je.convert(_t),Je.convert(pt),0);const Ht=U!==null?xe.get(U).__webglFramebuffer:null;pe.bindFramebuffer(J.FRAMEBUFFER,Ht);const tn=J.fenceSync(J.SYNC_GPU_COMMANDS_COMPLETE,0);return J.flush(),await cL(J,tn,4),J.bindBuffer(J.PIXEL_PACK_BUFFER,Tt),J.getBufferSubData(J.PIXEL_PACK_BUFFER,0,Xe),J.deleteBuffer(Tt),J.deleteSync(tn),Xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(q,ge=null,Te=0){const Ue=Math.pow(2,-Te),ae=Math.floor(q.image.width*Ue),Xe=Math.floor(q.image.height*Ue),$e=ge!==null?ge.x:0,lt=ge!==null?ge.y:0;be.setTexture2D(q,0),J.copyTexSubImage2D(J.TEXTURE_2D,Te,0,0,$e,lt,ae,Xe),pe.unbindTexture()};const Is=J.createFramebuffer(),xo=J.createFramebuffer();this.copyTextureToTexture=function(q,ge,Te=null,Ue=null,ae=0,Xe=null){Xe===null&&(ae!==0?(Rf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Xe=ae,ae=0):Xe=0);let $e,lt,at,vt,_t,pt,Tt,Ht,tn;const Jt=q.isCompressedTexture?q.mipmaps[Xe]:q.image;if(Te!==null)$e=Te.max.x-Te.min.x,lt=Te.max.y-Te.min.y,at=Te.isBox3?Te.max.z-Te.min.z:1,vt=Te.min.x,_t=Te.min.y,pt=Te.isBox3?Te.min.z:0;else{const Vn=Math.pow(2,-ae);$e=Math.floor(Jt.width*Vn),lt=Math.floor(Jt.height*Vn),q.isDataArrayTexture?at=Jt.depth:q.isData3DTexture?at=Math.floor(Jt.depth*Vn):at=1,vt=0,_t=0,pt=0}Ue!==null?(Tt=Ue.x,Ht=Ue.y,tn=Ue.z):(Tt=0,Ht=0,tn=0);const kt=Je.convert(ge.format),gt=Je.convert(ge.type);let Qt;ge.isData3DTexture?(be.setTexture3D(ge,0),Qt=J.TEXTURE_3D):ge.isDataArrayTexture||ge.isCompressedArrayTexture?(be.setTexture2DArray(ge,0),Qt=J.TEXTURE_2D_ARRAY):(be.setTexture2D(ge,0),Qt=J.TEXTURE_2D),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,ge.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ge.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,ge.unpackAlignment);const It=J.getParameter(J.UNPACK_ROW_LENGTH),Sn=J.getParameter(J.UNPACK_IMAGE_HEIGHT),rr=J.getParameter(J.UNPACK_SKIP_PIXELS),Gn=J.getParameter(J.UNPACK_SKIP_ROWS),xr=J.getParameter(J.UNPACK_SKIP_IMAGES);J.pixelStorei(J.UNPACK_ROW_LENGTH,Jt.width),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,Jt.height),J.pixelStorei(J.UNPACK_SKIP_PIXELS,vt),J.pixelStorei(J.UNPACK_SKIP_ROWS,_t),J.pixelStorei(J.UNPACK_SKIP_IMAGES,pt);const Pt=q.isDataArrayTexture||q.isData3DTexture,fi=ge.isDataArrayTexture||ge.isData3DTexture;if(q.isDepthTexture){const Vn=xe.get(q),xn=xe.get(ge),$n=xe.get(Vn.__renderTarget),Wr=xe.get(xn.__renderTarget);pe.bindFramebuffer(J.READ_FRAMEBUFFER,$n.__webglFramebuffer),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,Wr.__webglFramebuffer);for(let ei=0;ei<at;ei++)Pt&&(J.framebufferTextureLayer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,xe.get(q).__webglTexture,ae,pt+ei),J.framebufferTextureLayer(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,xe.get(ge).__webglTexture,Xe,tn+ei)),J.blitFramebuffer(vt,_t,$e,lt,Tt,Ht,$e,lt,J.DEPTH_BUFFER_BIT,J.NEAREST);pe.bindFramebuffer(J.READ_FRAMEBUFFER,null),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,null)}else if(ae!==0||q.isRenderTargetTexture||xe.has(q)){const Vn=xe.get(q),xn=xe.get(ge);pe.bindFramebuffer(J.READ_FRAMEBUFFER,Is),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,xo);for(let $n=0;$n<at;$n++)Pt?J.framebufferTextureLayer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,Vn.__webglTexture,ae,pt+$n):J.framebufferTexture2D(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,Vn.__webglTexture,ae),fi?J.framebufferTextureLayer(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,xn.__webglTexture,Xe,tn+$n):J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,xn.__webglTexture,Xe),ae!==0?J.blitFramebuffer(vt,_t,$e,lt,Tt,Ht,$e,lt,J.COLOR_BUFFER_BIT,J.NEAREST):fi?J.copyTexSubImage3D(Qt,Xe,Tt,Ht,tn+$n,vt,_t,$e,lt):J.copyTexSubImage2D(Qt,Xe,Tt,Ht,vt,_t,$e,lt);pe.bindFramebuffer(J.READ_FRAMEBUFFER,null),pe.bindFramebuffer(J.DRAW_FRAMEBUFFER,null)}else fi?q.isDataTexture||q.isData3DTexture?J.texSubImage3D(Qt,Xe,Tt,Ht,tn,$e,lt,at,kt,gt,Jt.data):ge.isCompressedArrayTexture?J.compressedTexSubImage3D(Qt,Xe,Tt,Ht,tn,$e,lt,at,kt,Jt.data):J.texSubImage3D(Qt,Xe,Tt,Ht,tn,$e,lt,at,kt,gt,Jt):q.isDataTexture?J.texSubImage2D(J.TEXTURE_2D,Xe,Tt,Ht,$e,lt,kt,gt,Jt.data):q.isCompressedTexture?J.compressedTexSubImage2D(J.TEXTURE_2D,Xe,Tt,Ht,Jt.width,Jt.height,kt,Jt.data):J.texSubImage2D(J.TEXTURE_2D,Xe,Tt,Ht,$e,lt,kt,gt,Jt);J.pixelStorei(J.UNPACK_ROW_LENGTH,It),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,Sn),J.pixelStorei(J.UNPACK_SKIP_PIXELS,rr),J.pixelStorei(J.UNPACK_SKIP_ROWS,Gn),J.pixelStorei(J.UNPACK_SKIP_IMAGES,xr),Xe===0&&ge.generateMipmaps&&J.generateMipmap(Qt),pe.unbindTexture()},this.initRenderTarget=function(q){xe.get(q).__webglFramebuffer===void 0&&be.setupRenderTarget(q)},this.initTexture=function(q){q.isCubeTexture?be.setTextureCube(q,0):q.isData3DTexture?be.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?be.setTexture2DArray(q,0):be.setTexture2D(q,0),pe.unbindTexture()},this.resetState=function(){T=0,R=0,U=null,pe.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return yr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Gt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Gt._getUnpackColorSpace()}}const gC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:zx,AddEquation:io,AddOperation:GA,AdditiveAnimationBlendMode:jx,AdditiveBlending:V_,AgXToneMapping:jA,AlphaFormat:Vx,AlwaysCompare:a2,AlwaysDepth:xm,AlwaysStencilFunc:q_,AmbientLight:Q2,AnimationAction:aC,AnimationClip:Nf,AnimationLoader:PI,AnimationMixer:uN,AnimationObjectGroup:lN,AnimationUtils:OI,ArcCurve:M2,ArrayCamera:iC,ArrowHelper:NN,AttachedBindMode:j_,Audio:rC,AudioAnalyser:QI,AudioContext:y1,AudioListener:ZI,AudioLoader:jI,AxesHelper:PN,BackSide:Fi,BasicDepthPacking:QA,BasicShadowMap:bA,BatchedMesh:_2,Bone:t1,BooleanKeyframeTrack:Il,Box2:_N,Box3:Qn,Box3Helper:LN,BoxGeometry:go,BoxHelper:ON,BufferAttribute:$t,BufferGeometry:Rt,BufferGeometryLoader:nC,ByteType:Bx,Cache:ws,Camera:Fg,CameraHelper:UN,CanvasTexture:tI,CapsuleGeometry:jg,CatmullRomCurve3:Kg,CineonToneMapping:WA,CircleGeometry:qg,ClampToEdgeWrapping:Fr,Clock:_1,Color:Ye,ColorKeyframeTrack:p1,ColorManagement:Gt,CompressedArrayTexture:$L,CompressedCubeTexture:eI,CompressedTexture:Xg,CompressedTextureLoader:zI,ConeGeometry:$f,ConstantAlphaFactor:FA,ConstantColorFactor:PA,Controls:FN,CubeCamera:f2,CubeReflectionMapping:_a,CubeRefractionMapping:co,CubeTexture:Qf,CubeTextureLoader:FI,CubeUVReflectionMapping:wu,CubicBezierCurve:a1,CubicBezierCurve3:w2,CubicInterpolant:V2,CullFaceBack:H_,CullFaceFront:xA,CullFaceFrontBack:cO,CullFaceNone:_A,Curve:us,CurvePath:T2,CustomBlending:SA,CustomToneMapping:XA,CylinderGeometry:Cu,Cylindrical:yN,Data3DTexture:zg,DataArrayTexture:Pg,DataTexture:As,DataTextureLoader:BI,DataUtils:ML,DecrementStencilOp:EO,DecrementWrapStencilOp:wO,DefaultLoadingManager:j2,DepthFormat:uu,DepthStencilFormat:hu,DepthTexture:i1,DetachedBindMode:YA,DirectionalLight:J2,DirectionalLightHelper:DN,DiscreteInterpolant:W2,DodecahedronGeometry:Yg,DoubleSide:zn,DstAlphaFactor:UA,DstColorFactor:LA,DynamicCopyUsage:kO,DynamicDrawUsage:IO,DynamicReadUsage:zO,EdgesGeometry:E2,EllipseCurve:Zg,EqualCompare:n2,EqualDepth:Sm,EqualStencilFunc:RO,EquirectangularReflectionMapping:xf,EquirectangularRefractionMapping:bf,Euler:Bi,EventDispatcher:Ds,ExternalTexture:r1,ExtrudeGeometry:Qg,FileLoader:ba,Float16BufferAttribute:UL,Float32BufferAttribute:ft,FloatType:Qi,Fog:kg,FogExp2:Bg,FramebufferTexture:QL,FrontSide:ya,Frustum:Ll,FrustumArray:Wg,GLBufferAttribute:mN,GLSL1:HO,GLSL3:Y_,GreaterCompare:i2,GreaterDepth:Mm,GreaterEqualCompare:s2,GreaterEqualDepth:Em,GreaterEqualStencilFunc:LO,GreaterStencilFunc:UO,GridHelper:CN,Group:eu,HalfFloatType:Tu,HemisphereLight:Y2,HemisphereLightHelper:AN,IcosahedronGeometry:$g,ImageBitmapLoader:XI,ImageLoader:Pf,ImageUtils:c2,IncrementStencilOp:SO,IncrementWrapStencilOp:MO,InstancedBufferAttribute:Al,InstancedBufferGeometry:v1,InstancedInterleavedBuffer:pN,InstancedMesh:y2,Int16BufferAttribute:RL,Int32BufferAttribute:DL,Int8BufferAttribute:TL,IntType:Rg,InterleavedBuffer:Hg,InterleavedBufferAttribute:Tl,Interpolant:nd,InterpolateDiscrete:Mf,InterpolateLinear:eg,InterpolateSmooth:sm,InterpolationSamplingMode:XO,InterpolationSamplingType:WO,InvertStencilOp:TO,KeepStencilOp:hl,KeyframeTrack:Vr,LOD:g2,LatheGeometry:e0,Layers:pu,LessCompare:t2,LessDepth:bm,LessEqualCompare:Yx,LessEqualDepth:wl,LessEqualStencilFunc:DO,LessStencilFunc:CO,Light:yo,LightProbe:tC,Line:ho,Line3:SN,LineBasicMaterial:ki,LineCurve:o1,LineCurve3:l1,LineDashedMaterial:k2,LineLoop:x2,LineSegments:Us,LinearFilter:Fn,LinearInterpolant:d1,LinearMipMapLinearFilter:dO,LinearMipMapNearestFilter:fO,LinearMipmapLinearFilter:Ms,LinearMipmapNearestFilter:sf,LinearSRGBColorSpace:uo,LinearToneMapping:HA,LinearTransfer:Tf,Loader:nr,LoaderUtils:$_,LoadingManager:m1,LoopOnce:ZA,LoopPingPong:JA,LoopRepeat:KA,MOUSE:yA,Material:Ui,MaterialLoader:l0,MathUtils:tg,Matrix2:M1,Matrix3:At,Matrix4:bt,MaxEquation:TA,Mesh:mn,MeshBasicMaterial:Ea,MeshDepthMaterial:a0,MeshDistanceMaterial:o0,MeshLambertMaterial:F2,MeshMatcapMaterial:B2,MeshNormalMaterial:z2,MeshPhongMaterial:N2,MeshPhysicalMaterial:I2,MeshStandardMaterial:h1,MeshToonMaterial:P2,MinEquation:wA,MirroredRepeatWrapping:Ef,MixOperation:kA,MultiplyBlending:X_,MultiplyOperation:Kf,NearestFilter:vi,NearestMipMapLinearFilter:hO,NearestMipMapNearestFilter:uO,NearestMipmapLinearFilter:Qc,NearestMipmapNearestFilter:Fx,NeutralToneMapping:qA,NeverCompare:e2,NeverDepth:_m,NeverStencilFunc:AO,NoBlending:pa,NoColorSpace:ha,NoToneMapping:Ts,NormalAnimationBlendMode:Ng,NormalBlending:xl,NotEqualCompare:r2,NotEqualDepth:wm,NotEqualStencilFunc:OO,NumberKeyframeTrack:Lf,Object3D:Xt,ObjectLoader:VI,ObjectSpaceNormalMap:$A,OctahedronGeometry:ed,OneFactor:CA,OneMinusConstantAlphaFactor:BA,OneMinusConstantColorFactor:zA,OneMinusDstAlphaFactor:OA,OneMinusDstColorFactor:IA,OneMinusSrcAlphaFactor:ym,OneMinusSrcColorFactor:DA,OrthographicCamera:Pl,PCFShadowMap:Ag,PCFSoftShadowMap:rf,PMREMGenerator:nx,Path:sg,PerspectiveCamera:Kn,Plane:ua,PlaneGeometry:Ma,PlaneHelper:IN,PointLight:K2,PointLightHelper:wN,Points:b2,PointsMaterial:n1,PolarGridHelper:RN,PolyhedronGeometry:vo,PositionalAudio:JI,PropertyBinding:Wt,PropertyMixer:sC,QuadraticBezierCurve:c1,QuadraticBezierCurve3:Jg,Quaternion:yi,QuaternionKeyframeTrack:id,QuaternionLinearInterpolant:X2,RED_GREEN_RGTC2_Format:Qm,RED_RGTC1_Format:Km,REVISION:Tg,RGBADepthPacking:qx,RGBAFormat:Di,RGBAIntegerFormat:Ig,RGBA_ASTC_10x10_Format:Wm,RGBA_ASTC_10x5_Format:Gm,RGBA_ASTC_10x6_Format:Hm,RGBA_ASTC_10x8_Format:Vm,RGBA_ASTC_12x10_Format:Xm,RGBA_ASTC_12x12_Format:jm,RGBA_ASTC_4x4_Format:Lm,RGBA_ASTC_5x4_Format:Im,RGBA_ASTC_5x5_Format:Nm,RGBA_ASTC_6x5_Format:Pm,RGBA_ASTC_6x6_Format:zm,RGBA_ASTC_8x5_Format:Fm,RGBA_ASTC_8x6_Format:Bm,RGBA_ASTC_8x8_Format:km,RGBA_BPTC_Format:qm,RGBA_ETC2_EAC_Format:Om,RGBA_PVRTC_2BPPV1_Format:Rm,RGBA_PVRTC_4BPPV1_Format:Cm,RGBA_S3TC_DXT1_Format:of,RGBA_S3TC_DXT3_Format:lf,RGBA_S3TC_DXT5_Format:cf,RGBDepthPacking:yO,RGBFormat:Wx,RGBIntegerFormat:pO,RGB_BPTC_SIGNED_Format:Ym,RGB_BPTC_UNSIGNED_Format:Zm,RGB_ETC1_Format:Dm,RGB_ETC2_Format:Um,RGB_PVRTC_2BPPV1_Format:Am,RGB_PVRTC_4BPPV1_Format:Tm,RGB_S3TC_DXT1_Format:af,RGDepthPacking:_O,RGFormat:Xx,RGIntegerFormat:Lg,RawShaderMaterial:L2,Ray:Au,Raycaster:E1,RectAreaLight:$2,RedFormat:Og,RedIntegerFormat:Jf,ReinhardToneMapping:VA,RenderTarget:Kx,RenderTarget3D:hN,RepeatWrapping:Sf,ReplaceStencilOp:bO,ReverseSubtractEquation:MA,RingGeometry:t0,SIGNED_RED_GREEN_RGTC2_Format:$m,SIGNED_RED_RGTC1_Format:Jm,SRGBColorSpace:Ri,SRGBTransfer:an,Scene:Gg,ShaderChunk:Ut,ShaderLib:rs,ShaderMaterial:Hr,ShadowMaterial:O2,Shape:oo,ShapeGeometry:n0,ShapePath:zN,ShapeUtils:os,ShortType:kx,Skeleton:Vg,SkeletonHelper:MN,SkinnedMesh:v2,Source:ro,Sphere:ri,SphereGeometry:td,Spherical:oC,SphericalHarmonics3:eC,SplineCurve:u1,SpotLight:Z2,SpotLightHelper:EN,Sprite:m2,SpriteMaterial:e1,SrcAlphaFactor:vm,SrcAlphaSaturateFactor:NA,SrcColorFactor:RA,StaticCopyUsage:BO,StaticDrawUsage:Af,StaticReadUsage:PO,StereoCamera:qI,StreamCopyUsage:GO,StreamDrawUsage:NO,StreamReadUsage:FO,StringKeyframeTrack:Nl,SubtractEquation:EA,SubtractiveBlending:W_,TOUCH:lO,TangentSpaceNormalMap:mo,TetrahedronGeometry:i0,Texture:Dn,TextureLoader:q2,TextureUtils:VN,Timer:gN,TimestampQuery:VO,TorusGeometry:r0,TorusKnotGeometry:s0,Triangle:Ji,TriangleFanDrawMode:vO,TriangleStripDrawMode:gO,TrianglesDrawMode:mO,TubeGeometry:fo,UVMapping:Cg,Uint16BufferAttribute:Jx,Uint32BufferAttribute:Qx,Uint8BufferAttribute:AL,Uint8ClampedBufferAttribute:CL,Uniform:S1,UniformsGroup:dN,UniformsLib:it,UniformsUtils:$x,UnsignedByteType:Gr,UnsignedInt101111Type:Hx,UnsignedInt248Type:cu,UnsignedInt5999Type:Gx,UnsignedIntType:xa,UnsignedShort4444Type:Dg,UnsignedShort5551Type:Ug,UnsignedShortType:lu,VSMShadowMap:is,Vector2:ke,Vector3:j,Vector4:Bt,VectorKeyframeTrack:If,VideoFrameTexture:JL,VideoTexture:S2,WebGL3DRenderTarget:pL,WebGLArrayRenderTarget:dL,WebGLCoordinateSystem:yr,WebGLCubeRenderTarget:d2,WebGLRenderTarget:Rs,WebGLRenderer:mC,WebGLUtils:pC,WebGPUCoordinateSystem:fu,WebXRController:am,WireframeGeometry:U2,WrapAroundEnding:wf,ZeroCurvatureEnding:ml,ZeroFactor:AA,ZeroSlopeEnding:gl,ZeroStencilOp:xO,createCanvasElement:l2},Symbol.toStringTag,{value:"Module"}));var Oy={exports:{}},Ly={};var AM;function M4(){if(AM)return Ly;AM=1;var i=gA(),e=PU();function t(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,s=i.useRef,a=i.useEffect,o=i.useMemo,l=i.useDebugValue;return Ly.useSyncExternalStoreWithSelector=function(c,h,d,p,m){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=o(function(){function g(T){if(!b){if(b=!0,E=T,T=p(T),m!==void 0&&x.hasValue){var R=x.value;if(m(R,T))return S=R}return S=T}if(R=S,n(E,T))return R;var U=p(T);return m!==void 0&&m(R,U)?(E=T,R):(E=T,S=U)}var b=!1,E,S,w=d===void 0?null:d;return[function(){return g(h())},w===null?void 0:function(){return g(w())}]},[h,d,p,m]);var _=r(c,v[0],v[1]);return a(function(){x.hasValue=!0,x.value=_},[_]),l(_),_},Ly}var CM;function w4(){return CM||(CM=1,Oy.exports=M4()),Oy.exports}var T4=w4();const A4=po(T4),{useSyncExternalStoreWithSelector:C4}=A4,R4=i=>i;function D4(i,e=R4,t){const n=C4(i.subscribe,i.getState,i.getInitialState,e,t);return nf.useDebugValue(n),n}const RM=(i,e)=>{const t=zU(i),n=(r,s=e)=>D4(t,r,s);return Object.assign(n,t),n},U4=((i,e)=>i?RM(i,e):RM),O4=i=>typeof i=="object"&&typeof i.then=="function",Pp=[];function L4(i,e,t=(n,r)=>n===r){if(i===e)return!0;if(!i||!e)return!1;const n=i.length;if(e.length!==n)return!1;for(let r=0;r<n;r++)if(!t(i[r],e[r]))return!1;return!0}function I4(i,e=null,t=!1,n={}){e===null&&(e=[i]);for(const s of Pp)if(L4(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return n.lifespan&&n.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:n.equal,remove:()=>{const s=Pp.indexOf(r);s!==-1&&Pp.splice(s,1)},promise:(O4(i)?i:i(...e)).then(s=>{r.response=s,n.lifespan&&n.lifespan>0&&(r.timeout=setTimeout(r.remove,n.lifespan))}).catch(s=>r.error=s)};if(Pp.push(r),!t)throw r.promise}const N4=(i,e,t)=>I4(i,e,!1,t);var Iy={exports:{}},Ny={exports:{}},Py={exports:{}},zy={};var DM;function P4(){return DM||(DM=1,(function(i){function e(z,O){var B=z.length;z.push(O);e:for(;0<B;){var G=B-1>>>1,X=z[G];if(0<r(X,O))z[G]=O,z[B]=X,B=G;else break e}}function t(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var O=z[0],B=z.pop();if(B!==O){z[0]=B;e:for(var G=0,X=z.length,k=X>>>1;G<k;){var Y=2*(G+1)-1,Q=z[Y],te=Y+1,ee=z[te];if(0>r(Q,B))te<X&&0>r(ee,Q)?(z[G]=ee,z[te]=B,G=te):(z[G]=Q,z[Y]=B,G=Y);else if(te<X&&0>r(ee,B))z[G]=ee,z[te]=B,G=te;else break e}}return O}function r(z,O){var B=z.sortIndex-O.sortIndex;return B!==0?B:z.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;i.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();i.unstable_now=function(){return a.now()-o}}var l=[],c=[],h=1,d=null,p=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function E(z){for(var O=t(c);O!==null;){if(O.callback===null)n(c);else if(O.startTime<=z)n(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(z){if(x=!1,E(z),!v)if(t(l)!==null)v=!0,V();else{var O=t(c);O!==null&&H(S,O.startTime-z)}}var w=!1,T=-1,R=5,U=-1;function A(){return!(i.unstable_now()-U<R)}function D(){if(w){var z=i.unstable_now();U=z;var O=!0;try{e:{v=!1,x&&(x=!1,g(T),T=-1),m=!0;var B=p;try{t:{for(E(z),d=t(l);d!==null&&!(d.expirationTime>z&&A());){var G=d.callback;if(typeof G=="function"){d.callback=null,p=d.priorityLevel;var X=G(d.expirationTime<=z);if(z=i.unstable_now(),typeof X=="function"){d.callback=X,E(z),O=!0;break t}d===t(l)&&n(l),E(z)}else n(l);d=t(l)}if(d!==null)O=!0;else{var k=t(c);k!==null&&H(S,k.startTime-z),O=!1}}break e}finally{d=null,p=B,m=!1}O=void 0}}finally{O?L():w=!1}}}var L;if(typeof b=="function")L=function(){b(D)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,I=P.port2;P.port1.onmessage=D,L=function(){I.postMessage(null)}}else L=function(){_(D,0)};function V(){w||(w=!0,L())}function H(z,O){T=_(function(){z(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(z){z.callback=null},i.unstable_continueExecution=function(){v||m||(v=!0,V())},i.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<z?Math.floor(1e3/z):5},i.unstable_getCurrentPriorityLevel=function(){return p},i.unstable_getFirstCallbackNode=function(){return t(l)},i.unstable_next=function(z){switch(p){case 1:case 2:case 3:var O=3;break;default:O=p}var B=p;p=O;try{return z()}finally{p=B}},i.unstable_pauseExecution=function(){},i.unstable_requestPaint=function(){},i.unstable_runWithPriority=function(z,O){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=p;p=z;try{return O()}finally{p=B}},i.unstable_scheduleCallback=function(z,O,B){var G=i.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?G+B:G):B=G,z){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=B+X,z={id:h++,callback:O,priorityLevel:z,startTime:B,expirationTime:X,sortIndex:-1},B>G?(z.sortIndex=B,e(c,z),t(l)===null&&z===t(c)&&(x?(g(T),T=-1):x=!0,H(S,B-G))):(z.sortIndex=X,e(l,z),v||m||(v=!0,V())),z},i.unstable_shouldYield=A,i.unstable_wrapCallback=function(z){var O=p;return function(){var B=p;p=O;try{return z.apply(this,arguments)}finally{p=B}}}})(zy)),zy}var UM;function z4(){return UM||(UM=1,Py.exports=P4()),Py.exports}var OM;function F4(){return OM||(OM=1,(function(i){i.exports=function(e){function t(u,f,y,M){return new $D(u,f,y,M)}function n(){}function r(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)f+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(u){return u===null||typeof u!="object"?null:(u=dS&&u[dS]||u["@@iterator"],typeof u=="function"?u:null)}function a(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===s3?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case Jl:return"Fragment";case Kl:return"Portal";case ov:return"Profiler";case uS:return"StrictMode";case cv:return"Suspense";case uv:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case Pa:return(u.displayName||"Context")+".Provider";case hS:return(u._context.displayName||"Context")+".Consumer";case lv:var f=u.render;return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case hv:return f=u.displayName||null,f!==null?f:a(u.type)||"Memo";case za:f=u._payload,u=u._init;try{return a(u(f))}catch{}}return null}function o(u){if(fv===void 0)try{throw Error()}catch(y){var f=y.stack.trim().match(/\n( *(at )?)/);fv=f&&f[1]||"",pS=-1<y.stack.indexOf(`
|
|
3873
3833
|
at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3874
3834
|
`+fv+u+pS}function l(u,f){if(!u||dv)return"";dv=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var M={DetermineComponentFrameRoot:function(){try{if(f){var ct=function(){throw Error()};if(Object.defineProperty(ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ct,[])}catch(Dt){var ht=Dt}Reflect.construct(u,[],ct)}else{try{ct.call()}catch(Dt){ht=Dt}u.call(ct.prototype)}}else{try{throw Error()}catch(Dt){ht=Dt}(ct=u())&&typeof ct.catch=="function"&&ct.catch(function(){})}}catch(Dt){if(Dt&&ht&&typeof Dt.stack=="string")return[Dt.stack,ht.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=M.DetermineComponentFrameRoot(),Z=N[0],le=N[1];if(Z&&le){var we=Z.split(`
|
|
3875
3835
|
`),Fe=le.split(`
|
|
@@ -3880,25 +3840,7 @@ Error generating stack: `+y.message+`
|
|
|
3880
3840
|
`+(M.join(" > ")+`
|
|
3881
3841
|
|
|
3882
3842
|
No matching component was found for:
|
|
3883
|
-
`)+u.join(" > ")}return null},zt.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 27:case 5:return Ju(u.child.stateNode);default:return u.child.stateNode}},zt.injectIntoDevTools=function(){var u={bundleType:0,version:a3,rendererPackageName:o3,currentDispatcherRef:wt,findFiberByHostInstance:yS,reconcilerVersion:"19.0.0"};if(mS!==null&&(u.rendererConfig=mS),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{eh=f.inject(u),hr=f}catch{}u=!!f.checkDCE}}return u},zt.isAlreadyRendering=function(){return!1},zt.observeVisibleRects=function(u,f,y,M){if(!Qu)throw Error(r(363));u=K0(u,f);var C=D3(u,y,M).disconnect;return{disconnect:function(){C()}}},zt.shouldError=function(){return null},zt.shouldSuspend=function(){return!1},zt.startHostTransition=function(u,f,y,M){if(u.tag!==5)throw Error(r(476));var C=wo(u).queue;zu(u,C,f,Ql,y===null?n:function(){var N=wo(u).next.queue;return Bs(u,N,{},lr()),y(M)})},zt.updateContainer=function(u,f,y,M){var C=f.current,N=lr();return lS(C,N,u,f,y,M),N},zt.updateContainerSync=function(u,f,y,M){return f.tag===0&&Oo(),lS(f.current,2,u,f,y,M),2},zt},i.exports.default=i.exports,Object.defineProperty(i.exports,"__esModule",{value:!0})})(Ny)),Ny.exports}var LM;function B4(){return LM||(LM=1,Iy.exports=F4()),Iy.exports}var k4=B4();const G4=po(k4);var Fy={exports:{}},By={};/**
|
|
3884
|
-
* @license React
|
|
3885
|
-
* scheduler.production.js
|
|
3886
|
-
*
|
|
3887
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3888
|
-
*
|
|
3889
|
-
* This source code is licensed under the MIT license found in the
|
|
3890
|
-
* LICENSE file in the root directory of this source tree.
|
|
3891
|
-
*/var IM;function H4(){return IM||(IM=1,(function(i){function e(z,O){var B=z.length;z.push(O);e:for(;0<B;){var G=B-1>>>1,X=z[G];if(0<r(X,O))z[G]=O,z[B]=X,B=G;else break e}}function t(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var O=z[0],B=z.pop();if(B!==O){z[0]=B;e:for(var G=0,X=z.length,k=X>>>1;G<k;){var Y=2*(G+1)-1,Q=z[Y],te=Y+1,ee=z[te];if(0>r(Q,B))te<X&&0>r(ee,Q)?(z[G]=ee,z[te]=B,G=te):(z[G]=Q,z[Y]=B,G=Y);else if(te<X&&0>r(ee,B))z[G]=ee,z[te]=B,G=te;else break e}}return O}function r(z,O){var B=z.sortIndex-O.sortIndex;return B!==0?B:z.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;i.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();i.unstable_now=function(){return a.now()-o}}var l=[],c=[],h=1,d=null,p=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function E(z){for(var O=t(c);O!==null;){if(O.callback===null)n(c);else if(O.startTime<=z)n(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(z){if(x=!1,E(z),!v)if(t(l)!==null)v=!0,V();else{var O=t(c);O!==null&&H(S,O.startTime-z)}}var w=!1,T=-1,R=5,U=-1;function A(){return!(i.unstable_now()-U<R)}function D(){if(w){var z=i.unstable_now();U=z;var O=!0;try{e:{v=!1,x&&(x=!1,g(T),T=-1),m=!0;var B=p;try{t:{for(E(z),d=t(l);d!==null&&!(d.expirationTime>z&&A());){var G=d.callback;if(typeof G=="function"){d.callback=null,p=d.priorityLevel;var X=G(d.expirationTime<=z);if(z=i.unstable_now(),typeof X=="function"){d.callback=X,E(z),O=!0;break t}d===t(l)&&n(l),E(z)}else n(l);d=t(l)}if(d!==null)O=!0;else{var k=t(c);k!==null&&H(S,k.startTime-z),O=!1}}break e}finally{d=null,p=B,m=!1}O=void 0}}finally{O?L():w=!1}}}var L;if(typeof b=="function")L=function(){b(D)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,I=P.port2;P.port1.onmessage=D,L=function(){I.postMessage(null)}}else L=function(){_(D,0)};function V(){w||(w=!0,L())}function H(z,O){T=_(function(){z(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(z){z.callback=null},i.unstable_continueExecution=function(){v||m||(v=!0,V())},i.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<z?Math.floor(1e3/z):5},i.unstable_getCurrentPriorityLevel=function(){return p},i.unstable_getFirstCallbackNode=function(){return t(l)},i.unstable_next=function(z){switch(p){case 1:case 2:case 3:var O=3;break;default:O=p}var B=p;p=O;try{return z()}finally{p=B}},i.unstable_pauseExecution=function(){},i.unstable_requestPaint=function(){},i.unstable_runWithPriority=function(z,O){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=p;p=z;try{return O()}finally{p=B}},i.unstable_scheduleCallback=function(z,O,B){var G=i.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?G+B:G):B=G,z){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=B+X,z={id:h++,callback:O,priorityLevel:z,startTime:B,expirationTime:X,sortIndex:-1},B>G?(z.sortIndex=B,e(c,z),t(l)===null&&z===t(c)&&(x?(g(T),T=-1):x=!0,H(S,B-G))):(z.sortIndex=X,e(l,z),v||m||(v=!0,V())),z},i.unstable_shouldYield=A,i.unstable_wrapCallback=function(z){var O=p;return function(){var B=p;p=O;try{return z.apply(this,arguments)}finally{p=B}}}})(By)),By}var NM;function V4(){return NM||(NM=1,Fy.exports=H4()),Fy.exports}var PM=V4();function T1(i,e,t){if(!i)return;if(t(i)===!0)return i;let n=e?i.return:i.child;for(;n;){const r=T1(n,e,t);if(r)return r;n=e?null:n.sibling}}function vC(i){try{return Object.defineProperties(i,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return i}}const A1=vC(K.createContext(null));let yC=class extends K.Component{render(){return K.createElement(A1.Provider,{value:this._reactInternals},this.props.children)}};function _C(){const i=K.useContext(A1);if(i===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=K.useId();return K.useMemo(()=>{for(const t of[i,i?.alternate]){if(!t)continue;const n=T1(t,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(n)return n}},[i,e])}const W4=Symbol.for("react.context"),X4=i=>i!==null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===W4;function j4(){const i=_C(),[e]=K.useState(()=>new Map);e.clear();let t=i;for(;t;){const n=t.type;X4(n)&&n!==A1&&!e.has(n)&&e.set(n,K.use(vC(n))),t=t.return}return e}function q4(){const i=j4();return K.useMemo(()=>Array.from(i.keys()).reduce((e,t)=>n=>K.createElement(e,null,K.createElement(t.Provider,{...n,value:i.get(t)})),e=>K.createElement(yC,{...e})),[i])}function xC(i){let e=i.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const bC=i=>i&&i.isOrthographicCamera,Y4=i=>i&&i.hasOwnProperty("current"),Z4=i=>i!=null&&(typeof i=="string"||typeof i=="number"||i.isColor),rd=((i,e)=>typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?K.useLayoutEffect:K.useEffect;function SC(i){const e=K.useRef(i);return rd(()=>void(e.current=i),[i]),e}function K4(){const i=_C(),e=q4();return K.useMemo(()=>({children:t})=>{const r=!!T1(i,!0,s=>s.type===K.StrictMode)?K.StrictMode:K.Fragment;return he.jsx(r,{children:he.jsx(e,{children:t})})},[i,e])}function J4({set:i}){return rd(()=>(i(new Promise(()=>null)),()=>i(!1)),[i]),null}const Q4=(i=>(i=class extends K.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},i.getDerivedStateFromError=()=>({error:!0}),i))();function EC(i){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(i)?Math.min(Math.max(i[0],t),i[1]):i}function zc(i){var e;return(e=i.__r3f)==null?void 0:e.root.getState()}const wn={obj:i=>i===Object(i)&&!wn.arr(i)&&typeof i!="function",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",boo:i=>typeof i=="boolean",und:i=>i===void 0,nul:i=>i===null,arr:i=>Array.isArray(i),equ(i,e,{arrays:t="shallow",objects:n="reference",strict:r=!0}={}){if(typeof i!=typeof e||!!i!=!!e)return!1;if(wn.str(i)||wn.num(i)||wn.boo(i))return i===e;const s=wn.obj(i);if(s&&n==="reference")return i===e;const a=wn.arr(i);if(a&&t==="reference")return i===e;if((a||s)&&i===e)return!0;let o;for(o in i)if(!(o in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(o in r?e:i)if(!wn.equ(i[o],e[o],{strict:r,objects:"reference"}))return!1}else for(o in r?e:i)if(i[o]!==e[o])return!1;if(wn.und(o)){if(a&&i.length===0&&e.length===0||s&&Object.keys(i).length===0&&Object.keys(e).length===0)return!0;if(i!==e)return!1}return!0}};function $4(i){i.type!=="Scene"&&(i.dispose==null||i.dispose());for(const e in i){const t=i[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const MC=["children","key","ref"];function e5(i){const e={};for(const t in i)MC.includes(t)||(e[t]=i[t]);return e}function ag(i,e,t,n){const r=i;let s=r?.__r3f;return s||(s={root:e,type:t,parent:null,children:[],props:e5(n),object:r,eventCount:0,handlers:{},isHidden:!1},r&&(r.__r3f=s)),s}function zf(i,e){let t=i[e];if(!e.includes("-"))return{root:i,key:e,target:t};t=i;for(const r of e.split("-")){var n;e=r,i=t,t=(n=t)==null?void 0:n[e]}return{root:i,key:e,target:t}}const zM=/-\d+$/;function og(i,e){if(wn.str(e.props.attach)){if(zM.test(e.props.attach)){const r=e.props.attach.replace(zM,""),{root:s,key:a}=zf(i.object,r);Array.isArray(s[a])||(s[a]=[])}const{root:t,key:n}=zf(i.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else wn.fun(e.props.attach)&&(e.previousAttach=e.props.attach(i.object,e.object))}function lg(i,e){if(wn.str(e.props.attach)){const{root:t,key:n}=zf(i.object,e.props.attach),r=e.previousAttach;r===void 0?delete t[n]:t[n]=r}else e.previousAttach==null||e.previousAttach(i.object,e.object);delete e.previousAttach}const rx=[...MC,"args","dispose","attach","object","onUpdate","dispose"],FM=new Map;function t5(i){let e=FM.get(i.constructor);try{e||(e=new i.constructor,FM.set(i.constructor,e))}catch{}return e}function n5(i,e){const t={};for(const n in e)if(!rx.includes(n)&&!wn.equ(e[n],i.props[n])){t[n]=e[n];for(const r in e)r.startsWith(`${n}-`)&&(t[r]=e[r])}for(const n in i.props){if(rx.includes(n)||e.hasOwnProperty(n))continue;const{root:r,key:s}=zf(i.object,n);if(r.constructor&&r.constructor.length===0){const a=t5(r);wn.und(a)||(t[s]=a[s])}else t[s]=0}return t}const i5=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],r5=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function da(i,e){var t;const n=i.__r3f,r=n&&xC(n).getState(),s=n?.eventCount;for(const o in e){let l=e[o];if(rx.includes(o))continue;if(n&&r5.test(o)){typeof l=="function"?n.handlers[o]=l:delete n.handlers[o],n.eventCount=Object.keys(n.handlers).length;continue}if(l===void 0)continue;let{root:c,key:h,target:d}=zf(i,o);if(d instanceof pu&&l instanceof pu)d.mask=l.mask;else if(d instanceof Ye&&Z4(l))d.set(l);else if(d!==null&&typeof d=="object"&&typeof d.set=="function"&&typeof d.copy=="function"&&l!=null&&l.constructor&&d.constructor===l.constructor)d.copy(l);else if(d!==null&&typeof d=="object"&&typeof d.set=="function"&&Array.isArray(l))typeof d.fromArray=="function"?d.fromArray(l):d.set(...l);else if(d!==null&&typeof d=="object"&&typeof d.set=="function"&&typeof l=="number")typeof d.setScalar=="function"?d.setScalar(l):d.set(l);else{var a;c[h]=l,r&&!r.linear&&i5.includes(h)&&(a=c[h])!=null&&a.isTexture&&c[h].format===Di&&c[h].type===Gr&&(c[h].colorSpace=Ri)}}if(n!=null&&n.parent&&r!=null&&r.internal&&(t=n.object)!=null&&t.isObject3D&&s!==n.eventCount){const o=n.object,l=r.internal.interaction.indexOf(o);l>-1&&r.internal.interaction.splice(l,1),n.eventCount&&o.raycast!==null&&r.internal.interaction.push(o)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Du(n),i}function Du(i){var e;if(!i.parent)return;i.props.onUpdate==null||i.props.onUpdate(i.object);const t=(e=i.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function s5(i,e){i.manual||(bC(i)?(i.left=e.width/-2,i.right=e.width/2,i.top=e.height/2,i.bottom=e.height/-2):i.aspect=e.width/e.height,i.updateProjectionMatrix())}const Ki=i=>i?.isObject3D;function zp(i){return(i.eventObject||i.object).uuid+"/"+i.index+i.instanceId}function wC(i,e,t,n){const r=t.get(e);r&&(t.delete(e),t.size===0&&(i.delete(n),r.target.releasePointerCapture(n)))}function a5(i,e){const{internal:t}=i.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,r)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((n,r)=>{wC(t.capturedMap,e,n,r)})}function o5(i){function e(l){const{internal:c}=i.getState(),h=l.offsetX-c.initialClick[0],d=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(h*h+d*d))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(h=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+h]}))}function n(l,c){const h=i.getState(),d=new Set,p=[],m=c?c(h.internal.interaction):h.internal.interaction;for(let g=0;g<m.length;g++){const b=zc(m[g]);b&&(b.raycaster.camera=void 0)}h.previousRoot||h.events.compute==null||h.events.compute(l,h);function v(g){const b=zc(g);if(!b||!b.events.enabled||b.raycaster.camera===null)return[];if(b.raycaster.camera===void 0){var E;b.events.compute==null||b.events.compute(l,b,(E=b.previousRoot)==null?void 0:E.getState()),b.raycaster.camera===void 0&&(b.raycaster.camera=null)}return b.raycaster.camera?b.raycaster.intersectObject(g,!0):[]}let x=m.flatMap(v).sort((g,b)=>{const E=zc(g.object),S=zc(b.object);return!E||!S?g.distance-b.distance:S.events.priority-E.events.priority||g.distance-b.distance}).filter(g=>{const b=zp(g);return d.has(b)?!1:(d.add(b),!0)});h.events.filter&&(x=h.events.filter(x,h));for(const g of x){let b=g.object;for(;b;){var _;(_=b.__r3f)!=null&&_.eventCount&&p.push({...g,eventObject:b}),b=b.parent}}if("pointerId"in l&&h.internal.capturedMap.has(l.pointerId))for(let g of h.internal.capturedMap.get(l.pointerId).values())d.has(zp(g.intersection))||p.push(g.intersection);return p}function r(l,c,h,d){if(l.length){const p={stopped:!1};for(const m of l){let v=zc(m.object);if(v||m.object.traverseAncestors(x=>{const _=zc(x);if(_)return v=_,!1}),v){const{raycaster:x,pointer:_,camera:g,internal:b}=v,E=new j(_.x,_.y,0).unproject(g),S=A=>{var D,L;return(D=(L=b.capturedMap.get(A))==null?void 0:L.has(m.eventObject))!=null?D:!1},w=A=>{const D={intersection:m,target:c.target};b.capturedMap.has(A)?b.capturedMap.get(A).set(m.eventObject,D):b.capturedMap.set(A,new Map([[m.eventObject,D]])),c.target.setPointerCapture(A)},T=A=>{const D=b.capturedMap.get(A);D&&wC(b.capturedMap,m.eventObject,D,A)};let R={};for(let A in c){let D=c[A];typeof D!="function"&&(R[A]=D)}let U={...m,...R,pointer:_,intersections:l,stopped:p.stopped,delta:h,unprojectedPoint:E,ray:x.ray,camera:g,stopPropagation(){const A="pointerId"in c&&b.capturedMap.get(c.pointerId);if((!A||A.has(m.eventObject))&&(U.stopped=p.stopped=!0,b.hovered.size&&Array.from(b.hovered.values()).find(D=>D.eventObject===m.eventObject))){const D=l.slice(0,l.indexOf(m));s([...D,m])}},target:{hasPointerCapture:S,setPointerCapture:w,releasePointerCapture:T},currentTarget:{hasPointerCapture:S,setPointerCapture:w,releasePointerCapture:T},nativeEvent:c};if(d(U),p.stopped===!0)break}}}return l}function s(l){const{internal:c}=i.getState();for(const h of c.hovered.values())if(!l.length||!l.find(d=>d.object===h.object&&d.index===h.index&&d.instanceId===h.instanceId)){const p=h.eventObject.__r3f;if(c.hovered.delete(zp(h)),p!=null&&p.eventCount){const m=p.handlers,v={...h,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function a(l,c){for(let h=0;h<c.length;h++){const d=c[h].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(l)}}function o(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:h}=i.getState();"pointerId"in c&&h.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(c.pointerId)&&(h.capturedMap.delete(c.pointerId),s([]))})}}return function(h){const{onPointerMissed:d,internal:p}=i.getState();p.lastEvent.current=h;const m=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=n(h,m?t:void 0),g=v?e(h):0;l==="onPointerDown"&&(p.initialClick=[h.offsetX,h.offsetY],p.initialHits=_.map(E=>E.eventObject)),v&&!_.length&&g<=2&&(a(h,p.interaction),d&&d(h)),m&&s(_);function b(E){const S=E.eventObject,w=S.__r3f;if(!(w!=null&&w.eventCount))return;const T=w.handlers;if(m){if(T.onPointerOver||T.onPointerEnter||T.onPointerOut||T.onPointerLeave){const R=zp(E),U=p.hovered.get(R);U?U.stopped&&E.stopPropagation():(p.hovered.set(R,E),T.onPointerOver==null||T.onPointerOver(E),T.onPointerEnter==null||T.onPointerEnter(E))}T.onPointerMove==null||T.onPointerMove(E)}else{const R=T[l];R?(!v||p.initialHits.includes(S))&&(a(h,p.interaction.filter(U=>!p.initialHits.includes(U))),R(E)):v&&p.initialHits.includes(S)&&a(h,p.interaction.filter(U=>!p.initialHits.includes(U)))}}r(_,h,g,b)}}return{handlePointer:o}}const BM=i=>!!(i!=null&&i.render),TC=K.createContext(null),l5=(i,e)=>{const t=U4((o,l)=>{const c=new j,h=new j,d=new j;function p(g=l().camera,b=h,E=l().size){const{width:S,height:w,top:T,left:R}=E,U=S/w;b.isVector3?d.copy(b):d.set(...b);const A=g.getWorldPosition(c).distanceTo(d);if(bC(g))return{width:S/g.zoom,height:w/g.zoom,top:T,left:R,factor:1,distance:A,aspect:U};{const D=g.fov*Math.PI/180,L=2*Math.tan(D/2)*A,P=L*(S/w);return{width:P,height:L,top:T,left:R,factor:S/P,distance:A,aspect:U}}}let m;const v=g=>o(b=>({performance:{...b.performance,current:g}})),x=new ke;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(g=1)=>i(l(),g),advance:(g,b)=>e(g,b,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new _1,pointer:x,mouse:x,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&v(g.performance.min),m=setTimeout(()=>v(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:g=>o(b=>({...b,events:{...b.events,...g}})),setSize:(g,b,E=0,S=0)=>{const w=l().camera,T={width:g,height:b,top:E,left:S};o(R=>({size:T,viewport:{...R.viewport,...p(w,h,T)}}))},setDpr:g=>o(b=>{const E=EC(g);return{viewport:{...b.viewport,dpr:E,initialDpr:b.viewport.initialDpr||E}}}),setFrameloop:(g="always")=>{const b=l().clock;b.stop(),b.elapsedTime=0,g!=="never"&&(b.start(),b.elapsedTime=0),o(()=>({frameloop:g}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:K.createRef(),active:!1,frames:0,priority:0,subscribe:(g,b,E)=>{const S=l().internal;return S.priority=S.priority+(b>0?1:0),S.subscribers.push({ref:g,priority:b,store:E}),S.subscribers=S.subscribers.sort((w,T)=>w.priority-T.priority),()=>{const w=l().internal;w!=null&&w.subscribers&&(w.priority=w.priority-(b>0?1:0),w.subscribers=w.subscribers.filter(T=>T.ref!==g))}}}}}),n=t.getState();let r=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:h,set:d}=t.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==s){r=l,s=c.dpr,s5(o,l),c.dpr>0&&h.setPixelRatio(c.dpr);const p=typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(l.width,l.height,p)}o!==a&&(a=o,d(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(o)}})))}),t.subscribe(o=>i(o)),t};function AC(){const i=K.useContext(TC);if(!i)throw new Error("R3F: Hooks can only be used within the Canvas component!");return i}function Jn(i=t=>t,e){return AC()(i,e)}function u0(i,e=0){const t=AC(),n=t.getState().internal.subscribe,r=SC(i);return rd(()=>n(r,e,t),[e,n,t]),null}function c5(i){const e=G4(i);return e.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:K.version}),e}const CC=0,vu={},u5=/^three(?=[A-Z])/,h0=i=>`${i[0].toUpperCase()}${i.slice(1)}`;let h5=0;const f5=i=>typeof i=="function";function RC(i){if(f5(i)){const e=`${h5++}`;return vu[e]=i,e}else Object.assign(vu,i)}function DC(i,e){const t=h0(i),n=vu[t];if(i!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(i==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function d5(i,e,t){var n;return i=h0(i)in vu?i:i.replace(u5,""),DC(i,e),i==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,ag(e.object,t,i,e)}function p5(i){if(!i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?lg(i.parent,i):Ki(i.object)&&(i.object.visible=!1),i.isHidden=!0,Du(i)}}function UC(i){if(i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?og(i.parent,i):Ki(i.object)&&i.props.visible!==!1&&(i.object.visible=!0),i.isHidden=!1,Du(i)}}function C1(i,e,t){const n=e.root.getState();if(!(!i.parent&&i.object!==n.scene)){if(!e.object){var r,s;const a=vu[h0(e.type)];e.object=(r=e.props.object)!=null?r:new a(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(da(e.object,e.props),e.props.attach)og(i,e);else if(Ki(e.object)&&Ki(i.object)){const a=i.object.children.indexOf(t?.object);if(t&&a!==-1){const o=i.object.children.indexOf(e.object);if(o!==-1){i.object.children.splice(o,1);const l=o<a?a-1:a;i.object.children.splice(l,0,e.object)}else e.object.parent=i.object,i.object.children.splice(a,0,e.object),e.object.dispatchEvent({type:"added"}),i.object.dispatchEvent({type:"childadded",child:e.object})}else i.object.add(e.object)}for(const a of e.children)C1(e,a);Du(e)}}function ky(i,e){e&&(e.parent=i,i.children.push(e),C1(i,e))}function kM(i,e,t){if(!e||!t)return;e.parent=i;const n=i.children.indexOf(t);n!==-1?i.children.splice(n,0,e):i.children.push(e),C1(i,e,t)}function OC(i){if(typeof i.dispose=="function"){const e=()=>{try{i.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():PM.unstable_scheduleCallback(PM.unstable_IdlePriority,e)}}function sx(i,e,t){if(!e)return;e.parent=null;const n=i.children.indexOf(e);n!==-1&&i.children.splice(n,1),e.props.attach?lg(i,e):Ki(e.object)&&Ki(i.object)&&(i.object.remove(e.object),a5(xC(e),e.object));const r=e.props.dispose!==null&&t!==!1;for(let s=e.children.length-1;s>=0;s--){const a=e.children[s];sx(e,a,r)}e.children.length=0,delete e.object.__r3f,r&&e.type!=="primitive"&&e.object.type!=="Scene"&&OC(e.object),t===void 0&&Du(e)}function m5(i,e){for(const t of[i,i.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lm=[];function g5(){for(const[t]of lm){const n=t.parent;if(n){t.props.attach?lg(n,t):Ki(t.object)&&Ki(n.object)&&n.object.remove(t.object);for(const r of t.children)r.props.attach?lg(t,r):Ki(r.object)&&Ki(t.object)&&t.object.remove(r.object)}t.isHidden&&UC(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&OC(t.object)}for(const[t,n,r]of lm){t.props=n;const s=t.parent;if(s){var i,e;const a=vu[h0(t.type)];t.object=(i=t.props.object)!=null?i:new a(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,m5(r,t.object),da(t.object,t.props),t.props.attach?og(s,t):Ki(t.object)&&Ki(s.object)&&s.object.add(t.object);for(const o of t.children)o.props.attach?og(t,o):Ki(o.object)&&Ki(t.object)&&t.object.add(o.object);Du(t)}}lm.length=0}const Gy=()=>{},GM={};let Fp=CC;const v5=0,y5=4,ax=c5({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:d5,removeChild:sx,appendChild:ky,appendInitialChild:ky,insertBefore:kM,appendChildToContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||ky(t,e)},removeChildFromContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||sx(t,e)},insertInContainerBefore(i,e,t){const n=i.getState().scene.__r3f;!e||!t||!n||kM(n,e,t)},getRootHostContext:()=>GM,getChildHostContext:()=>GM,commitUpdate(i,e,t,n,r){var s,a,o;DC(e,n);let l=!1;if((i.type==="primitive"&&t.object!==n.object||((s=n.args)==null?void 0:s.length)!==((a=t.args)==null?void 0:a.length)||(o=n.args)!=null&&o.some((h,d)=>{var p;return h!==((p=t.args)==null?void 0:p[d])}))&&(l=!0),l)lm.push([i,{...n},r]);else{const h=n5(i,n);Object.keys(h).length&&(Object.assign(i.props,h),da(i.object,h))}(r.sibling===null||(r.flags&y5)===v5)&&g5()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:i=>i?.object,prepareForCommit:()=>null,preparePortalMount:i=>ag(i.getState().scene,i,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:p5,unhideInstance:UC,createTextInstance:Gy,hideTextInstance:Gy,unhideTextInstance:Gy,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:K.createContext(null),setCurrentUpdatePriority(i){Fp=i},getCurrentUpdatePriority(){return Fp},resolveUpdatePriority(){var i;if(Fp!==CC)return Fp;switch(typeof window<"u"&&((i=window.event)==null?void 0:i.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return rm.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return rm.ContinuousEventPriority;default:return rm.DefaultEventPriority}},resetFormInstance(){}}),Rl=new Map,Fc={objects:"shallow",strict:!1};function _5(i,e){if(!e&&typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&i.parentElement){const{width:t,height:n,top:r,left:s}=i.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:s}}else if(!e&&typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas)return{width:i.width,height:i.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function x5(i){const e=Rl.get(i),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=n||l5(cx,VM),a=t||ax.createContainer(s,rm.ConcurrentRoot,null,!1,null,"",r,r,r,null);e||Rl.set(i,{fiber:a,store:s});let o,l,c=!1,h=null;return{async configure(d={}){let p;h=new Promise(k=>p=k);let{gl:m,size:v,scene:x,events:_,onCreated:g,shadows:b=!1,linear:E=!1,flat:S=!1,legacy:w=!1,orthographic:T=!1,frameloop:R="always",dpr:U=[1,2],performance:A,raycaster:D,camera:L,onPointerMissed:P}=d,I=s.getState(),V=I.gl;if(!I.gl){const k={canvas:i,powerPreference:"high-performance",antialias:!0,alpha:!0},Y=typeof m=="function"?await m(k):m;BM(Y)?V=Y:V=new mC({...k,...m}),I.set({gl:V})}let H=I.raycaster;H||I.set({raycaster:H=new E1});const{params:z,...O}=D||{};if(wn.equ(O,H,Fc)||da(H,{...O}),wn.equ(z,H.params,Fc)||da(H,{params:{...H.params,...z}}),!I.camera||I.camera===l&&!wn.equ(l,L,Fc)){l=L;const k=L?.isCamera,Y=k?L:T?new Pl(0,0,0,0,.1,1e3):new Kn(75,0,.1,1e3);k||(Y.position.z=5,L&&(da(Y,L),Y.manual||("aspect"in L||"left"in L||"right"in L||"bottom"in L||"top"in L)&&(Y.manual=!0,Y.updateProjectionMatrix())),!I.camera&&!(L!=null&&L.rotation)&&Y.lookAt(0,0,0)),I.set({camera:Y}),H.camera=Y}if(!I.scene){let k;x!=null&&x.isScene?(k=x,ag(k,s,"",{})):(k=new Gg,ag(k,s,"",{}),x&&da(k,x)),I.set({scene:k})}_&&!I.events.handlers&&I.set({events:_(s)});const B=_5(i,v);if(wn.equ(B,I.size,Fc)||I.setSize(B.width,B.height,B.top,B.left),U&&I.viewport.dpr!==EC(U)&&I.setDpr(U),I.frameloop!==R&&I.setFrameloop(R),I.onPointerMissed||I.set({onPointerMissed:P}),A&&!wn.equ(A,I.performance,Fc)&&I.set(k=>({performance:{...k.performance,...A}})),!I.xr){var G;const k=(te,ee)=>{const ie=s.getState();ie.frameloop!=="never"&&VM(te,!0,ie,ee)},Y=()=>{const te=s.getState();te.gl.xr.enabled=te.gl.xr.isPresenting,te.gl.xr.setAnimationLoop(te.gl.xr.isPresenting?k:null),te.gl.xr.isPresenting||cx(te)},Q={connect(){const te=s.getState().gl;te.xr.addEventListener("sessionstart",Y),te.xr.addEventListener("sessionend",Y)},disconnect(){const te=s.getState().gl;te.xr.removeEventListener("sessionstart",Y),te.xr.removeEventListener("sessionend",Y)}};typeof((G=V.xr)==null?void 0:G.addEventListener)=="function"&&Q.connect(),I.set({xr:Q})}if(V.shadowMap){const k=V.shadowMap.enabled,Y=V.shadowMap.type;if(V.shadowMap.enabled=!!b,wn.boo(b))V.shadowMap.type=rf;else if(wn.str(b)){var X;const Q={basic:bA,percentage:Ag,soft:rf,variance:is};V.shadowMap.type=(X=Q[b])!=null?X:rf}else wn.obj(b)&&Object.assign(V.shadowMap,b);(k!==V.shadowMap.enabled||Y!==V.shadowMap.type)&&(V.shadowMap.needsUpdate=!0)}return Gt.enabled=!w,c||(V.outputColorSpace=E?uo:Ri,V.toneMapping=S?Ts:zx),I.legacy!==w&&I.set(()=>({legacy:w})),I.linear!==E&&I.set(()=>({linear:E})),I.flat!==S&&I.set(()=>({flat:S})),m&&!wn.fun(m)&&!BM(m)&&!wn.equ(m,V,Fc)&&da(V,m),o=g,c=!0,p(),this},render(d){return!c&&!h&&this.configure(),h.then(()=>{ax.updateContainer(he.jsx(b5,{store:s,children:d,onCreated:o,rootElement:i}),a,null,()=>{})}),s},unmount(){LC(i)}}}function b5({store:i,children:e,onCreated:t,rootElement:n}){return rd(()=>{const r=i.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),i.getState().events.connected||r.events.connect==null||r.events.connect(n)},[]),he.jsx(TC.Provider,{value:i,children:e})}function LC(i,e){const t=Rl.get(i),n=t?.fiber;if(n){const r=t?.store.getState();r&&(r.internal.active=!1),ax.updateContainer(null,n,null,()=>{r&&setTimeout(()=>{try{var s,a,o,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=r.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),$4(r.scene),Rl.delete(i)}catch{}},500)})}}function S5(i,e){const t={callback:i};return e.add(t),()=>void e.delete(t)}const IC=new Set,E5=new Set,M5=new Set,w5=i=>S5(i,IC);function Hy(i,e){if(i.size)for(const{callback:t}of i.values())t(e)}function df(i,e){switch(i){case"before":return Hy(IC,e);case"after":return Hy(E5,e);case"tail":return Hy(M5,e)}}let Vy,Wy;function ox(i,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof i=="number"&&(n=i-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=i),Vy=e.internal.subscribers;for(let r=0;r<Vy.length;r++)Wy=Vy[r],Wy.ref.current(Wy.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let cg=!1,lx=!1,Xy,HM,Bc;function NC(i){HM=requestAnimationFrame(NC),cg=!0,Xy=0,df("before",i),lx=!0;for(const t of Rl.values()){var e;Bc=t.store.getState(),Bc.internal.active&&(Bc.frameloop==="always"||Bc.internal.frames>0)&&!((e=Bc.gl.xr)!=null&&e.isPresenting)&&(Xy+=ox(i,Bc))}if(lx=!1,df("after",i),Xy===0)return df("tail",i),cg=!1,cancelAnimationFrame(HM)}function cx(i,e=1){var t;if(!i)return Rl.forEach(n=>cx(n.store.getState(),e));(t=i.gl.xr)!=null&&t.isPresenting||!i.internal.active||i.frameloop==="never"||(e>1?i.internal.frames=Math.min(60,i.internal.frames+e):lx?i.internal.frames=2:i.internal.frames=1,cg||(cg=!0,requestAnimationFrame(NC)))}function VM(i,e=!0,t,n){if(e&&df("before",i),t)ox(i,t,n);else for(const r of Rl.values())ox(i,r.store.getState());e&&df("after",i)}const jy={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function T5(i){const{handlePointer:e}=o5(i);return{priority:1,enabled:!0,compute(t,n,r){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(jy).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:r}=i.getState();(t=r.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{const{set:n,events:r}=i.getState();if(r.disconnect==null||r.disconnect(),n(s=>({events:{...s.events,connected:t}})),r.handlers)for(const s in r.handlers){const a=r.handlers[s],[o,l]=jy[s];t.addEventListener(o,a,{passive:l})}},disconnect:()=>{const{set:t,events:n}=i.getState();if(n.connected){if(n.handlers)for(const r in n.handlers){const s=n.handlers[r],[a]=jy[r];n.connected.removeEventListener(a,s)}t(r=>({events:{...r.events,connected:void 0}}))}}}}function WM(i,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>i(...n),e)}}function A5({debounce:i,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=K.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=K.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=i?typeof i=="number"?i:i.scroll:null,c=i?typeof i=="number"?i:i.resize:null,h=K.useRef(!1);K.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[d,p,m]=K.useMemo(()=>{const g=()=>{if(!o.current.element)return;const{left:b,top:E,width:S,height:w,bottom:T,right:R,x:U,y:A}=o.current.element.getBoundingClientRect(),D={left:b,top:E,width:S,height:w,bottom:T,right:R,x:U,y:A};o.current.element instanceof HTMLElement&&n&&(D.height=o.current.element.offsetHeight,D.width=o.current.element.offsetWidth),Object.freeze(D),h.current&&!U5(o.current.lastBounds,D)&&a(o.current.lastBounds=D)};return[g,c?WM(g,c):g,l?WM(g,l):g]},[a,n,l,c]);function v(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(g=>g.removeEventListener("scroll",m,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function x(){o.current.element&&(o.current.resizeObserver=new r(m),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(g=>g.addEventListener("scroll",m,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const _=g=>{!g||g===o.current.element||(v(),o.current.element=g,o.current.scrollContainers=PC(g),x())};return R5(m,!!e),C5(p),K.useEffect(()=>{v(),x()},[e,m,p]),K.useEffect(()=>v,[]),[_,s,d]}function C5(i){K.useEffect(()=>{const e=i;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[i])}function R5(i,e){K.useEffect(()=>{if(e){const t=i;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[i,e])}function PC(i){const e=[];if(!i||i===document.body)return e;const{overflow:t,overflowX:n,overflowY:r}=window.getComputedStyle(i);return[t,n,r].some(s=>s==="auto"||s==="scroll")&&e.push(i),[...e,...PC(i.parentElement)]}const D5=["x","y","top","bottom","left","right","width","height"],U5=(i,e)=>D5.every(t=>i[t]===e[t]);function O5({ref:i,children:e,fallback:t,resize:n,style:r,gl:s,events:a=T5,eventSource:o,eventPrefix:l,shadows:c,linear:h,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:b,scene:E,onPointerMissed:S,onCreated:w,...T}){K.useMemo(()=>RC(gC),[]);const R=K4(),[U,A]=A5({scroll:!0,debounce:{scroll:50,resize:0},...n}),D=K.useRef(null),L=K.useRef(null);K.useImperativeHandle(i,()=>D.current);const P=SC(S),[I,V]=K.useState(!1),[H,z]=K.useState(!1);if(I)throw I;if(H)throw H;const O=K.useRef(null);rd(()=>{const G=D.current;if(A.width>0&&A.height>0&&G){O.current||(O.current=x5(G));async function X(){await O.current.configure({gl:s,scene:E,events:a,shadows:c,linear:h,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:b,size:A,onPointerMissed:(...k)=>P.current==null?void 0:P.current(...k),onCreated:k=>{k.events.connect==null||k.events.connect(o?Y4(o)?o.current:o:L.current),l&&k.setEvents({compute:(Y,Q)=>{const te=Y[l+"X"],ee=Y[l+"Y"];Q.pointer.set(te/Q.size.width*2-1,-(ee/Q.size.height)*2+1),Q.raycaster.setFromCamera(Q.pointer,Q.camera)}}),w?.(k)}}),O.current.render(he.jsx(R,{children:he.jsx(Q4,{set:z,children:he.jsx(K.Suspense,{fallback:he.jsx(J4,{set:V}),children:e??null})})}))}X()}}),K.useEffect(()=>{const G=D.current;if(G)return()=>LC(G)},[]);const B=o?"none":"auto";return he.jsx("div",{ref:L,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:B,...r},...T,children:he.jsx("div",{ref:U,style:{width:"100%",height:"100%"},children:he.jsx("canvas",{ref:D,style:{display:"block"},children:t})})})}function L5(i){return he.jsx(yC,{children:he.jsx(O5,{...i})})}/*!
|
|
3892
|
-
* camera-controls
|
|
3893
|
-
* https://github.com/yomotsu/camera-controls
|
|
3894
|
-
* (c) 2017 @yomotsu
|
|
3895
|
-
* Released under the MIT License.
|
|
3896
|
-
*/const Mn={LEFT:1,RIGHT:2,MIDDLE:4},Re=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),kc={NONE:0,IN:1,OUT:-1};function al(i){return i.isPerspectiveCamera}function no(i){return i.isOrthographicCamera}const $a=Math.PI*2,XM=Math.PI/2,zC=1e-5,wh=Math.PI/180;function ns(i,e,t){return Math.max(e,Math.min(t,i))}function pn(i,e=zC){return Math.abs(i)<e}function nn(i,e,t=zC){return pn(i-e,t)}function jM(i,e){return Math.round(i/e)*e}function Th(i){return isFinite(i)?i:i<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Ah(i){return Math.abs(i)<Number.MAX_VALUE?i:i*(1/0)}function Bp(i,e,t,n,r=1/0,s){n=Math.max(1e-4,n);const a=2/n,o=a*s,l=1/(1+o+.48*o*o+.235*o*o*o);let c=i-e;const h=e,d=r*n;c=ns(c,-d,d),e=i-c;const p=(t.value+a*c)*s;t.value=(t.value-a*p)*l;let m=e+(c+p)*l;return h-i>0==m>h&&(m=h,t.value=(m-h)/s),m}function qM(i,e,t,n,r=1/0,s,a){n=Math.max(1e-4,n);const o=2/n,l=o*s,c=1/(1+l+.48*l*l+.235*l*l*l);let h=e.x,d=e.y,p=e.z,m=i.x-h,v=i.y-d,x=i.z-p;const _=h,g=d,b=p,E=r*n,S=E*E,w=m*m+v*v+x*x;if(w>S){const H=Math.sqrt(w);m=m/H*E,v=v/H*E,x=x/H*E}h=i.x-m,d=i.y-v,p=i.z-x;const T=(t.x+o*m)*s,R=(t.y+o*v)*s,U=(t.z+o*x)*s;t.x=(t.x-o*T)*c,t.y=(t.y-o*R)*c,t.z=(t.z-o*U)*c,a.x=h+(m+T)*c,a.y=d+(v+R)*c,a.z=p+(x+U)*c;const A=_-i.x,D=g-i.y,L=b-i.z,P=a.x-_,I=a.y-g,V=a.z-b;return A*P+D*I+L*V>0&&(a.x=_,a.y=g,a.z=b,t.x=(a.x-_)/s,t.y=(a.y-g)/s,t.z=(a.z-b)/s),a}function qy(i,e){e.set(0,0),i.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=i.length,e.y/=i.length}function Yy(i,e){return no(i)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let I5=class{_listeners={};addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e)}}};const N5="3.1.1",kp=1/8,P5=/Mac/.test(globalThis?.navigator?.platform);let Mt,YM,Gp,Zy,Yi,Lt,Kt,Gc,Ch,ys,_s,ol,ZM,KM,vr,Hc,Vc,JM,Ky,QM,Jy,Qy,Hp,ni=class ux extends I5{static install(e){Mt=e.THREE,YM=Object.freeze(new Mt.Vector3(0,0,0)),Gp=Object.freeze(new Mt.Vector3(0,1,0)),Zy=Object.freeze(new Mt.Vector3(0,0,1)),Yi=new Mt.Vector2,Lt=new Mt.Vector3,Kt=new Mt.Vector3,Gc=new Mt.Vector3,Ch=new Mt.Vector3,ys=new Mt.Vector3,_s=new Mt.Vector3,ol=new Mt.Vector3,ZM=new Mt.Vector3,KM=new Mt.Vector3,vr=new Mt.Spherical,Hc=new Mt.Spherical,Vc=new Mt.Box3,JM=new Mt.Box3,Ky=new Mt.Sphere,QM=new Mt.Quaternion,Jy=new Mt.Quaternion,Qy=new Mt.Matrix4,Hp=new Mt.Raycaster}static get ACTION(){return Re}minPolarAngle=0;maxPolarAngle=Math.PI;minAzimuthAngle=-1/0;maxAzimuthAngle=1/0;minDistance=Number.EPSILON;maxDistance=1/0;infinityDolly=!1;minZoom=.01;maxZoom=1/0;smoothTime=.25;draggingSmoothTime=.125;maxSpeed=1/0;azimuthRotateSpeed=1;polarRotateSpeed=1;dollySpeed=1;dollyDragInverted=!1;truckSpeed=2;dollyToCursor=!1;dragToOffset=!1;boundaryFriction=0;restThreshold=.01;colliderMeshes=[];mouseButtons;touches;cancel=()=>{};lockPointer;unlockPointer;_enabled=!0;_camera;_yAxisUpSpace;_yAxisUpSpaceInverse;_state=Re.NONE;_domElement;_viewport=null;_target;_targetEnd;_focalOffset;_focalOffsetEnd;_spherical;_sphericalEnd;_lastDistance;_zoom;_zoomEnd;_lastZoom;_cameraUp0;_target0;_position0;_zoom0;_focalOffset0;_dollyControlCoord;_changedDolly=0;_changedZoom=0;_nearPlaneCorners;_hasRested=!0;_boundary;_boundaryEnclosesCamera=!1;_needsUpdate=!0;_updatedLastTime=!1;_elementRect=new DOMRect;_isDragging=!1;_dragNeedsUpdate=!0;_activePointers=[];_lockedPointer=null;_interactiveArea=new DOMRect(0,0,1,1);_isUserControllingRotate=!1;_isUserControllingDolly=!1;_isUserControllingTruck=!1;_isUserControllingOffset=!1;_isUserControllingZoom=!1;_lastDollyDirection=kc.NONE;_thetaVelocity={value:0};_phiVelocity={value:0};_radiusVelocity={value:0};_targetVelocity=new Mt.Vector3;_focalOffsetVelocity=new Mt.Vector3;_zoomVelocity={value:0};set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),typeof Mt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new Mt.Quaternion().setFromUnitVectors(this._camera.up,Gp),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=Re.NONE,this._target=new Mt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new Mt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new Mt.Spherical().setFromVector3(Lt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new Mt.Vector3,new Mt.Vector3,new Mt.Vector3,new Mt.Vector3],this._updateNearPlaneCorners(),this._boundary=new Mt.Box3(new Mt.Vector3(-1/0,-1/0,-1/0),new Mt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new Mt.Vector2,this.mouseButtons={left:Re.ROTATE,middle:Re.DOLLY,right:Re.TRUCK,wheel:al(this._camera)?Re.DOLLY:no(this._camera)?Re.ZOOM:Re.NONE},this.touches={one:Re.TOUCH_ROTATE,two:al(this._camera)?Re.TOUCH_DOLLY_TRUCK:no(this._camera)?Re.TOUCH_ZOOM_TRUCK:Re.NONE,three:Re.TOUCH_TRUCK};const n=new Mt.Vector2,r=new Mt.Vector2,s=new Mt.Vector2,a=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),w=g.clientX/S.width,T=g.clientY/S.height;if(w<this._interactiveArea.left||w>this._interactiveArea.right||T<this._interactiveArea.top||T>this._interactiveArea.bottom)return}const b=g.pointerType!=="mouse"?null:(g.buttons&Mn.LEFT)===Mn.LEFT?Mn.LEFT:(g.buttons&Mn.MIDDLE)===Mn.MIDDLE?Mn.MIDDLE:(g.buttons&Mn.RIGHT)===Mn.RIGHT?Mn.RIGHT:null;if(b!==null){const S=this._findPointerByMouseButton(b);S&&this._disposePointer(S)}if((g.buttons&Mn.LEFT)===Mn.LEFT&&this._lockedPointer)return;const E={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:b};this._activePointers.push(E),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,p(g)},o=g=>{g.cancelable&&g.preventDefault();const b=g.pointerId,E=this._lockedPointer||this._findPointerById(b);if(E){if(E.clientX=g.clientX,E.clientY=g.clientY,E.deltaX=g.movementX,E.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&Mn.LEFT)===Mn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&Mn.MIDDLE)===Mn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&Mn.RIGHT)===Mn.RIGHT&&(this._state=this._state|this.mouseButtons.right);m()}},l=g=>{const b=this._findPointerById(g.pointerId);if(!(b&&b===this._lockedPointer)){if(b&&this._disposePointer(b),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=Re.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=Re.NONE;v()}};let c=-1;const h=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===Re.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const T=this._domElement.getBoundingClientRect(),R=g.clientX/T.width,U=g.clientY/T.height;if(R<this._interactiveArea.left||R>this._interactiveArea.right||U<this._interactiveArea.top||U>this._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===Re.ROTATE||this.mouseButtons.wheel===Re.TRUCK){const T=performance.now();c-T<1e3&&this._getClientRect(this._elementRect),c=T}const b=P5?-1:-3,E=g.deltaMode===1||g.ctrlKey?g.deltaY/b:g.deltaY/(b*10),S=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case Re.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case Re.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case Re.SCREEN_PAN:{this._truckInternal(g.deltaX,g.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case Re.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case Re.DOLLY:{this._dollyInternal(-E,S,w),this._isUserControllingDolly=!0;break}case Re.ZOOM:{this._zoomInternal(-E,S,w),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},d=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===ux.ACTION.NONE){const b=g instanceof PointerEvent?g.pointerId:0,E=this._findPointerById(b);E&&this._disposePointer(E),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}g.preventDefault()}},p=g=>{if(!this._enabled)return;if(qy(this._activePointers,Yi),this._getClientRect(this._elementRect),n.copy(Yi),r.copy(Yi),this._activePointers.length>=2){const E=Yi.x-this._activePointers[1].clientX,S=Yi.y-this._activePointers[1].clientY,w=Math.sqrt(E*E+S*S);s.set(0,w);const T=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,R=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;r.set(T,R)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&Mn.LEFT)===Mn.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&Mn.MIDDLE)===Mn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&Mn.RIGHT)===Mn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&Re.ROTATE)===Re.ROTATE||(this._state&Re.TOUCH_ROTATE)===Re.TOUCH_ROTATE||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&Re.TRUCK)===Re.TRUCK||(this._state&Re.SCREEN_PAN)===Re.SCREEN_PAN||(this._state&Re.TOUCH_TRUCK)===Re.TOUCH_TRUCK||(this._state&Re.TOUCH_SCREEN_PAN)===Re.TOUCH_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&Re.DOLLY)===Re.DOLLY||(this._state&Re.TOUCH_DOLLY)===Re.TOUCH_DOLLY||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&Re.ZOOM)===Re.ZOOM||(this._state&Re.TOUCH_ZOOM)===Re.TOUCH_ZOOM||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_ZOOM_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&Re.OFFSET)===Re.OFFSET||(this._state&Re.TOUCH_OFFSET)===Re.TOUCH_OFFSET||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},m=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,qy(this._activePointers,Yi);const b=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,E=b?-b.deltaX:r.x-Yi.x,S=b?-b.deltaY:r.y-Yi.y;if(r.copy(Yi),((this._state&Re.ROTATE)===Re.ROTATE||(this._state&Re.TOUCH_ROTATE)===Re.TOUCH_ROTATE||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(E,S),this._isUserControllingRotate=!0),(this._state&Re.DOLLY)===Re.DOLLY||(this._state&Re.ZOOM)===Re.ZOOM){const w=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,T=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,R=this.dollyDragInverted?-1:1;(this._state&Re.DOLLY)===Re.DOLLY?(this._dollyInternal(R*S*kp,w,T),this._isUserControllingDolly=!0):(this._zoomInternal(R*S*kp,w,T),this._isUserControllingZoom=!0)}if((this._state&Re.TOUCH_DOLLY)===Re.TOUCH_DOLLY||(this._state&Re.TOUCH_ZOOM)===Re.TOUCH_ZOOM||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_ZOOM_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE){const w=Yi.x-this._activePointers[1].clientX,T=Yi.y-this._activePointers[1].clientY,R=Math.sqrt(w*w+T*T),U=s.y-R;s.set(0,R);const A=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&Re.TOUCH_DOLLY)===Re.TOUCH_DOLLY||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET?(this._dollyInternal(U*kp,A,D),this._isUserControllingDolly=!0):(this._zoomInternal(U*kp,A,D),this._isUserControllingZoom=!0)}((this._state&Re.TRUCK)===Re.TRUCK||(this._state&Re.TOUCH_TRUCK)===Re.TOUCH_TRUCK||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(E,S,!1,!1),this._isUserControllingTruck=!0),((this._state&Re.SCREEN_PAN)===Re.SCREEN_PAN||(this._state&Re.TOUCH_SCREEN_PAN)===Re.TOUCH_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(E,S,!1,!0),this._isUserControllingTruck=!0),((this._state&Re.OFFSET)===Re.OFFSET||(this._state&Re.TOUCH_OFFSET)===Re.TOUCH_OFFSET||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(E,S,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},v=()=>{qy(this._activePointers,Yi),r.copy(Yi),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",x),this._domElement.ownerDocument.addEventListener("pointerlockerror",_),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),p())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),this._domElement?.ownerDocument.exitPointerLock(),this._domElement?.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement?.ownerDocument.removeEventListener("pointerlockerror",_),this.cancel()};const x=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},_=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",h,{passive:!1}),this._domElement.addEventListener("contextmenu",d)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",h,{passive:!1}),this._domElement.removeEventListener("contextmenu",d),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))},this.cancel=()=>{this._state!==Re.NONE&&(this._state=Re.NONE,this._activePointers.length=0,v())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ns(e.width,0,1),this._interactiveArea.height=ns(e.height,0,1),this._interactiveArea.x=ns(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ns(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const r=ns(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=ns(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=r,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!n||nn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&nn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=kc.NONE,this._changedDolly=0,this._dollyToNoClamp(ns(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=nn(a,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||nn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ch).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ns(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||nn(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),ys.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),ys.multiplyScalar(e),_s.multiplyScalar(-t);const r=Lt.copy(ys).add(_s),s=Kt.copy(this._targetEnd).add(r);return this.moveTo(s.x,s.y,s.z,n)}forward(e,t=!1){Lt.setFromMatrixColumn(this._camera.matrix,0),Lt.crossVectors(this._camera.up,Lt),Lt.multiplyScalar(e);const n=Kt.copy(this._targetEnd).add(Lt);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return Lt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Lt.x,this._targetEnd.y+Lt.y,this._targetEnd.z+Lt.z,t)}moveTo(e,t,n,r=!1){this._isUserControllingTruck=!1;const s=Lt.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,r||this._target.copy(this._targetEnd);const a=!r||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,n,r=!1){const o=Lt.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,r)}fitToBox(e,t,{cover:n=!1,paddingLeft:r=0,paddingRight:s=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?Vc.copy(e):Vc.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=jM(this._sphericalEnd.theta,XM),d=jM(this._sphericalEnd.phi,XM);l.push(this.rotateTo(h,d,t));const p=Lt.setFromSpherical(this._sphericalEnd).normalize(),m=QM.setFromUnitVectors(p,Zy),v=nn(Math.abs(p.y),1);v&&m.multiply(Jy.setFromAxisAngle(Gp,h)),m.multiply(this._yAxisUpSpaceInverse);const x=JM.makeEmpty();Kt.copy(c.min).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.min).setX(c.max.x).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.min).setY(c.max.y).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).setZ(c.min.z).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.min).setZ(c.max.z).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).setY(c.min.y).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).setX(c.min.x).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).applyQuaternion(m),x.expandByPoint(Kt),x.min.x-=r,x.min.y-=a,x.max.x+=s,x.max.y+=o,m.setFromUnitVectors(Zy,p),v&&m.premultiply(Jy.invert()),m.premultiply(this._yAxisUpSpace);const _=x.getSize(Lt),g=x.getCenter(Kt).applyQuaternion(m);if(al(this._camera)){const b=this.getDistanceToFitBox(_.x,_.y,_.z,n);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(no(this._camera)){const b=this._camera,E=b.right-b.left,S=b.top-b.bottom,w=n?Math.max(E/_.x,S/_.y):Math.min(E/_.x,S/_.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(w,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],s="isObject3D"in e?ux.createBoundingSphere(e,Ky):Ky.copy(e);if(n.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),al(this._camera)){const a=this.getDistanceToFitSphere(s.radius);n.push(this.dollyTo(a,t))}else if(no(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*s.radius,c=Math.min(a/l,o/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,r,s,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=kc.NONE,this._changedDolly=0;const l=Kt.set(r,s,a),c=Lt.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!o||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold)&&nn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&nn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&nn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerp(e,t,n,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=kc.NONE,this._changedDolly=0;const s=Lt.set(...e.target);if("spherical"in e)vr.set(...e.spherical);else{const d=Kt.set(...e.position);vr.setFromVector3(d.sub(s).applyQuaternion(this._yAxisUpSpace))}const a=Gc.set(...t.target);if("spherical"in t)Hc.set(...t.spherical);else{const d=Kt.set(...t.position);Hc.setFromVector3(d.sub(a).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(s.lerp(a,n));const o=Hc.theta-vr.theta,l=Hc.phi-vr.phi,c=Hc.radius-vr.radius;this._sphericalEnd.set(vr.radius+c*n,vr.phi+l*n,vr.theta+o*n),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!r||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold)&&nn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&nn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&nn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,n,r,s,a,o,l,c,h,d,p,m,v=!1){return this.lerp({position:[e,t,n],target:[r,s,a]},{position:[o,l,c],target:[h,d,p]},m,v)}setPosition(e,t,n,r=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,r)}setTarget(e,t,n,r=!1){const s=this.getPosition(Lt),a=this.setLookAt(s.x,s.y,s.z,e,t,n,r);return this._sphericalEnd.phi=ns(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,n,r=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,r||this._focalOffset.copy(this._focalOffsetEnd);const s=!r||nn(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&nn(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&nn(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),ys.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_s.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ol.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const r=Lt.set(e,t,n),s=r.distanceTo(this._camera.position),a=r.sub(this._camera.position);ys.multiplyScalar(a.x),_s.multiplyScalar(a.y),ol.multiplyScalar(a.z),Lt.copy(ys).add(_s).add(ol),Lt.z=Lt.z+s,this.dollyTo(s,!1),this.setFocalOffset(-Lt.x,Lt.y,-Lt.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,r){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new Mt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,r):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,r=!1){if(Yy(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,a=this._camera.getEffectiveFOV()*wh,o=this._camera.aspect;return((r?s>o:s<o)?t:e/o)*.5/Math.tan(a*.5)+n*.5}getDistanceToFitSphere(e){if(Yy(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*wh,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,r=1<this._camera.aspect?t:n;return e/Math.sin(r*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new Mt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new Mt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new Mt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new Mt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%$a+$a)%$a,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=$a),this._spherical.theta+=$a*Math.round((this._sphericalEnd.theta-this._spherical.theta)/$a),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!nn(this._camera.up.x,this._cameraUp0.x)||!nn(this._camera.up.y,this._cameraUp0.y)||!nn(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(Lt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Gp),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=Lt.subVectors(this._target,this._camera.position).normalize(),t=Kt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(Lt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,r=this._sphericalEnd.radius-this._spherical.radius,s=ZM.subVectors(this._targetEnd,this._target),a=KM.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(pn(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Bp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(pn(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Bp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(pn(r))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Bp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(pn(s.x)&&pn(s.y)&&pn(s.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;qM(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(pn(a.x)&&pn(a.y)&&pn(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;qM(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(pn(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Bp(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(al(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,p=this._camera,m=this._getCameraDirection(Ch),v=Lt.copy(m).cross(p.up).normalize();v.lengthSq()===0&&(v.x=1);const x=Kt.crossVectors(v,m),_=this._sphericalEnd.radius*Math.tan(p.getEffectiveFOV()*wh*.5),b=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,E=Gc.copy(this._targetEnd).add(v.multiplyScalar(this._dollyControlCoord.x*_*p.aspect)).add(x.multiplyScalar(this._dollyControlCoord.y*_)),S=Lt.copy(this._targetEnd).lerp(E,b),w=this._lastDollyDirection===kc.IN&&this._spherical.radius<=this.minDistance,T=this._lastDollyDirection===kc.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(w||T)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const U=Kt.copy(m).multiplyScalar(-d);S.add(U)}this._boundary.clampPoint(S,S);const R=Kt.subVectors(S,this._targetEnd);this._targetEnd.copy(S),this._target.add(R),this._changedDolly-=d,pn(this._changedDolly)&&(this._changedDolly=0)}else if(no(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,p=this._camera,m=Lt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(p.near+p.far)/(p.near-p.far)).unproject(p),v=Kt.set(0,0,-1).applyQuaternion(p.quaternion),x=Gc.copy(m).add(v.multiplyScalar(-m.dot(p.up))),g=-(this._zoom-d-this._zoom)/this._zoom,b=this._getCameraDirection(Ch),E=this._targetEnd.dot(b),S=Lt.copy(this._targetEnd).lerp(x,g),w=S.dot(b),T=b.multiplyScalar(w-E);S.sub(T),this._boundary.clampPoint(S,S);const R=Kt.subVectors(S,this._targetEnd);this._targetEnd.copy(S),this._target.add(R),this._changedZoom-=d,pn(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!pn(this._focalOffset.x)||!pn(this._focalOffset.y)||!pn(this._focalOffset.z))&&(this._camera.matrix.compose(this._camera.position,this._camera.quaternion,this._camera.scale),ys.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),ol.setFromMatrixColumn(this._camera.matrix,2),ys.multiplyScalar(this._focalOffset.x),_s.multiplyScalar(-this._focalOffset.y),ol.multiplyScalar(this._focalOffset.z),Lt.copy(ys).add(_s).add(ol),this._camera.position.add(Lt),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Lt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),pn(t,this.restThreshold)&&pn(n,this.restThreshold)&&pn(r,this.restThreshold)&&pn(s.x,this.restThreshold)&&pn(s.y,this.restThreshold)&&pn(s.z,this.restThreshold)&&pn(a.x,this.restThreshold)&&pn(a.y,this.restThreshold)&&pn(a.z,this.restThreshold)&&pn(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Th(this.maxDistance),minZoom:this.minZoom,maxZoom:Th(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Th(this.maxPolarAngle),minAzimuthAngle:Th(this.minAzimuthAngle),maxAzimuthAngle:Th(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:Lt.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Ah(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Ah(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Ah(n.maxPolarAngle),this.minAzimuthAngle=Ah(n.minAzimuthAngle),this.maxAzimuthAngle=Ah(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),vr.setFromVector3(Lt.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(vr.theta,vr.phi,t),this.dollyTo(vr.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",N5),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const r=t.lengthSq();if(r===0)return e;const s=Kt.copy(t).add(e),o=this._boundary.clampPoint(s,Gc).sub(s),l=o.lengthSq();if(l===0)return e.add(t);if(l===r)return e;if(n===0)return e.add(t).add(o);{const c=1+n*l/t.dot(o);return e.add(Kt.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(al(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*wh,r=Math.tan(n*.5)*t,s=r*e.aspect;this._nearPlaneCorners[0].set(-s,-r,0),this._nearPlaneCorners[1].set(s,-r,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(-s,r,0)}else if(no(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,r=e.right*t,s=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(n,s,0),this._nearPlaneCorners[1].set(r,s,0),this._nearPlaneCorners[2].set(r,a,0),this._nearPlaneCorners[3].set(n,a,0)}}_truckInternal=(e,t,n,r)=>{let s,a;if(al(this._camera)){const o=Lt.copy(this._camera.position).sub(this._target),l=this._camera.getEffectiveFOV()*wh,c=o.length()*Math.tan(l*.5);s=this.truckSpeed*e*c/this._elementRect.height,a=this.truckSpeed*t*c/this._elementRect.height}else if(no(this._camera)){const o=this._camera;s=this.truckSpeed*e*(o.right-o.left)/o.zoom/this._elementRect.width,a=this.truckSpeed*t*(o.top-o.bottom)/o.zoom/this._elementRect.height}else return;r?(n?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(s,0,!0),this.forward(-a,!0)):n?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(s,a,!0)};_rotateInternal=(e,t)=>{const n=$a*this.azimuthRotateSpeed*e/this._elementRect.height,r=$a*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(n,r,!0)};_dollyInternal=(e,t,n)=>{const r=Math.pow(.95,-e*this.dollySpeed),s=this._sphericalEnd.radius,a=this._sphericalEnd.radius*r,o=ns(a,this.minDistance,this.maxDistance),l=o-a;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(l,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-s,this._dollyControlCoord.set(t,n)),this._lastDollyDirection=Math.sign(-e)};_zoomInternal=(e,t,n)=>{const r=Math.pow(.95,e*this.dollySpeed),s=this._zoom,a=this._zoom*r;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-s,this._dollyControlCoord.set(t,n))};_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Yy(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ch);Qy.lookAt(YM,n,this._camera.up);for(let r=0;r<4;r++){const s=Kt.copy(this._nearPlaneCorners[r]);s.applyMatrix4(Qy);const a=Gc.addVectors(this._target,s);Hp.set(a,n),Hp.far=this._spherical.radius+1;const o=Hp.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new Mt.Sphere){const n=t,r=n.center;Vc.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&Vc.expandByObject(a)}),Vc.getCenter(r);let s=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a;if(!o.geometry)return;const l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const h=l.attributes.position;for(let d=0,p=h.count;d<p;d++)Lt.fromBufferAttribute(h,d),s=Math.max(s,r.distanceToSquared(Lt))}),n.radius=Math.sqrt(s),n}};/*!
|
|
3897
|
-
* hold-event
|
|
3898
|
-
* https://github.com/yomotsu/hold-event
|
|
3899
|
-
* (c) 2020 @yomotsu
|
|
3900
|
-
* Released under the MIT License.
|
|
3901
|
-
*/var pf;(function(i){i.HOLD_START="holdStart",i.HOLD_END="holdEnd",i.HOLDING="holding"})(pf||(pf={}));class z5{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e)}}}class F5 extends z5{constructor(e){super(),this._enabled=!0,this._holding=!1,this._intervalId=-1,this._deltaTime=0,this._elapsedTime=0,this._lastTime=0,this._holdStart=t=>{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:pf.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const n=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n);const r=performance.now();this._deltaTime=r-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:pf.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const n=performance.now();this._deltaTime=n-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:pf.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}get holding(){return this._holding}}class Vp extends F5{constructor(e,t){if(typeof e!="string"){console.error("KeyboardKeyHold: the first argument has to be a KeyboardEvent.code string.");return}super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const n=s=>{B5(s)||s.code===e&&this._holdStart(s)},r=s=>{s.code===e&&this._holdEnd(s)};document.addEventListener("keydown",n),document.addEventListener("keyup",r),window.addEventListener("blur",this._holdEnd)}}function B5(i){const e=i.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var Wp={exports:{}},$M;function k5(){if($M)return Wp.exports;$M=1;var i=typeof Reflect=="object"?Reflect:null,e=i&&typeof i.apply=="function"?i.apply:function(w,T,R){return Function.prototype.apply.call(w,T,R)},t;i&&typeof i.ownKeys=="function"?t=i.ownKeys:Object.getOwnPropertySymbols?t=function(w){return Object.getOwnPropertyNames(w).concat(Object.getOwnPropertySymbols(w))}:t=function(w){return Object.getOwnPropertyNames(w)};function n(S){console&&console.warn&&console.warn(S)}var r=Number.isNaN||function(w){return w!==w};function s(){s.init.call(this)}Wp.exports=s,Wp.exports.once=g,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(S){if(typeof S!="number"||S<0||r(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");a=S}}),s.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},s.prototype.setMaxListeners=function(w){if(typeof w!="number"||w<0||r(w))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+w+".");return this._maxListeners=w,this};function l(S){return S._maxListeners===void 0?s.defaultMaxListeners:S._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(w){for(var T=[],R=1;R<arguments.length;R++)T.push(arguments[R]);var U=w==="error",A=this._events;if(A!==void 0)U=U&&A.error===void 0;else if(!U)return!1;if(U){var D;if(T.length>0&&(D=T[0]),D instanceof Error)throw D;var L=new Error("Unhandled error."+(D?" ("+D.message+")":""));throw L.context=D,L}var P=A[w];if(P===void 0)return!1;if(typeof P=="function")e(P,this,T);else for(var I=P.length,V=v(P,I),R=0;R<I;++R)e(V[R],this,T);return!0};function c(S,w,T,R){var U,A,D;if(o(T),A=S._events,A===void 0?(A=S._events=Object.create(null),S._eventsCount=0):(A.newListener!==void 0&&(S.emit("newListener",w,T.listener?T.listener:T),A=S._events),D=A[w]),D===void 0)D=A[w]=T,++S._eventsCount;else if(typeof D=="function"?D=A[w]=R?[T,D]:[D,T]:R?D.unshift(T):D.push(T),U=l(S),U>0&&D.length>U&&!D.warned){D.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(w)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=S,L.type=w,L.count=D.length,n(L)}return S}s.prototype.addListener=function(w,T){return c(this,w,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(w,T){return c(this,w,T,!0)};function h(){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 d(S,w,T){var R={fired:!1,wrapFn:void 0,target:S,type:w,listener:T},U=h.bind(R);return U.listener=T,R.wrapFn=U,U}s.prototype.once=function(w,T){return o(T),this.on(w,d(this,w,T)),this},s.prototype.prependOnceListener=function(w,T){return o(T),this.prependListener(w,d(this,w,T)),this},s.prototype.removeListener=function(w,T){var R,U,A,D,L;if(o(T),U=this._events,U===void 0)return this;if(R=U[w],R===void 0)return this;if(R===T||R.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete U[w],U.removeListener&&this.emit("removeListener",w,R.listener||T));else if(typeof R!="function"){for(A=-1,D=R.length-1;D>=0;D--)if(R[D]===T||R[D].listener===T){L=R[D].listener,A=D;break}if(A<0)return this;A===0?R.shift():x(R,A),R.length===1&&(U[w]=R[0]),U.removeListener!==void 0&&this.emit("removeListener",w,L||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(w){var T,R,U;if(R=this._events,R===void 0)return this;if(R.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):R[w]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete R[w]),this;if(arguments.length===0){var A=Object.keys(R),D;for(U=0;U<A.length;++U)D=A[U],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=R[w],typeof T=="function")this.removeListener(w,T);else if(T!==void 0)for(U=T.length-1;U>=0;U--)this.removeListener(w,T[U]);return this};function p(S,w,T){var R=S._events;if(R===void 0)return[];var U=R[w];return U===void 0?[]:typeof U=="function"?T?[U.listener||U]:[U]:T?_(U):v(U,U.length)}s.prototype.listeners=function(w){return p(this,w,!0)},s.prototype.rawListeners=function(w){return p(this,w,!1)},s.listenerCount=function(S,w){return typeof S.listenerCount=="function"?S.listenerCount(w):m.call(S,w)},s.prototype.listenerCount=m;function m(S){var w=this._events;if(w!==void 0){var T=w[S];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function v(S,w){for(var T=new Array(w),R=0;R<w;++R)T[R]=S[R];return T}function x(S,w){for(;w+1<S.length;w++)S[w]=S[w+1];S.pop()}function _(S){for(var w=new Array(S.length),T=0;T<w.length;++T)w[T]=S[T].listener||S[T];return w}function g(S,w){return new Promise(function(T,R){function U(D){S.removeListener(w,A),R(D)}function A(){typeof S.removeListener=="function"&&S.removeListener("error",U),T([].slice.call(arguments))}E(S,w,A,{once:!0}),w!=="error"&&b(S,U,{once:!0})})}function b(S,w,T){typeof S.on=="function"&&E(S,"error",w,T)}function E(S,w,T,R){if(typeof S.on=="function")R.once?S.once(w,T):S.on(w,T);else if(typeof S.addEventListener=="function")S.addEventListener(w,function U(A){R.once&&S.removeEventListener(w,U),T(A)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}return Wp.exports}var G5=k5();function H5(){const i=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const n in arguments[e])i[n]=arguments[e][n];return i}let ii=H5;typeof Object.assign=="function"&&(ii=Object.assign);function kr(i,e,t,n){const r=i._nodes.get(e);let s=null;return r&&(n==="mixed"?s=r.out&&r.out[t]||r.undirected&&r.undirected[t]:n==="directed"?s=r.out&&r.out[t]:s=r.undirected&&r.undirected[t]),s}function gi(i){return typeof i=="object"&&i!==null}function FC(i){let e;for(e in i)return!1;return!0}function Or(i,e,t){Object.defineProperty(i,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function $r(i,e,t){const n={enumerable:!0,configurable:!0};typeof t=="function"?n.get=t:(n.value=t,n.writable=!1),Object.defineProperty(i,e,n)}function ew(i){return!(!gi(i)||i.attributes&&!Array.isArray(i.attributes))}function V5(){let i=Math.floor(Math.random()*256)&255;return()=>i++}function ga(){const i=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let n=null;do{if(e===null){if(t++,t>=i.length)return{done:!0};e=i[t][Symbol.iterator]()}if(n=e.next(),n.done){e=null;continue}break}while(!0);return n}}}function Uu(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class R1 extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class ut extends R1{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ut.prototype.constructor)}}class et extends R1{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,et.prototype.constructor)}}class xt extends R1{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xt.prototype.constructor)}}function BC(i,e){this.key=i,this.attributes=e,this.clear()}BC.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function kC(i,e){this.key=i,this.attributes=e,this.clear()}kC.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function GC(i,e){this.key=i,this.attributes=e,this.clear()}GC.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ou(i,e,t,n,r){this.key=e,this.attributes=r,this.undirected=i,this.source=t,this.target=n}Ou.prototype.attach=function(){let i="out",e="in";this.undirected&&(i=e="undirected");const t=this.source.key,n=this.target.key;this.source[i][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)};Ou.prototype.attachMulti=function(){let i="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(i=e="undirected");const r=this.source[i],s=r[n];if(typeof s>"u"){r[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}s.previous=this,this.next=s,r[n]=this,this.target[e][t]=this};Ou.prototype.detach=function(){const i=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][i]};Ou.prototype.detachMulti=function(){const i=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][i]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][i]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const HC=0,VC=1,W5=2,WC=3;function wa(i,e,t,n,r,s,a){let o,l,c,h;if(n=""+n,t===HC){if(o=i._nodes.get(n),!o)throw new et(`Graph.${e}: could not find the "${n}" node in the graph.`);c=r,h=s}else if(t===WC){if(r=""+r,l=i._edges.get(r),!l)throw new et(`Graph.${e}: could not find the "${r}" edge in the graph.`);const d=l.source.key,p=l.target.key;if(n===d)o=l.target;else if(n===p)o=l.source;else throw new et(`Graph.${e}: the "${n}" node is not attached to the "${r}" edge (${d}, ${p}).`);c=s,h=a}else{if(l=i._edges.get(n),!l)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===VC?o=l.source:o=l.target,c=r,h=s}return[o,c,h]}function X5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);return a.attributes[o]}}function j5(i,e,t){i.prototype[e]=function(n,r){const[s]=wa(this,e,t,n,r);return s.attributes}}function q5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);return a.attributes.hasOwnProperty(o)}}function Y5(i,e,t){i.prototype[e]=function(n,r,s,a){const[o,l,c]=wa(this,e,t,n,r,s,a);return o.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function Z5(i,e,t){i.prototype[e]=function(n,r,s,a){const[o,l,c]=wa(this,e,t,n,r,s,a);if(typeof c!="function")throw new ut(`Graph.${e}: updater should be a function.`);const h=o.attributes,d=c(h[l]);return h[l]=d,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function K5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);return delete a.attributes[o],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:o}),this}}function J5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);if(!gi(o))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=o,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Q5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);if(!gi(o))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return ii(a.attributes,o),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:o}),this}}function $5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);if(typeof o!="function")throw new ut(`Graph.${e}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const ek=[{name:i=>`get${i}Attribute`,attacher:X5},{name:i=>`get${i}Attributes`,attacher:j5},{name:i=>`has${i}Attribute`,attacher:q5},{name:i=>`set${i}Attribute`,attacher:Y5},{name:i=>`update${i}Attribute`,attacher:Z5},{name:i=>`remove${i}Attribute`,attacher:K5},{name:i=>`replace${i}Attributes`,attacher:J5},{name:i=>`merge${i}Attributes`,attacher:Q5},{name:i=>`update${i}Attributes`,attacher:$5}];function tk(i){ek.forEach(function({name:e,attacher:t}){t(i,e("Node"),HC),t(i,e("Source"),VC),t(i,e("Target"),W5),t(i,e("Opposite"),WC)})}function nk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes[r]}}function ik(i,e,t){i.prototype[e]=function(n){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,a=""+arguments[1];if(r=kr(this,s,a,t),!r)throw new et(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,r=this._edges.get(n),!r)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return r.attributes}}function rk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes.hasOwnProperty(r)}}function sk(i,e,t){i.prototype[e]=function(n,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,l=""+r;if(r=arguments[2],s=arguments[3],a=kr(this,o,l,t),!a)throw new et(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,a=this._edges.get(n),!a)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return a.attributes[r]=s,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function ak(i,e,t){i.prototype[e]=function(n,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,l=""+r;if(r=arguments[2],s=arguments[3],a=kr(this,o,l,t),!a)throw new et(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,a=this._edges.get(n),!a)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof s!="function")throw new ut(`Graph.${e}: updater should be a function.`);return a.attributes[r]=s(a.attributes[r]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function ok(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete s.attributes[r],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:r}),this}}function lk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!gi(r))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function ck(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!gi(r))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return ii(s.attributes,r),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:r}),this}}function uk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof r!="function")throw new ut(`Graph.${e}: provided updater is not a function.`);return s.attributes=r(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const hk=[{name:i=>`get${i}Attribute`,attacher:nk},{name:i=>`get${i}Attributes`,attacher:ik},{name:i=>`has${i}Attribute`,attacher:rk},{name:i=>`set${i}Attribute`,attacher:sk},{name:i=>`update${i}Attribute`,attacher:ak},{name:i=>`remove${i}Attribute`,attacher:ok},{name:i=>`replace${i}Attributes`,attacher:lk},{name:i=>`merge${i}Attributes`,attacher:ck},{name:i=>`update${i}Attributes`,attacher:uk}];function fk(i){hk.forEach(function({name:e,attacher:t}){t(i,e("Edge"),"mixed"),t(i,e("DirectedEdge"),"directed"),t(i,e("UndirectedEdge"),"undirected")})}const dk=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function pk(i,e,t,n){let r=!1;for(const s in e){if(s===n)continue;const a=e[s];if(r=t(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),i&&r)return a.key}}function mk(i,e,t,n){let r,s,a,o=!1;for(const l in e)if(l!==n){r=e[l];do{if(s=r.source,a=r.target,o=t(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected),i&&o)return r.key;r=r.next}while(r!==void 0)}}function $y(i,e){const t=Object.keys(i),n=t.length;let r,s=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(s>=n)return{done:!0};const a=t[s++];if(a===e){r=void 0;continue}r=i[a]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function gk(i,e,t,n){const r=e[t];if(!r)return;const s=r.source,a=r.target;if(n(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected)&&i)return r.key}function vk(i,e,t,n){let r=e[t];if(!r)return;let s=!1;do{if(s=n(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),i&&s)return r.key;r=r.next}while(r!==void 0)}function e_(i,e){let t=i[e];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let n=!1;return{[Symbol.iterator](){return this},next(){return n===!0?{done:!0}:(n=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function yk(i,e){if(i.size===0)return[];if(e==="mixed"||e===i.type)return Array.from(i._edges.keys());const t=e==="undirected"?i.undirectedSize:i.directedSize,n=new Array(t),r=e==="undirected",s=i._edges.values();let a=0,o,l;for(;o=s.next(),o.done!==!0;)l=o.value,l.undirected===r&&(n[a++]=l.key);return n}function XC(i,e,t,n){if(e.size===0)return;const r=t!=="mixed"&&t!==e.type,s=t==="undirected";let a,o,l=!1;const c=e._edges.values();for(;a=c.next(),a.done!==!0;){if(o=a.value,r&&o.undirected!==s)continue;const{key:h,attributes:d,source:p,target:m}=o;if(l=n(h,d,p.key,m.key,p.attributes,m.attributes,o.undirected),i&&l)return h}}function _k(i,e){if(i.size===0)return Uu();const t=e!=="mixed"&&e!==i.type,n=e==="undirected",r=i._edges.values();return{[Symbol.iterator](){return this},next(){let s,a;for(;;){if(s=r.next(),s.done)return s;if(a=s.value,!(t&&a.undirected!==n))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}}}}function D1(i,e,t,n,r,s){const a=e?mk:pk;let o;if(t!=="undirected"&&(n!=="out"&&(o=a(i,r.in,s),i&&o)||n!=="in"&&(o=a(i,r.out,s,n?void 0:r.key),i&&o))||t!=="directed"&&(o=a(i,r.undirected,s),i&&o))return o}function xk(i,e,t,n){const r=[];return D1(!1,i,e,t,n,function(s){r.push(s)}),r}function bk(i,e,t){let n=Uu();return i!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=ga(n,$y(t.in))),e!=="in"&&typeof t.out<"u"&&(n=ga(n,$y(t.out,e?void 0:t.key)))),i!=="directed"&&typeof t.undirected<"u"&&(n=ga(n,$y(t.undirected))),n}function U1(i,e,t,n,r,s,a){const o=t?vk:gk;let l;if(e!=="undirected"&&(typeof r.in<"u"&&n!=="out"&&(l=o(i,r.in,s,a),i&&l)||typeof r.out<"u"&&n!=="in"&&(n||r.key!==s)&&(l=o(i,r.out,s,a),i&&l))||e!=="directed"&&typeof r.undirected<"u"&&(l=o(i,r.undirected,s,a),i&&l))return l}function Sk(i,e,t,n,r){const s=[];return U1(!1,i,e,t,n,r,function(a){s.push(a)}),s}function Ek(i,e,t,n){let r=Uu();return i!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(r=ga(r,e_(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(r=ga(r,e_(t.out,n)))),i!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(r=ga(r,e_(t.undirected,n))),r}function Mk(i,e){const{name:t,type:n,direction:r}=e;i.prototype[t]=function(s,a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return yk(this,n);if(arguments.length===1){s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new et(`Graph.${t}: could not find the "${s}" node in the graph.`);return xk(this.multi,n==="mixed"?this.type:n,r,o)}if(arguments.length===2){s=""+s,a=""+a;const o=this._nodes.get(s);if(!o)throw new et(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new et(`Graph.${t}: could not find the "${a}" target node in the graph.`);return Sk(n,this.multi,r,o,a)}throw new ut(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function wk(i,e){const{name:t,type:n,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(c,h,d){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return d=c,XC(!1,this,n,d);if(arguments.length===2){c=""+c,d=h;const p=this._nodes.get(c);if(typeof p>"u")throw new et(`Graph.${s}: could not find the "${c}" node in the graph.`);return D1(!1,this.multi,n==="mixed"?this.type:n,r,p,d)}if(arguments.length===3){c=""+c,h=""+h;const p=this._nodes.get(c);if(!p)throw new et(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(h))throw new et(`Graph.${s}: could not find the "${h}" target node in the graph.`);return U1(!1,n,this.multi,r,p,h,d)}throw new ut(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+t[0].toUpperCase()+t.slice(1);i.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),h=c.pop();let d;if(c.length===0){let p=0;n!=="directed"&&(p+=this.undirectedSize),n!=="undirected"&&(p+=this.directedSize),d=new Array(p);let m=0;c.push((v,x,_,g,b,E,S)=>{d[m++]=h(v,x,_,g,b,E,S)})}else d=[],c.push((p,m,v,x,_,g,b)=>{d.push(h(p,m,v,x,_,g,b))});return this[s].apply(this,c),d};const o="filter"+t[0].toUpperCase()+t.slice(1);i.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),h=c.pop(),d=[];return c.push((p,m,v,x,_,g,b)=>{h(p,m,v,x,_,g,b)&&d.push(p)}),this[s].apply(this,c),d};const l="reduce"+t[0].toUpperCase()+t.slice(1);i.prototype[l]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new ut(`Graph.${l}: invalid number of arguments (expecting 2, 3 or 4 and got ${c.length}).`);if(typeof c[c.length-1]=="function"&&typeof c[c.length-2]!="function")throw new ut(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h,d;c.length===2?(h=c[0],d=c[1],c=[]):c.length===3?(h=c[1],d=c[2],c=[c[0]]):c.length===4&&(h=c[2],d=c[3],c=[c[0],c[1]]);let p=d;return c.push((m,v,x,_,g,b,E)=>{p=h(p,m,v,x,_,g,b,E)}),this[s].apply(this,c),p}}function Tk(i,e){const{name:t,type:n,direction:r}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(l,c,h){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return h=l,XC(!0,this,n,h);if(arguments.length===2){l=""+l,h=c;const d=this._nodes.get(l);if(typeof d>"u")throw new et(`Graph.${s}: could not find the "${l}" node in the graph.`);return D1(!0,this.multi,n==="mixed"?this.type:n,r,d,h)}if(arguments.length===3){l=""+l,c=""+c;const d=this._nodes.get(l);if(!d)throw new et(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(c))throw new et(`Graph.${s}: could not find the "${c}" target node in the graph.`);return U1(!0,n,this.multi,r,d,c,h)}throw new ut(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((d,p,m,v,x,_,g)=>c(d,p,m,v,x,_,g)),!!this[s].apply(this,l)};const o="every"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((d,p,m,v,x,_,g)=>!c(d,p,m,v,x,_,g)),!this[s].apply(this,l)}}function Ak(i,e){const{name:t,type:n,direction:r}=e,s=t.slice(0,-1)+"Entries";i.prototype[s]=function(a,o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Uu();if(!arguments.length)return _k(this,n);if(arguments.length===1){a=""+a;const l=this._nodes.get(a);if(!l)throw new et(`Graph.${s}: could not find the "${a}" node in the graph.`);return bk(n,r,l)}if(arguments.length===2){a=""+a,o=""+o;const l=this._nodes.get(a);if(!l)throw new et(`Graph.${s}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new et(`Graph.${s}: could not find the "${o}" target node in the graph.`);return Ek(n,r,l,o)}throw new ut(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ck(i){dk.forEach(e=>{Mk(i,e),wk(i,e),Tk(i,e),Ak(i,e)})}const Rk=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function f0(){this.A=null,this.B=null}f0.prototype.wrap=function(i){this.A===null?this.A=i:this.B===null&&(this.B=i)};f0.prototype.has=function(i){return this.A!==null&&i in this.A||this.B!==null&&i in this.B};function Rh(i,e,t,n,r){for(const s in n){const a=n[s],o=a.source,l=a.target,c=o===t?l:o;if(e&&e.has(c.key))continue;const h=r(c.key,c.attributes);if(i&&h)return c.key}}function O1(i,e,t,n,r){if(e!=="mixed"){if(e==="undirected")return Rh(i,null,n,n.undirected,r);if(typeof t=="string")return Rh(i,null,n,n[t],r)}const s=new f0;let a;if(e!=="undirected"){if(t!=="out"){if(a=Rh(i,null,n,n.in,r),i&&a)return a;s.wrap(n.in)}if(t!=="in"){if(a=Rh(i,s,n,n.out,r),i&&a)return a;s.wrap(n.out)}}if(e!=="directed"&&(a=Rh(i,s,n,n.undirected,r),i&&a))return a}function Dk(i,e,t){if(i!=="mixed"){if(i==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return O1(!1,i,e,t,function(r){n.push(r)}),n}function Dh(i,e,t){const n=Object.keys(t),r=n.length;let s=0;return{[Symbol.iterator](){return this},next(){let a=null;do{if(s>=r)return i&&i.wrap(t),{done:!0};const o=t[n[s++]],l=o.source,c=o.target;if(a=l===e?c:l,i&&i.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}}}function Uk(i,e,t){if(i!=="mixed"){if(i==="undirected")return Dh(null,t,t.undirected);if(typeof e=="string")return Dh(null,t,t[e])}let n=Uu();const r=new f0;return i!=="undirected"&&(e!=="out"&&(n=ga(n,Dh(r,t,t.in))),e!=="in"&&(n=ga(n,Dh(r,t,t.out)))),i!=="directed"&&(n=ga(n,Dh(r,t,t.undirected))),n}function Ok(i,e){const{name:t,type:n,direction:r}=e;i.prototype[t]=function(s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new et(`Graph.${t}: could not find the "${s}" node in the graph.`);return Dk(n==="mixed"?this.type:n,r,a)}}function Lk(i,e){const{name:t,type:n,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(c,h){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;c=""+c;const d=this._nodes.get(c);if(typeof d>"u")throw new et(`Graph.${s}: could not find the "${c}" node in the graph.`);O1(!1,n==="mixed"?this.type:n,r,d,h)};const a="map"+t[0].toUpperCase()+t.slice(1);i.prototype[a]=function(c,h){const d=[];return this[s](c,(p,m)=>{d.push(h(p,m))}),d};const o="filter"+t[0].toUpperCase()+t.slice(1);i.prototype[o]=function(c,h){const d=[];return this[s](c,(p,m)=>{h(p,m)&&d.push(p)}),d};const l="reduce"+t[0].toUpperCase()+t.slice(1);i.prototype[l]=function(c,h,d){if(arguments.length<3)throw new ut(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let p=d;return this[s](c,(m,v)=>{p=h(p,m,v)}),p}}function Ik(i,e){const{name:t,type:n,direction:r}=e,s=t[0].toUpperCase()+t.slice(1,-1),a="find"+s;i.prototype[a]=function(c,h){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;c=""+c;const d=this._nodes.get(c);if(typeof d>"u")throw new et(`Graph.${a}: could not find the "${c}" node in the graph.`);return O1(!0,n==="mixed"?this.type:n,r,d,h)};const o="some"+s;i.prototype[o]=function(c,h){return!!this[a](c,h)};const l="every"+s;i.prototype[l]=function(c,h){return!this[a](c,(p,m)=>!h(p,m))}}function Nk(i,e){const{name:t,type:n,direction:r}=e,s=t.slice(0,-1)+"Entries";i.prototype[s]=function(a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Uu();a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new et(`Graph.${s}: could not find the "${a}" node in the graph.`);return Uk(n==="mixed"?this.type:n,r,o)}}function Pk(i){Rk.forEach(e=>{Ok(i,e),Lk(i,e),Ik(i,e),Nk(i,e)})}function Xp(i,e,t,n,r){const s=n._nodes.values(),a=n.type;let o,l,c,h,d,p;for(;o=s.next(),o.done!==!0;){let m=!1;if(l=o.value,a!=="undirected"){h=l.out;for(c in h){d=h[c];do p=d.target,m=!0,r(l.key,p.key,l.attributes,p.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}if(a!=="directed"){h=l.undirected;for(c in h)if(!(e&&l.key>c)){d=h[c];do p=d.target,p.key!==c&&(p=d.source),m=!0,r(l.key,p.key,l.attributes,p.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}t&&!m&&r(l.key,null,l.attributes,null,null,null,null)}}function zk(i,e){const t={key:i};return FC(e.attributes)||(t.attributes=ii({},e.attributes)),t}function Fk(i,e,t){const n={key:e,source:t.source.key,target:t.target.key};return FC(t.attributes)||(n.attributes=ii({},t.attributes)),i==="mixed"&&t.undirected&&(n.undirected=!0),n}function Bk(i){if(!gi(i))throw new ut('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in i))throw new ut("Graph.import: serialized node is missing its key.");if("attributes"in i&&(!gi(i.attributes)||i.attributes===null))throw new ut("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function kk(i){if(!gi(i))throw new ut('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in i))throw new ut("Graph.import: serialized edge is missing its source.");if(!("target"in i))throw new ut("Graph.import: serialized edge is missing its target.");if("attributes"in i&&(!gi(i.attributes)||i.attributes===null))throw new ut("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in i&&typeof i.undirected!="boolean")throw new ut("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const Gk=V5(),Hk=new Set(["directed","undirected","mixed"]),tw=new Set(["domain","_events","_eventsCount","_maxListeners"]),Vk=[{name:i=>`${i}Edge`,generateKey:!0},{name:i=>`${i}DirectedEdge`,generateKey:!0,type:"directed"},{name:i=>`${i}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:i=>`${i}EdgeWithKey`},{name:i=>`${i}DirectedEdgeWithKey`,type:"directed"},{name:i=>`${i}UndirectedEdgeWithKey`,type:"undirected"}],Wk={allowSelfLoops:!0,multi:!1,type:"mixed"};function Xk(i,e,t){if(t&&!gi(t))throw new ut(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},i._nodes.has(e))throw new xt(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new i.NodeDataClass(e,t);return i._nodes.set(e,n),i.emit("nodeAdded",{key:e,attributes:t}),n}function nw(i,e,t){const n=new i.NodeDataClass(e,t);return i._nodes.set(e,n),i.emit("nodeAdded",{key:e,attributes:t}),n}function jC(i,e,t,n,r,s,a,o){if(!n&&i.type==="undirected")throw new xt(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&i.type==="directed")throw new xt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(o&&!gi(o))throw new ut(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`);if(s=""+s,a=""+a,o=o||{},!i.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const l=i._nodes.get(s),c=i._nodes.get(a);if(!l)throw new et(`Graph.${e}: source node "${s}" not found.`);if(!c)throw new et(`Graph.${e}: target node "${a}" not found.`);const h={key:null,undirected:n,source:s,target:a,attributes:o};if(t)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!i.multi&&(n?typeof l.undirected[a]<"u":typeof l.out[a]<"u"))throw new xt(`Graph.${e}: an edge linking "${s}" to "${a}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const d=new Ou(n,r,l,c,o);i._edges.set(r,d);const p=s===a;return n?(l.undirectedDegree++,c.undirectedDegree++,p&&(l.undirectedLoops++,i._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,p&&(l.directedLoops++,i._directedSelfLoopCount++)),i.multi?d.attachMulti():d.attach(),n?i._undirectedSize++:i._directedSize++,h.key=r,i.emit("edgeAdded",h),r}function jk(i,e,t,n,r,s,a,o,l){if(!n&&i.type==="undirected")throw new xt(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&i.type==="directed")throw new xt(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(o){if(l){if(typeof o!="function")throw new ut(`Graph.${e}: invalid updater function. Expecting a function but got "${o}"`)}else if(!gi(o))throw new ut(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`)}s=""+s,a=""+a;let c;if(l&&(c=o,o=void 0),!i.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let h=i._nodes.get(s),d=i._nodes.get(a),p,m;if(!t&&(p=i._edges.get(r),p)){if((p.source.key!==s||p.target.key!==a)&&(!n||p.source.key!==a||p.target.key!==s))throw new xt(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${s}" source & "${a}" target vs. ("${p.source.key}", "${p.target.key}").`);m=p}if(!m&&!i.multi&&h&&(m=n?h.undirected[a]:h.out[a]),m){const b=[m.key,!1,!1,!1];if(l?!c:!o)return b;if(l){const E=m.attributes;m.attributes=c(E),i.emit("edgeAttributesUpdated",{type:"replace",key:m.key,attributes:m.attributes})}else ii(m.attributes,o),i.emit("edgeAttributesUpdated",{type:"merge",key:m.key,attributes:m.attributes,data:o});return b}o=o||{},l&&c&&(o=c(o));const v={key:null,undirected:n,source:s,target:a,attributes:o};if(t)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);let x=!1,_=!1;h||(h=nw(i,s,{}),x=!0,s===a&&(d=h,_=!0)),d||(d=nw(i,a,{}),_=!0),p=new Ou(n,r,h,d,o),i._edges.set(r,p);const g=s===a;return n?(h.undirectedDegree++,d.undirectedDegree++,g&&(h.undirectedLoops++,i._undirectedSelfLoopCount++)):(h.outDegree++,d.inDegree++,g&&(h.directedLoops++,i._directedSelfLoopCount++)),i.multi?p.attachMulti():p.attach(),n?i._undirectedSize++:i._directedSize++,v.key=r,i.emit("edgeAdded",v),[r,!0,x,_]}function Wc(i,e){i._edges.delete(e.key);const{source:t,target:n,attributes:r}=e,s=e.undirected,a=t===n;s?(t.undirectedDegree--,n.undirectedDegree--,a&&(t.undirectedLoops--,i._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,a&&(t.directedLoops--,i._directedSelfLoopCount--)),i.multi?e.detachMulti():e.detach(),s?i._undirectedSize--:i._directedSize--,i.emit("edgeDropped",{key:e.key,attributes:r,source:t.key,target:n.key,undirected:s})}class un extends G5.EventEmitter{constructor(e){if(super(),e=ii({},Wk,e),typeof e.multi!="boolean")throw new ut(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Hk.has(e.type))throw new ut(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new ut(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?BC:e.type==="directed"?kC:GC;Or(this,"NodeDataClass",t);const n="geid_"+Gk()+"_";let r=0;const s=()=>{let a;do a=n+r++;while(this._edges.has(a));return a};Or(this,"_attributes",{}),Or(this,"_nodes",new Map),Or(this,"_edges",new Map),Or(this,"_directedSize",0),Or(this,"_undirectedSize",0),Or(this,"_directedSelfLoopCount",0),Or(this,"_undirectedSelfLoopCount",0),Or(this,"_edgeKeyGenerator",s),Or(this,"_options",e),tw.forEach(a=>Or(this,a,this[a])),$r(this,"order",()=>this._nodes.size),$r(this,"size",()=>this._edges.size),$r(this,"directedSize",()=>this._directedSize),$r(this,"undirectedSize",()=>this._undirectedSize),$r(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),$r(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),$r(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),$r(this,"multi",this._options.multi),$r(this,"type",this._options.type),$r(this,"allowSelfLoops",this._options.allowSelfLoops),$r(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new ut(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const n=""+e,r=this._edges.get(n);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new ut(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new ut(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new et(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new et(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new et(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new et(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new xt("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new et(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new et(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=n.source.key,s=n.target.key;if(e===r)return s;if(e===s)return r;throw new et(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new et(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Xk(this,e,t).key}mergeNode(e,t){if(t&&!gi(t))throw new ut(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(ii(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new ut(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const s=n.attributes;n.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const r in t.out){n=t.out[r];do Wc(this,n),n=n.next;while(n)}for(const r in t.in){n=t.in[r];do Wc(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const r in t.undirected){n=t.undirected[r];do Wc(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],r=""+arguments[1];if(t=kr(this,n,r,this.type),!t)throw new et(`Graph.dropEdge: could not find the "${n}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new et(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return Wc(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new xt("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new xt("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const n=kr(this,e,t,"directed");if(!n)throw new et(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Wc(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new xt("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new xt("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=kr(this,e,t,"undirected");if(!n)throw new et(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Wc(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new ut("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!gi(e))throw new ut("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!gi(e))throw new ut("Graph.mergeAttributes: provided attributes are not a plain object.");return ii(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new ut("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new ut("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!ew(t))throw new ut("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let r,s;for(;r=n.next(),r.done!==!0;)s=r.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new ut("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!ew(t))throw new ut("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let r,s,a,o;for(;r=n.next(),r.done!==!0;)s=r.value,a=s.source,o=s.target,s.attributes=e(s.key,s.attributes,a.key,o.key,a.attributes,o.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new ut("Graph.forEachAdjacencyEntry: expecting a callback.");Xp(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new ut("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Xp(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new ut("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Xp(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new ut("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Xp(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new ut("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new ut("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new ut("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,r;const s=new Array(this.order);let a=0;for(;n=t.next(),n.done!==!0;)r=n.value,s[a++]=e(r.key,r.attributes);return s}someNode(e){if(typeof e!="function")throw new ut("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new ut("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new ut("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,r;const s=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&s.push(r.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new ut("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ut("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t;const r=this._nodes.values();let s,a;for(;s=r.next(),s.done!==!0;)a=s.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,s)=>{e[t++]=zk(s,r)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((r,s)=>{n[t++]=Fk(this.type,s,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof un)return e.forEachNode((l,c)=>{t?this.mergeNode(l,c):this.addNode(l,c)}),e.forEachEdge((l,c,h,d,p,m,v)=>{t?v?this.mergeUndirectedEdgeWithKey(l,h,d,c):this.mergeDirectedEdgeWithKey(l,h,d,c):v?this.addUndirectedEdgeWithKey(l,h,d,c):this.addDirectedEdgeWithKey(l,h,d,c)}),this;if(!gi(e))throw new ut("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!gi(e.attributes))throw new ut("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,r,s,a,o;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new ut("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=s.length;n<r;n++){a=s[n],Bk(a);const{key:l,attributes:c}=a;t?this.mergeNode(l,c):this.addNode(l,c)}}if(e.edges){let l=!1;if(this.type==="undirected"&&(l=!0),s=e.edges,!Array.isArray(s))throw new ut("Graph.import: invalid edges. Expecting an array.");for(n=0,r=s.length;n<r;n++){o=s[n],kk(o);const{source:c,target:h,attributes:d,undirected:p=l}=o;let m;"key"in o?(m=t?p?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:p?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,m.call(this,o.key,c,h,d)):(m=t?p?this.mergeUndirectedEdge:this.mergeDirectedEdge:p?this.addUndirectedEdge:this.addDirectedEdge,m.call(this,c,h,d))}}return this}nullCopy(e){const t=new un(ii({},this._options,e));return t.replaceAttributes(ii({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((n,r)=>{const s=ii({},n.attributes);n=new t.NodeDataClass(r,s),t._nodes.set(r,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new xt(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new xt("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new xt("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),n=this._edges.values();let r,s;for(;r=n.next(),r.done!==!0;)s=r.value,jC(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,ii({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,a)=>{e[a]=s.attributes});const t={},n={};this._edges.forEach((s,a)=>{const o=s.undirected?"--":"->";let l="",c=s.source.key,h=s.target.key,d;s.undirected&&c>h&&(d=c,c=h,h=d);const p=`(${c})${o}(${h})`;a.startsWith("geid_")?this.multi&&(typeof n[p]>"u"?n[p]=0:n[p]++,l+=`${n[p]}. `):l+=`[${a}]: `,l+=p,t[l]=s.attributes});const r={};for(const s in this)this.hasOwnProperty(s)&&!tw.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(r[s]=this[s]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Or(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(un.prototype[Symbol.for("nodejs.util.inspect.custom")]=un.prototype.inspect);Vk.forEach(i=>{["add","merge","update"].forEach(e=>{const t=i.name(e),n=e==="add"?jC:jk;i.generateKey?un.prototype[t]=function(r,s,a){return n(this,t,!0,(i.type||this.type)==="undirected",null,r,s,a,e==="update")}:un.prototype[t]=function(r,s,a,o){return n(this,t,!1,(i.type||this.type)==="undirected",r,s,a,o,e==="update")}})});tk(un);fk(un);Ck(un);Pk(un);class qC extends un{constructor(e){const t=ii({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new ut("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new ut('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class YC extends un{constructor(e){const t=ii({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new ut("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new ut('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ZC extends un{constructor(e){const t=ii({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new ut("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class KC extends un{constructor(e){const t=ii({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new ut("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new ut('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class JC extends un{constructor(e){const t=ii({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new ut("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new ut('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Lu(i){i.from=function(e,t){const n=ii({},e.options,t),r=new i(n);return r.import(e),r}}Lu(un);Lu(qC);Lu(YC);Lu(ZC);Lu(KC);Lu(JC);un.Graph=un;un.DirectedGraph=qC;un.UndirectedGraph=YC;un.MultiGraph=ZC;un.MultiDirectedGraph=KC;un.MultiUndirectedGraph=JC;un.InvalidArgumentsGraphError=ut;un.NotFoundGraphError=et;un.UsageGraphError=xt;const Jh=(i,e)=>{const t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},o=i[0].morphTargetsRelative,l=new Rt;let c=0;if(i.forEach((h,d)=>{let p=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in h.attributes){if(!n.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(h.attributes[m]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(o!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in h.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;a[m]===void 0&&(a[m]=[]),a[m].push(h.morphAttributes[m])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let m;if(h.index)m=h.index.count;else if(h.attributes.position!==void 0)m=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,m,d),c+=m}}),t){let h=0;const d=[];i.forEach(p=>{const m=p.index;for(let v=0;v<m.count;++v)d.push(m.getX(v)+h);h+=p.attributes.position.count}),l.setIndex(d)}for(let h in s){const d=iw(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){const d=a[h][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let p=0;p<d;++p){const m=[];for(let x=0;x<a[h].length;++x)m.push(a[h][x][p]);const v=iw(m);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(v)}}return l},iw=i=>{let e,t,n,r=0;if(i.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=s.array.length}),e&&t){const s=new e(r);let a=0;return i.forEach(o=>{s.set(o.array,a),a+=o.array.length}),new $t(s,t,n)}};function qk(i,e=Math.PI/3){const t=Math.cos(e),n=(1+1e-10)*100,r=[new j,new j,new j],s=new j,a=new j,o=new j,l=new j;function c(x){const _=~~(x.x*n),g=~~(x.y*n),b=~~(x.z*n);return`${_},${g},${b}`}const h=i.index?i.toNonIndexed():i,d=h.attributes.position,p={};for(let x=0,_=d.count/3;x<_;x++){const g=3*x,b=r[0].fromBufferAttribute(d,g+0),E=r[1].fromBufferAttribute(d,g+1),S=r[2].fromBufferAttribute(d,g+2);s.subVectors(S,E),a.subVectors(b,E);const w=new j().crossVectors(s,a).normalize();for(let T=0;T<3;T++){const R=r[T],U=c(R);U in p||(p[U]=[]),p[U].push(w)}}const m=new Float32Array(d.count*3),v=new $t(m,3,!1);for(let x=0,_=d.count/3;x<_;x++){const g=3*x,b=r[0].fromBufferAttribute(d,g+0),E=r[1].fromBufferAttribute(d,g+1),S=r[2].fromBufferAttribute(d,g+2);s.subVectors(S,E),a.subVectors(b,E),o.crossVectors(s,a).normalize();for(let w=0;w<3;w++){const T=r[w],R=c(T),U=p[R];l.set(0,0,0);for(let A=0,D=U.length;A<D;A++){const L=U[A];o.dot(L)>t&&l.add(L)}l.normalize(),v.setXYZ(g+w,l.x,l.y,l.z)}}return h.setAttribute("normal",v),h}const t_=new Ll,n_=new j,Xc=new j,es=new j,sa=new j,xs=new j,aa=new j,oa=new j,Uh=new j,Oh=new j,Lh=new j,jp=new j,Ih=new j,Nh=new j,Ph=new j;class rw{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new j,this.endPoint=new j,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(t_,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Xc.copy(e),Xc.x=Math.min(e.x,t.x),Xc.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),es.setFromMatrixPosition(this.camera.matrixWorld),sa.copy(Xc),xs.set(t.x,Xc.y,0),aa.copy(t),oa.set(Xc.x,t.y,0),sa.unproject(this.camera),xs.unproject(this.camera),aa.unproject(this.camera),oa.unproject(this.camera),Ih.copy(sa).sub(es),Nh.copy(xs).sub(es),Ph.copy(aa).sub(es),Ih.normalize(),Nh.normalize(),Ph.normalize(),Ih.multiplyScalar(this.deep),Nh.multiplyScalar(this.deep),Ph.multiplyScalar(this.deep),Ih.add(es),Nh.add(es),Ph.add(es);var n=t_.planes;n[0].setFromCoplanarPoints(es,sa,xs),n[1].setFromCoplanarPoints(es,xs,aa),n[2].setFromCoplanarPoints(aa,oa,es),n[3].setFromCoplanarPoints(oa,sa,es),n[4].setFromCoplanarPoints(xs,aa,oa),n[5].setFromCoplanarPoints(Ph,Nh,Ih),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const r=Math.min(e.x,t.x),s=Math.max(e.y,t.y),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y);sa.set(r,s,-1),xs.set(a,s,-1),aa.set(a,o,-1),oa.set(r,o,-1),Uh.set(r,s,1),Oh.set(a,s,1),Lh.set(a,o,1),jp.set(r,o,1),sa.unproject(this.camera),xs.unproject(this.camera),aa.unproject(this.camera),oa.unproject(this.camera),Uh.unproject(this.camera),Oh.unproject(this.camera),Lh.unproject(this.camera),jp.unproject(this.camera);var n=t_.planes;n[0].setFromCoplanarPoints(sa,Uh,Oh),n[1].setFromCoplanarPoints(xs,Oh,Lh),n[2].setFromCoplanarPoints(Lh,jp,oa),n[3].setFromCoplanarPoints(jp,Uh,sa),n[4].setFromCoplanarPoints(xs,aa,oa),n[5].setFromCoplanarPoints(Lh,Oh,Uh),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),n_.copy(t.geometry.boundingSphere.center),n_.applyMatrix4(t.matrixWorld),e.containsPoint(n_)&&this.collection.push(t)),t.children.length>0)for(let n=0;n<t.children.length;n++)this.searchChildInFrustum(e,t.children[n])}}var zh={},i_,sw;function Ta(){return sw||(sw=1,i_=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"}),i_}var aw;function Yk(){if(aw)return zh;aw=1;var i=Ta();function e(s,a,o,l){var c=a+"Centrality";if(!i(o))throw new Error("graphology-centrality/"+c+": the given graph is not a valid graphology instance.");if(a!=="degree"&&o.type==="undirected")throw new Error("graphology-centrality/"+c+": cannot compute "+a+" centrality on an undirected graph.");l=l||{};var h=l.nodeCentralityAttribute||c,d=o.order-1,p=o[a].bind(o);if(s){o.updateEachNodeAttributes(function(v,x){return x[h]=p(v)/d,x},{attributes:[h]});return}var m={};return o.forEachNode(function(v){m[v]=p(v)/d}),m}var t=e.bind(null,!1,"degree"),n=e.bind(null,!1,"inDegree"),r=e.bind(null,!1,"outDegree");return t.assign=e.bind(null,!0,"degree"),n.assign=e.bind(null,!0,"inDegree"),r.assign=e.bind(null,!0,"outDegree"),zh.degreeCentrality=t,zh.inDegreeCentrality=n,zh.outDegreeCentrality=r,zh}var Zk=Yk();function cm(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function Kk(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function QC(i){let e,t,n;i.length!==2?(e=cm,t=(o,l)=>cm(i(o),l),n=(o,l)=>i(o)-l):(e=i===cm||i===Kk?i:Jk,t=i,n=i);function r(o,l,c=0,h=o.length){if(c<h){if(e(l,l)!==0)return h;do{const d=c+h>>>1;t(o[d],l)<0?c=d+1:h=d}while(c<h)}return c}function s(o,l,c=0,h=o.length){if(c<h){if(e(l,l)!==0)return h;do{const d=c+h>>>1;t(o[d],l)<=0?c=d+1:h=d}while(c<h)}return c}function a(o,l,c=0,h=o.length){const d=r(o,l,c,h-1);return d>c&&n(o[d-1],l)>-n(o[d],l)?d-1:d}return{left:r,center:a,right:s}}function Jk(){return 0}function Qk(i){return i===null?NaN:+i}const $k=QC(cm),eG=$k.right;QC(Qk).center;const tG=Math.sqrt(50),nG=Math.sqrt(10),iG=Math.sqrt(2);function ug(i,e,t){const n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),a=s>=tG?10:s>=nG?5:s>=iG?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/a,o=Math.round(i*c),l=Math.round(e*c),o/c<i&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,o=Math.round(i/c),l=Math.round(e/c),o*c<i&&++o,l*c>e&&--l),l<o&&.5<=t&&t<2?ug(i,e,t*2):[o,l,c]}function rG(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];const n=e<i,[r,s,a]=n?ug(e,i,t):ug(i,e,t);if(!(s>=r))return[];const o=s-r+1,l=new Array(o);if(n)if(a<0)for(let c=0;c<o;++c)l[c]=(s-c)/-a;else for(let c=0;c<o;++c)l[c]=(s-c)*a;else if(a<0)for(let c=0;c<o;++c)l[c]=(r+c)/-a;else for(let c=0;c<o;++c)l[c]=(r+c)*a;return l}function hx(i,e,t){return e=+e,i=+i,t=+t,ug(i,e,t)[2]}function sG(i,e,t){e=+e,i=+i,t=+t;const n=e<i,r=n?hx(e,i,t):hx(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function aG(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function L1(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function $C(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function sd(){}var Ff=.7,hg=1/Ff,su="\\s*([+-]?\\d+)\\s*",Bf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oG=/^#([0-9a-f]{3,8})$/,lG=new RegExp(`^rgb\\(${su},${su},${su}\\)$`),cG=new RegExp(`^rgb\\(${Cs},${Cs},${Cs}\\)$`),uG=new RegExp(`^rgba\\(${su},${su},${su},${Bf}\\)$`),hG=new RegExp(`^rgba\\(${Cs},${Cs},${Cs},${Bf}\\)$`),fG=new RegExp(`^hsl\\(${Bf},${Cs},${Cs}\\)$`),dG=new RegExp(`^hsla\\(${Bf},${Cs},${Cs},${Bf}\\)$`),ow={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};L1(sd,kf,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:lw,formatHex:lw,formatHex8:pG,formatHsl:mG,formatRgb:cw,toString:cw});function lw(){return this.rgb().formatHex()}function pG(){return this.rgb().formatHex8()}function mG(){return eR(this).formatHsl()}function cw(){return this.rgb().formatRgb()}function kf(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=oG.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?uw(e):t===3?new $i(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?qp(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?qp(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=lG.exec(i))?new $i(e[1],e[2],e[3],1):(e=cG.exec(i))?new $i(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=uG.exec(i))?qp(e[1],e[2],e[3],e[4]):(e=hG.exec(i))?qp(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=fG.exec(i))?dw(e[1],e[2]/100,e[3]/100,1):(e=dG.exec(i))?dw(e[1],e[2]/100,e[3]/100,e[4]):ow.hasOwnProperty(i)?uw(ow[i]):i==="transparent"?new $i(NaN,NaN,NaN,0):null}function uw(i){return new $i(i>>16&255,i>>8&255,i&255,1)}function qp(i,e,t,n){return n<=0&&(i=e=t=NaN),new $i(i,e,t,n)}function gG(i){return i instanceof sd||(i=kf(i)),i?(i=i.rgb(),new $i(i.r,i.g,i.b,i.opacity)):new $i}function fx(i,e,t,n){return arguments.length===1?gG(i):new $i(i,e,t,n??1)}function $i(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}L1($i,fx,$C(sd,{brighter(i){return i=i==null?hg:Math.pow(hg,i),new $i(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Ff:Math.pow(Ff,i),new $i(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new $i(Sl(this.r),Sl(this.g),Sl(this.b),fg(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:hw,formatHex:hw,formatHex8:vG,formatRgb:fw,toString:fw}));function hw(){return`#${yl(this.r)}${yl(this.g)}${yl(this.b)}`}function vG(){return`#${yl(this.r)}${yl(this.g)}${yl(this.b)}${yl((isNaN(this.opacity)?1:this.opacity)*255)}`}function fw(){const i=fg(this.opacity);return`${i===1?"rgb(":"rgba("}${Sl(this.r)}, ${Sl(this.g)}, ${Sl(this.b)}${i===1?")":`, ${i})`}`}function fg(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function Sl(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function yl(i){return i=Sl(i),(i<16?"0":"")+i.toString(16)}function dw(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new as(i,e,t,n)}function eR(i){if(i instanceof as)return new as(i.h,i.s,i.l,i.opacity);if(i instanceof sd||(i=kf(i)),!i)return new as;if(i instanceof as)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),a=NaN,o=s-r,l=(s+r)/2;return o?(e===s?a=(t-n)/o+(t<n)*6:t===s?a=(n-e)/o+2:a=(e-t)/o+4,o/=l<.5?s+r:2-s-r,a*=60):o=l>0&&l<1?0:a,new as(a,o,l,i.opacity)}function yG(i,e,t,n){return arguments.length===1?eR(i):new as(i,e,t,n??1)}function as(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}L1(as,yG,$C(sd,{brighter(i){return i=i==null?hg:Math.pow(hg,i),new as(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Ff:Math.pow(Ff,i),new as(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new $i(r_(i>=240?i-240:i+120,r,n),r_(i,r,n),r_(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new as(pw(this.h),Yp(this.s),Yp(this.l),fg(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 i=fg(this.opacity);return`${i===1?"hsl(":"hsla("}${pw(this.h)}, ${Yp(this.s)*100}%, ${Yp(this.l)*100}%${i===1?")":`, ${i})`}`}}));function pw(i){return i=(i||0)%360,i<0?i+360:i}function Yp(i){return Math.max(0,Math.min(1,i||0))}function r_(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}const I1=i=>()=>i;function _G(i,e){return function(t){return i+t*e}}function xG(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function bG(i){return(i=+i)==1?tR:function(e,t){return t-e?xG(e,t,i):I1(isNaN(e)?t:e)}}function tR(i,e){var t=e-i;return t?_G(i,t):I1(isNaN(i)?e:i)}const mw=(function i(e){var t=bG(e);function n(r,s){var a=t((r=fx(r)).r,(s=fx(s)).r),o=t(r.g,s.g),l=t(r.b,s.b),c=tR(r.opacity,s.opacity);return function(h){return r.r=a(h),r.g=o(h),r.b=l(h),r.opacity=c(h),r+""}}return n.gamma=i,n})(1);function SG(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function EG(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function MG(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),a;for(a=0;a<n;++a)r[a]=N1(i[a],e[a]);for(;a<t;++a)s[a]=e[a];return function(o){for(a=0;a<n;++a)s[a]=r[a](o);return s}}function wG(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function dg(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function TG(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=N1(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var dx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,s_=new RegExp(dx.source,"g");function AG(i){return function(){return i}}function CG(i){return function(e){return i(e)+""}}function RG(i,e){var t=dx.lastIndex=s_.lastIndex=0,n,r,s,a=-1,o=[],l=[];for(i=i+"",e=e+"";(n=dx.exec(i))&&(r=s_.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),o[a]?o[a]+=s:o[++a]=s),(n=n[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:dg(n,r)})),t=s_.lastIndex;return t<e.length&&(s=e.slice(t),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?CG(l[0].x):AG(e):(e=l.length,function(c){for(var h=0,d;h<e;++h)o[(d=l[h]).i]=d.x(c);return o.join("")})}function N1(i,e){var t=typeof e,n;return e==null||t==="boolean"?I1(e):(t==="number"?dg:t==="string"?(n=kf(e))?(e=n,mw):RG:e instanceof kf?mw:e instanceof Date?wG:EG(e)?SG:Array.isArray(e)?MG:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?TG:dg)(i,e)}function DG(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function UG(i){return function(){return i}}function OG(i){return+i}var gw=[0,1];function nu(i){return i}function px(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:UG(isNaN(e)?NaN:.5)}function LG(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function IG(i,e,t){var n=i[0],r=i[1],s=e[0],a=e[1];return r<n?(n=px(r,n),s=t(a,s)):(n=px(n,r),s=t(s,a)),function(o){return s(n(o))}}function NG(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),a=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++a<n;)r[a]=px(i[a],i[a+1]),s[a]=t(e[a],e[a+1]);return function(o){var l=eG(i,o,1,n)-1;return s[l](r[l](o))}}function PG(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function zG(){var i=gw,e=gw,t=N1,n,r,s,a=nu,o,l,c;function h(){var p=Math.min(i.length,e.length);return a!==nu&&(a=LG(i[0],i[p-1])),o=p>2?NG:IG,l=c=null,d}function d(p){return p==null||isNaN(p=+p)?s:(l||(l=o(i.map(n),e,t)))(n(a(p)))}return d.invert=function(p){return a(r((c||(c=o(e,i.map(n),dg)))(p)))},d.domain=function(p){return arguments.length?(i=Array.from(p,OG),h()):i.slice()},d.range=function(p){return arguments.length?(e=Array.from(p),h()):e.slice()},d.rangeRound=function(p){return e=Array.from(p),t=DG,h()},d.clamp=function(p){return arguments.length?(a=p?!0:nu,h()):a!==nu},d.interpolate=function(p){return arguments.length?(t=p,h()):t},d.unknown=function(p){return arguments.length?(s=p,d):s},function(p,m){return n=p,r=m,h()}}function FG(){return zG()(nu,nu)}function BG(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function pg(i,e){if((t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"))<0)return null;var t,n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function yu(i){return i=pg(Math.abs(i)),i?i[1]:NaN}function kG(i,e){return function(t,n){for(var r=t.length,s=[],a=0,o=i[0],l=0;r>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(r-=o,r+o)),!((l+=o+1)>n));)o=i[a=(a+1)%i.length];return s.reverse().join(e)}}function GG(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var HG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mg(i){if(!(e=HG.exec(i)))throw new Error("invalid format: "+i);var e;return new P1({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}mg.prototype=P1.prototype;function P1(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}P1.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 VG(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var nR;function WG(i,e){var t=pg(i,e);if(!t)return i+"";var n=t[0],r=t[1],s=r-(nR=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+pg(i,Math.max(0,e+s-1))[0]}function vw(i,e){var t=pg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}const yw={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:BG,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>vw(i*100,e),r:vw,s:WG,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function _w(i){return i}var xw=Array.prototype.map,bw=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function XG(i){var e=i.grouping===void 0||i.thousands===void 0?_w:kG(xw.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?_w:GG(xw.call(i.numerals,String)),a=i.percent===void 0?"%":i.percent+"",o=i.minus===void 0?"−":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(d){d=mg(d);var p=d.fill,m=d.align,v=d.sign,x=d.symbol,_=d.zero,g=d.width,b=d.comma,E=d.precision,S=d.trim,w=d.type;w==="n"?(b=!0,w="g"):yw[w]||(E===void 0&&(E=12),S=!0,w="g"),(_||p==="0"&&m==="=")&&(_=!0,p="0",m="=");var T=x==="$"?t:x==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",R=x==="$"?n:/[%p]/.test(w)?a:"",U=yw[w],A=/[defgprs%]/.test(w);E=E===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function D(L){var P=T,I=R,V,H,z;if(w==="c")I=U(L)+I,L="";else{L=+L;var O=L<0||1/L<0;if(L=isNaN(L)?l:U(Math.abs(L),E),S&&(L=VG(L)),O&&+L==0&&v!=="+"&&(O=!1),P=(O?v==="("?v:o:v==="-"||v==="("?"":v)+P,I=(w==="s"?bw[8+nR/3]:"")+I+(O&&v==="("?")":""),A){for(V=-1,H=L.length;++V<H;)if(z=L.charCodeAt(V),48>z||z>57){I=(z===46?r+L.slice(V+1):L.slice(V))+I,L=L.slice(0,V);break}}}b&&!_&&(L=e(L,1/0));var B=P.length+L.length+I.length,G=B<g?new Array(g-B+1).join(p):"";switch(b&&_&&(L=e(G+L,G.length?g-I.length:1/0),G=""),m){case"<":L=P+L+I+G;break;case"=":L=P+G+L+I;break;case"^":L=G.slice(0,B=G.length>>1)+P+L+I+G.slice(B);break;default:L=G+P+L+I;break}return s(L)}return D.toString=function(){return d+""},D}function h(d,p){var m=c((d=mg(d),d.type="f",d)),v=Math.max(-8,Math.min(8,Math.floor(yu(p)/3)))*3,x=Math.pow(10,-v),_=bw[8+v/3];return function(g){return m(x*g)+_}}return{format:c,formatPrefix:h}}var Zp,iR,rR;jG({thousands:",",grouping:[3],currency:["$",""]});function jG(i){return Zp=XG(i),iR=Zp.format,rR=Zp.formatPrefix,Zp}function qG(i){return Math.max(0,-yu(Math.abs(i)))}function YG(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(yu(e)/3)))*3-yu(Math.abs(i)))}function ZG(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,yu(e)-yu(i))+1}function KG(i,e,t,n){var r=sG(i,e,t),s;switch(n=mg(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=YG(r,a))&&(n.precision=s),rR(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=ZG(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=qG(r))&&(n.precision=s-(n.type==="%")*2);break}}return iR(n)}function JG(i){var e=i.domain;return i.ticks=function(t){var n=e();return rG(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return KG(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,a=n[r],o=n[s],l,c,h=10;for(o<a&&(c=a,a=o,o=c,c=r,r=s,s=c);h-- >0;){if(c=hx(a,o,t),c===l)return n[r]=a,n[s]=o,e(n);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return i},i}function sR(){var i=FG();return i.copy=function(){return PG(i,sR())},aG.apply(i,arguments),JG(i)}var a_,Sw;function z1(){if(Sw)return a_;Sw=1;function i(t){return!t||typeof t!="object"||typeof t=="function"||Array.isArray(t)||t instanceof Set||t instanceof Map||t instanceof RegExp||t instanceof Date}function e(t,n){t=t||{};var r={};for(var s in n){var a=t[s],o=n[s];if(!i(o)){r[s]=e(a,o);continue}a===void 0?r[s]=o:r[s]=a}return r}return a_=e,a_}var Kp={},o_={},Ew;function aR(){return Ew||(Ew=1,(function(i){var e=Math.pow(2,8)-1,t=Math.pow(2,16)-1,n=Math.pow(2,32)-1,r=Math.pow(2,7)-1,s=Math.pow(2,15)-1,a=Math.pow(2,31)-1;i.getPointerArray=function(l){var c=l-1;if(c<=e)return Uint8Array;if(c<=t)return Uint16Array;if(c<=n)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},i.getSignedPointerArray=function(l){var c=l-1;return c<=r?Int8Array:c<=s?Int16Array:c<=a?Int32Array:Float64Array},i.getNumberType=function(l){return l===(l|0)?Math.sign(l)===-1?l<=127&&l>=-128?Int8Array:l<=32767&&l>=-32768?Int16Array:Int32Array:l<=255?Uint8Array:l<=65535?Uint16Array:Uint32Array:Float64Array};var o={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};i.getMinimalRepresentation=function(l,c){var h=null,d=0,p,m,v,x,_;for(x=0,_=l.length;x<_;x++)v=c?c(l[x]):l[x],m=i.getNumberType(v),p=o[m.name],p>d&&(d=p,h=m);return h},i.isTypedArray=function(l){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(l)},i.concat=function(){var l=0,c,h,d;for(c=0,d=arguments.length;c<d;c++)l+=arguments[c].length;var p=new arguments[0].constructor(l);for(c=0,h=0;c<d;c++)p.set(arguments[c],h),h+=arguments[c].length;return p},i.indices=function(l){for(var c=i.getPointerArray(l),h=new c(l),d=0;d<l;d++)h[d]=d;return h}})(o_)),o_}var Fh={},Mw;function d0(){if(Mw)return Fh;Mw=1;function i(n){return typeof n!="number"||isNaN(n)?1:n}function e(n,r){var s={},a=function(c){return typeof c>"u"?r:c};typeof r=="function"&&(a=r);var o=function(c){return a(c[n])},l=function(){return a(void 0)};return typeof n=="string"?(s.fromAttributes=o,s.fromGraph=function(c,h){return o(c.getNodeAttributes(h))},s.fromEntry=function(c,h){return o(h)}):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},s.fromGraph=function(c,h){return a(n(h,c.getNodeAttributes(h)))},s.fromEntry=function(c,h){return a(n(c,h))}):(s.fromAttributes=l,s.fromGraph=l,s.fromEntry=l),s}function t(n,r){var s={},a=function(c){return typeof c>"u"?r:c};typeof r=="function"&&(a=r);var o=function(c){return a(c[n])},l=function(){return a(void 0)};return typeof n=="string"?(s.fromAttributes=o,s.fromGraph=function(c,h){return o(c.getEdgeAttributes(h))},s.fromEntry=function(c,h){return o(h)},s.fromPartialEntry=s.fromEntry,s.fromMinimalEntry=s.fromEntry):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},s.fromGraph=function(c,h){var d=c.extremities(h);return a(n(h,c.getEdgeAttributes(h),d[0],d[1],c.getNodeAttributes(d[0]),c.getNodeAttributes(d[1]),c.isUndirected(h)))},s.fromEntry=function(c,h,d,p,m,v,x){return a(n(c,h,d,p,m,v,x))},s.fromPartialEntry=function(c,h,d,p){return a(n(c,h,d,p))},s.fromMinimalEntry=function(c,h){return a(n(c,h))}):(s.fromAttributes=l,s.fromGraph=l,s.fromEntry=l,s.fromMinimalEntry=l),s}return Fh.createNodeValueGetter=e,Fh.createEdgeValueGetter=t,Fh.createEdgeWeightGetter=function(n){return t(n,i)},Fh}var ww;function QG(){if(ww)return Kp;ww=1;var i=aR(),e=d0().createEdgeWeightGetter;function t(s,a){return s==="outbound"||s==="inbound"?a.directedSize+a.undirectedSize*2:s==="in"||s==="out"||s==="directed"?a.directedSize:a.undirectedSize*2}function n(s,a){a=a||"outbound";var o=s[a+"Neighbors"].bind(s),l=t(a,s),c=i.getPointerArray(l),h=i.getPointerArray(s.order);this.graph=s,this.neighborhood=new h(l),this.starts=new c(s.order+1),this.nodes=s.nodes();var d={},p,m,v,x,_,g,b=0;for(p=0,m=s.order;p<m;p++)d[this.nodes[p]]=p;for(p=0,m=s.order;p<m;p++)for(_=this.nodes[p],g=o(_),this.starts[p]=b,v=0,x=g.length;v<x;v++)this.neighborhood[b++]=d[g[v]];this.starts[p]=l}n.prototype.bounds=function(s){return[this.starts[s],this.starts[s+1]]},n.prototype.project=function(){var s=this,a={};return s.nodes.forEach(function(o,l){a[o]=Array.from(s.neighborhood.slice(s.starts[l],s.starts[l+1])).map(function(c){return s.nodes[c]})}),a},n.prototype.collect=function(s){var a,o,l={};for(a=0,o=s.length;a<o;a++)l[this.nodes[a]]=s[a];return l},n.prototype.assign=function(s,a){var o=0;this.graph.updateEachNodeAttributes(function(l,c){return c[s]=a[o++],c},{attributes:[s]})},Kp.NeighborhoodIndex=n;function r(s,a,o){o=o||"outbound";var l=s[o+"Edges"].bind(s),c=t(o,s),h=i.getPointerArray(c),d=i.getPointerArray(s.order),p=e(a).fromMinimalEntry;this.graph=s,this.neighborhood=new d(c),this.weights=new Float64Array(c),this.outDegrees=new Float64Array(s.order),this.starts=new h(s.order+1),this.nodes=s.nodes();var m={},v,x,_,g,b,E,S,w,T,R=0;for(v=0,x=s.order;v<x;v++)m[this.nodes[v]]=v;for(v=0,x=s.order;v<x;v++)for(b=this.nodes[v],S=l(b),this.starts[v]=R,_=0,g=S.length;_<g;_++)w=S[_],E=s.opposite(b,w),T=p(w,s.getEdgeAttributes(w)),this.neighborhood[R]=m[E],this.weights[R++]=T,this.outDegrees[v]+=T;this.starts[v]=c}return r.prototype.bounds=n.prototype.bounds,r.prototype.project=n.prototype.project,r.prototype.collect=n.prototype.collect,r.prototype.assign=n.prototype.assign,Kp.WeightedNeighborhoodIndex=r,Kp}var l_,Tw;function $G(){if(Tw)return l_;Tw=1;var i=Ta(),e=z1(),t=QG().WeightedNeighborhoodIndex,n={nodePagerankAttribute:"pagerank",getEdgeWeight:"weight",alpha:.85,maxIterations:100,tolerance:1e-6};function r(a,o,l){if(!i(o))throw new Error("graphology-metrics/centrality/pagerank: the given graph is not a valid graphology instance.");l=e(l,n);var c=l.alpha,h=l.maxIterations,d=l.tolerance,p=l.nodePagerankAttribute,m=o.order,v=1/m,x=new t(o,l.getEdgeWeight),_,g,b,E,S=new Float64Array(o.order),w=new Float64Array(x.weights.length),T=[];for(_=0;_<m;_++)for(S[_]=v,b=x.starts[_+1],E=x.outDegrees[_],E===0&&T.push(_),g=x.starts[_];g<b;g++)w[g]=x.weights[g]/E;for(var R=0,U=0,A,D,L,P=!1;R<h;){for(L=S,S=new Float64Array(o.order),A=0,_=0,b=T.length;_<b;_++)A+=L[T[_]];for(A*=c,_=0;_<m;_++){for(b=x.starts[_+1],g=x.starts[_];g<b;g++)D=x.neighborhood[g],S[D]+=c*L[_]*w[g];S[_]+=A*v+(1-c)*v}for(U=0,_=0;_<m;_++)U+=Math.abs(S[_]-L[_]);if(U<m*d){P=!0;break}R++}if(!P)throw Error("graphology-metrics/centrality/pagerank: failed to converge.");if(a){x.assign(p,S);return}return x.collect(S)}var s=r.bind(null,!1);return s.assign=r.bind(null,!0),l_=s,l_}var eH=$G();const tH=po(eH);var ts={},ll={},c_,Aw;function nH(){if(Aw)return c_;Aw=1;function i(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=function(){return this}),i.of=function(){var e=arguments,t=e.length,n=0;return new i(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},i.empty=function(){var e=new i(function(){return{done:!0}});return e},i.fromSequence=function(e){var t=0,n=e.length;return new i(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},i.is=function(e){return e instanceof i?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},c_=i,c_}var Jp={},Cw;function iH(){return Cw||(Cw=1,Jp.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Jp.SYMBOL_SUPPORT=typeof Symbol<"u"),Jp}var u_,Rw;function F1(){if(Rw)return u_;Rw=1;var i=iH(),e=i.ARRAY_BUFFER_SUPPORT,t=i.SYMBOL_SUPPORT;return u_=function(r,s){var a,o,l,c,h;if(!r)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(r)||e&&ArrayBuffer.isView(r)||typeof r=="string"||r.toString()==="[object Arguments]"){for(l=0,c=r.length;l<c;l++)s(r[l],l);return}if(typeof r.forEach=="function"){r.forEach(s);return}if(t&&Symbol.iterator in r&&typeof r.next!="function"&&(r=r[Symbol.iterator]()),typeof r.next=="function"){for(a=r,l=0;h=a.next(),h.done!==!0;)s(h.value,l),l++;return}for(o in r)r.hasOwnProperty(o)&&s(r[o],o)},u_}var h_,Dw;function rH(){if(Dw)return h_;Dw=1;var i=nH(),e=F1();function t(){this.clear()}return t.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},t.prototype.enqueue=function(n){return this.items.push(n),++this.size},t.prototype.dequeue=function(){if(this.size){var n=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}},t.prototype.peek=function(){if(this.size)return this.items[this.offset]},t.prototype.forEach=function(n,r){r=arguments.length>1?r:this;for(var s=this.offset,a=0,o=this.items.length;s<o;s++,a++)n.call(r,this.items[s],a,this)},t.prototype.toArray=function(){return this.items.slice(this.offset)},t.prototype.values=function(){var n=this.items,r=this.offset;return new i(function(){if(r>=n.length)return{done:!0};var s=n[r];return r++,{value:s,done:!1}})},t.prototype.entries=function(){var n=this.items,r=this.offset,s=0;return new i(function(){if(r>=n.length)return{done:!0};var a=n[r];return r++,{value:[s++,a],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.toString=function(){return this.toArray().join(",")},t.prototype.toJSON=function(){return this.toArray()},t.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(n){var r=new t;return e(n,function(s){r.enqueue(s)}),r},t.of=function(){return t.from(arguments)},h_=t,h_}var f_,Uw;function sH(){return Uw||(Uw=1,f_=function(e,t){var n=t.length;if(n!==0){var r=e.length;e.length+=n;for(var s=0;s<n;s++)e[r+s]=t[s]}}),f_}var Ow;function aH(){if(Ow)return ll;Ow=1;var i=Ta(),e=rH(),t=sH();function n(c,h,d){if(!i(c))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<3)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 3.");if(!c.hasNode(h))throw new Error('graphology-shortest-path: the "'+h+'" source node does not exist in the given graph.');if(!c.hasNode(d))throw new Error('graphology-shortest-path: the "'+d+'" target node does not exist in the given graph.');if(h=""+h,d=""+d,h===d)return[h];var p=c.inboundNeighbors.bind(c),m=c.outboundNeighbors.bind(c),v={},x={};v[h]=null,x[d]=null;var _=[h],g=[d],b,E,S,w,T,R,U,A,D=!1;e:for(;_.length&&g.length;)if(_.length<=g.length){for(b=_,_=[],T=0,U=b.length;T<U;T++)for(E=b[T],S=m(E),R=0,A=S.length;R<A;R++)if(w=S[R],w in v||(_.push(w),v[w]=E),w in x){D=!0;break e}}else for(b=g,g=[],T=0,U=b.length;T<U;T++)for(E=b[T],S=p(E),R=0,A=S.length;R<A;R++)if(w=S[R],w in x||(g.push(w),x[w]=E),w in v){D=!0;break e}if(!D)return null;for(var L=[];w;)L.unshift(w),w=v[w];for(w=x[L[L.length-1]];w;)L.push(w),w=x[w];return L.length?L:null}function r(c,h){if(!i(c))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<2)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 2.");if(!c.hasNode(h))throw new Error('graphology-shortest-path: the "'+h+'" source node does not exist in the given graph.');h=""+h;var d={},p={},m,v,x,_,g,b;for(d[h]=!0,p[h]=[h];Object.keys(d).length;){m=d,d={};for(x in m)for(v=c.outboundNeighbors(x),g=0,b=v.length;g<b;g++)_=v[g],p[_]||(p[_]=p[x].concat(_),d[_]=!0)}return p}function s(c,h,d){if(!i(h))throw new Error("graphology-shortest-path: invalid graphology instance.");if(!h.hasNode(d))throw new Error('graphology-shortest-path: the "'+d+'" source node does not exist in the given graph.');d=""+d;var p=new Set,m={},v=0;m[d]=0;for(var x=[d],_,g,b;x.length!==0;){var E=[];for(_=0,g=x.length;_<g;_++)b=x[_],!p.has(b)&&(p.add(b),t(E,h[c](b)),m[b]=v);v++,x=E}return m}var a=s.bind(null,"outboundNeighbors"),o=s.bind(null,"neighbors");function l(c,h){h=""+h;var d=[],p={},m={},v=c.nodes(),x,_,g,b,E,S,w,T,R;for(S=0,T=v.length;S<T;S++)b=v[S],p[b]=[],m[b]=0;var U={};m[h]=1,U[h]=0;for(var A=e.of(h);A.size;)for(b=A.dequeue(),d.push(b),x=U[b],_=m[b],g=c.outboundNeighbors(b),w=0,R=g.length;w<R;w++)E=g[w],E in U||(A.enqueue(E),U[E]=x+1),U[E]===x+1&&(m[E]+=_,p[E].push(b));return[d,p,m]}return ll.bidirectional=n,ll.singleSource=r,ll.singleSourceLength=a,ll.undirectedSingleSourceLength=o,ll.brandes=l,ll}var d_={},Lw;function oH(){if(Lw)return d_;Lw=1;var i=function(){return!0};return d_.edgePathFromNodePath=function(e,t){var n=t.length,r,s,a,o;if(n<2)return s=t[0],o=e.multi?e.findEdge(s,s,i):e.edge(s,s),o?[o]:[];n--;var l=new Array(n);for(r=0;r<n;r++){if(s=t[r],a=t[r+1],o=e.multi?e.findOutboundEdge(s,a,i):e.edge(s,a),o===void 0)throw new Error("graphology-shortest-path: given path is impossible in given graph.");l[r]=o}return l},d_}var Bh={},jc={},Iw;function lH(){if(Iw)return jc;Iw=1;var i=function(r,s){return r<s?-1:r>s?1:0},e=function(r,s){return r<s?1:r>s?-1:0};function t(r){return function(s,a){return r(a,s)}}function n(r){return r===2?function(s,a){return s[0]<a[0]?-1:s[0]>a[0]?1:s[1]<a[1]?-1:s[1]>a[1]?1:0}:function(s,a){for(var o=0;o<r;){if(s[o]<a[o])return-1;if(s[o]>a[o])return 1;o++}return 0}}return jc.DEFAULT_COMPARATOR=i,jc.DEFAULT_REVERSE_COMPARATOR=e,jc.reverseComparator=t,jc.createTupleComparator=n,jc}var qc={},Nw;function cH(){if(Nw)return qc;Nw=1;var i=F1(),e=aR();function t(a){return Array.isArray(a)||e.isTypedArray(a)}function n(a){if(typeof a.length=="number")return a.length;if(typeof a.size=="number")return a.size}function r(a){var o=n(a),l=typeof o=="number"?new Array(o):[],c=0;return i(a,function(h){l[c++]=h}),l}function s(a){var o=n(a),l=typeof o=="number"?e.getPointerArray(o):Array,c=typeof o=="number"?new Array(o):[],h=typeof o=="number"?new l(o):[],d=0;return i(a,function(p){c[d]=p,h[d]=d++}),[c,h]}return qc.isArrayLike=t,qc.guessLength=n,qc.toArray=r,qc.toArrayWithIndices=s,qc}var p_,Pw;function oR(){if(Pw)return p_;Pw=1;var i=F1(),e=lH(),t=cH(),n=e.DEFAULT_COMPARATOR,r=e.reverseComparator;function s(g,b,E,S){for(var w=b[S],T,R;S>E;){if(T=S-1>>1,R=b[T],g(w,R)<0){b[S]=R,S=T;continue}break}b[S]=w}function a(g,b,E){for(var S=b.length,w=E,T=b[E],R=2*E+1,U;R<S;)U=R+1,U<S&&g(b[R],b[U])>=0&&(R=U),b[E]=b[R],E=R,R=2*E+1;b[E]=T,s(g,b,w,E)}function o(g,b,E){b.push(E),s(g,b,0,b.length-1)}function l(g,b){var E=b.pop();if(b.length!==0){var S=b[0];return b[0]=E,a(g,b,0),S}return E}function c(g,b,E){if(b.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var S=b[0];return b[0]=E,a(g,b,0),S}function h(g,b,E){var S;return b.length!==0&&g(b[0],E)<0&&(S=b[0],b[0]=E,E=S,a(g,b,0)),E}function d(g,b){for(var E=b.length,S=E>>1,w=S;--w>=0;)a(g,b,w)}function p(g,b){for(var E=b.length,S=0,w=new Array(E);S<E;)w[S++]=l(g,b);return w}function m(g,b,E){arguments.length===2&&(E=b,b=g,g=n);var S=r(g),w,T,R,U=1/0,A;if(b===1){if(t.isArrayLike(E)){for(w=0,T=E.length;w<T;w++)R=E[w],(U===1/0||g(R,U)<0)&&(U=R);return A=new E.constructor(1),A[0]=U,A}return i(E,function(L){(U===1/0||g(L,U)<0)&&(U=L)}),[U]}if(t.isArrayLike(E)){if(b>=E.length)return E.slice().sort(g);for(A=E.slice(0,b),d(S,A),w=b,T=E.length;w<T;w++)S(E[w],A[0])>0&&c(S,A,E[w]);return A.sort(g)}var D=t.guessLength(E);return D!==null&&D<b&&(b=D),A=new Array(b),w=0,i(E,function(L){w<b?A[w]=L:(w===b&&d(S,A),S(L,A[0])>0&&c(S,A,L)),w++}),A.length>w&&(A.length=w),A.sort(g)}function v(g,b,E){arguments.length===2&&(E=b,b=g,g=n);var S=r(g),w,T,R,U=-1/0,A;if(b===1){if(t.isArrayLike(E)){for(w=0,T=E.length;w<T;w++)R=E[w],(U===-1/0||g(R,U)>0)&&(U=R);return A=new E.constructor(1),A[0]=U,A}return i(E,function(L){(U===-1/0||g(L,U)>0)&&(U=L)}),[U]}if(t.isArrayLike(E)){if(b>=E.length)return E.slice().sort(S);for(A=E.slice(0,b),d(g,A),w=b,T=E.length;w<T;w++)g(E[w],A[0])>0&&c(g,A,E[w]);return A.sort(S)}var D=t.guessLength(E);return D!==null&&D<b&&(b=D),A=new Array(b),w=0,i(E,function(L){w<b?A[w]=L:(w===b&&d(g,A),g(L,A[0])>0&&c(g,A,L)),w++}),A.length>w&&(A.length=w),A.sort(S)}function x(g){if(this.clear(),this.comparator=g||n,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}x.prototype.clear=function(){this.items=[],this.size=0},x.prototype.push=function(g){return o(this.comparator,this.items,g),++this.size},x.prototype.peek=function(){return this.items[0]},x.prototype.pop=function(){return this.size!==0&&this.size--,l(this.comparator,this.items)},x.prototype.replace=function(g){return c(this.comparator,this.items,g)},x.prototype.pushpop=function(g){return h(this.comparator,this.items,g)},x.prototype.consume=function(){return this.size=0,p(this.comparator,this.items)},x.prototype.toArray=function(){return p(this.comparator,this.items.slice())},x.prototype.inspect=function(){var g=this.toArray();return Object.defineProperty(g,"constructor",{value:x,enumerable:!1}),g},typeof Symbol<"u"&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=x.prototype.inspect);function _(g){if(this.clear(),this.comparator=g||n,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=r(this.comparator)}return _.prototype=x.prototype,x.from=function(g,b){var E=new x(b),S;return t.isArrayLike(g)?S=g.slice():S=t.toArray(g),d(E.comparator,S),E.items=S,E.size=S.length,E},_.from=function(g,b){var E=new _(b),S;return t.isArrayLike(g)?S=g.slice():S=t.toArray(g),d(E.comparator,S),E.items=S,E.size=S.length,E},x.siftUp=a,x.siftDown=s,x.push=o,x.pop=l,x.replace=c,x.pushpop=h,x.heapify=d,x.consume=p,x.nsmallest=m,x.nlargest=v,x.MinHeap=x,x.MaxHeap=_,p_=x,p_}var zw;function uH(){if(zw)return Bh;zw=1;var i=Ta(),e=d0().createEdgeWeightGetter,t=oR(),n="weight";function r(d,p){return d[0]>p[0]?1:d[0]<p[0]?-1:d[1]>p[1]?1:d[1]<p[1]?-1:d[2]>p[2]?1:d[2]<p[2]?-1:0}function s(d,p){return d[0]>p[0]?1:d[0]<p[0]?-1:d[1]>p[1]?1:d[1]<p[1]?-1:d[2]>p[2]?1:d[2]<p[2]?-1:d[3]>p[3]?1:d[3]<p[3]?-1:0}function a(d,p,m,v){if(p=""+p,m=""+m,!i(d))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(p&&!d.hasNode(p))throw new Error('graphology-shortest-path/dijkstra: the "'+p+'" source node does not exist in the given graph.');if(m&&!d.hasNode(m))throw new Error('graphology-shortest-path/dijkstra: the "'+m+'" target node does not exist in the given graph.');if(v=e(v||n).fromMinimalEntry,p===m)return[0,[p]];var x=[{},{}],_=[{},{}],g=[new t(r),new t(r)],b=[{},{}];_[0][p]=[p],_[1][m]=[m],b[0][p]=0,b[1][m]=0;var E=[],S=1/0,w=0,T=1,R,U,A,D,L,P,I,V,H;for(g[0].push([0,w++,p]),g[1].push([0,w++,m]);g[0].size&&g[1].size;)if(T=1-T,R=g[T].pop(),D=R[0],L=R[2],!(L in x[T])){if(x[T][L]=D,L in x[1-T])return[S,E];for(U=T===1?d.inboundEdges(L):d.outboundEdges(L),V=0,H=U.length;V<H;V++){if(I=U[V],P=d.opposite(L,I),A=x[T][L]+v(I,d.getEdgeAttributes(I)),P in x[T]&&A<x[T][P])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(P in b[T])||A<b[T][P])&&(b[T][P]=A,g[T].push([A,w++,P]),_[T][P]=_[T][L].concat(P),P in b[0]&&P in b[1]&&(D=b[0][P]+b[1][P],(E.length===0||S>D)&&(S=D,E=_[0][P].concat(_[1][P].slice(0,-1).reverse()))))}}return[1/0,null]}function o(d,p,m,v,x,_){if(!i(d))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");m=e(m||n).fromMinimalEntry;var g={},b={},E=new t(r),S=0,w,T,R,U,A,D,L,P,I,V,H;for(P=0,V=p.length;P<V;P++)U=p[P],b[U]=0,E.push([0,S++,U]),_&&(_[U]=[U]);for(;E.size;)if(T=E.pop(),L=T[0],U=T[2],!(U in g)){if(g[U]=L,U===x)break;for(w=d.outboundEdges(U),I=0,H=w.length;I<H;I++){if(D=w[I],A=d.opposite(U,D),R=m(D,d.getEdgeAttributes(D))+g[U],A in g&&R<g[A])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(A in b)||R<b[A])&&(b[A]=R,E.push([R,S++,A]),_&&(_[A]=_[U].concat(A)))}}return g}function l(d,p,m){var v={};return o(d,[p],m,0,null,v),v}function c(d,p,m,v){return a(d,p,m,v)[1]}function h(d,p,m){p=""+p,m=e(m||n).fromMinimalEntry;var v=[],x={},_={},g=d.nodes(),b,E,S,w,T,R,U,A,D,L;for(D=0,L=g.length;D<L;D++)R=g[D],x[R]=[],_[R]=0;var P={};_[p]=1;var I={};I[p]=0;var V=0,H=new t(s);for(H.push([0,V++,p,p]);H.size;)if(E=H.pop(),w=E[0],S=E[2],R=E[3],!(R in P))for(_[R]+=_[S],v.push(R),P[R]=w,b=d.outboundEdges(R),D=0,L=b.length;D<L;D++)A=b[D],U=d.opposite(R,A),T=w+m(A,d.getEdgeAttributes(A)),!(U in P)&&(!(U in I)||T<I[U])?(I[U]=T,H.push([T,V++,R,U]),_[U]=0,x[U]=[R]):T===I[U]&&(_[U]+=_[R],x[U].push(R));return[v,x,_]}return Bh.bidirectional=c,Bh.singleSource=l,Bh.brandes=h,Bh}var m_={},Fw;function hH(){if(Fw)return m_;Fw=1;var i=Ta(),e=d0().createEdgeWeightGetter,t=oR(),n="weight";function r(a,o){return a[0]>o[0]?1:a[0]<o[0]?-1:a[1]>o[1]?1:a[1]<o[1]?-1:0}function s(a,o,l,c,h,d){if(!i(a))throw new Error("graphology-shortest-path/astar: invalid graphology instance.");if(o&&!a.hasNode(o))throw new Error('graphology-shortest-path/astar: the "'+o+'" source node does not exist in the given graph.');if(l&&!a.hasNode(l))throw new Error('graphology-shortest-path/astar: the "'+l+'" target node does not exist in the given graph.');if(c=e(c||n).fromMinimalEntry,o===l)return[o];h=h||function(){return 0},d=d||{};var p=0,m=new t(r);m.push([0,p++,o,0,null]);var v={},x={},_,g,b,E,S,w,T,R,U,A,D,L;function P(I,V,H,z){if(L=g===H?z:H,A=c(I,V),A!==null){if(D=E+A,v.hasOwnProperty(L)){if(b=v[L],R=b[0],U=b[1],R<=D)return}else U=h(L,l);d.cutoff&&D+U>d.cutoff||(v[L]=[D,U],m.push([D+U,p++,L,D,g]))}}for(;m.size!==0;){if(_=m.pop(),g=_[2],E=_[3],S=_[4],g===l){for(w=[g],T=S;T!==null;)w.push(T),T=x[T];return w.reverse(),w}x.hasOwnProperty(g)&&(x[g]===null||(R=v[g][0],R<E))||(x[g]=S,a.forEachOutboundEdge(g,P))}return null}return m_.bidirectional=s,m_}var Bw;function fH(){if(Bw)return ts;Bw=1;var i=aH(),e=oH();return ts.unweighted=i,ts.dijkstra=uH(),ts.astar=hH(),ts.bidirectional=i.bidirectional,ts.singleSource=i.singleSource,ts.singleSourceLength=i.singleSourceLength,ts.undirectedSingleSourceLength=i.undirectedSingleSourceLength,ts.brandes=i.brandes,ts.edgePathFromNodePath=e.edgePathFromNodePath,ts}var dH=fH(),B1=od(),Ct=i=>ad(i,B1),k1=od();Ct.write=i=>ad(i,k1);var p0=od();Ct.onStart=i=>ad(i,p0);var G1=od();Ct.onFrame=i=>ad(i,G1);var H1=od();Ct.onFinish=i=>ad(i,H1);var au=[];Ct.setTimeout=(i,e)=>{const t=Ct.now()+e,n=()=>{const s=au.findIndex(a=>a.cancel==n);~s&&au.splice(s,1),ao-=~s?1:0},r={time:t,handler:i,cancel:n};return au.splice(lR(t),0,r),ao+=1,cR(),r};var lR=i=>~(~au.findIndex(e=>e.time>i)||~au.length);Ct.cancel=i=>{p0.delete(i),G1.delete(i),H1.delete(i),B1.delete(i),k1.delete(i)};Ct.sync=i=>{mx=!0,Ct.batchedUpdates(i),mx=!1};Ct.throttle=i=>{let e;function t(){try{i(...e)}finally{e=null}}function n(...r){e=r,Ct.onStart(t)}return n.handler=i,n.cancel=()=>{p0.delete(t),e=null},n};var V1=typeof window<"u"?window.requestAnimationFrame:(()=>{});Ct.use=i=>V1=i;Ct.now=typeof performance<"u"?()=>performance.now():Date.now;Ct.batchedUpdates=i=>i();Ct.catch=console.error;Ct.frameLoop="always";Ct.advance=()=>{Ct.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):hR()};var so=-1,ao=0,mx=!1;function ad(i,e){mx?(e.delete(i),i(0)):(e.add(i),cR())}function cR(){so<0&&(so=0,Ct.frameLoop!=="demand"&&V1(uR))}function pH(){so=-1}function uR(){~so&&(V1(uR),Ct.batchedUpdates(hR))}function hR(){const i=so;so=Ct.now();const e=lR(so);if(e&&(fR(au.splice(0,e),t=>t.handler()),ao-=e),!ao){pH();return}p0.flush(),B1.flush(i?Math.min(64,so-i):16.667),G1.flush(),k1.flush(),H1.flush()}function od(){let i=new Set,e=i;return{add(t){ao+=e==i&&!i.has(t)?1:0,i.add(t)},delete(t){return ao-=e==i&&i.has(t)?1:0,i.delete(t)},flush(t){e.size&&(i=new Set,ao-=e.size,fR(e,n=>n(t)&&i.add(n)),ao+=i.size,e=i)}}}function fR(i,e){i.forEach(t=>{try{e(t)}catch(n){Ct.catch(n)}})}var mH=Object.defineProperty,gH=(i,e)=>{for(var t in e)mH(i,t,{get:e[t],enumerable:!0})},cs={};gH(cs,{assign:()=>yH,colors:()=>lo,createStringInterpolator:()=>X1,skipAnimation:()=>pR,to:()=>dR,willAdvance:()=>j1});function gx(){}var vH=(i,e,t)=>Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0}),nt={arr:Array.isArray,obj:i=>!!i&&i.constructor.name==="Object",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",und:i=>i===void 0};function ca(i,e){if(nt.arr(i)){if(!nt.arr(e)||i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0}return i===e}var rn=(i,e)=>i.forEach(e);function Sa(i,e,t){if(nt.arr(i)){for(let n=0;n<i.length;n++)e.call(t,i[n],`${n}`);return}for(const n in i)i.hasOwnProperty(n)&&e.call(t,i[n],n)}var Br=i=>nt.und(i)?[]:nt.arr(i)?i:[i];function mf(i,e){if(i.size){const t=Array.from(i);i.clear(),rn(t,e)}}var Qh=(i,...e)=>mf(i,t=>t(...e)),W1=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),X1,dR,lo=null,pR=!1,j1=gx,yH=i=>{i.to&&(dR=i.to),i.now&&(Ct.now=i.now),i.colors!==void 0&&(lo=i.colors),i.skipAnimation!=null&&(pR=i.skipAnimation),i.createStringInterpolator&&(X1=i.createStringInterpolator),i.requestAnimationFrame&&Ct.use(i.requestAnimationFrame),i.batchedUpdates&&(Ct.batchedUpdates=i.batchedUpdates),i.willAdvance&&(j1=i.willAdvance),i.frameLoop&&(Ct.frameLoop=i.frameLoop)},gf=new Set,zr=[],g_=[],gg=0,m0={get idle(){return!gf.size&&!zr.length},start(i){gg>i.priority?(gf.add(i),Ct.onStart(_H)):(mR(i),Ct(vx))},advance:vx,sort(i){if(gg)Ct.onFrame(()=>m0.sort(i));else{const e=zr.indexOf(i);~e&&(zr.splice(e,1),gR(i))}},clear(){zr=[],gf.clear()}};function _H(){gf.forEach(mR),gf.clear(),Ct(vx)}function mR(i){zr.includes(i)||gR(i)}function gR(i){zr.splice(xH(zr,e=>e.priority>i.priority),0,i)}function vx(i){const e=g_;for(let t=0;t<zr.length;t++){const n=zr[t];gg=n.priority,n.idle||(j1(n),n.advance(i),n.idle||e.push(n))}return gg=0,g_=zr,g_.length=0,zr=e,zr.length>0}function xH(i,e){const t=i.findIndex(e);return t<0?i.length:t}var bH={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},ls="[-+]?\\d*\\.?\\d+",vg=ls+"%";function g0(...i){return"\\(\\s*("+i.join(")\\s*,\\s*(")+")\\s*\\)"}var SH=new RegExp("rgb"+g0(ls,ls,ls)),EH=new RegExp("rgba"+g0(ls,ls,ls,ls)),MH=new RegExp("hsl"+g0(ls,vg,vg)),wH=new RegExp("hsla"+g0(ls,vg,vg,ls)),TH=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,AH=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,CH=/^#([0-9a-fA-F]{6})$/,RH=/^#([0-9a-fA-F]{8})$/;function DH(i){let e;return typeof i=="number"?i>>>0===i&&i>=0&&i<=4294967295?i:null:(e=CH.exec(i))?parseInt(e[1]+"ff",16)>>>0:lo&&lo[i]!==void 0?lo[i]:(e=SH.exec(i))?(Yc(e[1])<<24|Yc(e[2])<<16|Yc(e[3])<<8|255)>>>0:(e=EH.exec(i))?(Yc(e[1])<<24|Yc(e[2])<<16|Yc(e[3])<<8|Hw(e[4]))>>>0:(e=TH.exec(i))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=RH.exec(i))?parseInt(e[1],16)>>>0:(e=AH.exec(i))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=MH.exec(i))?(kw(Gw(e[1]),Qp(e[2]),Qp(e[3]))|255)>>>0:(e=wH.exec(i))?(kw(Gw(e[1]),Qp(e[2]),Qp(e[3]))|Hw(e[4]))>>>0:null}function v_(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function kw(i,e,t){const n=t<.5?t*(1+e):t+e-t*e,r=2*t-n,s=v_(r,n,i+1/3),a=v_(r,n,i),o=v_(r,n,i-1/3);return Math.round(s*255)<<24|Math.round(a*255)<<16|Math.round(o*255)<<8}function Yc(i){const e=parseInt(i,10);return e<0?0:e>255?255:e}function Gw(i){return(parseFloat(i)%360+360)%360/360}function Hw(i){const e=parseFloat(i);return e<0?0:e>1?255:Math.round(e*255)}function Qp(i){const e=parseFloat(i);return e<0?0:e>100?1:e/100}function Vw(i){let e=DH(i);if(e===null)return i;e=e||0;const t=(e&4278190080)>>>24,n=(e&16711680)>>>16,r=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${n}, ${r}, ${s})`}var Gf=(i,e,t)=>{if(nt.fun(i))return i;if(nt.arr(i))return Gf({range:i,output:e,extrapolate:t});if(nt.str(i.output[0]))return X1(i);const n=i,r=n.output,s=n.range||[0,1],a=n.extrapolateLeft||n.extrapolate||"extend",o=n.extrapolateRight||n.extrapolate||"extend",l=n.easing||(c=>c);return c=>{const h=OH(c,s);return UH(c,s[h],s[h+1],r[h],r[h+1],l,a,o,n.map)}};function UH(i,e,t,n,r,s,a,o,l){let c=l?l(i):i;if(c<e){if(a==="identity")return c;a==="clamp"&&(c=e)}if(c>t){if(o==="identity")return c;o==="clamp"&&(c=t)}return n===r?n:e===t?i<=e?n:r:(e===-1/0?c=-c:t===1/0?c=c-e:c=(c-e)/(t-e),c=s(c),n===-1/0?c=-c:r===1/0?c=c+n:c=c*(r-n)+n,c)}function OH(i,e){for(var t=1;t<e.length-1&&!(e[t]>=i);++t);return t-1}var LH={linear:i=>i},Hf=Symbol.for("FluidValue.get"),_u=Symbol.for("FluidValue.observers"),Es=i=>!!(i&&i[Hf]),Ir=i=>i&&i[Hf]?i[Hf]():i,Ww=i=>i[_u]||null;function IH(i,e){i.eventObserved?i.eventObserved(e):i(e)}function yg(i,e){const t=i[_u];t&&t.forEach(n=>{IH(n,e)})}var NH=class{constructor(i){if(!i&&!(i=this.get))throw Error("Unknown getter");PH(this,i)}},PH=(i,e)=>vR(i,Hf,e);function ld(i,e){if(i[Hf]){let t=i[_u];t||vR(i,_u,t=new Set),t.has(e)||(t.add(e),i.observerAdded&&i.observerAdded(t.size,e))}return e}function _g(i,e){const t=i[_u];if(t&&t.has(e)){const n=t.size-1;n?t.delete(e):i[_u]=null,i.observerRemoved&&i.observerRemoved(n,e)}}var vR=(i,e,t)=>Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0}),um=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,zH=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,Xw=new RegExp(`(${um.source})(%|[a-z]+)`,"i"),FH=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,v0=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,yR=i=>{const[e,t]=BH(i);if(!e||W1())return i;const n=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(n)return n.trim();if(t&&t.startsWith("--")){const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r||i}else{if(t&&v0.test(t))return yR(t);if(t)return t}return i},BH=i=>{const e=v0.exec(i);if(!e)return[,];const[,t,n]=e;return[t,n]},y_,kH=(i,e,t,n,r)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${r})`,_R=i=>{y_||(y_=lo?new RegExp(`(${Object.keys(lo).join("|")})(?!\\w)`,"g"):/^\b$/);const e=i.output.map(s=>Ir(s).replace(v0,yR).replace(zH,Vw).replace(y_,Vw)),t=e.map(s=>s.match(um).map(Number)),r=t[0].map((s,a)=>t.map(o=>{if(!(a in o))throw Error('The arity of each "output" value must be equal');return o[a]})).map(s=>Gf({...i,output:s}));return s=>{const a=!Xw.test(e[0])&&e.find(l=>Xw.test(l))?.replace(um,"");let o=0;return e[0].replace(um,()=>`${r[o++](s)}${a||""}`).replace(FH,kH)}},q1="react-spring: ",xR=i=>{const e=i;let t=!1;if(typeof e!="function")throw new TypeError(`${q1}once requires a function parameter`);return(...n)=>{t||(e(...n),t=!0)}},GH=xR(console.warn);function HH(){GH(`${q1}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var VH=xR(console.warn);function WH(){VH(`${q1}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function y0(i){return nt.str(i)&&(i[0]=="#"||/\d/.test(i)||!W1()&&v0.test(i)||i in(lo||{}))}var Y1=W1()?K.useEffect:K.useLayoutEffect,XH=()=>{const i=K.useRef(!1);return Y1(()=>(i.current=!0,()=>{i.current=!1}),[]),i};function bR(){const i=K.useState()[1],e=XH();return()=>{e.current&&i(Math.random())}}var SR=i=>K.useEffect(i,jH),jH=[];function jw(i){const e=K.useRef(void 0);return K.useEffect(()=>{e.current=i}),e.current}var Vf=Symbol.for("Animated:node"),qH=i=>!!i&&i[Vf]===i,Ss=i=>i&&i[Vf],Z1=(i,e)=>vH(i,Vf,e),_0=i=>i&&i[Vf]&&i[Vf].getPayload(),ER=class{constructor(){Z1(this,this)}getPayload(){return this.payload||[]}},x0=class MR extends ER{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,nt.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new MR(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return nt.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,nt.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},xg=class wR extends x0{constructor(e){super(0),this._string=null,this._toString=Gf({output:[e,e]})}static create(e){return new wR(e)}getValue(){const e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(nt.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=Gf({output:[this.getValue(),e]})),this._value=0,super.reset()}},bg={dependencies:null},K1=class extends ER{constructor(i){super(),this.source=i,this.setValue(i)}getValue(i){const e={};return Sa(this.source,(t,n)=>{qH(t)?e[n]=t.getValue(i):Es(t)?e[n]=Ir(t):i||(e[n]=t)}),e}setValue(i){this.source=i,this.payload=this._makePayload(i)}reset(){this.payload&&rn(this.payload,i=>i.reset())}_makePayload(i){if(i){const e=new Set;return Sa(i,this._addToPayload,e),Array.from(e)}}_addToPayload(i){bg.dependencies&&Es(i)&&bg.dependencies.add(i);const e=_0(i);e&&rn(e,t=>this.add(t))}},YH=class TR extends K1{constructor(e){super(e)}static create(e){return new TR(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((n,r)=>n.setValue(e[r])).some(Boolean):(super.setValue(e.map(ZH)),!0)}};function ZH(i){return(y0(i)?xg:x0).create(i)}function yx(i){const e=Ss(i);return e?e.constructor:nt.arr(i)?YH:y0(i)?xg:x0}var qw=(i,e)=>{const t=!nt.fun(i)||i.prototype&&i.prototype.isReactComponent;return K.forwardRef((n,r)=>{const s=K.useRef(null),a=t&&K.useCallback(v=>{s.current=QH(r,v)},[r]),[o,l]=JH(n,e),c=bR(),h=()=>{const v=s.current;if(t&&!v)return;(v?e.applyAnimatedValues(v,o.getValue(!0)):!1)===!1&&c()},d=new KH(h,l),p=K.useRef(void 0);Y1(()=>(p.current=d,rn(l,v=>ld(v,d)),()=>{p.current&&(rn(p.current.deps,v=>_g(v,p.current)),Ct.cancel(p.current.update))})),K.useEffect(h,[]),SR(()=>()=>{const v=p.current;rn(v.deps,x=>_g(x,v))});const m=e.getComponentProps(o.getValue());return K.createElement(i,{...m,ref:a})})},KH=class{constructor(i,e){this.update=i,this.deps=e}eventObserved(i){i.type=="change"&&Ct.write(this.update)}};function JH(i,e){const t=new Set;return bg.dependencies=t,i.style&&(i={...i,style:e.createAnimatedStyle(i.style)}),i=new K1(i),bg.dependencies=null,[i,t]}function QH(i,e){return i&&(nt.fun(i)?i(e):i.current=e),e}var Yw=Symbol.for("AnimatedComponent"),$H=(i,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=r=>new K1(r),getComponentProps:n=r=>r}={})=>{const r={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:n},s=a=>{const o=Zw(a)||"Anonymous";return nt.str(a)?a=s[a]||(s[a]=qw(a,r)):a=a[Yw]||(a[Yw]=qw(a,r)),a.displayName=`Animated(${o})`,a};return Sa(i,(a,o)=>{nt.arr(i)&&(o=Zw(a)),s[o]=s(a)}),{animated:s}},Zw=i=>nt.str(i)?i:i&&nt.str(i.displayName)?i.displayName:nt.fun(i)&&i.name||null;function pl(i,...e){return nt.fun(i)?i(...e):i}var vf=(i,e)=>i===!0||!!(e&&i&&(nt.fun(i)?i(e):Br(i).includes(e))),AR=(i,e)=>nt.obj(i)?e&&i[e]:i,CR=(i,e)=>i.default===!0?i[e]:i.default?i.default[e]:void 0,eV=i=>i,J1=(i,e=eV)=>{let t=tV;i.default&&i.default!==!0&&(i=i.default,t=Object.keys(i));const n={};for(const r of t){const s=e(i[r],r);nt.und(s)||(n[r]=s)}return n},tV=["config","onProps","onStart","onChange","onPause","onResume","onRest"],nV={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function iV(i){const e={};let t=0;if(Sa(i,(n,r)=>{nV[r]||(e[r]=n,t++)}),t)return e}function RR(i){const e=iV(i);if(e){const t={to:e};return Sa(i,(n,r)=>r in e||(t[r]=n)),t}return{...i}}function Wf(i){return i=Ir(i),nt.arr(i)?i.map(Wf):y0(i)?cs.createStringInterpolator({range:[0,1],output:[i,i]})(1):i}function rV(i){for(const e in i)return!0;return!1}function _x(i){return nt.fun(i)||nt.arr(i)&&nt.obj(i[0])}function sV(i,e){i.ref?.delete(i),e?.delete(i)}function aV(i,e){e&&i.ref!==e&&(i.ref?.delete(i),e.add(i),i.ref=e)}var oV={default:{tension:170,friction:26}},xx={...oV.default,mass:1,damping:1,easing:LH.linear,clamp:!1},lV=class{constructor(){this.velocity=0,Object.assign(this,xx)}};function cV(i,e,t){t&&(t={...t},Kw(t,e),e={...t,...e}),Kw(i,e),Object.assign(i,e);for(const a in xx)i[a]==null&&(i[a]=xx[a]);let{frequency:n,damping:r}=i;const{mass:s}=i;return nt.und(n)||(n<.01&&(n=.01),r<0&&(r=0),i.tension=Math.pow(2*Math.PI/n,2)*s,i.friction=4*Math.PI*r*s/n),i}function Kw(i,e){if(!nt.und(e.decay))i.duration=void 0;else{const t=!nt.und(e.tension)||!nt.und(e.friction);(t||!nt.und(e.frequency)||!nt.und(e.damping)||!nt.und(e.mass))&&(i.duration=void 0,i.decay=void 0),t&&(i.frequency=void 0)}}var Jw=[],uV=class{constructor(){this.changed=!1,this.values=Jw,this.toValues=null,this.fromValues=Jw,this.config=new lV,this.immediate=!1}};function DR(i,{key:e,props:t,defaultProps:n,state:r,actions:s}){return new Promise((a,o)=>{let l,c,h=vf(t.cancel??n?.cancel,e);if(h)m();else{nt.und(t.pause)||(r.paused=vf(t.pause,e));let v=n?.pause;v!==!0&&(v=r.paused||vf(v,e)),l=pl(t.delay||0,e),v?(r.resumeQueue.add(p),s.pause()):(s.resume(),p())}function d(){r.resumeQueue.add(p),r.timeouts.delete(c),c.cancel(),l=c.time-Ct.now()}function p(){l>0&&!cs.skipAnimation?(r.delayed=!0,c=Ct.setTimeout(m,l),r.pauseQueue.add(d),r.timeouts.add(c)):m()}function m(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(d),r.timeouts.delete(c),i<=(r.cancelId||0)&&(h=!0);try{s.start({...t,callId:i,cancel:h},a)}catch(v){o(v)}}})}var Q1=(i,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?ou(i.get()):e.every(t=>t.noop)?UR(i.get()):ss(i.get(),e.every(t=>t.finished)),UR=i=>({value:i,noop:!0,finished:!0,cancelled:!1}),ss=(i,e,t=!1)=>({value:i,finished:e,cancelled:t}),ou=i=>({value:i,cancelled:!0,finished:!1});function OR(i,e,t,n){const{callId:r,parentId:s,onRest:a}=e,{asyncTo:o,promise:l}=t;return!s&&i===o&&!e.reset?l:t.promise=(async()=>{t.asyncId=r,t.asyncTo=i;const c=J1(e,(_,g)=>g==="onRest"?void 0:_);let h,d;const p=new Promise((_,g)=>(h=_,d=g)),m=_=>{const g=r<=(t.cancelId||0)&&ou(n)||r!==t.asyncId&&ss(n,!1);if(g)throw _.result=g,d(_),_},v=(_,g)=>{const b=new Qw,E=new $w;return(async()=>{if(cs.skipAnimation)throw Xf(t),E.result=ss(n,!1),d(E),E;m(b);const S=nt.obj(_)?{..._}:{...g,to:_};S.parentId=r,Sa(c,(T,R)=>{nt.und(S[R])&&(S[R]=T)});const w=await n.start(S);return m(b),t.paused&&await new Promise(T=>{t.resumeQueue.add(T)}),w})()};let x;if(cs.skipAnimation)return Xf(t),ss(n,!1);try{let _;nt.arr(i)?_=(async g=>{for(const b of g)await v(b)})(i):_=Promise.resolve(i(v,n.stop.bind(n))),await Promise.all([_.then(h),p]),x=ss(n.get(),!0,!1)}catch(_){if(_ instanceof Qw)x=_.result;else if(_ instanceof $w)x=_.result;else throw _}finally{r==t.asyncId&&(t.asyncId=s,t.asyncTo=s?o:void 0,t.promise=s?l:void 0)}return nt.fun(a)&&Ct.batchedUpdates(()=>{a(x,n,n.item)}),x})()}function Xf(i,e){mf(i.timeouts,t=>t.cancel()),i.pauseQueue.clear(),i.resumeQueue.clear(),i.asyncId=i.asyncTo=i.promise=void 0,e&&(i.cancelId=e)}var Qw=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},$w=class extends Error{constructor(){super("SkipAnimationSignal")}},bx=i=>i instanceof $1,hV=1,$1=class extends NH{constructor(){super(...arguments),this.id=hV++,this._priority=0}get priority(){return this._priority}set priority(i){this._priority!=i&&(this._priority=i,this._onPriorityChange(i))}get(){const i=Ss(this);return i&&i.getValue()}to(...i){return cs.to(this,i)}interpolate(...i){return HH(),cs.to(this,i)}toJSON(){return this.get()}observerAdded(i){i==1&&this._attach()}observerRemoved(i){i==0&&this._detach()}_attach(){}_detach(){}_onChange(i,e=!1){yg(this,{type:"change",parent:this,value:i,idle:e})}_onPriorityChange(i){this.idle||m0.sort(this),yg(this,{type:"priority",parent:this,priority:i})}},Dl=Symbol.for("SpringPhase"),LR=1,Sx=2,Ex=4,__=i=>(i[Dl]&LR)>0,eo=i=>(i[Dl]&Sx)>0,kh=i=>(i[Dl]&Ex)>0,eT=(i,e)=>e?i[Dl]|=Sx|LR:i[Dl]&=~Sx,tT=(i,e)=>e?i[Dl]|=Ex:i[Dl]&=~Ex,fV=class extends $1{constructor(i,e){if(super(),this.animation=new uV,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!nt.und(i)||!nt.und(e)){const t=nt.obj(i)?{...i}:{...e,from:i};nt.und(t.default)&&(t.default=!0),this.start(t)}}get idle(){return!(eo(this)||this._state.asyncTo)||kh(this)}get goal(){return Ir(this.animation.to)}get velocity(){const i=Ss(this);return i instanceof x0?i.lastVelocity||0:i.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return __(this)}get isAnimating(){return eo(this)}get isPaused(){return kh(this)}get isDelayed(){return this._state.delayed}advance(i){let e=!0,t=!1;const n=this.animation;let{toValues:r}=n;const{config:s}=n,a=_0(n.to);!a&&Es(n.to)&&(r=Br(Ir(n.to))),n.values.forEach((c,h)=>{if(c.done)return;const d=c.constructor==xg?1:a?a[h].lastPosition:r[h];let p=n.immediate,m=d;if(!p){if(m=c.lastPosition,s.tension<=0){c.done=!0;return}let v=c.elapsedTime+=i;const x=n.fromValues[h],_=c.v0!=null?c.v0:c.v0=nt.arr(s.velocity)?s.velocity[h]:s.velocity;let g;const b=s.precision||(x==d?.005:Math.min(1,Math.abs(d-x)*.001));if(nt.und(s.duration))if(s.decay){const E=s.decay===!0?.998:s.decay,S=Math.exp(-(1-E)*v);m=x+_/(1-E)*(1-S),p=Math.abs(c.lastPosition-m)<=b,g=_*S}else{g=c.lastVelocity==null?_:c.lastVelocity;const E=s.restVelocity||b/10,S=s.clamp?0:s.bounce,w=!nt.und(S),T=x==d?c.v0>0:x<d;let R,U=!1;const A=1,D=Math.ceil(i/A);for(let L=0;L<D&&(R=Math.abs(g)>E,!(!R&&(p=Math.abs(d-m)<=b,p)));++L){w&&(U=m==d||m>d==T,U&&(g=-g*S,m=d));const P=-s.tension*1e-6*(m-d),I=-s.friction*.001*g,V=(P+I)/s.mass;g=g+V*A,m=m+g*A}}else{let E=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,c.durationProgress>0&&(c.elapsedTime=s.duration*c.durationProgress,v=c.elapsedTime+=i)),E=(s.progress||0)+v/this._memoizedDuration,E=E>1?1:E<0?0:E,c.durationProgress=E),m=x+s.easing(E)*(d-x),g=(m-c.lastPosition)/i,p=E==1}c.lastVelocity=g,Number.isNaN(m)&&(console.warn("Got NaN while animating:",this),p=!0)}a&&!a[h].done&&(p=!1),p?c.done=!0:e=!1,c.setValue(m,s.round)&&(t=!0)});const o=Ss(this),l=o.getValue();if(e){const c=Ir(n.to);(l!==c||t)&&!s.decay?(o.setValue(c),this._onChange(c)):t&&s.decay&&this._onChange(l),this._stop()}else t&&this._onChange(l)}set(i){return Ct.batchedUpdates(()=>{this._stop(),this._focus(i),this._set(i)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(eo(this)){const{to:i,config:e}=this.animation;Ct.batchedUpdates(()=>{this._onStart(),e.decay||this._set(i,!1),this._stop()})}return this}update(i){return(this.queue||(this.queue=[])).push(i),this}start(i,e){let t;return nt.und(i)?(t=this.queue||[],this.queue=[]):t=[nt.obj(i)?i:{...e,to:i}],Promise.all(t.map(n=>this._update(n))).then(n=>Q1(this,n))}stop(i){const{to:e}=this.animation;return this._focus(this.get()),Xf(this._state,i&&this._lastCallId),Ct.batchedUpdates(()=>this._stop(e,i)),this}reset(){this._update({reset:!0})}eventObserved(i){i.type=="change"?this._start():i.type=="priority"&&(this.priority=i.priority+1)}_prepareNode(i){const e=this.key||"";let{to:t,from:n}=i;t=nt.obj(t)?t[e]:t,(t==null||_x(t))&&(t=void 0),n=nt.obj(n)?n[e]:n,n==null&&(n=void 0);const r={to:t,from:n};return __(this)||(i.reverse&&([t,n]=[n,t]),n=Ir(n),nt.und(n)?Ss(this)||this._set(t):this._set(n)),r}_update({...i},e){const{key:t,defaultProps:n}=this;i.default&&Object.assign(n,J1(i,(a,o)=>/^on/.test(o)?AR(a,t):a)),iT(this,i,"onProps"),Hh(this,"onProps",i,this);const r=this._prepareNode(i);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const s=this._state;return DR(++this._lastCallId,{key:t,props:i,defaultProps:n,state:s,actions:{pause:()=>{kh(this)||(tT(this,!0),Qh(s.pauseQueue),Hh(this,"onPause",ss(this,Gh(this,this.animation.to)),this))},resume:()=>{kh(this)&&(tT(this,!1),eo(this)&&this._resume(),Qh(s.resumeQueue),Hh(this,"onResume",ss(this,Gh(this,this.animation.to)),this))},start:this._merge.bind(this,r)}}).then(a=>{if(i.loop&&a.finished&&!(e&&a.noop)){const o=IR(i);if(o)return this._update(o,!0)}return a})}_merge(i,e,t){if(e.cancel)return this.stop(!0),t(ou(this));const n=!nt.und(i.to),r=!nt.und(i.from);if(n||r)if(e.callId>this._lastToId)this._lastToId=e.callId;else return t(ou(this));const{key:s,defaultProps:a,animation:o}=this,{to:l,from:c}=o;let{to:h=l,from:d=c}=i;r&&!n&&(!e.default||nt.und(h))&&(h=d),e.reverse&&([h,d]=[d,h]);const p=!ca(d,c);p&&(o.from=d),d=Ir(d);const m=!ca(h,l);m&&this._focus(h);const v=_x(e.to),{config:x}=o,{decay:_,velocity:g}=x;(n||r)&&(x.velocity=0),e.config&&!v&&cV(x,pl(e.config,s),e.config!==a.config?pl(a.config,s):void 0);let b=Ss(this);if(!b||nt.und(h))return t(ss(this,!0));const E=nt.und(e.reset)?r&&!e.default:!nt.und(d)&&vf(e.reset,s),S=E?d:this.get(),w=Wf(h),T=nt.num(w)||nt.arr(w)||y0(w),R=!v&&(!T||vf(a.immediate||e.immediate,s));if(m){const L=yx(h);if(L!==b.constructor)if(R)b=this._set(w);else throw Error(`Cannot animate between ${b.constructor.name} and ${L.name}, as the "to" prop suggests`)}const U=b.constructor;let A=Es(h),D=!1;if(!A){const L=E||!__(this)&&p;(m||L)&&(D=ca(Wf(S),w),A=!D),(!ca(o.immediate,R)&&!R||!ca(x.decay,_)||!ca(x.velocity,g))&&(A=!0)}if(D&&eo(this)&&(o.changed&&!E?A=!0:A||this._stop(l)),!v&&((A||Es(l))&&(o.values=b.getPayload(),o.toValues=Es(h)?null:U==xg?[1]:Br(w)),o.immediate!=R&&(o.immediate=R,!R&&!E&&this._set(l)),A)){const{onRest:L}=o;rn(pV,I=>iT(this,e,I));const P=ss(this,Gh(this,l));Qh(this._pendingCalls,P),this._pendingCalls.add(t),o.changed&&Ct.batchedUpdates(()=>{o.changed=!E,L?.(P,this),E?pl(a.onRest,P):o.onStart?.(P,this)})}E&&this._set(S),v?t(OR(e.to,e,this._state,this)):A?this._start():eo(this)&&!m?this._pendingCalls.add(t):t(UR(S))}_focus(i){const e=this.animation;i!==e.to&&(Ww(this)&&this._detach(),e.to=i,Ww(this)&&this._attach())}_attach(){let i=0;const{to:e}=this.animation;Es(e)&&(ld(e,this),bx(e)&&(i=e.priority+1)),this.priority=i}_detach(){const{to:i}=this.animation;Es(i)&&_g(i,this)}_set(i,e=!0){const t=Ir(i);if(!nt.und(t)){const n=Ss(this);if(!n||!ca(t,n.getValue())){const r=yx(t);!n||n.constructor!=r?Z1(this,r.create(t)):n.setValue(t),n&&Ct.batchedUpdates(()=>{this._onChange(t,e)})}}return Ss(this)}_onStart(){const i=this.animation;i.changed||(i.changed=!0,Hh(this,"onStart",ss(this,Gh(this,i.to)),this))}_onChange(i,e){e||(this._onStart(),pl(this.animation.onChange,i,this)),pl(this.defaultProps.onChange,i,this),super._onChange(i,e)}_start(){const i=this.animation;Ss(this).reset(Ir(i.to)),i.immediate||(i.fromValues=i.values.map(e=>e.lastPosition)),eo(this)||(eT(this,!0),kh(this)||this._resume())}_resume(){cs.skipAnimation?this.finish():m0.start(this)}_stop(i,e){if(eo(this)){eT(this,!1);const t=this.animation;rn(t.values,r=>{r.done=!0}),t.toValues&&(t.onChange=t.onPause=t.onResume=void 0),yg(this,{type:"idle",parent:this});const n=e?ou(this.get()):ss(this.get(),Gh(this,i??t.to));Qh(this._pendingCalls,n),t.changed&&(t.changed=!1,Hh(this,"onRest",n,this))}}};function Gh(i,e){const t=Wf(e),n=Wf(i.get());return ca(n,t)}function IR(i,e=i.loop,t=i.to){const n=pl(e);if(n){const r=n!==!0&&RR(n),s=(r||i).reverse,a=!r||r.reset;return jf({...i,loop:e,default:!1,pause:void 0,to:!s||_x(t)?t:void 0,from:a?i.from:void 0,reset:a,...r})}}function jf(i){const{to:e,from:t}=i=RR(i),n=new Set;return nt.obj(e)&&nT(e,n),nt.obj(t)&&nT(t,n),i.keys=n.size?Array.from(n):null,i}function dV(i){const e=jf(i);return nt.und(e.default)&&(e.default=J1(e)),e}function nT(i,e){Sa(i,(t,n)=>t!=null&&e.add(n))}var pV=["onStart","onRest","onChange","onPause","onResume"];function iT(i,e,t){i.animation[t]=e[t]!==CR(e,t)?AR(e[t],i.key):void 0}function Hh(i,e,...t){i.animation[e]?.(...t),i.defaultProps[e]?.(...t)}var mV=["onStart","onChange","onRest"],gV=1,vV=class{constructor(e,t){this.id=gV++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];nt.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(jf(e)),this}start(e){let{queue:t}=this;return e?t=Br(e).map(jf):this.queue=[],this._flush?this._flush(this,t):(BR(this,t),Mx(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;rn(Br(t),r=>n[r].stop(!!e))}else Xf(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(nt.und(e))this.start({pause:!0});else{const t=this.springs;rn(Br(e),n=>t[n].pause())}return this}resume(e){if(nt.und(e))this.start({pause:!1});else{const t=this.springs;rn(Br(e),n=>t[n].resume())}return this}each(e){Sa(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,s=this._changed.size>0;(r&&!this._started||s&&!this._started)&&(this._started=!0,mf(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const a=!r&&this._started,o=s||a&&n.size?this.get():null;s&&t.size&&mf(t,([l,c])=>{c.value=o,l(c,this,this._item)}),a&&(this._started=!1,mf(n,([l,c])=>{c.value=o,l(c,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Ct.onFrame(this._onFrame)}};function Mx(i,e){return Promise.all(e.map(t=>NR(i,t))).then(t=>Q1(i,t))}async function NR(i,e,t){const{keys:n,to:r,from:s,loop:a,onRest:o,onResolve:l}=e,c=nt.obj(e.default)&&e.default;a&&(e.loop=!1),r===!1&&(e.to=null),s===!1&&(e.from=null);const h=nt.arr(r)||nt.fun(r)?r:void 0;h?(e.to=void 0,e.onRest=void 0,c&&(c.onRest=void 0)):rn(mV,x=>{const _=e[x];if(nt.fun(_)){const g=i._events[x];e[x]=({finished:b,cancelled:E})=>{const S=g.get(_);S?(b||(S.finished=!1),E&&(S.cancelled=!0)):g.set(_,{value:null,finished:b||!1,cancelled:E||!1})},c&&(c[x]=e[x])}});const d=i._state;e.pause===!d.paused?(d.paused=e.pause,Qh(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);const p=(n||Object.keys(i.springs)).map(x=>i.springs[x].start(e)),m=e.cancel===!0||CR(e,"cancel")===!0;(h||m&&d.asyncId)&&p.push(DR(++i._lastAsyncId,{props:e,state:d,actions:{pause:gx,resume:gx,start(x,_){m?(Xf(d,i._lastAsyncId),_(ou(i))):(x.onRest=o,_(OR(h,x,d,i)))}}})),d.paused&&await new Promise(x=>{d.resumeQueue.add(x)});const v=Q1(i,await Promise.all(p));if(a&&v.finished&&!(t&&v.noop)){const x=IR(e,a,r);if(x)return BR(i,[x]),NR(i,x,!0)}return l&&Ct.batchedUpdates(()=>l(v,i,i.item)),v}function rT(i,e){const t={...i.springs};return e&&rn(Br(e),n=>{nt.und(n.keys)&&(n=jf(n)),nt.obj(n.to)||(n={...n,to:void 0}),FR(t,n,r=>zR(r))}),PR(i,t),t}function PR(i,e){Sa(e,(t,n)=>{i.springs[n]||(i.springs[n]=t,ld(t,i))})}function zR(i,e){const t=new fV;return t.key=i,e&&ld(t,e),t}function FR(i,e,t){e.keys&&rn(e.keys,n=>{(i[n]||(i[n]=t(n)))._prepareNode(e)})}function BR(i,e){rn(e,t=>{FR(i.springs,t,n=>zR(n,i))})}var yV=K.createContext({pause:!1,immediate:!1}),_V=()=>{const i=[],e=function(n){WH();const r=[];return rn(i,(s,a)=>{if(nt.und(n))r.push(s.start());else{const o=t(n,s,a);o&&r.push(s.start(o))}}),r};e.current=i,e.add=function(n){i.includes(n)||i.push(n)},e.delete=function(n){const r=i.indexOf(n);~r&&i.splice(r,1)},e.pause=function(){return rn(i,n=>n.pause(...arguments)),this},e.resume=function(){return rn(i,n=>n.resume(...arguments)),this},e.set=function(n){rn(i,(r,s)=>{const a=nt.fun(n)?n(s,r):n;a&&r.set(a)})},e.start=function(n){const r=[];return rn(i,(s,a)=>{if(nt.und(n))r.push(s.start());else{const o=this._getProps(n,s,a);o&&r.push(s.start(o))}}),r},e.stop=function(){return rn(i,n=>n.stop(...arguments)),this},e.update=function(n){return rn(i,(r,s)=>r.update(this._getProps(n,r,s))),this};const t=function(n,r,s){return nt.fun(n)?n(s,r):n};return e._getProps=t,e};function xV(i,e,t){const n=nt.fun(e)&&e;n&&!t&&(t=[]);const r=K.useMemo(()=>n||arguments.length==3?_V():void 0,[]),s=K.useRef(0),a=bR(),o=K.useMemo(()=>({ctrls:[],queue:[],flush(g,b){const E=rT(g,b);return s.current>0&&!o.queue.length&&!Object.keys(E).some(w=>!g.springs[w])?Mx(g,b):new Promise(w=>{PR(g,E),o.queue.push(()=>{w(Mx(g,b))}),a()})}}),[]),l=K.useRef([...o.ctrls]),c=K.useRef([]),h=jw(i)||0;K.useMemo(()=>{rn(l.current.slice(i,h),g=>{sV(g,r),g.stop(!0)}),l.current.length=i,d(h,i)},[i]),K.useMemo(()=>{d(0,Math.min(h,i))},t);function d(g,b){for(let E=g;E<b;E++){const S=l.current[E]||(l.current[E]=new vV(null,o.flush)),w=n?n(E,S):e[E];w&&(c.current[E]=dV(w))}}const p=l.current.map((g,b)=>rT(g,c.current[b])),m=K.useContext(yV),v=jw(m),x=m!==v&&rV(m);Y1(()=>{s.current++,o.ctrls=l.current;const{queue:g}=o;g.length&&(o.queue=[],rn(g,b=>b())),rn(l.current,(b,E)=>{r?.add(b),x&&b.start({default:m});const S=c.current[E];S&&(aV(b,S.ref),b.ref?b.queue.push(S):b.start(S))})}),SR(()=>()=>{rn(o.ctrls,g=>g.stop(!0))});const _=p.map(g=>({...g}));return r?[_,r]:_}function er(i,e){const t=nt.fun(i),[[n],r]=xV(1,t?i:[i],t?e||[]:e);return t||arguments.length==2?[n,r]:n}var bV=class extends $1{constructor(i,e){super(),this.source=i,this.idle=!0,this._active=new Set,this.calc=Gf(...e);const t=this._get(),n=yx(t);Z1(this,n.create(t))}advance(i){const e=this._get(),t=this.get();ca(e,t)||(Ss(this).setValue(e),this._onChange(e,this.idle)),!this.idle&&sT(this._active)&&x_(this)}_get(){const i=nt.arr(this.source)?this.source.map(Ir):Br(Ir(this.source));return this.calc(...i)}_start(){this.idle&&!sT(this._active)&&(this.idle=!1,rn(_0(this),i=>{i.done=!1}),cs.skipAnimation?(Ct.batchedUpdates(()=>this.advance()),x_(this)):m0.start(this))}_attach(){let i=1;rn(Br(this.source),e=>{Es(e)&&ld(e,this),bx(e)&&(e.idle||this._active.add(e),i=Math.max(i,e.priority+1))}),this.priority=i,this._start()}_detach(){rn(Br(this.source),i=>{Es(i)&&_g(i,this)}),this._active.clear(),x_(this)}eventObserved(i){i.type=="change"?i.idle?this.advance():(this._active.add(i.parent),this._start()):i.type=="idle"?this._active.delete(i.parent):i.type=="priority"&&(this.priority=Br(this.source).reduce((e,t)=>Math.max(e,(bx(t)?t.priority:0)+1),0))}};function SV(i){return i.idle!==!1}function sT(i){return!i.size||Array.from(i).every(SV)}function x_(i){i.idle||(i.idle=!0,rn(_0(i),e=>{e.done=!0}),yg(i,{type:"idle",parent:i}))}cs.assign({createStringInterpolator:_R,to:(i,e)=>new bV(i,e)});var EV=["primitive"].concat(Object.keys(gC).filter(i=>/^[A-Z]/.test(i)).map(i=>i[0].toLowerCase()+i.slice(1)));cs.assign({createStringInterpolator:_R,colors:bH,frameLoop:"demand"});w5(()=>{Ct.advance()});var MV=$H(EV,{applyAnimatedValues:da}),An=MV.animated;function Ul(){return Ul=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Ul.apply(null,arguments)}const cd=new j,eb=new j,wV=new j,aT=new ke;function TV(i,e,t){const n=cd.setFromMatrixPosition(i.matrixWorld);n.project(e);const r=t.width/2,s=t.height/2;return[n.x*r+r,-(n.y*s)+s]}function AV(i,e){const t=cd.setFromMatrixPosition(i.matrixWorld),n=eb.setFromMatrixPosition(e.matrixWorld),r=t.sub(n),s=e.getWorldDirection(wV);return r.angleTo(s)>Math.PI/2}function CV(i,e,t,n){const r=cd.setFromMatrixPosition(i.matrixWorld),s=r.clone();s.project(e),aT.set(s.x,s.y),t.setFromCamera(aT,e);const a=t.intersectObjects(n,!0);if(a.length){const o=a[0].distance;return r.distanceTo(t.ray.origin)<o}return!0}function RV(i,e){if(e instanceof Pl)return e.zoom;if(e instanceof Kn){const t=cd.setFromMatrixPosition(i.matrixWorld),n=eb.setFromMatrixPosition(e.matrixWorld),r=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(r/2)*s)}else return 1}function DV(i,e,t){if(e instanceof Kn||e instanceof Pl){const n=cd.setFromMatrixPosition(i.matrixWorld),r=eb.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(r),a=(t[1]-t[0])/(e.far-e.near),o=t[1]-a*e.far;return Math.round(a*s+o)}}const wx=i=>Math.abs(i)<1e-10?0:i;function kR(i,e,t=""){let n="matrix3d(";for(let r=0;r!==16;r++)n+=wx(e[r]*i.elements[r])+(r!==15?",":")");return t+n}const UV=(i=>e=>kR(e,i))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),OV=(i=>(e,t)=>kR(e,i(t),"translate(-50%,-50%)"))(i=>[1/i,1/i,1/i,1,-1/i,-1/i,-1/i,-1,1/i,1/i,1/i,1,1,1,1,1]);function LV(i){return i&&typeof i=="object"&&"current"in i}const tb=K.forwardRef(({children:i,eps:e=.001,style:t,className:n,prepend:r,center:s,fullscreen:a,portal:o,distanceFactor:l,sprite:c=!1,transform:h=!1,occlude:d,onOcclude:p,castShadow:m,receiveShadow:v,material:x,geometry:_,zIndexRange:g=[16777271,0],calculatePosition:b=TV,as:E="div",wrapperClass:S,pointerEvents:w="auto",...T},R)=>{const{gl:U,camera:A,scene:D,size:L,raycaster:P,events:I,viewport:V}=Jn(),[H]=K.useState(()=>document.createElement(E)),z=K.useRef(null),O=K.useRef(null),B=K.useRef(0),G=K.useRef([0,0]),X=K.useRef(null),k=K.useRef(null),Y=o?.current||I.connected||U.domElement.parentNode,Q=K.useRef(null),te=K.useRef(!1),ee=K.useMemo(()=>d&&d!=="blending"||Array.isArray(d)&&d.length&&LV(d[0]),[d]);K.useLayoutEffect(()=>{const Me=U.domElement;d&&d==="blending"?(Me.style.zIndex=`${Math.floor(g[0]/2)}`,Me.style.position="absolute",Me.style.pointerEvents="none"):(Me.style.zIndex=null,Me.style.position=null,Me.style.pointerEvents=null)},[d]),K.useLayoutEffect(()=>{if(O.current){const Me=z.current=FU.createRoot(H);if(D.updateMatrixWorld(),h)H.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const ve=b(O.current,A,L);H.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${ve[0]}px,${ve[1]}px,0);transform-origin:0 0;`}return Y&&(r?Y.prepend(H):Y.appendChild(H)),()=>{Y&&Y.removeChild(H),Me.unmount()}}},[Y,h]),K.useLayoutEffect(()=>{S&&(H.className=S)},[S]);const ie=K.useMemo(()=>h?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,a,L,h]),re=K.useMemo(()=>({position:"absolute",pointerEvents:w}),[w]);K.useLayoutEffect(()=>{if(te.current=!1,h){var Me;(Me=z.current)==null||Me.render(K.createElement("div",{ref:X,style:ie},K.createElement("div",{ref:k,style:re},K.createElement("div",{ref:R,className:n,style:t,children:i}))))}else{var ve;(ve=z.current)==null||ve.render(K.createElement("div",{ref:R,style:ie,className:n,children:i}))}});const de=K.useRef(!0);u0(Me=>{if(O.current){A.updateMatrixWorld(),O.current.updateWorldMatrix(!0,!1);const ve=h?G.current:b(O.current,A,L);if(h||Math.abs(B.current-A.zoom)>e||Math.abs(G.current[0]-ve[0])>e||Math.abs(G.current[1]-ve[1])>e){const fe=AV(O.current,A);let J=!1;ee&&(Array.isArray(d)?J=d.map(pe=>pe.current):d!=="blending"&&(J=[D]));const oe=de.current;if(J){const pe=CV(O.current,A,P,J);de.current=pe&&!fe}else de.current=!fe;oe!==de.current&&(p?p(!de.current):H.style.display=de.current?"block":"none");const se=Math.floor(g[0]/2),$=d?ee?[g[0],se]:[se-1,0]:g;if(H.style.zIndex=`${DV(O.current,A,$)}`,h){const[pe,ye]=[L.width/2,L.height/2],xe=A.projectionMatrix.elements[5]*ye,{isOrthographicCamera:be,top:ue,left:He,bottom:W,right:F}=A,ne=UV(A.matrixWorldInverse),Se=be?`scale(${xe})translate(${wx(-(F+He)/2)}px,${wx((ue+W)/2)}px)`:`translateZ(${xe}px)`;let _e=O.current.matrixWorld;c&&(_e=A.matrixWorldInverse.clone().transpose().copyPosition(_e).scale(O.current.scale),_e.elements[3]=_e.elements[7]=_e.elements[11]=0,_e.elements[15]=1),H.style.width=L.width+"px",H.style.height=L.height+"px",H.style.perspective=be?"":`${xe}px`,X.current&&k.current&&(X.current.style.transform=`${Se}${ne}translate(${pe}px,${ye}px)`,k.current.style.transform=OV(_e,1/((l||10)/400)))}else{const pe=l===void 0?1:RV(O.current,A)*l;H.style.transform=`translate3d(${ve[0]}px,${ve[1]}px,0) scale(${pe})`}G.current=ve,B.current=A.zoom}}if(!ee&&Q.current&&!te.current)if(h){if(X.current){const ve=X.current.children[0];if(ve!=null&&ve.clientWidth&&ve!=null&&ve.clientHeight){const{isOrthographicCamera:fe}=A;if(fe||_)T.scale&&(Array.isArray(T.scale)?T.scale instanceof j?Q.current.scale.copy(T.scale.clone().divideScalar(1)):Q.current.scale.set(1/T.scale[0],1/T.scale[1],1/T.scale[2]):Q.current.scale.setScalar(1/T.scale));else{const J=(l||10)/400,oe=ve.clientWidth*J,se=ve.clientHeight*J;Q.current.scale.set(oe,se,1)}te.current=!0}}}else{const ve=H.children[0];if(ve!=null&&ve.clientWidth&&ve!=null&&ve.clientHeight){const fe=1/V.factor,J=ve.clientWidth*fe,oe=ve.clientHeight*fe;Q.current.scale.set(J,oe,1),te.current=!0}Q.current.lookAt(Me.camera.position)}});const Ae=K.useMemo(()=>({vertexShader:h?void 0:`
|
|
3843
|
+
`)+u.join(" > ")}return null},zt.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 27:case 5:return Ju(u.child.stateNode);default:return u.child.stateNode}},zt.injectIntoDevTools=function(){var u={bundleType:0,version:a3,rendererPackageName:o3,currentDispatcherRef:wt,findFiberByHostInstance:yS,reconcilerVersion:"19.0.0"};if(mS!==null&&(u.rendererConfig=mS),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{eh=f.inject(u),hr=f}catch{}u=!!f.checkDCE}}return u},zt.isAlreadyRendering=function(){return!1},zt.observeVisibleRects=function(u,f,y,M){if(!Qu)throw Error(r(363));u=K0(u,f);var C=D3(u,y,M).disconnect;return{disconnect:function(){C()}}},zt.shouldError=function(){return null},zt.shouldSuspend=function(){return!1},zt.startHostTransition=function(u,f,y,M){if(u.tag!==5)throw Error(r(476));var C=wo(u).queue;zu(u,C,f,Ql,y===null?n:function(){var N=wo(u).next.queue;return Bs(u,N,{},lr()),y(M)})},zt.updateContainer=function(u,f,y,M){var C=f.current,N=lr();return lS(C,N,u,f,y,M),N},zt.updateContainerSync=function(u,f,y,M){return f.tag===0&&Oo(),lS(f.current,2,u,f,y,M),2},zt},i.exports.default=i.exports,Object.defineProperty(i.exports,"__esModule",{value:!0})})(Ny)),Ny.exports}var LM;function B4(){return LM||(LM=1,Iy.exports=F4()),Iy.exports}var k4=B4();const G4=po(k4);var Fy={exports:{}},By={};var IM;function H4(){return IM||(IM=1,(function(i){function e(z,O){var B=z.length;z.push(O);e:for(;0<B;){var G=B-1>>>1,X=z[G];if(0<r(X,O))z[G]=O,z[B]=X,B=G;else break e}}function t(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var O=z[0],B=z.pop();if(B!==O){z[0]=B;e:for(var G=0,X=z.length,k=X>>>1;G<k;){var Y=2*(G+1)-1,Q=z[Y],te=Y+1,ee=z[te];if(0>r(Q,B))te<X&&0>r(ee,Q)?(z[G]=ee,z[te]=B,G=te):(z[G]=Q,z[Y]=B,G=Y);else if(te<X&&0>r(ee,B))z[G]=ee,z[te]=B,G=te;else break e}}return O}function r(z,O){var B=z.sortIndex-O.sortIndex;return B!==0?B:z.id-O.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;i.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();i.unstable_now=function(){return a.now()-o}}var l=[],c=[],h=1,d=null,p=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function E(z){for(var O=t(c);O!==null;){if(O.callback===null)n(c);else if(O.startTime<=z)n(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(z){if(x=!1,E(z),!v)if(t(l)!==null)v=!0,V();else{var O=t(c);O!==null&&H(S,O.startTime-z)}}var w=!1,T=-1,R=5,U=-1;function A(){return!(i.unstable_now()-U<R)}function D(){if(w){var z=i.unstable_now();U=z;var O=!0;try{e:{v=!1,x&&(x=!1,g(T),T=-1),m=!0;var B=p;try{t:{for(E(z),d=t(l);d!==null&&!(d.expirationTime>z&&A());){var G=d.callback;if(typeof G=="function"){d.callback=null,p=d.priorityLevel;var X=G(d.expirationTime<=z);if(z=i.unstable_now(),typeof X=="function"){d.callback=X,E(z),O=!0;break t}d===t(l)&&n(l),E(z)}else n(l);d=t(l)}if(d!==null)O=!0;else{var k=t(c);k!==null&&H(S,k.startTime-z),O=!1}}break e}finally{d=null,p=B,m=!1}O=void 0}}finally{O?L():w=!1}}}var L;if(typeof b=="function")L=function(){b(D)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,I=P.port2;P.port1.onmessage=D,L=function(){I.postMessage(null)}}else L=function(){_(D,0)};function V(){w||(w=!0,L())}function H(z,O){T=_(function(){z(i.unstable_now())},O)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(z){z.callback=null},i.unstable_continueExecution=function(){v||m||(v=!0,V())},i.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<z?Math.floor(1e3/z):5},i.unstable_getCurrentPriorityLevel=function(){return p},i.unstable_getFirstCallbackNode=function(){return t(l)},i.unstable_next=function(z){switch(p){case 1:case 2:case 3:var O=3;break;default:O=p}var B=p;p=O;try{return z()}finally{p=B}},i.unstable_pauseExecution=function(){},i.unstable_requestPaint=function(){},i.unstable_runWithPriority=function(z,O){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=p;p=z;try{return O()}finally{p=B}},i.unstable_scheduleCallback=function(z,O,B){var G=i.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?G+B:G):B=G,z){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=B+X,z={id:h++,callback:O,priorityLevel:z,startTime:B,expirationTime:X,sortIndex:-1},B>G?(z.sortIndex=B,e(c,z),t(l)===null&&z===t(c)&&(x?(g(T),T=-1):x=!0,H(S,B-G))):(z.sortIndex=X,e(l,z),v||m||(v=!0,V())),z},i.unstable_shouldYield=A,i.unstable_wrapCallback=function(z){var O=p;return function(){var B=p;p=O;try{return z.apply(this,arguments)}finally{p=B}}}})(By)),By}var NM;function V4(){return NM||(NM=1,Fy.exports=H4()),Fy.exports}var PM=V4();function T1(i,e,t){if(!i)return;if(t(i)===!0)return i;let n=e?i.return:i.child;for(;n;){const r=T1(n,e,t);if(r)return r;n=e?null:n.sibling}}function vC(i){try{return Object.defineProperties(i,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return i}}const A1=vC(K.createContext(null));let yC=class extends K.Component{render(){return K.createElement(A1.Provider,{value:this._reactInternals},this.props.children)}};function _C(){const i=K.useContext(A1);if(i===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=K.useId();return K.useMemo(()=>{for(const t of[i,i?.alternate]){if(!t)continue;const n=T1(t,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(n)return n}},[i,e])}const W4=Symbol.for("react.context"),X4=i=>i!==null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===W4;function j4(){const i=_C(),[e]=K.useState(()=>new Map);e.clear();let t=i;for(;t;){const n=t.type;X4(n)&&n!==A1&&!e.has(n)&&e.set(n,K.use(vC(n))),t=t.return}return e}function q4(){const i=j4();return K.useMemo(()=>Array.from(i.keys()).reduce((e,t)=>n=>K.createElement(e,null,K.createElement(t.Provider,{...n,value:i.get(t)})),e=>K.createElement(yC,{...e})),[i])}function xC(i){let e=i.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const bC=i=>i&&i.isOrthographicCamera,Y4=i=>i&&i.hasOwnProperty("current"),Z4=i=>i!=null&&(typeof i=="string"||typeof i=="number"||i.isColor),rd=((i,e)=>typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?K.useLayoutEffect:K.useEffect;function SC(i){const e=K.useRef(i);return rd(()=>void(e.current=i),[i]),e}function K4(){const i=_C(),e=q4();return K.useMemo(()=>({children:t})=>{const r=!!T1(i,!0,s=>s.type===K.StrictMode)?K.StrictMode:K.Fragment;return he.jsx(r,{children:he.jsx(e,{children:t})})},[i,e])}function J4({set:i}){return rd(()=>(i(new Promise(()=>null)),()=>i(!1)),[i]),null}const Q4=(i=>(i=class extends K.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},i.getDerivedStateFromError=()=>({error:!0}),i))();function EC(i){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(i)?Math.min(Math.max(i[0],t),i[1]):i}function zc(i){var e;return(e=i.__r3f)==null?void 0:e.root.getState()}const wn={obj:i=>i===Object(i)&&!wn.arr(i)&&typeof i!="function",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",boo:i=>typeof i=="boolean",und:i=>i===void 0,nul:i=>i===null,arr:i=>Array.isArray(i),equ(i,e,{arrays:t="shallow",objects:n="reference",strict:r=!0}={}){if(typeof i!=typeof e||!!i!=!!e)return!1;if(wn.str(i)||wn.num(i)||wn.boo(i))return i===e;const s=wn.obj(i);if(s&&n==="reference")return i===e;const a=wn.arr(i);if(a&&t==="reference")return i===e;if((a||s)&&i===e)return!0;let o;for(o in i)if(!(o in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(o in r?e:i)if(!wn.equ(i[o],e[o],{strict:r,objects:"reference"}))return!1}else for(o in r?e:i)if(i[o]!==e[o])return!1;if(wn.und(o)){if(a&&i.length===0&&e.length===0||s&&Object.keys(i).length===0&&Object.keys(e).length===0)return!0;if(i!==e)return!1}return!0}};function $4(i){i.type!=="Scene"&&(i.dispose==null||i.dispose());for(const e in i){const t=i[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const MC=["children","key","ref"];function e5(i){const e={};for(const t in i)MC.includes(t)||(e[t]=i[t]);return e}function ag(i,e,t,n){const r=i;let s=r?.__r3f;return s||(s={root:e,type:t,parent:null,children:[],props:e5(n),object:r,eventCount:0,handlers:{},isHidden:!1},r&&(r.__r3f=s)),s}function zf(i,e){let t=i[e];if(!e.includes("-"))return{root:i,key:e,target:t};t=i;for(const r of e.split("-")){var n;e=r,i=t,t=(n=t)==null?void 0:n[e]}return{root:i,key:e,target:t}}const zM=/-\d+$/;function og(i,e){if(wn.str(e.props.attach)){if(zM.test(e.props.attach)){const r=e.props.attach.replace(zM,""),{root:s,key:a}=zf(i.object,r);Array.isArray(s[a])||(s[a]=[])}const{root:t,key:n}=zf(i.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else wn.fun(e.props.attach)&&(e.previousAttach=e.props.attach(i.object,e.object))}function lg(i,e){if(wn.str(e.props.attach)){const{root:t,key:n}=zf(i.object,e.props.attach),r=e.previousAttach;r===void 0?delete t[n]:t[n]=r}else e.previousAttach==null||e.previousAttach(i.object,e.object);delete e.previousAttach}const rx=[...MC,"args","dispose","attach","object","onUpdate","dispose"],FM=new Map;function t5(i){let e=FM.get(i.constructor);try{e||(e=new i.constructor,FM.set(i.constructor,e))}catch{}return e}function n5(i,e){const t={};for(const n in e)if(!rx.includes(n)&&!wn.equ(e[n],i.props[n])){t[n]=e[n];for(const r in e)r.startsWith(`${n}-`)&&(t[r]=e[r])}for(const n in i.props){if(rx.includes(n)||e.hasOwnProperty(n))continue;const{root:r,key:s}=zf(i.object,n);if(r.constructor&&r.constructor.length===0){const a=t5(r);wn.und(a)||(t[s]=a[s])}else t[s]=0}return t}const i5=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],r5=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function da(i,e){var t;const n=i.__r3f,r=n&&xC(n).getState(),s=n?.eventCount;for(const o in e){let l=e[o];if(rx.includes(o))continue;if(n&&r5.test(o)){typeof l=="function"?n.handlers[o]=l:delete n.handlers[o],n.eventCount=Object.keys(n.handlers).length;continue}if(l===void 0)continue;let{root:c,key:h,target:d}=zf(i,o);if(d instanceof pu&&l instanceof pu)d.mask=l.mask;else if(d instanceof Ye&&Z4(l))d.set(l);else if(d!==null&&typeof d=="object"&&typeof d.set=="function"&&typeof d.copy=="function"&&l!=null&&l.constructor&&d.constructor===l.constructor)d.copy(l);else if(d!==null&&typeof d=="object"&&typeof d.set=="function"&&Array.isArray(l))typeof d.fromArray=="function"?d.fromArray(l):d.set(...l);else if(d!==null&&typeof d=="object"&&typeof d.set=="function"&&typeof l=="number")typeof d.setScalar=="function"?d.setScalar(l):d.set(l);else{var a;c[h]=l,r&&!r.linear&&i5.includes(h)&&(a=c[h])!=null&&a.isTexture&&c[h].format===Di&&c[h].type===Gr&&(c[h].colorSpace=Ri)}}if(n!=null&&n.parent&&r!=null&&r.internal&&(t=n.object)!=null&&t.isObject3D&&s!==n.eventCount){const o=n.object,l=r.internal.interaction.indexOf(o);l>-1&&r.internal.interaction.splice(l,1),n.eventCount&&o.raycast!==null&&r.internal.interaction.push(o)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Du(n),i}function Du(i){var e;if(!i.parent)return;i.props.onUpdate==null||i.props.onUpdate(i.object);const t=(e=i.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function s5(i,e){i.manual||(bC(i)?(i.left=e.width/-2,i.right=e.width/2,i.top=e.height/2,i.bottom=e.height/-2):i.aspect=e.width/e.height,i.updateProjectionMatrix())}const Ki=i=>i?.isObject3D;function zp(i){return(i.eventObject||i.object).uuid+"/"+i.index+i.instanceId}function wC(i,e,t,n){const r=t.get(e);r&&(t.delete(e),t.size===0&&(i.delete(n),r.target.releasePointerCapture(n)))}function a5(i,e){const{internal:t}=i.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,r)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((n,r)=>{wC(t.capturedMap,e,n,r)})}function o5(i){function e(l){const{internal:c}=i.getState(),h=l.offsetX-c.initialClick[0],d=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(h*h+d*d))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(h=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+h]}))}function n(l,c){const h=i.getState(),d=new Set,p=[],m=c?c(h.internal.interaction):h.internal.interaction;for(let g=0;g<m.length;g++){const b=zc(m[g]);b&&(b.raycaster.camera=void 0)}h.previousRoot||h.events.compute==null||h.events.compute(l,h);function v(g){const b=zc(g);if(!b||!b.events.enabled||b.raycaster.camera===null)return[];if(b.raycaster.camera===void 0){var E;b.events.compute==null||b.events.compute(l,b,(E=b.previousRoot)==null?void 0:E.getState()),b.raycaster.camera===void 0&&(b.raycaster.camera=null)}return b.raycaster.camera?b.raycaster.intersectObject(g,!0):[]}let x=m.flatMap(v).sort((g,b)=>{const E=zc(g.object),S=zc(b.object);return!E||!S?g.distance-b.distance:S.events.priority-E.events.priority||g.distance-b.distance}).filter(g=>{const b=zp(g);return d.has(b)?!1:(d.add(b),!0)});h.events.filter&&(x=h.events.filter(x,h));for(const g of x){let b=g.object;for(;b;){var _;(_=b.__r3f)!=null&&_.eventCount&&p.push({...g,eventObject:b}),b=b.parent}}if("pointerId"in l&&h.internal.capturedMap.has(l.pointerId))for(let g of h.internal.capturedMap.get(l.pointerId).values())d.has(zp(g.intersection))||p.push(g.intersection);return p}function r(l,c,h,d){if(l.length){const p={stopped:!1};for(const m of l){let v=zc(m.object);if(v||m.object.traverseAncestors(x=>{const _=zc(x);if(_)return v=_,!1}),v){const{raycaster:x,pointer:_,camera:g,internal:b}=v,E=new j(_.x,_.y,0).unproject(g),S=A=>{var D,L;return(D=(L=b.capturedMap.get(A))==null?void 0:L.has(m.eventObject))!=null?D:!1},w=A=>{const D={intersection:m,target:c.target};b.capturedMap.has(A)?b.capturedMap.get(A).set(m.eventObject,D):b.capturedMap.set(A,new Map([[m.eventObject,D]])),c.target.setPointerCapture(A)},T=A=>{const D=b.capturedMap.get(A);D&&wC(b.capturedMap,m.eventObject,D,A)};let R={};for(let A in c){let D=c[A];typeof D!="function"&&(R[A]=D)}let U={...m,...R,pointer:_,intersections:l,stopped:p.stopped,delta:h,unprojectedPoint:E,ray:x.ray,camera:g,stopPropagation(){const A="pointerId"in c&&b.capturedMap.get(c.pointerId);if((!A||A.has(m.eventObject))&&(U.stopped=p.stopped=!0,b.hovered.size&&Array.from(b.hovered.values()).find(D=>D.eventObject===m.eventObject))){const D=l.slice(0,l.indexOf(m));s([...D,m])}},target:{hasPointerCapture:S,setPointerCapture:w,releasePointerCapture:T},currentTarget:{hasPointerCapture:S,setPointerCapture:w,releasePointerCapture:T},nativeEvent:c};if(d(U),p.stopped===!0)break}}}return l}function s(l){const{internal:c}=i.getState();for(const h of c.hovered.values())if(!l.length||!l.find(d=>d.object===h.object&&d.index===h.index&&d.instanceId===h.instanceId)){const p=h.eventObject.__r3f;if(c.hovered.delete(zp(h)),p!=null&&p.eventCount){const m=p.handlers,v={...h,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function a(l,c){for(let h=0;h<c.length;h++){const d=c[h].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(l)}}function o(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:h}=i.getState();"pointerId"in c&&h.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(c.pointerId)&&(h.capturedMap.delete(c.pointerId),s([]))})}}return function(h){const{onPointerMissed:d,internal:p}=i.getState();p.lastEvent.current=h;const m=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=n(h,m?t:void 0),g=v?e(h):0;l==="onPointerDown"&&(p.initialClick=[h.offsetX,h.offsetY],p.initialHits=_.map(E=>E.eventObject)),v&&!_.length&&g<=2&&(a(h,p.interaction),d&&d(h)),m&&s(_);function b(E){const S=E.eventObject,w=S.__r3f;if(!(w!=null&&w.eventCount))return;const T=w.handlers;if(m){if(T.onPointerOver||T.onPointerEnter||T.onPointerOut||T.onPointerLeave){const R=zp(E),U=p.hovered.get(R);U?U.stopped&&E.stopPropagation():(p.hovered.set(R,E),T.onPointerOver==null||T.onPointerOver(E),T.onPointerEnter==null||T.onPointerEnter(E))}T.onPointerMove==null||T.onPointerMove(E)}else{const R=T[l];R?(!v||p.initialHits.includes(S))&&(a(h,p.interaction.filter(U=>!p.initialHits.includes(U))),R(E)):v&&p.initialHits.includes(S)&&a(h,p.interaction.filter(U=>!p.initialHits.includes(U)))}}r(_,h,g,b)}}return{handlePointer:o}}const BM=i=>!!(i!=null&&i.render),TC=K.createContext(null),l5=(i,e)=>{const t=U4((o,l)=>{const c=new j,h=new j,d=new j;function p(g=l().camera,b=h,E=l().size){const{width:S,height:w,top:T,left:R}=E,U=S/w;b.isVector3?d.copy(b):d.set(...b);const A=g.getWorldPosition(c).distanceTo(d);if(bC(g))return{width:S/g.zoom,height:w/g.zoom,top:T,left:R,factor:1,distance:A,aspect:U};{const D=g.fov*Math.PI/180,L=2*Math.tan(D/2)*A,P=L*(S/w);return{width:P,height:L,top:T,left:R,factor:S/P,distance:A,aspect:U}}}let m;const v=g=>o(b=>({performance:{...b.performance,current:g}})),x=new ke;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(g=1)=>i(l(),g),advance:(g,b)=>e(g,b,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new _1,pointer:x,mouse:x,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&v(g.performance.min),m=setTimeout(()=>v(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:g=>o(b=>({...b,events:{...b.events,...g}})),setSize:(g,b,E=0,S=0)=>{const w=l().camera,T={width:g,height:b,top:E,left:S};o(R=>({size:T,viewport:{...R.viewport,...p(w,h,T)}}))},setDpr:g=>o(b=>{const E=EC(g);return{viewport:{...b.viewport,dpr:E,initialDpr:b.viewport.initialDpr||E}}}),setFrameloop:(g="always")=>{const b=l().clock;b.stop(),b.elapsedTime=0,g!=="never"&&(b.start(),b.elapsedTime=0),o(()=>({frameloop:g}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:K.createRef(),active:!1,frames:0,priority:0,subscribe:(g,b,E)=>{const S=l().internal;return S.priority=S.priority+(b>0?1:0),S.subscribers.push({ref:g,priority:b,store:E}),S.subscribers=S.subscribers.sort((w,T)=>w.priority-T.priority),()=>{const w=l().internal;w!=null&&w.subscribers&&(w.priority=w.priority-(b>0?1:0),w.subscribers=w.subscribers.filter(T=>T.ref!==g))}}}}}),n=t.getState();let r=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:h,set:d}=t.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==s){r=l,s=c.dpr,s5(o,l),c.dpr>0&&h.setPixelRatio(c.dpr);const p=typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(l.width,l.height,p)}o!==a&&(a=o,d(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(o)}})))}),t.subscribe(o=>i(o)),t};function AC(){const i=K.useContext(TC);if(!i)throw new Error("R3F: Hooks can only be used within the Canvas component!");return i}function Jn(i=t=>t,e){return AC()(i,e)}function u0(i,e=0){const t=AC(),n=t.getState().internal.subscribe,r=SC(i);return rd(()=>n(r,e,t),[e,n,t]),null}function c5(i){const e=G4(i);return e.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:K.version}),e}const CC=0,vu={},u5=/^three(?=[A-Z])/,h0=i=>`${i[0].toUpperCase()}${i.slice(1)}`;let h5=0;const f5=i=>typeof i=="function";function RC(i){if(f5(i)){const e=`${h5++}`;return vu[e]=i,e}else Object.assign(vu,i)}function DC(i,e){const t=h0(i),n=vu[t];if(i!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(i==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function d5(i,e,t){var n;return i=h0(i)in vu?i:i.replace(u5,""),DC(i,e),i==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,ag(e.object,t,i,e)}function p5(i){if(!i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?lg(i.parent,i):Ki(i.object)&&(i.object.visible=!1),i.isHidden=!0,Du(i)}}function UC(i){if(i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?og(i.parent,i):Ki(i.object)&&i.props.visible!==!1&&(i.object.visible=!0),i.isHidden=!1,Du(i)}}function C1(i,e,t){const n=e.root.getState();if(!(!i.parent&&i.object!==n.scene)){if(!e.object){var r,s;const a=vu[h0(e.type)];e.object=(r=e.props.object)!=null?r:new a(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(da(e.object,e.props),e.props.attach)og(i,e);else if(Ki(e.object)&&Ki(i.object)){const a=i.object.children.indexOf(t?.object);if(t&&a!==-1){const o=i.object.children.indexOf(e.object);if(o!==-1){i.object.children.splice(o,1);const l=o<a?a-1:a;i.object.children.splice(l,0,e.object)}else e.object.parent=i.object,i.object.children.splice(a,0,e.object),e.object.dispatchEvent({type:"added"}),i.object.dispatchEvent({type:"childadded",child:e.object})}else i.object.add(e.object)}for(const a of e.children)C1(e,a);Du(e)}}function ky(i,e){e&&(e.parent=i,i.children.push(e),C1(i,e))}function kM(i,e,t){if(!e||!t)return;e.parent=i;const n=i.children.indexOf(t);n!==-1?i.children.splice(n,0,e):i.children.push(e),C1(i,e,t)}function OC(i){if(typeof i.dispose=="function"){const e=()=>{try{i.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():PM.unstable_scheduleCallback(PM.unstable_IdlePriority,e)}}function sx(i,e,t){if(!e)return;e.parent=null;const n=i.children.indexOf(e);n!==-1&&i.children.splice(n,1),e.props.attach?lg(i,e):Ki(e.object)&&Ki(i.object)&&(i.object.remove(e.object),a5(xC(e),e.object));const r=e.props.dispose!==null&&t!==!1;for(let s=e.children.length-1;s>=0;s--){const a=e.children[s];sx(e,a,r)}e.children.length=0,delete e.object.__r3f,r&&e.type!=="primitive"&&e.object.type!=="Scene"&&OC(e.object),t===void 0&&Du(e)}function m5(i,e){for(const t of[i,i.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const lm=[];function g5(){for(const[t]of lm){const n=t.parent;if(n){t.props.attach?lg(n,t):Ki(t.object)&&Ki(n.object)&&n.object.remove(t.object);for(const r of t.children)r.props.attach?lg(t,r):Ki(r.object)&&Ki(t.object)&&t.object.remove(r.object)}t.isHidden&&UC(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&OC(t.object)}for(const[t,n,r]of lm){t.props=n;const s=t.parent;if(s){var i,e;const a=vu[h0(t.type)];t.object=(i=t.props.object)!=null?i:new a(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,m5(r,t.object),da(t.object,t.props),t.props.attach?og(s,t):Ki(t.object)&&Ki(s.object)&&s.object.add(t.object);for(const o of t.children)o.props.attach?og(t,o):Ki(o.object)&&Ki(t.object)&&t.object.add(o.object);Du(t)}}lm.length=0}const Gy=()=>{},GM={};let Fp=CC;const v5=0,y5=4,ax=c5({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:d5,removeChild:sx,appendChild:ky,appendInitialChild:ky,insertBefore:kM,appendChildToContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||ky(t,e)},removeChildFromContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||sx(t,e)},insertInContainerBefore(i,e,t){const n=i.getState().scene.__r3f;!e||!t||!n||kM(n,e,t)},getRootHostContext:()=>GM,getChildHostContext:()=>GM,commitUpdate(i,e,t,n,r){var s,a,o;DC(e,n);let l=!1;if((i.type==="primitive"&&t.object!==n.object||((s=n.args)==null?void 0:s.length)!==((a=t.args)==null?void 0:a.length)||(o=n.args)!=null&&o.some((h,d)=>{var p;return h!==((p=t.args)==null?void 0:p[d])}))&&(l=!0),l)lm.push([i,{...n},r]);else{const h=n5(i,n);Object.keys(h).length&&(Object.assign(i.props,h),da(i.object,h))}(r.sibling===null||(r.flags&y5)===v5)&&g5()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:i=>i?.object,prepareForCommit:()=>null,preparePortalMount:i=>ag(i.getState().scene,i,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:p5,unhideInstance:UC,createTextInstance:Gy,hideTextInstance:Gy,unhideTextInstance:Gy,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:K.createContext(null),setCurrentUpdatePriority(i){Fp=i},getCurrentUpdatePriority(){return Fp},resolveUpdatePriority(){var i;if(Fp!==CC)return Fp;switch(typeof window<"u"&&((i=window.event)==null?void 0:i.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return rm.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return rm.ContinuousEventPriority;default:return rm.DefaultEventPriority}},resetFormInstance(){}}),Rl=new Map,Fc={objects:"shallow",strict:!1};function _5(i,e){if(!e&&typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&i.parentElement){const{width:t,height:n,top:r,left:s}=i.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:s}}else if(!e&&typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas)return{width:i.width,height:i.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function x5(i){const e=Rl.get(i),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=n||l5(cx,VM),a=t||ax.createContainer(s,rm.ConcurrentRoot,null,!1,null,"",r,r,r,null);e||Rl.set(i,{fiber:a,store:s});let o,l,c=!1,h=null;return{async configure(d={}){let p;h=new Promise(k=>p=k);let{gl:m,size:v,scene:x,events:_,onCreated:g,shadows:b=!1,linear:E=!1,flat:S=!1,legacy:w=!1,orthographic:T=!1,frameloop:R="always",dpr:U=[1,2],performance:A,raycaster:D,camera:L,onPointerMissed:P}=d,I=s.getState(),V=I.gl;if(!I.gl){const k={canvas:i,powerPreference:"high-performance",antialias:!0,alpha:!0},Y=typeof m=="function"?await m(k):m;BM(Y)?V=Y:V=new mC({...k,...m}),I.set({gl:V})}let H=I.raycaster;H||I.set({raycaster:H=new E1});const{params:z,...O}=D||{};if(wn.equ(O,H,Fc)||da(H,{...O}),wn.equ(z,H.params,Fc)||da(H,{params:{...H.params,...z}}),!I.camera||I.camera===l&&!wn.equ(l,L,Fc)){l=L;const k=L?.isCamera,Y=k?L:T?new Pl(0,0,0,0,.1,1e3):new Kn(75,0,.1,1e3);k||(Y.position.z=5,L&&(da(Y,L),Y.manual||("aspect"in L||"left"in L||"right"in L||"bottom"in L||"top"in L)&&(Y.manual=!0,Y.updateProjectionMatrix())),!I.camera&&!(L!=null&&L.rotation)&&Y.lookAt(0,0,0)),I.set({camera:Y}),H.camera=Y}if(!I.scene){let k;x!=null&&x.isScene?(k=x,ag(k,s,"",{})):(k=new Gg,ag(k,s,"",{}),x&&da(k,x)),I.set({scene:k})}_&&!I.events.handlers&&I.set({events:_(s)});const B=_5(i,v);if(wn.equ(B,I.size,Fc)||I.setSize(B.width,B.height,B.top,B.left),U&&I.viewport.dpr!==EC(U)&&I.setDpr(U),I.frameloop!==R&&I.setFrameloop(R),I.onPointerMissed||I.set({onPointerMissed:P}),A&&!wn.equ(A,I.performance,Fc)&&I.set(k=>({performance:{...k.performance,...A}})),!I.xr){var G;const k=(te,ee)=>{const ie=s.getState();ie.frameloop!=="never"&&VM(te,!0,ie,ee)},Y=()=>{const te=s.getState();te.gl.xr.enabled=te.gl.xr.isPresenting,te.gl.xr.setAnimationLoop(te.gl.xr.isPresenting?k:null),te.gl.xr.isPresenting||cx(te)},Q={connect(){const te=s.getState().gl;te.xr.addEventListener("sessionstart",Y),te.xr.addEventListener("sessionend",Y)},disconnect(){const te=s.getState().gl;te.xr.removeEventListener("sessionstart",Y),te.xr.removeEventListener("sessionend",Y)}};typeof((G=V.xr)==null?void 0:G.addEventListener)=="function"&&Q.connect(),I.set({xr:Q})}if(V.shadowMap){const k=V.shadowMap.enabled,Y=V.shadowMap.type;if(V.shadowMap.enabled=!!b,wn.boo(b))V.shadowMap.type=rf;else if(wn.str(b)){var X;const Q={basic:bA,percentage:Ag,soft:rf,variance:is};V.shadowMap.type=(X=Q[b])!=null?X:rf}else wn.obj(b)&&Object.assign(V.shadowMap,b);(k!==V.shadowMap.enabled||Y!==V.shadowMap.type)&&(V.shadowMap.needsUpdate=!0)}return Gt.enabled=!w,c||(V.outputColorSpace=E?uo:Ri,V.toneMapping=S?Ts:zx),I.legacy!==w&&I.set(()=>({legacy:w})),I.linear!==E&&I.set(()=>({linear:E})),I.flat!==S&&I.set(()=>({flat:S})),m&&!wn.fun(m)&&!BM(m)&&!wn.equ(m,V,Fc)&&da(V,m),o=g,c=!0,p(),this},render(d){return!c&&!h&&this.configure(),h.then(()=>{ax.updateContainer(he.jsx(b5,{store:s,children:d,onCreated:o,rootElement:i}),a,null,()=>{})}),s},unmount(){LC(i)}}}function b5({store:i,children:e,onCreated:t,rootElement:n}){return rd(()=>{const r=i.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),i.getState().events.connected||r.events.connect==null||r.events.connect(n)},[]),he.jsx(TC.Provider,{value:i,children:e})}function LC(i,e){const t=Rl.get(i),n=t?.fiber;if(n){const r=t?.store.getState();r&&(r.internal.active=!1),ax.updateContainer(null,n,null,()=>{r&&setTimeout(()=>{try{var s,a,o,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=r.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),$4(r.scene),Rl.delete(i)}catch{}},500)})}}function S5(i,e){const t={callback:i};return e.add(t),()=>void e.delete(t)}const IC=new Set,E5=new Set,M5=new Set,w5=i=>S5(i,IC);function Hy(i,e){if(i.size)for(const{callback:t}of i.values())t(e)}function df(i,e){switch(i){case"before":return Hy(IC,e);case"after":return Hy(E5,e);case"tail":return Hy(M5,e)}}let Vy,Wy;function ox(i,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof i=="number"&&(n=i-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=i),Vy=e.internal.subscribers;for(let r=0;r<Vy.length;r++)Wy=Vy[r],Wy.ref.current(Wy.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let cg=!1,lx=!1,Xy,HM,Bc;function NC(i){HM=requestAnimationFrame(NC),cg=!0,Xy=0,df("before",i),lx=!0;for(const t of Rl.values()){var e;Bc=t.store.getState(),Bc.internal.active&&(Bc.frameloop==="always"||Bc.internal.frames>0)&&!((e=Bc.gl.xr)!=null&&e.isPresenting)&&(Xy+=ox(i,Bc))}if(lx=!1,df("after",i),Xy===0)return df("tail",i),cg=!1,cancelAnimationFrame(HM)}function cx(i,e=1){var t;if(!i)return Rl.forEach(n=>cx(n.store.getState(),e));(t=i.gl.xr)!=null&&t.isPresenting||!i.internal.active||i.frameloop==="never"||(e>1?i.internal.frames=Math.min(60,i.internal.frames+e):lx?i.internal.frames=2:i.internal.frames=1,cg||(cg=!0,requestAnimationFrame(NC)))}function VM(i,e=!0,t,n){if(e&&df("before",i),t)ox(i,t,n);else for(const r of Rl.values())ox(i,r.store.getState());e&&df("after",i)}const jy={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function T5(i){const{handlePointer:e}=o5(i);return{priority:1,enabled:!0,compute(t,n,r){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(jy).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:r}=i.getState();(t=r.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{const{set:n,events:r}=i.getState();if(r.disconnect==null||r.disconnect(),n(s=>({events:{...s.events,connected:t}})),r.handlers)for(const s in r.handlers){const a=r.handlers[s],[o,l]=jy[s];t.addEventListener(o,a,{passive:l})}},disconnect:()=>{const{set:t,events:n}=i.getState();if(n.connected){if(n.handlers)for(const r in n.handlers){const s=n.handlers[r],[a]=jy[r];n.connected.removeEventListener(a,s)}t(r=>({events:{...r.events,connected:void 0}}))}}}}function WM(i,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>i(...n),e)}}function A5({debounce:i,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=K.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=K.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=i?typeof i=="number"?i:i.scroll:null,c=i?typeof i=="number"?i:i.resize:null,h=K.useRef(!1);K.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[d,p,m]=K.useMemo(()=>{const g=()=>{if(!o.current.element)return;const{left:b,top:E,width:S,height:w,bottom:T,right:R,x:U,y:A}=o.current.element.getBoundingClientRect(),D={left:b,top:E,width:S,height:w,bottom:T,right:R,x:U,y:A};o.current.element instanceof HTMLElement&&n&&(D.height=o.current.element.offsetHeight,D.width=o.current.element.offsetWidth),Object.freeze(D),h.current&&!U5(o.current.lastBounds,D)&&a(o.current.lastBounds=D)};return[g,c?WM(g,c):g,l?WM(g,l):g]},[a,n,l,c]);function v(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(g=>g.removeEventListener("scroll",m,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function x(){o.current.element&&(o.current.resizeObserver=new r(m),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(g=>g.addEventListener("scroll",m,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const _=g=>{!g||g===o.current.element||(v(),o.current.element=g,o.current.scrollContainers=PC(g),x())};return R5(m,!!e),C5(p),K.useEffect(()=>{v(),x()},[e,m,p]),K.useEffect(()=>v,[]),[_,s,d]}function C5(i){K.useEffect(()=>{const e=i;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[i])}function R5(i,e){K.useEffect(()=>{if(e){const t=i;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[i,e])}function PC(i){const e=[];if(!i||i===document.body)return e;const{overflow:t,overflowX:n,overflowY:r}=window.getComputedStyle(i);return[t,n,r].some(s=>s==="auto"||s==="scroll")&&e.push(i),[...e,...PC(i.parentElement)]}const D5=["x","y","top","bottom","left","right","width","height"],U5=(i,e)=>D5.every(t=>i[t]===e[t]);function O5({ref:i,children:e,fallback:t,resize:n,style:r,gl:s,events:a=T5,eventSource:o,eventPrefix:l,shadows:c,linear:h,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:b,scene:E,onPointerMissed:S,onCreated:w,...T}){K.useMemo(()=>RC(gC),[]);const R=K4(),[U,A]=A5({scroll:!0,debounce:{scroll:50,resize:0},...n}),D=K.useRef(null),L=K.useRef(null);K.useImperativeHandle(i,()=>D.current);const P=SC(S),[I,V]=K.useState(!1),[H,z]=K.useState(!1);if(I)throw I;if(H)throw H;const O=K.useRef(null);rd(()=>{const G=D.current;if(A.width>0&&A.height>0&&G){O.current||(O.current=x5(G));async function X(){await O.current.configure({gl:s,scene:E,events:a,shadows:c,linear:h,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:b,size:A,onPointerMissed:(...k)=>P.current==null?void 0:P.current(...k),onCreated:k=>{k.events.connect==null||k.events.connect(o?Y4(o)?o.current:o:L.current),l&&k.setEvents({compute:(Y,Q)=>{const te=Y[l+"X"],ee=Y[l+"Y"];Q.pointer.set(te/Q.size.width*2-1,-(ee/Q.size.height)*2+1),Q.raycaster.setFromCamera(Q.pointer,Q.camera)}}),w?.(k)}}),O.current.render(he.jsx(R,{children:he.jsx(Q4,{set:z,children:he.jsx(K.Suspense,{fallback:he.jsx(J4,{set:V}),children:e??null})})}))}X()}}),K.useEffect(()=>{const G=D.current;if(G)return()=>LC(G)},[]);const B=o?"none":"auto";return he.jsx("div",{ref:L,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:B,...r},...T,children:he.jsx("div",{ref:U,style:{width:"100%",height:"100%"},children:he.jsx("canvas",{ref:D,style:{display:"block"},children:t})})})}function L5(i){return he.jsx(yC,{children:he.jsx(O5,{...i})})}const Mn={LEFT:1,RIGHT:2,MIDDLE:4},Re=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),kc={NONE:0,IN:1,OUT:-1};function al(i){return i.isPerspectiveCamera}function no(i){return i.isOrthographicCamera}const $a=Math.PI*2,XM=Math.PI/2,zC=1e-5,wh=Math.PI/180;function ns(i,e,t){return Math.max(e,Math.min(t,i))}function pn(i,e=zC){return Math.abs(i)<e}function nn(i,e,t=zC){return pn(i-e,t)}function jM(i,e){return Math.round(i/e)*e}function Th(i){return isFinite(i)?i:i<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Ah(i){return Math.abs(i)<Number.MAX_VALUE?i:i*(1/0)}function Bp(i,e,t,n,r=1/0,s){n=Math.max(1e-4,n);const a=2/n,o=a*s,l=1/(1+o+.48*o*o+.235*o*o*o);let c=i-e;const h=e,d=r*n;c=ns(c,-d,d),e=i-c;const p=(t.value+a*c)*s;t.value=(t.value-a*p)*l;let m=e+(c+p)*l;return h-i>0==m>h&&(m=h,t.value=(m-h)/s),m}function qM(i,e,t,n,r=1/0,s,a){n=Math.max(1e-4,n);const o=2/n,l=o*s,c=1/(1+l+.48*l*l+.235*l*l*l);let h=e.x,d=e.y,p=e.z,m=i.x-h,v=i.y-d,x=i.z-p;const _=h,g=d,b=p,E=r*n,S=E*E,w=m*m+v*v+x*x;if(w>S){const H=Math.sqrt(w);m=m/H*E,v=v/H*E,x=x/H*E}h=i.x-m,d=i.y-v,p=i.z-x;const T=(t.x+o*m)*s,R=(t.y+o*v)*s,U=(t.z+o*x)*s;t.x=(t.x-o*T)*c,t.y=(t.y-o*R)*c,t.z=(t.z-o*U)*c,a.x=h+(m+T)*c,a.y=d+(v+R)*c,a.z=p+(x+U)*c;const A=_-i.x,D=g-i.y,L=b-i.z,P=a.x-_,I=a.y-g,V=a.z-b;return A*P+D*I+L*V>0&&(a.x=_,a.y=g,a.z=b,t.x=(a.x-_)/s,t.y=(a.y-g)/s,t.z=(a.z-b)/s),a}function qy(i,e){e.set(0,0),i.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=i.length,e.y/=i.length}function Yy(i,e){return no(i)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let I5=class{_listeners={};addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e)}}};const N5="3.1.1",kp=1/8,P5=/Mac/.test(globalThis?.navigator?.platform);let Mt,YM,Gp,Zy,Yi,Lt,Kt,Gc,Ch,ys,_s,ol,ZM,KM,vr,Hc,Vc,JM,Ky,QM,Jy,Qy,Hp,ni=class ux extends I5{static install(e){Mt=e.THREE,YM=Object.freeze(new Mt.Vector3(0,0,0)),Gp=Object.freeze(new Mt.Vector3(0,1,0)),Zy=Object.freeze(new Mt.Vector3(0,0,1)),Yi=new Mt.Vector2,Lt=new Mt.Vector3,Kt=new Mt.Vector3,Gc=new Mt.Vector3,Ch=new Mt.Vector3,ys=new Mt.Vector3,_s=new Mt.Vector3,ol=new Mt.Vector3,ZM=new Mt.Vector3,KM=new Mt.Vector3,vr=new Mt.Spherical,Hc=new Mt.Spherical,Vc=new Mt.Box3,JM=new Mt.Box3,Ky=new Mt.Sphere,QM=new Mt.Quaternion,Jy=new Mt.Quaternion,Qy=new Mt.Matrix4,Hp=new Mt.Raycaster}static get ACTION(){return Re}minPolarAngle=0;maxPolarAngle=Math.PI;minAzimuthAngle=-1/0;maxAzimuthAngle=1/0;minDistance=Number.EPSILON;maxDistance=1/0;infinityDolly=!1;minZoom=.01;maxZoom=1/0;smoothTime=.25;draggingSmoothTime=.125;maxSpeed=1/0;azimuthRotateSpeed=1;polarRotateSpeed=1;dollySpeed=1;dollyDragInverted=!1;truckSpeed=2;dollyToCursor=!1;dragToOffset=!1;boundaryFriction=0;restThreshold=.01;colliderMeshes=[];mouseButtons;touches;cancel=()=>{};lockPointer;unlockPointer;_enabled=!0;_camera;_yAxisUpSpace;_yAxisUpSpaceInverse;_state=Re.NONE;_domElement;_viewport=null;_target;_targetEnd;_focalOffset;_focalOffsetEnd;_spherical;_sphericalEnd;_lastDistance;_zoom;_zoomEnd;_lastZoom;_cameraUp0;_target0;_position0;_zoom0;_focalOffset0;_dollyControlCoord;_changedDolly=0;_changedZoom=0;_nearPlaneCorners;_hasRested=!0;_boundary;_boundaryEnclosesCamera=!1;_needsUpdate=!0;_updatedLastTime=!1;_elementRect=new DOMRect;_isDragging=!1;_dragNeedsUpdate=!0;_activePointers=[];_lockedPointer=null;_interactiveArea=new DOMRect(0,0,1,1);_isUserControllingRotate=!1;_isUserControllingDolly=!1;_isUserControllingTruck=!1;_isUserControllingOffset=!1;_isUserControllingZoom=!1;_lastDollyDirection=kc.NONE;_thetaVelocity={value:0};_phiVelocity={value:0};_radiusVelocity={value:0};_targetVelocity=new Mt.Vector3;_focalOffsetVelocity=new Mt.Vector3;_zoomVelocity={value:0};set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),typeof Mt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new Mt.Quaternion().setFromUnitVectors(this._camera.up,Gp),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=Re.NONE,this._target=new Mt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new Mt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new Mt.Spherical().setFromVector3(Lt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new Mt.Vector3,new Mt.Vector3,new Mt.Vector3,new Mt.Vector3],this._updateNearPlaneCorners(),this._boundary=new Mt.Box3(new Mt.Vector3(-1/0,-1/0,-1/0),new Mt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new Mt.Vector2,this.mouseButtons={left:Re.ROTATE,middle:Re.DOLLY,right:Re.TRUCK,wheel:al(this._camera)?Re.DOLLY:no(this._camera)?Re.ZOOM:Re.NONE},this.touches={one:Re.TOUCH_ROTATE,two:al(this._camera)?Re.TOUCH_DOLLY_TRUCK:no(this._camera)?Re.TOUCH_ZOOM_TRUCK:Re.NONE,three:Re.TOUCH_TRUCK};const n=new Mt.Vector2,r=new Mt.Vector2,s=new Mt.Vector2,a=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),w=g.clientX/S.width,T=g.clientY/S.height;if(w<this._interactiveArea.left||w>this._interactiveArea.right||T<this._interactiveArea.top||T>this._interactiveArea.bottom)return}const b=g.pointerType!=="mouse"?null:(g.buttons&Mn.LEFT)===Mn.LEFT?Mn.LEFT:(g.buttons&Mn.MIDDLE)===Mn.MIDDLE?Mn.MIDDLE:(g.buttons&Mn.RIGHT)===Mn.RIGHT?Mn.RIGHT:null;if(b!==null){const S=this._findPointerByMouseButton(b);S&&this._disposePointer(S)}if((g.buttons&Mn.LEFT)===Mn.LEFT&&this._lockedPointer)return;const E={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:b};this._activePointers.push(E),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,p(g)},o=g=>{g.cancelable&&g.preventDefault();const b=g.pointerId,E=this._lockedPointer||this._findPointerById(b);if(E){if(E.clientX=g.clientX,E.clientY=g.clientY,E.deltaX=g.movementX,E.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&Mn.LEFT)===Mn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&Mn.MIDDLE)===Mn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&Mn.RIGHT)===Mn.RIGHT&&(this._state=this._state|this.mouseButtons.right);m()}},l=g=>{const b=this._findPointerById(g.pointerId);if(!(b&&b===this._lockedPointer)){if(b&&this._disposePointer(b),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=Re.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=Re.NONE;v()}};let c=-1;const h=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===Re.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const T=this._domElement.getBoundingClientRect(),R=g.clientX/T.width,U=g.clientY/T.height;if(R<this._interactiveArea.left||R>this._interactiveArea.right||U<this._interactiveArea.top||U>this._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===Re.ROTATE||this.mouseButtons.wheel===Re.TRUCK){const T=performance.now();c-T<1e3&&this._getClientRect(this._elementRect),c=T}const b=P5?-1:-3,E=g.deltaMode===1||g.ctrlKey?g.deltaY/b:g.deltaY/(b*10),S=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case Re.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case Re.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case Re.SCREEN_PAN:{this._truckInternal(g.deltaX,g.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case Re.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case Re.DOLLY:{this._dollyInternal(-E,S,w),this._isUserControllingDolly=!0;break}case Re.ZOOM:{this._zoomInternal(-E,S,w),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},d=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===ux.ACTION.NONE){const b=g instanceof PointerEvent?g.pointerId:0,E=this._findPointerById(b);E&&this._disposePointer(E),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}g.preventDefault()}},p=g=>{if(!this._enabled)return;if(qy(this._activePointers,Yi),this._getClientRect(this._elementRect),n.copy(Yi),r.copy(Yi),this._activePointers.length>=2){const E=Yi.x-this._activePointers[1].clientX,S=Yi.y-this._activePointers[1].clientY,w=Math.sqrt(E*E+S*S);s.set(0,w);const T=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,R=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;r.set(T,R)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&Mn.LEFT)===Mn.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&Mn.MIDDLE)===Mn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&Mn.RIGHT)===Mn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&Re.ROTATE)===Re.ROTATE||(this._state&Re.TOUCH_ROTATE)===Re.TOUCH_ROTATE||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&Re.TRUCK)===Re.TRUCK||(this._state&Re.SCREEN_PAN)===Re.SCREEN_PAN||(this._state&Re.TOUCH_TRUCK)===Re.TOUCH_TRUCK||(this._state&Re.TOUCH_SCREEN_PAN)===Re.TOUCH_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&Re.DOLLY)===Re.DOLLY||(this._state&Re.TOUCH_DOLLY)===Re.TOUCH_DOLLY||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&Re.ZOOM)===Re.ZOOM||(this._state&Re.TOUCH_ZOOM)===Re.TOUCH_ZOOM||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_ZOOM_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&Re.OFFSET)===Re.OFFSET||(this._state&Re.TOUCH_OFFSET)===Re.TOUCH_OFFSET||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},m=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,qy(this._activePointers,Yi);const b=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,E=b?-b.deltaX:r.x-Yi.x,S=b?-b.deltaY:r.y-Yi.y;if(r.copy(Yi),((this._state&Re.ROTATE)===Re.ROTATE||(this._state&Re.TOUCH_ROTATE)===Re.TOUCH_ROTATE||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(E,S),this._isUserControllingRotate=!0),(this._state&Re.DOLLY)===Re.DOLLY||(this._state&Re.ZOOM)===Re.ZOOM){const w=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,T=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,R=this.dollyDragInverted?-1:1;(this._state&Re.DOLLY)===Re.DOLLY?(this._dollyInternal(R*S*kp,w,T),this._isUserControllingDolly=!0):(this._zoomInternal(R*S*kp,w,T),this._isUserControllingZoom=!0)}if((this._state&Re.TOUCH_DOLLY)===Re.TOUCH_DOLLY||(this._state&Re.TOUCH_ZOOM)===Re.TOUCH_ZOOM||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_ZOOM_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_ZOOM_ROTATE)===Re.TOUCH_ZOOM_ROTATE){const w=Yi.x-this._activePointers[1].clientX,T=Yi.y-this._activePointers[1].clientY,R=Math.sqrt(w*w+T*T),U=s.y-R;s.set(0,R);const A=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&Re.TOUCH_DOLLY)===Re.TOUCH_DOLLY||(this._state&Re.TOUCH_DOLLY_ROTATE)===Re.TOUCH_DOLLY_ROTATE||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET?(this._dollyInternal(U*kp,A,D),this._isUserControllingDolly=!0):(this._zoomInternal(U*kp,A,D),this._isUserControllingZoom=!0)}((this._state&Re.TRUCK)===Re.TRUCK||(this._state&Re.TOUCH_TRUCK)===Re.TOUCH_TRUCK||(this._state&Re.TOUCH_DOLLY_TRUCK)===Re.TOUCH_DOLLY_TRUCK||(this._state&Re.TOUCH_ZOOM_TRUCK)===Re.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(E,S,!1,!1),this._isUserControllingTruck=!0),((this._state&Re.SCREEN_PAN)===Re.SCREEN_PAN||(this._state&Re.TOUCH_SCREEN_PAN)===Re.TOUCH_SCREEN_PAN||(this._state&Re.TOUCH_DOLLY_SCREEN_PAN)===Re.TOUCH_DOLLY_SCREEN_PAN||(this._state&Re.TOUCH_ZOOM_SCREEN_PAN)===Re.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(E,S,!1,!0),this._isUserControllingTruck=!0),((this._state&Re.OFFSET)===Re.OFFSET||(this._state&Re.TOUCH_OFFSET)===Re.TOUCH_OFFSET||(this._state&Re.TOUCH_DOLLY_OFFSET)===Re.TOUCH_DOLLY_OFFSET||(this._state&Re.TOUCH_ZOOM_OFFSET)===Re.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(E,S,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},v=()=>{qy(this._activePointers,Yi),r.copy(Yi),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",x),this._domElement.ownerDocument.addEventListener("pointerlockerror",_),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),p())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),this._domElement?.ownerDocument.exitPointerLock(),this._domElement?.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement?.ownerDocument.removeEventListener("pointerlockerror",_),this.cancel()};const x=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},_=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",h,{passive:!1}),this._domElement.addEventListener("contextmenu",d)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",h,{passive:!1}),this._domElement.removeEventListener("contextmenu",d),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))},this.cancel=()=>{this._state!==Re.NONE&&(this._state=Re.NONE,this._activePointers.length=0,v())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ns(e.width,0,1),this._interactiveArea.height=ns(e.height,0,1),this._interactiveArea.x=ns(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ns(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const r=ns(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=ns(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=r,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!n||nn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&nn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=kc.NONE,this._changedDolly=0,this._dollyToNoClamp(ns(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=nn(a,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||nn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ch).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ns(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||nn(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),ys.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),ys.multiplyScalar(e),_s.multiplyScalar(-t);const r=Lt.copy(ys).add(_s),s=Kt.copy(this._targetEnd).add(r);return this.moveTo(s.x,s.y,s.z,n)}forward(e,t=!1){Lt.setFromMatrixColumn(this._camera.matrix,0),Lt.crossVectors(this._camera.up,Lt),Lt.multiplyScalar(e);const n=Kt.copy(this._targetEnd).add(Lt);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return Lt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Lt.x,this._targetEnd.y+Lt.y,this._targetEnd.z+Lt.z,t)}moveTo(e,t,n,r=!1){this._isUserControllingTruck=!1;const s=Lt.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,r||this._target.copy(this._targetEnd);const a=!r||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,n,r=!1){const o=Lt.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,r)}fitToBox(e,t,{cover:n=!1,paddingLeft:r=0,paddingRight:s=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?Vc.copy(e):Vc.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=jM(this._sphericalEnd.theta,XM),d=jM(this._sphericalEnd.phi,XM);l.push(this.rotateTo(h,d,t));const p=Lt.setFromSpherical(this._sphericalEnd).normalize(),m=QM.setFromUnitVectors(p,Zy),v=nn(Math.abs(p.y),1);v&&m.multiply(Jy.setFromAxisAngle(Gp,h)),m.multiply(this._yAxisUpSpaceInverse);const x=JM.makeEmpty();Kt.copy(c.min).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.min).setX(c.max.x).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.min).setY(c.max.y).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).setZ(c.min.z).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.min).setZ(c.max.z).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).setY(c.min.y).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).setX(c.min.x).applyQuaternion(m),x.expandByPoint(Kt),Kt.copy(c.max).applyQuaternion(m),x.expandByPoint(Kt),x.min.x-=r,x.min.y-=a,x.max.x+=s,x.max.y+=o,m.setFromUnitVectors(Zy,p),v&&m.premultiply(Jy.invert()),m.premultiply(this._yAxisUpSpace);const _=x.getSize(Lt),g=x.getCenter(Kt).applyQuaternion(m);if(al(this._camera)){const b=this.getDistanceToFitBox(_.x,_.y,_.z,n);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(no(this._camera)){const b=this._camera,E=b.right-b.left,S=b.top-b.bottom,w=n?Math.max(E/_.x,S/_.y):Math.min(E/_.x,S/_.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(w,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],s="isObject3D"in e?ux.createBoundingSphere(e,Ky):Ky.copy(e);if(n.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),al(this._camera)){const a=this.getDistanceToFitSphere(s.radius);n.push(this.dollyTo(a,t))}else if(no(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*s.radius,c=Math.min(a/l,o/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,r,s,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=kc.NONE,this._changedDolly=0;const l=Kt.set(r,s,a),c=Lt.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!o||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold)&&nn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&nn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&nn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerp(e,t,n,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=kc.NONE,this._changedDolly=0;const s=Lt.set(...e.target);if("spherical"in e)vr.set(...e.spherical);else{const d=Kt.set(...e.position);vr.setFromVector3(d.sub(s).applyQuaternion(this._yAxisUpSpace))}const a=Gc.set(...t.target);if("spherical"in t)Hc.set(...t.spherical);else{const d=Kt.set(...t.position);Hc.setFromVector3(d.sub(a).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(s.lerp(a,n));const o=Hc.theta-vr.theta,l=Hc.phi-vr.phi,c=Hc.radius-vr.radius;this._sphericalEnd.set(vr.radius+c*n,vr.phi+l*n,vr.theta+o*n),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!r||nn(this._target.x,this._targetEnd.x,this.restThreshold)&&nn(this._target.y,this._targetEnd.y,this.restThreshold)&&nn(this._target.z,this._targetEnd.z,this.restThreshold)&&nn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&nn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&nn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,n,r,s,a,o,l,c,h,d,p,m,v=!1){return this.lerp({position:[e,t,n],target:[r,s,a]},{position:[o,l,c],target:[h,d,p]},m,v)}setPosition(e,t,n,r=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,r)}setTarget(e,t,n,r=!1){const s=this.getPosition(Lt),a=this.setLookAt(s.x,s.y,s.z,e,t,n,r);return this._sphericalEnd.phi=ns(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,n,r=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,r||this._focalOffset.copy(this._focalOffsetEnd);const s=!r||nn(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&nn(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&nn(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),ys.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_s.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ol.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const r=Lt.set(e,t,n),s=r.distanceTo(this._camera.position),a=r.sub(this._camera.position);ys.multiplyScalar(a.x),_s.multiplyScalar(a.y),ol.multiplyScalar(a.z),Lt.copy(ys).add(_s).add(ol),Lt.z=Lt.z+s,this.dollyTo(s,!1),this.setFocalOffset(-Lt.x,Lt.y,-Lt.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,r){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new Mt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,r):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,r=!1){if(Yy(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,a=this._camera.getEffectiveFOV()*wh,o=this._camera.aspect;return((r?s>o:s<o)?t:e/o)*.5/Math.tan(a*.5)+n*.5}getDistanceToFitSphere(e){if(Yy(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*wh,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,r=1<this._camera.aspect?t:n;return e/Math.sin(r*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new Mt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new Mt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new Mt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new Mt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%$a+$a)%$a,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=$a),this._spherical.theta+=$a*Math.round((this._sphericalEnd.theta-this._spherical.theta)/$a),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!nn(this._camera.up.x,this._cameraUp0.x)||!nn(this._camera.up.y,this._cameraUp0.y)||!nn(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(Lt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Gp),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=Lt.subVectors(this._target,this._camera.position).normalize(),t=Kt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(Lt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,r=this._sphericalEnd.radius-this._spherical.radius,s=ZM.subVectors(this._targetEnd,this._target),a=KM.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(pn(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Bp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(pn(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Bp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(pn(r))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Bp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(pn(s.x)&&pn(s.y)&&pn(s.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;qM(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(pn(a.x)&&pn(a.y)&&pn(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;qM(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(pn(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Bp(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(al(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,p=this._camera,m=this._getCameraDirection(Ch),v=Lt.copy(m).cross(p.up).normalize();v.lengthSq()===0&&(v.x=1);const x=Kt.crossVectors(v,m),_=this._sphericalEnd.radius*Math.tan(p.getEffectiveFOV()*wh*.5),b=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,E=Gc.copy(this._targetEnd).add(v.multiplyScalar(this._dollyControlCoord.x*_*p.aspect)).add(x.multiplyScalar(this._dollyControlCoord.y*_)),S=Lt.copy(this._targetEnd).lerp(E,b),w=this._lastDollyDirection===kc.IN&&this._spherical.radius<=this.minDistance,T=this._lastDollyDirection===kc.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(w||T)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const U=Kt.copy(m).multiplyScalar(-d);S.add(U)}this._boundary.clampPoint(S,S);const R=Kt.subVectors(S,this._targetEnd);this._targetEnd.copy(S),this._target.add(R),this._changedDolly-=d,pn(this._changedDolly)&&(this._changedDolly=0)}else if(no(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,p=this._camera,m=Lt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(p.near+p.far)/(p.near-p.far)).unproject(p),v=Kt.set(0,0,-1).applyQuaternion(p.quaternion),x=Gc.copy(m).add(v.multiplyScalar(-m.dot(p.up))),g=-(this._zoom-d-this._zoom)/this._zoom,b=this._getCameraDirection(Ch),E=this._targetEnd.dot(b),S=Lt.copy(this._targetEnd).lerp(x,g),w=S.dot(b),T=b.multiplyScalar(w-E);S.sub(T),this._boundary.clampPoint(S,S);const R=Kt.subVectors(S,this._targetEnd);this._targetEnd.copy(S),this._target.add(R),this._changedZoom-=d,pn(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!pn(this._focalOffset.x)||!pn(this._focalOffset.y)||!pn(this._focalOffset.z))&&(this._camera.matrix.compose(this._camera.position,this._camera.quaternion,this._camera.scale),ys.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),ol.setFromMatrixColumn(this._camera.matrix,2),ys.multiplyScalar(this._focalOffset.x),_s.multiplyScalar(-this._focalOffset.y),ol.multiplyScalar(this._focalOffset.z),Lt.copy(ys).add(_s).add(ol),this._camera.position.add(Lt),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Lt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),pn(t,this.restThreshold)&&pn(n,this.restThreshold)&&pn(r,this.restThreshold)&&pn(s.x,this.restThreshold)&&pn(s.y,this.restThreshold)&&pn(s.z,this.restThreshold)&&pn(a.x,this.restThreshold)&&pn(a.y,this.restThreshold)&&pn(a.z,this.restThreshold)&&pn(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Th(this.maxDistance),minZoom:this.minZoom,maxZoom:Th(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Th(this.maxPolarAngle),minAzimuthAngle:Th(this.minAzimuthAngle),maxAzimuthAngle:Th(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:Lt.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Ah(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Ah(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Ah(n.maxPolarAngle),this.minAzimuthAngle=Ah(n.minAzimuthAngle),this.maxAzimuthAngle=Ah(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),vr.setFromVector3(Lt.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(vr.theta,vr.phi,t),this.dollyTo(vr.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",N5),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const r=t.lengthSq();if(r===0)return e;const s=Kt.copy(t).add(e),o=this._boundary.clampPoint(s,Gc).sub(s),l=o.lengthSq();if(l===0)return e.add(t);if(l===r)return e;if(n===0)return e.add(t).add(o);{const c=1+n*l/t.dot(o);return e.add(Kt.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(al(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*wh,r=Math.tan(n*.5)*t,s=r*e.aspect;this._nearPlaneCorners[0].set(-s,-r,0),this._nearPlaneCorners[1].set(s,-r,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(-s,r,0)}else if(no(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,r=e.right*t,s=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(n,s,0),this._nearPlaneCorners[1].set(r,s,0),this._nearPlaneCorners[2].set(r,a,0),this._nearPlaneCorners[3].set(n,a,0)}}_truckInternal=(e,t,n,r)=>{let s,a;if(al(this._camera)){const o=Lt.copy(this._camera.position).sub(this._target),l=this._camera.getEffectiveFOV()*wh,c=o.length()*Math.tan(l*.5);s=this.truckSpeed*e*c/this._elementRect.height,a=this.truckSpeed*t*c/this._elementRect.height}else if(no(this._camera)){const o=this._camera;s=this.truckSpeed*e*(o.right-o.left)/o.zoom/this._elementRect.width,a=this.truckSpeed*t*(o.top-o.bottom)/o.zoom/this._elementRect.height}else return;r?(n?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(s,0,!0),this.forward(-a,!0)):n?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(s,a,!0)};_rotateInternal=(e,t)=>{const n=$a*this.azimuthRotateSpeed*e/this._elementRect.height,r=$a*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(n,r,!0)};_dollyInternal=(e,t,n)=>{const r=Math.pow(.95,-e*this.dollySpeed),s=this._sphericalEnd.radius,a=this._sphericalEnd.radius*r,o=ns(a,this.minDistance,this.maxDistance),l=o-a;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(l,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-s,this._dollyControlCoord.set(t,n)),this._lastDollyDirection=Math.sign(-e)};_zoomInternal=(e,t,n)=>{const r=Math.pow(.95,e*this.dollySpeed),s=this._zoom,a=this._zoom*r;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-s,this._dollyControlCoord.set(t,n))};_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Yy(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ch);Qy.lookAt(YM,n,this._camera.up);for(let r=0;r<4;r++){const s=Kt.copy(this._nearPlaneCorners[r]);s.applyMatrix4(Qy);const a=Gc.addVectors(this._target,s);Hp.set(a,n),Hp.far=this._spherical.radius+1;const o=Hp.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new Mt.Sphere){const n=t,r=n.center;Vc.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&Vc.expandByObject(a)}),Vc.getCenter(r);let s=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a;if(!o.geometry)return;const l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const h=l.attributes.position;for(let d=0,p=h.count;d<p;d++)Lt.fromBufferAttribute(h,d),s=Math.max(s,r.distanceToSquared(Lt))}),n.radius=Math.sqrt(s),n}};var pf;(function(i){i.HOLD_START="holdStart",i.HOLD_END="holdEnd",i.HOLDING="holding"})(pf||(pf={}));class z5{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e)}}}class F5 extends z5{constructor(e){super(),this._enabled=!0,this._holding=!1,this._intervalId=-1,this._deltaTime=0,this._elapsedTime=0,this._lastTime=0,this._holdStart=t=>{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:pf.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const n=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n);const r=performance.now();this._deltaTime=r-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:pf.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const n=performance.now();this._deltaTime=n-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:pf.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}get holding(){return this._holding}}class Vp extends F5{constructor(e,t){if(typeof e!="string"){console.error("KeyboardKeyHold: the first argument has to be a KeyboardEvent.code string.");return}super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const n=s=>{B5(s)||s.code===e&&this._holdStart(s)},r=s=>{s.code===e&&this._holdEnd(s)};document.addEventListener("keydown",n),document.addEventListener("keyup",r),window.addEventListener("blur",this._holdEnd)}}function B5(i){const e=i.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var Wp={exports:{}},$M;function k5(){if($M)return Wp.exports;$M=1;var i=typeof Reflect=="object"?Reflect:null,e=i&&typeof i.apply=="function"?i.apply:function(w,T,R){return Function.prototype.apply.call(w,T,R)},t;i&&typeof i.ownKeys=="function"?t=i.ownKeys:Object.getOwnPropertySymbols?t=function(w){return Object.getOwnPropertyNames(w).concat(Object.getOwnPropertySymbols(w))}:t=function(w){return Object.getOwnPropertyNames(w)};function n(S){console&&console.warn&&console.warn(S)}var r=Number.isNaN||function(w){return w!==w};function s(){s.init.call(this)}Wp.exports=s,Wp.exports.once=g,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(S){if(typeof S!="number"||S<0||r(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");a=S}}),s.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},s.prototype.setMaxListeners=function(w){if(typeof w!="number"||w<0||r(w))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+w+".");return this._maxListeners=w,this};function l(S){return S._maxListeners===void 0?s.defaultMaxListeners:S._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(w){for(var T=[],R=1;R<arguments.length;R++)T.push(arguments[R]);var U=w==="error",A=this._events;if(A!==void 0)U=U&&A.error===void 0;else if(!U)return!1;if(U){var D;if(T.length>0&&(D=T[0]),D instanceof Error)throw D;var L=new Error("Unhandled error."+(D?" ("+D.message+")":""));throw L.context=D,L}var P=A[w];if(P===void 0)return!1;if(typeof P=="function")e(P,this,T);else for(var I=P.length,V=v(P,I),R=0;R<I;++R)e(V[R],this,T);return!0};function c(S,w,T,R){var U,A,D;if(o(T),A=S._events,A===void 0?(A=S._events=Object.create(null),S._eventsCount=0):(A.newListener!==void 0&&(S.emit("newListener",w,T.listener?T.listener:T),A=S._events),D=A[w]),D===void 0)D=A[w]=T,++S._eventsCount;else if(typeof D=="function"?D=A[w]=R?[T,D]:[D,T]:R?D.unshift(T):D.push(T),U=l(S),U>0&&D.length>U&&!D.warned){D.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(w)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=S,L.type=w,L.count=D.length,n(L)}return S}s.prototype.addListener=function(w,T){return c(this,w,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(w,T){return c(this,w,T,!0)};function h(){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 d(S,w,T){var R={fired:!1,wrapFn:void 0,target:S,type:w,listener:T},U=h.bind(R);return U.listener=T,R.wrapFn=U,U}s.prototype.once=function(w,T){return o(T),this.on(w,d(this,w,T)),this},s.prototype.prependOnceListener=function(w,T){return o(T),this.prependListener(w,d(this,w,T)),this},s.prototype.removeListener=function(w,T){var R,U,A,D,L;if(o(T),U=this._events,U===void 0)return this;if(R=U[w],R===void 0)return this;if(R===T||R.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete U[w],U.removeListener&&this.emit("removeListener",w,R.listener||T));else if(typeof R!="function"){for(A=-1,D=R.length-1;D>=0;D--)if(R[D]===T||R[D].listener===T){L=R[D].listener,A=D;break}if(A<0)return this;A===0?R.shift():x(R,A),R.length===1&&(U[w]=R[0]),U.removeListener!==void 0&&this.emit("removeListener",w,L||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(w){var T,R,U;if(R=this._events,R===void 0)return this;if(R.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):R[w]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete R[w]),this;if(arguments.length===0){var A=Object.keys(R),D;for(U=0;U<A.length;++U)D=A[U],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=R[w],typeof T=="function")this.removeListener(w,T);else if(T!==void 0)for(U=T.length-1;U>=0;U--)this.removeListener(w,T[U]);return this};function p(S,w,T){var R=S._events;if(R===void 0)return[];var U=R[w];return U===void 0?[]:typeof U=="function"?T?[U.listener||U]:[U]:T?_(U):v(U,U.length)}s.prototype.listeners=function(w){return p(this,w,!0)},s.prototype.rawListeners=function(w){return p(this,w,!1)},s.listenerCount=function(S,w){return typeof S.listenerCount=="function"?S.listenerCount(w):m.call(S,w)},s.prototype.listenerCount=m;function m(S){var w=this._events;if(w!==void 0){var T=w[S];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function v(S,w){for(var T=new Array(w),R=0;R<w;++R)T[R]=S[R];return T}function x(S,w){for(;w+1<S.length;w++)S[w]=S[w+1];S.pop()}function _(S){for(var w=new Array(S.length),T=0;T<w.length;++T)w[T]=S[T].listener||S[T];return w}function g(S,w){return new Promise(function(T,R){function U(D){S.removeListener(w,A),R(D)}function A(){typeof S.removeListener=="function"&&S.removeListener("error",U),T([].slice.call(arguments))}E(S,w,A,{once:!0}),w!=="error"&&b(S,U,{once:!0})})}function b(S,w,T){typeof S.on=="function"&&E(S,"error",w,T)}function E(S,w,T,R){if(typeof S.on=="function")R.once?S.once(w,T):S.on(w,T);else if(typeof S.addEventListener=="function")S.addEventListener(w,function U(A){R.once&&S.removeEventListener(w,U),T(A)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}return Wp.exports}var G5=k5();function H5(){const i=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const n in arguments[e])i[n]=arguments[e][n];return i}let ii=H5;typeof Object.assign=="function"&&(ii=Object.assign);function kr(i,e,t,n){const r=i._nodes.get(e);let s=null;return r&&(n==="mixed"?s=r.out&&r.out[t]||r.undirected&&r.undirected[t]:n==="directed"?s=r.out&&r.out[t]:s=r.undirected&&r.undirected[t]),s}function gi(i){return typeof i=="object"&&i!==null}function FC(i){let e;for(e in i)return!1;return!0}function Or(i,e,t){Object.defineProperty(i,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function $r(i,e,t){const n={enumerable:!0,configurable:!0};typeof t=="function"?n.get=t:(n.value=t,n.writable=!1),Object.defineProperty(i,e,n)}function ew(i){return!(!gi(i)||i.attributes&&!Array.isArray(i.attributes))}function V5(){let i=Math.floor(Math.random()*256)&255;return()=>i++}function ga(){const i=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let n=null;do{if(e===null){if(t++,t>=i.length)return{done:!0};e=i[t][Symbol.iterator]()}if(n=e.next(),n.done){e=null;continue}break}while(!0);return n}}}function Uu(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class R1 extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class ut extends R1{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ut.prototype.constructor)}}class et extends R1{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,et.prototype.constructor)}}class xt extends R1{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xt.prototype.constructor)}}function BC(i,e){this.key=i,this.attributes=e,this.clear()}BC.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function kC(i,e){this.key=i,this.attributes=e,this.clear()}kC.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function GC(i,e){this.key=i,this.attributes=e,this.clear()}GC.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ou(i,e,t,n,r){this.key=e,this.attributes=r,this.undirected=i,this.source=t,this.target=n}Ou.prototype.attach=function(){let i="out",e="in";this.undirected&&(i=e="undirected");const t=this.source.key,n=this.target.key;this.source[i][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)};Ou.prototype.attachMulti=function(){let i="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(i=e="undirected");const r=this.source[i],s=r[n];if(typeof s>"u"){r[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}s.previous=this,this.next=s,r[n]=this,this.target[e][t]=this};Ou.prototype.detach=function(){const i=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][i]};Ou.prototype.detachMulti=function(){const i=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][i]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][i]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const HC=0,VC=1,W5=2,WC=3;function wa(i,e,t,n,r,s,a){let o,l,c,h;if(n=""+n,t===HC){if(o=i._nodes.get(n),!o)throw new et(`Graph.${e}: could not find the "${n}" node in the graph.`);c=r,h=s}else if(t===WC){if(r=""+r,l=i._edges.get(r),!l)throw new et(`Graph.${e}: could not find the "${r}" edge in the graph.`);const d=l.source.key,p=l.target.key;if(n===d)o=l.target;else if(n===p)o=l.source;else throw new et(`Graph.${e}: the "${n}" node is not attached to the "${r}" edge (${d}, ${p}).`);c=s,h=a}else{if(l=i._edges.get(n),!l)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===VC?o=l.source:o=l.target,c=r,h=s}return[o,c,h]}function X5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);return a.attributes[o]}}function j5(i,e,t){i.prototype[e]=function(n,r){const[s]=wa(this,e,t,n,r);return s.attributes}}function q5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);return a.attributes.hasOwnProperty(o)}}function Y5(i,e,t){i.prototype[e]=function(n,r,s,a){const[o,l,c]=wa(this,e,t,n,r,s,a);return o.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function Z5(i,e,t){i.prototype[e]=function(n,r,s,a){const[o,l,c]=wa(this,e,t,n,r,s,a);if(typeof c!="function")throw new ut(`Graph.${e}: updater should be a function.`);const h=o.attributes,d=c(h[l]);return h[l]=d,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function K5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);return delete a.attributes[o],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:o}),this}}function J5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);if(!gi(o))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=o,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Q5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);if(!gi(o))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return ii(a.attributes,o),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:o}),this}}function $5(i,e,t){i.prototype[e]=function(n,r,s){const[a,o]=wa(this,e,t,n,r,s);if(typeof o!="function")throw new ut(`Graph.${e}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const ek=[{name:i=>`get${i}Attribute`,attacher:X5},{name:i=>`get${i}Attributes`,attacher:j5},{name:i=>`has${i}Attribute`,attacher:q5},{name:i=>`set${i}Attribute`,attacher:Y5},{name:i=>`update${i}Attribute`,attacher:Z5},{name:i=>`remove${i}Attribute`,attacher:K5},{name:i=>`replace${i}Attributes`,attacher:J5},{name:i=>`merge${i}Attributes`,attacher:Q5},{name:i=>`update${i}Attributes`,attacher:$5}];function tk(i){ek.forEach(function({name:e,attacher:t}){t(i,e("Node"),HC),t(i,e("Source"),VC),t(i,e("Target"),W5),t(i,e("Opposite"),WC)})}function nk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes[r]}}function ik(i,e,t){i.prototype[e]=function(n){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,a=""+arguments[1];if(r=kr(this,s,a,t),!r)throw new et(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,r=this._edges.get(n),!r)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return r.attributes}}function rk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes.hasOwnProperty(r)}}function sk(i,e,t){i.prototype[e]=function(n,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,l=""+r;if(r=arguments[2],s=arguments[3],a=kr(this,o,l,t),!a)throw new et(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,a=this._edges.get(n),!a)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return a.attributes[r]=s,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function ak(i,e,t){i.prototype[e]=function(n,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,l=""+r;if(r=arguments[2],s=arguments[3],a=kr(this,o,l,t),!a)throw new et(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,a=this._edges.get(n),!a)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof s!="function")throw new ut(`Graph.${e}: updater should be a function.`);return a.attributes[r]=s(a.attributes[r]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function ok(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete s.attributes[r],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:r}),this}}function lk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!gi(r))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function ck(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!gi(r))throw new ut(`Graph.${e}: provided attributes are not a plain object.`);return ii(s.attributes,r),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:r}),this}}function uk(i,e,t){i.prototype[e]=function(n,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,o=""+r;if(r=arguments[2],s=kr(this,a,o,t),!s)throw new et(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new et(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof r!="function")throw new ut(`Graph.${e}: provided updater is not a function.`);return s.attributes=r(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const hk=[{name:i=>`get${i}Attribute`,attacher:nk},{name:i=>`get${i}Attributes`,attacher:ik},{name:i=>`has${i}Attribute`,attacher:rk},{name:i=>`set${i}Attribute`,attacher:sk},{name:i=>`update${i}Attribute`,attacher:ak},{name:i=>`remove${i}Attribute`,attacher:ok},{name:i=>`replace${i}Attributes`,attacher:lk},{name:i=>`merge${i}Attributes`,attacher:ck},{name:i=>`update${i}Attributes`,attacher:uk}];function fk(i){hk.forEach(function({name:e,attacher:t}){t(i,e("Edge"),"mixed"),t(i,e("DirectedEdge"),"directed"),t(i,e("UndirectedEdge"),"undirected")})}const dk=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function pk(i,e,t,n){let r=!1;for(const s in e){if(s===n)continue;const a=e[s];if(r=t(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),i&&r)return a.key}}function mk(i,e,t,n){let r,s,a,o=!1;for(const l in e)if(l!==n){r=e[l];do{if(s=r.source,a=r.target,o=t(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected),i&&o)return r.key;r=r.next}while(r!==void 0)}}function $y(i,e){const t=Object.keys(i),n=t.length;let r,s=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(s>=n)return{done:!0};const a=t[s++];if(a===e){r=void 0;continue}r=i[a]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function gk(i,e,t,n){const r=e[t];if(!r)return;const s=r.source,a=r.target;if(n(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected)&&i)return r.key}function vk(i,e,t,n){let r=e[t];if(!r)return;let s=!1;do{if(s=n(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),i&&s)return r.key;r=r.next}while(r!==void 0)}function e_(i,e){let t=i[e];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let n=!1;return{[Symbol.iterator](){return this},next(){return n===!0?{done:!0}:(n=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function yk(i,e){if(i.size===0)return[];if(e==="mixed"||e===i.type)return Array.from(i._edges.keys());const t=e==="undirected"?i.undirectedSize:i.directedSize,n=new Array(t),r=e==="undirected",s=i._edges.values();let a=0,o,l;for(;o=s.next(),o.done!==!0;)l=o.value,l.undirected===r&&(n[a++]=l.key);return n}function XC(i,e,t,n){if(e.size===0)return;const r=t!=="mixed"&&t!==e.type,s=t==="undirected";let a,o,l=!1;const c=e._edges.values();for(;a=c.next(),a.done!==!0;){if(o=a.value,r&&o.undirected!==s)continue;const{key:h,attributes:d,source:p,target:m}=o;if(l=n(h,d,p.key,m.key,p.attributes,m.attributes,o.undirected),i&&l)return h}}function _k(i,e){if(i.size===0)return Uu();const t=e!=="mixed"&&e!==i.type,n=e==="undirected",r=i._edges.values();return{[Symbol.iterator](){return this},next(){let s,a;for(;;){if(s=r.next(),s.done)return s;if(a=s.value,!(t&&a.undirected!==n))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}}}}function D1(i,e,t,n,r,s){const a=e?mk:pk;let o;if(t!=="undirected"&&(n!=="out"&&(o=a(i,r.in,s),i&&o)||n!=="in"&&(o=a(i,r.out,s,n?void 0:r.key),i&&o))||t!=="directed"&&(o=a(i,r.undirected,s),i&&o))return o}function xk(i,e,t,n){const r=[];return D1(!1,i,e,t,n,function(s){r.push(s)}),r}function bk(i,e,t){let n=Uu();return i!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=ga(n,$y(t.in))),e!=="in"&&typeof t.out<"u"&&(n=ga(n,$y(t.out,e?void 0:t.key)))),i!=="directed"&&typeof t.undirected<"u"&&(n=ga(n,$y(t.undirected))),n}function U1(i,e,t,n,r,s,a){const o=t?vk:gk;let l;if(e!=="undirected"&&(typeof r.in<"u"&&n!=="out"&&(l=o(i,r.in,s,a),i&&l)||typeof r.out<"u"&&n!=="in"&&(n||r.key!==s)&&(l=o(i,r.out,s,a),i&&l))||e!=="directed"&&typeof r.undirected<"u"&&(l=o(i,r.undirected,s,a),i&&l))return l}function Sk(i,e,t,n,r){const s=[];return U1(!1,i,e,t,n,r,function(a){s.push(a)}),s}function Ek(i,e,t,n){let r=Uu();return i!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(r=ga(r,e_(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(r=ga(r,e_(t.out,n)))),i!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(r=ga(r,e_(t.undirected,n))),r}function Mk(i,e){const{name:t,type:n,direction:r}=e;i.prototype[t]=function(s,a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return yk(this,n);if(arguments.length===1){s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new et(`Graph.${t}: could not find the "${s}" node in the graph.`);return xk(this.multi,n==="mixed"?this.type:n,r,o)}if(arguments.length===2){s=""+s,a=""+a;const o=this._nodes.get(s);if(!o)throw new et(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new et(`Graph.${t}: could not find the "${a}" target node in the graph.`);return Sk(n,this.multi,r,o,a)}throw new ut(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function wk(i,e){const{name:t,type:n,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(c,h,d){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return d=c,XC(!1,this,n,d);if(arguments.length===2){c=""+c,d=h;const p=this._nodes.get(c);if(typeof p>"u")throw new et(`Graph.${s}: could not find the "${c}" node in the graph.`);return D1(!1,this.multi,n==="mixed"?this.type:n,r,p,d)}if(arguments.length===3){c=""+c,h=""+h;const p=this._nodes.get(c);if(!p)throw new et(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(h))throw new et(`Graph.${s}: could not find the "${h}" target node in the graph.`);return U1(!1,n,this.multi,r,p,h,d)}throw new ut(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+t[0].toUpperCase()+t.slice(1);i.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),h=c.pop();let d;if(c.length===0){let p=0;n!=="directed"&&(p+=this.undirectedSize),n!=="undirected"&&(p+=this.directedSize),d=new Array(p);let m=0;c.push((v,x,_,g,b,E,S)=>{d[m++]=h(v,x,_,g,b,E,S)})}else d=[],c.push((p,m,v,x,_,g,b)=>{d.push(h(p,m,v,x,_,g,b))});return this[s].apply(this,c),d};const o="filter"+t[0].toUpperCase()+t.slice(1);i.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),h=c.pop(),d=[];return c.push((p,m,v,x,_,g,b)=>{h(p,m,v,x,_,g,b)&&d.push(p)}),this[s].apply(this,c),d};const l="reduce"+t[0].toUpperCase()+t.slice(1);i.prototype[l]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new ut(`Graph.${l}: invalid number of arguments (expecting 2, 3 or 4 and got ${c.length}).`);if(typeof c[c.length-1]=="function"&&typeof c[c.length-2]!="function")throw new ut(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h,d;c.length===2?(h=c[0],d=c[1],c=[]):c.length===3?(h=c[1],d=c[2],c=[c[0]]):c.length===4&&(h=c[2],d=c[3],c=[c[0],c[1]]);let p=d;return c.push((m,v,x,_,g,b,E)=>{p=h(p,m,v,x,_,g,b,E)}),this[s].apply(this,c),p}}function Tk(i,e){const{name:t,type:n,direction:r}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(l,c,h){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return h=l,XC(!0,this,n,h);if(arguments.length===2){l=""+l,h=c;const d=this._nodes.get(l);if(typeof d>"u")throw new et(`Graph.${s}: could not find the "${l}" node in the graph.`);return D1(!0,this.multi,n==="mixed"?this.type:n,r,d,h)}if(arguments.length===3){l=""+l,c=""+c;const d=this._nodes.get(l);if(!d)throw new et(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(c))throw new et(`Graph.${s}: could not find the "${c}" target node in the graph.`);return U1(!0,n,this.multi,r,d,c,h)}throw new ut(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((d,p,m,v,x,_,g)=>c(d,p,m,v,x,_,g)),!!this[s].apply(this,l)};const o="every"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((d,p,m,v,x,_,g)=>!c(d,p,m,v,x,_,g)),!this[s].apply(this,l)}}function Ak(i,e){const{name:t,type:n,direction:r}=e,s=t.slice(0,-1)+"Entries";i.prototype[s]=function(a,o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Uu();if(!arguments.length)return _k(this,n);if(arguments.length===1){a=""+a;const l=this._nodes.get(a);if(!l)throw new et(`Graph.${s}: could not find the "${a}" node in the graph.`);return bk(n,r,l)}if(arguments.length===2){a=""+a,o=""+o;const l=this._nodes.get(a);if(!l)throw new et(`Graph.${s}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new et(`Graph.${s}: could not find the "${o}" target node in the graph.`);return Ek(n,r,l,o)}throw new ut(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ck(i){dk.forEach(e=>{Mk(i,e),wk(i,e),Tk(i,e),Ak(i,e)})}const Rk=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function f0(){this.A=null,this.B=null}f0.prototype.wrap=function(i){this.A===null?this.A=i:this.B===null&&(this.B=i)};f0.prototype.has=function(i){return this.A!==null&&i in this.A||this.B!==null&&i in this.B};function Rh(i,e,t,n,r){for(const s in n){const a=n[s],o=a.source,l=a.target,c=o===t?l:o;if(e&&e.has(c.key))continue;const h=r(c.key,c.attributes);if(i&&h)return c.key}}function O1(i,e,t,n,r){if(e!=="mixed"){if(e==="undirected")return Rh(i,null,n,n.undirected,r);if(typeof t=="string")return Rh(i,null,n,n[t],r)}const s=new f0;let a;if(e!=="undirected"){if(t!=="out"){if(a=Rh(i,null,n,n.in,r),i&&a)return a;s.wrap(n.in)}if(t!=="in"){if(a=Rh(i,s,n,n.out,r),i&&a)return a;s.wrap(n.out)}}if(e!=="directed"&&(a=Rh(i,s,n,n.undirected,r),i&&a))return a}function Dk(i,e,t){if(i!=="mixed"){if(i==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return O1(!1,i,e,t,function(r){n.push(r)}),n}function Dh(i,e,t){const n=Object.keys(t),r=n.length;let s=0;return{[Symbol.iterator](){return this},next(){let a=null;do{if(s>=r)return i&&i.wrap(t),{done:!0};const o=t[n[s++]],l=o.source,c=o.target;if(a=l===e?c:l,i&&i.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}}}function Uk(i,e,t){if(i!=="mixed"){if(i==="undirected")return Dh(null,t,t.undirected);if(typeof e=="string")return Dh(null,t,t[e])}let n=Uu();const r=new f0;return i!=="undirected"&&(e!=="out"&&(n=ga(n,Dh(r,t,t.in))),e!=="in"&&(n=ga(n,Dh(r,t,t.out)))),i!=="directed"&&(n=ga(n,Dh(r,t,t.undirected))),n}function Ok(i,e){const{name:t,type:n,direction:r}=e;i.prototype[t]=function(s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new et(`Graph.${t}: could not find the "${s}" node in the graph.`);return Dk(n==="mixed"?this.type:n,r,a)}}function Lk(i,e){const{name:t,type:n,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(c,h){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;c=""+c;const d=this._nodes.get(c);if(typeof d>"u")throw new et(`Graph.${s}: could not find the "${c}" node in the graph.`);O1(!1,n==="mixed"?this.type:n,r,d,h)};const a="map"+t[0].toUpperCase()+t.slice(1);i.prototype[a]=function(c,h){const d=[];return this[s](c,(p,m)=>{d.push(h(p,m))}),d};const o="filter"+t[0].toUpperCase()+t.slice(1);i.prototype[o]=function(c,h){const d=[];return this[s](c,(p,m)=>{h(p,m)&&d.push(p)}),d};const l="reduce"+t[0].toUpperCase()+t.slice(1);i.prototype[l]=function(c,h,d){if(arguments.length<3)throw new ut(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let p=d;return this[s](c,(m,v)=>{p=h(p,m,v)}),p}}function Ik(i,e){const{name:t,type:n,direction:r}=e,s=t[0].toUpperCase()+t.slice(1,-1),a="find"+s;i.prototype[a]=function(c,h){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;c=""+c;const d=this._nodes.get(c);if(typeof d>"u")throw new et(`Graph.${a}: could not find the "${c}" node in the graph.`);return O1(!0,n==="mixed"?this.type:n,r,d,h)};const o="some"+s;i.prototype[o]=function(c,h){return!!this[a](c,h)};const l="every"+s;i.prototype[l]=function(c,h){return!this[a](c,(p,m)=>!h(p,m))}}function Nk(i,e){const{name:t,type:n,direction:r}=e,s=t.slice(0,-1)+"Entries";i.prototype[s]=function(a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Uu();a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new et(`Graph.${s}: could not find the "${a}" node in the graph.`);return Uk(n==="mixed"?this.type:n,r,o)}}function Pk(i){Rk.forEach(e=>{Ok(i,e),Lk(i,e),Ik(i,e),Nk(i,e)})}function Xp(i,e,t,n,r){const s=n._nodes.values(),a=n.type;let o,l,c,h,d,p;for(;o=s.next(),o.done!==!0;){let m=!1;if(l=o.value,a!=="undirected"){h=l.out;for(c in h){d=h[c];do p=d.target,m=!0,r(l.key,p.key,l.attributes,p.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}if(a!=="directed"){h=l.undirected;for(c in h)if(!(e&&l.key>c)){d=h[c];do p=d.target,p.key!==c&&(p=d.source),m=!0,r(l.key,p.key,l.attributes,p.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}t&&!m&&r(l.key,null,l.attributes,null,null,null,null)}}function zk(i,e){const t={key:i};return FC(e.attributes)||(t.attributes=ii({},e.attributes)),t}function Fk(i,e,t){const n={key:e,source:t.source.key,target:t.target.key};return FC(t.attributes)||(n.attributes=ii({},t.attributes)),i==="mixed"&&t.undirected&&(n.undirected=!0),n}function Bk(i){if(!gi(i))throw new ut('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in i))throw new ut("Graph.import: serialized node is missing its key.");if("attributes"in i&&(!gi(i.attributes)||i.attributes===null))throw new ut("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function kk(i){if(!gi(i))throw new ut('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in i))throw new ut("Graph.import: serialized edge is missing its source.");if(!("target"in i))throw new ut("Graph.import: serialized edge is missing its target.");if("attributes"in i&&(!gi(i.attributes)||i.attributes===null))throw new ut("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in i&&typeof i.undirected!="boolean")throw new ut("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const Gk=V5(),Hk=new Set(["directed","undirected","mixed"]),tw=new Set(["domain","_events","_eventsCount","_maxListeners"]),Vk=[{name:i=>`${i}Edge`,generateKey:!0},{name:i=>`${i}DirectedEdge`,generateKey:!0,type:"directed"},{name:i=>`${i}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:i=>`${i}EdgeWithKey`},{name:i=>`${i}DirectedEdgeWithKey`,type:"directed"},{name:i=>`${i}UndirectedEdgeWithKey`,type:"undirected"}],Wk={allowSelfLoops:!0,multi:!1,type:"mixed"};function Xk(i,e,t){if(t&&!gi(t))throw new ut(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},i._nodes.has(e))throw new xt(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new i.NodeDataClass(e,t);return i._nodes.set(e,n),i.emit("nodeAdded",{key:e,attributes:t}),n}function nw(i,e,t){const n=new i.NodeDataClass(e,t);return i._nodes.set(e,n),i.emit("nodeAdded",{key:e,attributes:t}),n}function jC(i,e,t,n,r,s,a,o){if(!n&&i.type==="undirected")throw new xt(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&i.type==="directed")throw new xt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(o&&!gi(o))throw new ut(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`);if(s=""+s,a=""+a,o=o||{},!i.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const l=i._nodes.get(s),c=i._nodes.get(a);if(!l)throw new et(`Graph.${e}: source node "${s}" not found.`);if(!c)throw new et(`Graph.${e}: target node "${a}" not found.`);const h={key:null,undirected:n,source:s,target:a,attributes:o};if(t)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!i.multi&&(n?typeof l.undirected[a]<"u":typeof l.out[a]<"u"))throw new xt(`Graph.${e}: an edge linking "${s}" to "${a}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const d=new Ou(n,r,l,c,o);i._edges.set(r,d);const p=s===a;return n?(l.undirectedDegree++,c.undirectedDegree++,p&&(l.undirectedLoops++,i._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,p&&(l.directedLoops++,i._directedSelfLoopCount++)),i.multi?d.attachMulti():d.attach(),n?i._undirectedSize++:i._directedSize++,h.key=r,i.emit("edgeAdded",h),r}function jk(i,e,t,n,r,s,a,o,l){if(!n&&i.type==="undirected")throw new xt(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&i.type==="directed")throw new xt(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(o){if(l){if(typeof o!="function")throw new ut(`Graph.${e}: invalid updater function. Expecting a function but got "${o}"`)}else if(!gi(o))throw new ut(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`)}s=""+s,a=""+a;let c;if(l&&(c=o,o=void 0),!i.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let h=i._nodes.get(s),d=i._nodes.get(a),p,m;if(!t&&(p=i._edges.get(r),p)){if((p.source.key!==s||p.target.key!==a)&&(!n||p.source.key!==a||p.target.key!==s))throw new xt(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${s}" source & "${a}" target vs. ("${p.source.key}", "${p.target.key}").`);m=p}if(!m&&!i.multi&&h&&(m=n?h.undirected[a]:h.out[a]),m){const b=[m.key,!1,!1,!1];if(l?!c:!o)return b;if(l){const E=m.attributes;m.attributes=c(E),i.emit("edgeAttributesUpdated",{type:"replace",key:m.key,attributes:m.attributes})}else ii(m.attributes,o),i.emit("edgeAttributesUpdated",{type:"merge",key:m.key,attributes:m.attributes,data:o});return b}o=o||{},l&&c&&(o=c(o));const v={key:null,undirected:n,source:s,target:a,attributes:o};if(t)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);let x=!1,_=!1;h||(h=nw(i,s,{}),x=!0,s===a&&(d=h,_=!0)),d||(d=nw(i,a,{}),_=!0),p=new Ou(n,r,h,d,o),i._edges.set(r,p);const g=s===a;return n?(h.undirectedDegree++,d.undirectedDegree++,g&&(h.undirectedLoops++,i._undirectedSelfLoopCount++)):(h.outDegree++,d.inDegree++,g&&(h.directedLoops++,i._directedSelfLoopCount++)),i.multi?p.attachMulti():p.attach(),n?i._undirectedSize++:i._directedSize++,v.key=r,i.emit("edgeAdded",v),[r,!0,x,_]}function Wc(i,e){i._edges.delete(e.key);const{source:t,target:n,attributes:r}=e,s=e.undirected,a=t===n;s?(t.undirectedDegree--,n.undirectedDegree--,a&&(t.undirectedLoops--,i._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,a&&(t.directedLoops--,i._directedSelfLoopCount--)),i.multi?e.detachMulti():e.detach(),s?i._undirectedSize--:i._directedSize--,i.emit("edgeDropped",{key:e.key,attributes:r,source:t.key,target:n.key,undirected:s})}class un extends G5.EventEmitter{constructor(e){if(super(),e=ii({},Wk,e),typeof e.multi!="boolean")throw new ut(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Hk.has(e.type))throw new ut(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new ut(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?BC:e.type==="directed"?kC:GC;Or(this,"NodeDataClass",t);const n="geid_"+Gk()+"_";let r=0;const s=()=>{let a;do a=n+r++;while(this._edges.has(a));return a};Or(this,"_attributes",{}),Or(this,"_nodes",new Map),Or(this,"_edges",new Map),Or(this,"_directedSize",0),Or(this,"_undirectedSize",0),Or(this,"_directedSelfLoopCount",0),Or(this,"_undirectedSelfLoopCount",0),Or(this,"_edgeKeyGenerator",s),Or(this,"_options",e),tw.forEach(a=>Or(this,a,this[a])),$r(this,"order",()=>this._nodes.size),$r(this,"size",()=>this._edges.size),$r(this,"directedSize",()=>this._directedSize),$r(this,"undirectedSize",()=>this._undirectedSize),$r(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),$r(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),$r(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),$r(this,"multi",this._options.multi),$r(this,"type",this._options.type),$r(this,"allowSelfLoops",this._options.allowSelfLoops),$r(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new ut(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const n=""+e,r=this._edges.get(n);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new ut(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new ut(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new et(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new et(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new et(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new et(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new xt("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new et(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new et(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new et(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=n.source.key,s=n.target.key;if(e===r)return s;if(e===s)return r;throw new et(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new et(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new et(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Xk(this,e,t).key}mergeNode(e,t){if(t&&!gi(t))throw new ut(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(ii(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new ut(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const s=n.attributes;n.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new et(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const r in t.out){n=t.out[r];do Wc(this,n),n=n.next;while(n)}for(const r in t.in){n=t.in[r];do Wc(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const r in t.undirected){n=t.undirected[r];do Wc(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],r=""+arguments[1];if(t=kr(this,n,r,this.type),!t)throw new et(`Graph.dropEdge: could not find the "${n}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new et(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return Wc(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new xt("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new xt("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const n=kr(this,e,t,"directed");if(!n)throw new et(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Wc(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new xt("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new xt("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=kr(this,e,t,"undirected");if(!n)throw new et(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Wc(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new ut("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!gi(e))throw new ut("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!gi(e))throw new ut("Graph.mergeAttributes: provided attributes are not a plain object.");return ii(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new ut("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new ut("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!ew(t))throw new ut("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let r,s;for(;r=n.next(),r.done!==!0;)s=r.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new ut("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!ew(t))throw new ut("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let r,s,a,o;for(;r=n.next(),r.done!==!0;)s=r.value,a=s.source,o=s.target,s.attributes=e(s.key,s.attributes,a.key,o.key,a.attributes,o.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new ut("Graph.forEachAdjacencyEntry: expecting a callback.");Xp(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new ut("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Xp(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new ut("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Xp(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new ut("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Xp(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new ut("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new ut("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new ut("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,r;const s=new Array(this.order);let a=0;for(;n=t.next(),n.done!==!0;)r=n.value,s[a++]=e(r.key,r.attributes);return s}someNode(e){if(typeof e!="function")throw new ut("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new ut("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new ut("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,r;const s=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&s.push(r.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new ut("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ut("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t;const r=this._nodes.values();let s,a;for(;s=r.next(),s.done!==!0;)a=s.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,s)=>{e[t++]=zk(s,r)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((r,s)=>{n[t++]=Fk(this.type,s,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof un)return e.forEachNode((l,c)=>{t?this.mergeNode(l,c):this.addNode(l,c)}),e.forEachEdge((l,c,h,d,p,m,v)=>{t?v?this.mergeUndirectedEdgeWithKey(l,h,d,c):this.mergeDirectedEdgeWithKey(l,h,d,c):v?this.addUndirectedEdgeWithKey(l,h,d,c):this.addDirectedEdgeWithKey(l,h,d,c)}),this;if(!gi(e))throw new ut("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!gi(e.attributes))throw new ut("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,r,s,a,o;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new ut("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=s.length;n<r;n++){a=s[n],Bk(a);const{key:l,attributes:c}=a;t?this.mergeNode(l,c):this.addNode(l,c)}}if(e.edges){let l=!1;if(this.type==="undirected"&&(l=!0),s=e.edges,!Array.isArray(s))throw new ut("Graph.import: invalid edges. Expecting an array.");for(n=0,r=s.length;n<r;n++){o=s[n],kk(o);const{source:c,target:h,attributes:d,undirected:p=l}=o;let m;"key"in o?(m=t?p?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:p?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,m.call(this,o.key,c,h,d)):(m=t?p?this.mergeUndirectedEdge:this.mergeDirectedEdge:p?this.addUndirectedEdge:this.addDirectedEdge,m.call(this,c,h,d))}}return this}nullCopy(e){const t=new un(ii({},this._options,e));return t.replaceAttributes(ii({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((n,r)=>{const s=ii({},n.attributes);n=new t.NodeDataClass(r,s),t._nodes.set(r,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new xt(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new xt("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new xt("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),n=this._edges.values();let r,s;for(;r=n.next(),r.done!==!0;)s=r.value,jC(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,ii({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,a)=>{e[a]=s.attributes});const t={},n={};this._edges.forEach((s,a)=>{const o=s.undirected?"--":"->";let l="",c=s.source.key,h=s.target.key,d;s.undirected&&c>h&&(d=c,c=h,h=d);const p=`(${c})${o}(${h})`;a.startsWith("geid_")?this.multi&&(typeof n[p]>"u"?n[p]=0:n[p]++,l+=`${n[p]}. `):l+=`[${a}]: `,l+=p,t[l]=s.attributes});const r={};for(const s in this)this.hasOwnProperty(s)&&!tw.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(r[s]=this[s]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Or(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(un.prototype[Symbol.for("nodejs.util.inspect.custom")]=un.prototype.inspect);Vk.forEach(i=>{["add","merge","update"].forEach(e=>{const t=i.name(e),n=e==="add"?jC:jk;i.generateKey?un.prototype[t]=function(r,s,a){return n(this,t,!0,(i.type||this.type)==="undirected",null,r,s,a,e==="update")}:un.prototype[t]=function(r,s,a,o){return n(this,t,!1,(i.type||this.type)==="undirected",r,s,a,o,e==="update")}})});tk(un);fk(un);Ck(un);Pk(un);class qC extends un{constructor(e){const t=ii({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new ut("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new ut('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class YC extends un{constructor(e){const t=ii({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new ut("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new ut('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ZC extends un{constructor(e){const t=ii({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new ut("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class KC extends un{constructor(e){const t=ii({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new ut("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new ut('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class JC extends un{constructor(e){const t=ii({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new ut("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new ut('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Lu(i){i.from=function(e,t){const n=ii({},e.options,t),r=new i(n);return r.import(e),r}}Lu(un);Lu(qC);Lu(YC);Lu(ZC);Lu(KC);Lu(JC);un.Graph=un;un.DirectedGraph=qC;un.UndirectedGraph=YC;un.MultiGraph=ZC;un.MultiDirectedGraph=KC;un.MultiUndirectedGraph=JC;un.InvalidArgumentsGraphError=ut;un.NotFoundGraphError=et;un.UsageGraphError=xt;const Jh=(i,e)=>{const t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},o=i[0].morphTargetsRelative,l=new Rt;let c=0;if(i.forEach((h,d)=>{let p=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in h.attributes){if(!n.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(h.attributes[m]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(o!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in h.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;a[m]===void 0&&(a[m]=[]),a[m].push(h.morphAttributes[m])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let m;if(h.index)m=h.index.count;else if(h.attributes.position!==void 0)m=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,m,d),c+=m}}),t){let h=0;const d=[];i.forEach(p=>{const m=p.index;for(let v=0;v<m.count;++v)d.push(m.getX(v)+h);h+=p.attributes.position.count}),l.setIndex(d)}for(let h in s){const d=iw(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){const d=a[h][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let p=0;p<d;++p){const m=[];for(let x=0;x<a[h].length;++x)m.push(a[h][x][p]);const v=iw(m);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(v)}}return l},iw=i=>{let e,t,n,r=0;if(i.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=s.array.length}),e&&t){const s=new e(r);let a=0;return i.forEach(o=>{s.set(o.array,a),a+=o.array.length}),new $t(s,t,n)}};function qk(i,e=Math.PI/3){const t=Math.cos(e),n=(1+1e-10)*100,r=[new j,new j,new j],s=new j,a=new j,o=new j,l=new j;function c(x){const _=~~(x.x*n),g=~~(x.y*n),b=~~(x.z*n);return`${_},${g},${b}`}const h=i.index?i.toNonIndexed():i,d=h.attributes.position,p={};for(let x=0,_=d.count/3;x<_;x++){const g=3*x,b=r[0].fromBufferAttribute(d,g+0),E=r[1].fromBufferAttribute(d,g+1),S=r[2].fromBufferAttribute(d,g+2);s.subVectors(S,E),a.subVectors(b,E);const w=new j().crossVectors(s,a).normalize();for(let T=0;T<3;T++){const R=r[T],U=c(R);U in p||(p[U]=[]),p[U].push(w)}}const m=new Float32Array(d.count*3),v=new $t(m,3,!1);for(let x=0,_=d.count/3;x<_;x++){const g=3*x,b=r[0].fromBufferAttribute(d,g+0),E=r[1].fromBufferAttribute(d,g+1),S=r[2].fromBufferAttribute(d,g+2);s.subVectors(S,E),a.subVectors(b,E),o.crossVectors(s,a).normalize();for(let w=0;w<3;w++){const T=r[w],R=c(T),U=p[R];l.set(0,0,0);for(let A=0,D=U.length;A<D;A++){const L=U[A];o.dot(L)>t&&l.add(L)}l.normalize(),v.setXYZ(g+w,l.x,l.y,l.z)}}return h.setAttribute("normal",v),h}const t_=new Ll,n_=new j,Xc=new j,es=new j,sa=new j,xs=new j,aa=new j,oa=new j,Uh=new j,Oh=new j,Lh=new j,jp=new j,Ih=new j,Nh=new j,Ph=new j;class rw{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new j,this.endPoint=new j,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(t_,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Xc.copy(e),Xc.x=Math.min(e.x,t.x),Xc.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),es.setFromMatrixPosition(this.camera.matrixWorld),sa.copy(Xc),xs.set(t.x,Xc.y,0),aa.copy(t),oa.set(Xc.x,t.y,0),sa.unproject(this.camera),xs.unproject(this.camera),aa.unproject(this.camera),oa.unproject(this.camera),Ih.copy(sa).sub(es),Nh.copy(xs).sub(es),Ph.copy(aa).sub(es),Ih.normalize(),Nh.normalize(),Ph.normalize(),Ih.multiplyScalar(this.deep),Nh.multiplyScalar(this.deep),Ph.multiplyScalar(this.deep),Ih.add(es),Nh.add(es),Ph.add(es);var n=t_.planes;n[0].setFromCoplanarPoints(es,sa,xs),n[1].setFromCoplanarPoints(es,xs,aa),n[2].setFromCoplanarPoints(aa,oa,es),n[3].setFromCoplanarPoints(oa,sa,es),n[4].setFromCoplanarPoints(xs,aa,oa),n[5].setFromCoplanarPoints(Ph,Nh,Ih),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const r=Math.min(e.x,t.x),s=Math.max(e.y,t.y),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y);sa.set(r,s,-1),xs.set(a,s,-1),aa.set(a,o,-1),oa.set(r,o,-1),Uh.set(r,s,1),Oh.set(a,s,1),Lh.set(a,o,1),jp.set(r,o,1),sa.unproject(this.camera),xs.unproject(this.camera),aa.unproject(this.camera),oa.unproject(this.camera),Uh.unproject(this.camera),Oh.unproject(this.camera),Lh.unproject(this.camera),jp.unproject(this.camera);var n=t_.planes;n[0].setFromCoplanarPoints(sa,Uh,Oh),n[1].setFromCoplanarPoints(xs,Oh,Lh),n[2].setFromCoplanarPoints(Lh,jp,oa),n[3].setFromCoplanarPoints(jp,Uh,sa),n[4].setFromCoplanarPoints(xs,aa,oa),n[5].setFromCoplanarPoints(Lh,Oh,Uh),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),n_.copy(t.geometry.boundingSphere.center),n_.applyMatrix4(t.matrixWorld),e.containsPoint(n_)&&this.collection.push(t)),t.children.length>0)for(let n=0;n<t.children.length;n++)this.searchChildInFrustum(e,t.children[n])}}var zh={},i_,sw;function Ta(){return sw||(sw=1,i_=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"}),i_}var aw;function Yk(){if(aw)return zh;aw=1;var i=Ta();function e(s,a,o,l){var c=a+"Centrality";if(!i(o))throw new Error("graphology-centrality/"+c+": the given graph is not a valid graphology instance.");if(a!=="degree"&&o.type==="undirected")throw new Error("graphology-centrality/"+c+": cannot compute "+a+" centrality on an undirected graph.");l=l||{};var h=l.nodeCentralityAttribute||c,d=o.order-1,p=o[a].bind(o);if(s){o.updateEachNodeAttributes(function(v,x){return x[h]=p(v)/d,x},{attributes:[h]});return}var m={};return o.forEachNode(function(v){m[v]=p(v)/d}),m}var t=e.bind(null,!1,"degree"),n=e.bind(null,!1,"inDegree"),r=e.bind(null,!1,"outDegree");return t.assign=e.bind(null,!0,"degree"),n.assign=e.bind(null,!0,"inDegree"),r.assign=e.bind(null,!0,"outDegree"),zh.degreeCentrality=t,zh.inDegreeCentrality=n,zh.outDegreeCentrality=r,zh}var Zk=Yk();function cm(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function Kk(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function QC(i){let e,t,n;i.length!==2?(e=cm,t=(o,l)=>cm(i(o),l),n=(o,l)=>i(o)-l):(e=i===cm||i===Kk?i:Jk,t=i,n=i);function r(o,l,c=0,h=o.length){if(c<h){if(e(l,l)!==0)return h;do{const d=c+h>>>1;t(o[d],l)<0?c=d+1:h=d}while(c<h)}return c}function s(o,l,c=0,h=o.length){if(c<h){if(e(l,l)!==0)return h;do{const d=c+h>>>1;t(o[d],l)<=0?c=d+1:h=d}while(c<h)}return c}function a(o,l,c=0,h=o.length){const d=r(o,l,c,h-1);return d>c&&n(o[d-1],l)>-n(o[d],l)?d-1:d}return{left:r,center:a,right:s}}function Jk(){return 0}function Qk(i){return i===null?NaN:+i}const $k=QC(cm),eG=$k.right;QC(Qk).center;const tG=Math.sqrt(50),nG=Math.sqrt(10),iG=Math.sqrt(2);function ug(i,e,t){const n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),a=s>=tG?10:s>=nG?5:s>=iG?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/a,o=Math.round(i*c),l=Math.round(e*c),o/c<i&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,o=Math.round(i/c),l=Math.round(e/c),o*c<i&&++o,l*c>e&&--l),l<o&&.5<=t&&t<2?ug(i,e,t*2):[o,l,c]}function rG(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];const n=e<i,[r,s,a]=n?ug(e,i,t):ug(i,e,t);if(!(s>=r))return[];const o=s-r+1,l=new Array(o);if(n)if(a<0)for(let c=0;c<o;++c)l[c]=(s-c)/-a;else for(let c=0;c<o;++c)l[c]=(s-c)*a;else if(a<0)for(let c=0;c<o;++c)l[c]=(r+c)/-a;else for(let c=0;c<o;++c)l[c]=(r+c)*a;return l}function hx(i,e,t){return e=+e,i=+i,t=+t,ug(i,e,t)[2]}function sG(i,e,t){e=+e,i=+i,t=+t;const n=e<i,r=n?hx(e,i,t):hx(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function aG(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function L1(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function $C(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function sd(){}var Ff=.7,hg=1/Ff,su="\\s*([+-]?\\d+)\\s*",Bf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oG=/^#([0-9a-f]{3,8})$/,lG=new RegExp(`^rgb\\(${su},${su},${su}\\)$`),cG=new RegExp(`^rgb\\(${Cs},${Cs},${Cs}\\)$`),uG=new RegExp(`^rgba\\(${su},${su},${su},${Bf}\\)$`),hG=new RegExp(`^rgba\\(${Cs},${Cs},${Cs},${Bf}\\)$`),fG=new RegExp(`^hsl\\(${Bf},${Cs},${Cs}\\)$`),dG=new RegExp(`^hsla\\(${Bf},${Cs},${Cs},${Bf}\\)$`),ow={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};L1(sd,kf,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:lw,formatHex:lw,formatHex8:pG,formatHsl:mG,formatRgb:cw,toString:cw});function lw(){return this.rgb().formatHex()}function pG(){return this.rgb().formatHex8()}function mG(){return eR(this).formatHsl()}function cw(){return this.rgb().formatRgb()}function kf(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=oG.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?uw(e):t===3?new $i(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?qp(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?qp(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=lG.exec(i))?new $i(e[1],e[2],e[3],1):(e=cG.exec(i))?new $i(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=uG.exec(i))?qp(e[1],e[2],e[3],e[4]):(e=hG.exec(i))?qp(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=fG.exec(i))?dw(e[1],e[2]/100,e[3]/100,1):(e=dG.exec(i))?dw(e[1],e[2]/100,e[3]/100,e[4]):ow.hasOwnProperty(i)?uw(ow[i]):i==="transparent"?new $i(NaN,NaN,NaN,0):null}function uw(i){return new $i(i>>16&255,i>>8&255,i&255,1)}function qp(i,e,t,n){return n<=0&&(i=e=t=NaN),new $i(i,e,t,n)}function gG(i){return i instanceof sd||(i=kf(i)),i?(i=i.rgb(),new $i(i.r,i.g,i.b,i.opacity)):new $i}function fx(i,e,t,n){return arguments.length===1?gG(i):new $i(i,e,t,n??1)}function $i(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}L1($i,fx,$C(sd,{brighter(i){return i=i==null?hg:Math.pow(hg,i),new $i(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Ff:Math.pow(Ff,i),new $i(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new $i(Sl(this.r),Sl(this.g),Sl(this.b),fg(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:hw,formatHex:hw,formatHex8:vG,formatRgb:fw,toString:fw}));function hw(){return`#${yl(this.r)}${yl(this.g)}${yl(this.b)}`}function vG(){return`#${yl(this.r)}${yl(this.g)}${yl(this.b)}${yl((isNaN(this.opacity)?1:this.opacity)*255)}`}function fw(){const i=fg(this.opacity);return`${i===1?"rgb(":"rgba("}${Sl(this.r)}, ${Sl(this.g)}, ${Sl(this.b)}${i===1?")":`, ${i})`}`}function fg(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function Sl(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function yl(i){return i=Sl(i),(i<16?"0":"")+i.toString(16)}function dw(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new as(i,e,t,n)}function eR(i){if(i instanceof as)return new as(i.h,i.s,i.l,i.opacity);if(i instanceof sd||(i=kf(i)),!i)return new as;if(i instanceof as)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),a=NaN,o=s-r,l=(s+r)/2;return o?(e===s?a=(t-n)/o+(t<n)*6:t===s?a=(n-e)/o+2:a=(e-t)/o+4,o/=l<.5?s+r:2-s-r,a*=60):o=l>0&&l<1?0:a,new as(a,o,l,i.opacity)}function yG(i,e,t,n){return arguments.length===1?eR(i):new as(i,e,t,n??1)}function as(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}L1(as,yG,$C(sd,{brighter(i){return i=i==null?hg:Math.pow(hg,i),new as(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Ff:Math.pow(Ff,i),new as(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new $i(r_(i>=240?i-240:i+120,r,n),r_(i,r,n),r_(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new as(pw(this.h),Yp(this.s),Yp(this.l),fg(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 i=fg(this.opacity);return`${i===1?"hsl(":"hsla("}${pw(this.h)}, ${Yp(this.s)*100}%, ${Yp(this.l)*100}%${i===1?")":`, ${i})`}`}}));function pw(i){return i=(i||0)%360,i<0?i+360:i}function Yp(i){return Math.max(0,Math.min(1,i||0))}function r_(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}const I1=i=>()=>i;function _G(i,e){return function(t){return i+t*e}}function xG(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function bG(i){return(i=+i)==1?tR:function(e,t){return t-e?xG(e,t,i):I1(isNaN(e)?t:e)}}function tR(i,e){var t=e-i;return t?_G(i,t):I1(isNaN(i)?e:i)}const mw=(function i(e){var t=bG(e);function n(r,s){var a=t((r=fx(r)).r,(s=fx(s)).r),o=t(r.g,s.g),l=t(r.b,s.b),c=tR(r.opacity,s.opacity);return function(h){return r.r=a(h),r.g=o(h),r.b=l(h),r.opacity=c(h),r+""}}return n.gamma=i,n})(1);function SG(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function EG(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function MG(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),a;for(a=0;a<n;++a)r[a]=N1(i[a],e[a]);for(;a<t;++a)s[a]=e[a];return function(o){for(a=0;a<n;++a)s[a]=r[a](o);return s}}function wG(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function dg(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function TG(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=N1(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var dx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,s_=new RegExp(dx.source,"g");function AG(i){return function(){return i}}function CG(i){return function(e){return i(e)+""}}function RG(i,e){var t=dx.lastIndex=s_.lastIndex=0,n,r,s,a=-1,o=[],l=[];for(i=i+"",e=e+"";(n=dx.exec(i))&&(r=s_.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),o[a]?o[a]+=s:o[++a]=s),(n=n[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:dg(n,r)})),t=s_.lastIndex;return t<e.length&&(s=e.slice(t),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?CG(l[0].x):AG(e):(e=l.length,function(c){for(var h=0,d;h<e;++h)o[(d=l[h]).i]=d.x(c);return o.join("")})}function N1(i,e){var t=typeof e,n;return e==null||t==="boolean"?I1(e):(t==="number"?dg:t==="string"?(n=kf(e))?(e=n,mw):RG:e instanceof kf?mw:e instanceof Date?wG:EG(e)?SG:Array.isArray(e)?MG:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?TG:dg)(i,e)}function DG(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function UG(i){return function(){return i}}function OG(i){return+i}var gw=[0,1];function nu(i){return i}function px(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:UG(isNaN(e)?NaN:.5)}function LG(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function IG(i,e,t){var n=i[0],r=i[1],s=e[0],a=e[1];return r<n?(n=px(r,n),s=t(a,s)):(n=px(n,r),s=t(s,a)),function(o){return s(n(o))}}function NG(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),a=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++a<n;)r[a]=px(i[a],i[a+1]),s[a]=t(e[a],e[a+1]);return function(o){var l=eG(i,o,1,n)-1;return s[l](r[l](o))}}function PG(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function zG(){var i=gw,e=gw,t=N1,n,r,s,a=nu,o,l,c;function h(){var p=Math.min(i.length,e.length);return a!==nu&&(a=LG(i[0],i[p-1])),o=p>2?NG:IG,l=c=null,d}function d(p){return p==null||isNaN(p=+p)?s:(l||(l=o(i.map(n),e,t)))(n(a(p)))}return d.invert=function(p){return a(r((c||(c=o(e,i.map(n),dg)))(p)))},d.domain=function(p){return arguments.length?(i=Array.from(p,OG),h()):i.slice()},d.range=function(p){return arguments.length?(e=Array.from(p),h()):e.slice()},d.rangeRound=function(p){return e=Array.from(p),t=DG,h()},d.clamp=function(p){return arguments.length?(a=p?!0:nu,h()):a!==nu},d.interpolate=function(p){return arguments.length?(t=p,h()):t},d.unknown=function(p){return arguments.length?(s=p,d):s},function(p,m){return n=p,r=m,h()}}function FG(){return zG()(nu,nu)}function BG(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function pg(i,e){if((t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"))<0)return null;var t,n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function yu(i){return i=pg(Math.abs(i)),i?i[1]:NaN}function kG(i,e){return function(t,n){for(var r=t.length,s=[],a=0,o=i[0],l=0;r>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(r-=o,r+o)),!((l+=o+1)>n));)o=i[a=(a+1)%i.length];return s.reverse().join(e)}}function GG(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var HG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mg(i){if(!(e=HG.exec(i)))throw new Error("invalid format: "+i);var e;return new P1({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}mg.prototype=P1.prototype;function P1(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}P1.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 VG(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var nR;function WG(i,e){var t=pg(i,e);if(!t)return i+"";var n=t[0],r=t[1],s=r-(nR=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+pg(i,Math.max(0,e+s-1))[0]}function vw(i,e){var t=pg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}const yw={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:BG,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>vw(i*100,e),r:vw,s:WG,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function _w(i){return i}var xw=Array.prototype.map,bw=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function XG(i){var e=i.grouping===void 0||i.thousands===void 0?_w:kG(xw.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?_w:GG(xw.call(i.numerals,String)),a=i.percent===void 0?"%":i.percent+"",o=i.minus===void 0?"−":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(d){d=mg(d);var p=d.fill,m=d.align,v=d.sign,x=d.symbol,_=d.zero,g=d.width,b=d.comma,E=d.precision,S=d.trim,w=d.type;w==="n"?(b=!0,w="g"):yw[w]||(E===void 0&&(E=12),S=!0,w="g"),(_||p==="0"&&m==="=")&&(_=!0,p="0",m="=");var T=x==="$"?t:x==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",R=x==="$"?n:/[%p]/.test(w)?a:"",U=yw[w],A=/[defgprs%]/.test(w);E=E===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function D(L){var P=T,I=R,V,H,z;if(w==="c")I=U(L)+I,L="";else{L=+L;var O=L<0||1/L<0;if(L=isNaN(L)?l:U(Math.abs(L),E),S&&(L=VG(L)),O&&+L==0&&v!=="+"&&(O=!1),P=(O?v==="("?v:o:v==="-"||v==="("?"":v)+P,I=(w==="s"?bw[8+nR/3]:"")+I+(O&&v==="("?")":""),A){for(V=-1,H=L.length;++V<H;)if(z=L.charCodeAt(V),48>z||z>57){I=(z===46?r+L.slice(V+1):L.slice(V))+I,L=L.slice(0,V);break}}}b&&!_&&(L=e(L,1/0));var B=P.length+L.length+I.length,G=B<g?new Array(g-B+1).join(p):"";switch(b&&_&&(L=e(G+L,G.length?g-I.length:1/0),G=""),m){case"<":L=P+L+I+G;break;case"=":L=P+G+L+I;break;case"^":L=G.slice(0,B=G.length>>1)+P+L+I+G.slice(B);break;default:L=G+P+L+I;break}return s(L)}return D.toString=function(){return d+""},D}function h(d,p){var m=c((d=mg(d),d.type="f",d)),v=Math.max(-8,Math.min(8,Math.floor(yu(p)/3)))*3,x=Math.pow(10,-v),_=bw[8+v/3];return function(g){return m(x*g)+_}}return{format:c,formatPrefix:h}}var Zp,iR,rR;jG({thousands:",",grouping:[3],currency:["$",""]});function jG(i){return Zp=XG(i),iR=Zp.format,rR=Zp.formatPrefix,Zp}function qG(i){return Math.max(0,-yu(Math.abs(i)))}function YG(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(yu(e)/3)))*3-yu(Math.abs(i)))}function ZG(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,yu(e)-yu(i))+1}function KG(i,e,t,n){var r=sG(i,e,t),s;switch(n=mg(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=YG(r,a))&&(n.precision=s),rR(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=ZG(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=qG(r))&&(n.precision=s-(n.type==="%")*2);break}}return iR(n)}function JG(i){var e=i.domain;return i.ticks=function(t){var n=e();return rG(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return KG(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,a=n[r],o=n[s],l,c,h=10;for(o<a&&(c=a,a=o,o=c,c=r,r=s,s=c);h-- >0;){if(c=hx(a,o,t),c===l)return n[r]=a,n[s]=o,e(n);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return i},i}function sR(){var i=FG();return i.copy=function(){return PG(i,sR())},aG.apply(i,arguments),JG(i)}var a_,Sw;function z1(){if(Sw)return a_;Sw=1;function i(t){return!t||typeof t!="object"||typeof t=="function"||Array.isArray(t)||t instanceof Set||t instanceof Map||t instanceof RegExp||t instanceof Date}function e(t,n){t=t||{};var r={};for(var s in n){var a=t[s],o=n[s];if(!i(o)){r[s]=e(a,o);continue}a===void 0?r[s]=o:r[s]=a}return r}return a_=e,a_}var Kp={},o_={},Ew;function aR(){return Ew||(Ew=1,(function(i){var e=Math.pow(2,8)-1,t=Math.pow(2,16)-1,n=Math.pow(2,32)-1,r=Math.pow(2,7)-1,s=Math.pow(2,15)-1,a=Math.pow(2,31)-1;i.getPointerArray=function(l){var c=l-1;if(c<=e)return Uint8Array;if(c<=t)return Uint16Array;if(c<=n)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},i.getSignedPointerArray=function(l){var c=l-1;return c<=r?Int8Array:c<=s?Int16Array:c<=a?Int32Array:Float64Array},i.getNumberType=function(l){return l===(l|0)?Math.sign(l)===-1?l<=127&&l>=-128?Int8Array:l<=32767&&l>=-32768?Int16Array:Int32Array:l<=255?Uint8Array:l<=65535?Uint16Array:Uint32Array:Float64Array};var o={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};i.getMinimalRepresentation=function(l,c){var h=null,d=0,p,m,v,x,_;for(x=0,_=l.length;x<_;x++)v=c?c(l[x]):l[x],m=i.getNumberType(v),p=o[m.name],p>d&&(d=p,h=m);return h},i.isTypedArray=function(l){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(l)},i.concat=function(){var l=0,c,h,d;for(c=0,d=arguments.length;c<d;c++)l+=arguments[c].length;var p=new arguments[0].constructor(l);for(c=0,h=0;c<d;c++)p.set(arguments[c],h),h+=arguments[c].length;return p},i.indices=function(l){for(var c=i.getPointerArray(l),h=new c(l),d=0;d<l;d++)h[d]=d;return h}})(o_)),o_}var Fh={},Mw;function d0(){if(Mw)return Fh;Mw=1;function i(n){return typeof n!="number"||isNaN(n)?1:n}function e(n,r){var s={},a=function(c){return typeof c>"u"?r:c};typeof r=="function"&&(a=r);var o=function(c){return a(c[n])},l=function(){return a(void 0)};return typeof n=="string"?(s.fromAttributes=o,s.fromGraph=function(c,h){return o(c.getNodeAttributes(h))},s.fromEntry=function(c,h){return o(h)}):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},s.fromGraph=function(c,h){return a(n(h,c.getNodeAttributes(h)))},s.fromEntry=function(c,h){return a(n(c,h))}):(s.fromAttributes=l,s.fromGraph=l,s.fromEntry=l),s}function t(n,r){var s={},a=function(c){return typeof c>"u"?r:c};typeof r=="function"&&(a=r);var o=function(c){return a(c[n])},l=function(){return a(void 0)};return typeof n=="string"?(s.fromAttributes=o,s.fromGraph=function(c,h){return o(c.getEdgeAttributes(h))},s.fromEntry=function(c,h){return o(h)},s.fromPartialEntry=s.fromEntry,s.fromMinimalEntry=s.fromEntry):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},s.fromGraph=function(c,h){var d=c.extremities(h);return a(n(h,c.getEdgeAttributes(h),d[0],d[1],c.getNodeAttributes(d[0]),c.getNodeAttributes(d[1]),c.isUndirected(h)))},s.fromEntry=function(c,h,d,p,m,v,x){return a(n(c,h,d,p,m,v,x))},s.fromPartialEntry=function(c,h,d,p){return a(n(c,h,d,p))},s.fromMinimalEntry=function(c,h){return a(n(c,h))}):(s.fromAttributes=l,s.fromGraph=l,s.fromEntry=l,s.fromMinimalEntry=l),s}return Fh.createNodeValueGetter=e,Fh.createEdgeValueGetter=t,Fh.createEdgeWeightGetter=function(n){return t(n,i)},Fh}var ww;function QG(){if(ww)return Kp;ww=1;var i=aR(),e=d0().createEdgeWeightGetter;function t(s,a){return s==="outbound"||s==="inbound"?a.directedSize+a.undirectedSize*2:s==="in"||s==="out"||s==="directed"?a.directedSize:a.undirectedSize*2}function n(s,a){a=a||"outbound";var o=s[a+"Neighbors"].bind(s),l=t(a,s),c=i.getPointerArray(l),h=i.getPointerArray(s.order);this.graph=s,this.neighborhood=new h(l),this.starts=new c(s.order+1),this.nodes=s.nodes();var d={},p,m,v,x,_,g,b=0;for(p=0,m=s.order;p<m;p++)d[this.nodes[p]]=p;for(p=0,m=s.order;p<m;p++)for(_=this.nodes[p],g=o(_),this.starts[p]=b,v=0,x=g.length;v<x;v++)this.neighborhood[b++]=d[g[v]];this.starts[p]=l}n.prototype.bounds=function(s){return[this.starts[s],this.starts[s+1]]},n.prototype.project=function(){var s=this,a={};return s.nodes.forEach(function(o,l){a[o]=Array.from(s.neighborhood.slice(s.starts[l],s.starts[l+1])).map(function(c){return s.nodes[c]})}),a},n.prototype.collect=function(s){var a,o,l={};for(a=0,o=s.length;a<o;a++)l[this.nodes[a]]=s[a];return l},n.prototype.assign=function(s,a){var o=0;this.graph.updateEachNodeAttributes(function(l,c){return c[s]=a[o++],c},{attributes:[s]})},Kp.NeighborhoodIndex=n;function r(s,a,o){o=o||"outbound";var l=s[o+"Edges"].bind(s),c=t(o,s),h=i.getPointerArray(c),d=i.getPointerArray(s.order),p=e(a).fromMinimalEntry;this.graph=s,this.neighborhood=new d(c),this.weights=new Float64Array(c),this.outDegrees=new Float64Array(s.order),this.starts=new h(s.order+1),this.nodes=s.nodes();var m={},v,x,_,g,b,E,S,w,T,R=0;for(v=0,x=s.order;v<x;v++)m[this.nodes[v]]=v;for(v=0,x=s.order;v<x;v++)for(b=this.nodes[v],S=l(b),this.starts[v]=R,_=0,g=S.length;_<g;_++)w=S[_],E=s.opposite(b,w),T=p(w,s.getEdgeAttributes(w)),this.neighborhood[R]=m[E],this.weights[R++]=T,this.outDegrees[v]+=T;this.starts[v]=c}return r.prototype.bounds=n.prototype.bounds,r.prototype.project=n.prototype.project,r.prototype.collect=n.prototype.collect,r.prototype.assign=n.prototype.assign,Kp.WeightedNeighborhoodIndex=r,Kp}var l_,Tw;function $G(){if(Tw)return l_;Tw=1;var i=Ta(),e=z1(),t=QG().WeightedNeighborhoodIndex,n={nodePagerankAttribute:"pagerank",getEdgeWeight:"weight",alpha:.85,maxIterations:100,tolerance:1e-6};function r(a,o,l){if(!i(o))throw new Error("graphology-metrics/centrality/pagerank: the given graph is not a valid graphology instance.");l=e(l,n);var c=l.alpha,h=l.maxIterations,d=l.tolerance,p=l.nodePagerankAttribute,m=o.order,v=1/m,x=new t(o,l.getEdgeWeight),_,g,b,E,S=new Float64Array(o.order),w=new Float64Array(x.weights.length),T=[];for(_=0;_<m;_++)for(S[_]=v,b=x.starts[_+1],E=x.outDegrees[_],E===0&&T.push(_),g=x.starts[_];g<b;g++)w[g]=x.weights[g]/E;for(var R=0,U=0,A,D,L,P=!1;R<h;){for(L=S,S=new Float64Array(o.order),A=0,_=0,b=T.length;_<b;_++)A+=L[T[_]];for(A*=c,_=0;_<m;_++){for(b=x.starts[_+1],g=x.starts[_];g<b;g++)D=x.neighborhood[g],S[D]+=c*L[_]*w[g];S[_]+=A*v+(1-c)*v}for(U=0,_=0;_<m;_++)U+=Math.abs(S[_]-L[_]);if(U<m*d){P=!0;break}R++}if(!P)throw Error("graphology-metrics/centrality/pagerank: failed to converge.");if(a){x.assign(p,S);return}return x.collect(S)}var s=r.bind(null,!1);return s.assign=r.bind(null,!0),l_=s,l_}var eH=$G();const tH=po(eH);var ts={},ll={},c_,Aw;function nH(){if(Aw)return c_;Aw=1;function i(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=function(){return this}),i.of=function(){var e=arguments,t=e.length,n=0;return new i(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},i.empty=function(){var e=new i(function(){return{done:!0}});return e},i.fromSequence=function(e){var t=0,n=e.length;return new i(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},i.is=function(e){return e instanceof i?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},c_=i,c_}var Jp={},Cw;function iH(){return Cw||(Cw=1,Jp.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Jp.SYMBOL_SUPPORT=typeof Symbol<"u"),Jp}var u_,Rw;function F1(){if(Rw)return u_;Rw=1;var i=iH(),e=i.ARRAY_BUFFER_SUPPORT,t=i.SYMBOL_SUPPORT;return u_=function(r,s){var a,o,l,c,h;if(!r)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(r)||e&&ArrayBuffer.isView(r)||typeof r=="string"||r.toString()==="[object Arguments]"){for(l=0,c=r.length;l<c;l++)s(r[l],l);return}if(typeof r.forEach=="function"){r.forEach(s);return}if(t&&Symbol.iterator in r&&typeof r.next!="function"&&(r=r[Symbol.iterator]()),typeof r.next=="function"){for(a=r,l=0;h=a.next(),h.done!==!0;)s(h.value,l),l++;return}for(o in r)r.hasOwnProperty(o)&&s(r[o],o)},u_}var h_,Dw;function rH(){if(Dw)return h_;Dw=1;var i=nH(),e=F1();function t(){this.clear()}return t.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},t.prototype.enqueue=function(n){return this.items.push(n),++this.size},t.prototype.dequeue=function(){if(this.size){var n=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}},t.prototype.peek=function(){if(this.size)return this.items[this.offset]},t.prototype.forEach=function(n,r){r=arguments.length>1?r:this;for(var s=this.offset,a=0,o=this.items.length;s<o;s++,a++)n.call(r,this.items[s],a,this)},t.prototype.toArray=function(){return this.items.slice(this.offset)},t.prototype.values=function(){var n=this.items,r=this.offset;return new i(function(){if(r>=n.length)return{done:!0};var s=n[r];return r++,{value:s,done:!1}})},t.prototype.entries=function(){var n=this.items,r=this.offset,s=0;return new i(function(){if(r>=n.length)return{done:!0};var a=n[r];return r++,{value:[s++,a],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.toString=function(){return this.toArray().join(",")},t.prototype.toJSON=function(){return this.toArray()},t.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(n){var r=new t;return e(n,function(s){r.enqueue(s)}),r},t.of=function(){return t.from(arguments)},h_=t,h_}var f_,Uw;function sH(){return Uw||(Uw=1,f_=function(e,t){var n=t.length;if(n!==0){var r=e.length;e.length+=n;for(var s=0;s<n;s++)e[r+s]=t[s]}}),f_}var Ow;function aH(){if(Ow)return ll;Ow=1;var i=Ta(),e=rH(),t=sH();function n(c,h,d){if(!i(c))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<3)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 3.");if(!c.hasNode(h))throw new Error('graphology-shortest-path: the "'+h+'" source node does not exist in the given graph.');if(!c.hasNode(d))throw new Error('graphology-shortest-path: the "'+d+'" target node does not exist in the given graph.');if(h=""+h,d=""+d,h===d)return[h];var p=c.inboundNeighbors.bind(c),m=c.outboundNeighbors.bind(c),v={},x={};v[h]=null,x[d]=null;var _=[h],g=[d],b,E,S,w,T,R,U,A,D=!1;e:for(;_.length&&g.length;)if(_.length<=g.length){for(b=_,_=[],T=0,U=b.length;T<U;T++)for(E=b[T],S=m(E),R=0,A=S.length;R<A;R++)if(w=S[R],w in v||(_.push(w),v[w]=E),w in x){D=!0;break e}}else for(b=g,g=[],T=0,U=b.length;T<U;T++)for(E=b[T],S=p(E),R=0,A=S.length;R<A;R++)if(w=S[R],w in x||(g.push(w),x[w]=E),w in v){D=!0;break e}if(!D)return null;for(var L=[];w;)L.unshift(w),w=v[w];for(w=x[L[L.length-1]];w;)L.push(w),w=x[w];return L.length?L:null}function r(c,h){if(!i(c))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<2)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 2.");if(!c.hasNode(h))throw new Error('graphology-shortest-path: the "'+h+'" source node does not exist in the given graph.');h=""+h;var d={},p={},m,v,x,_,g,b;for(d[h]=!0,p[h]=[h];Object.keys(d).length;){m=d,d={};for(x in m)for(v=c.outboundNeighbors(x),g=0,b=v.length;g<b;g++)_=v[g],p[_]||(p[_]=p[x].concat(_),d[_]=!0)}return p}function s(c,h,d){if(!i(h))throw new Error("graphology-shortest-path: invalid graphology instance.");if(!h.hasNode(d))throw new Error('graphology-shortest-path: the "'+d+'" source node does not exist in the given graph.');d=""+d;var p=new Set,m={},v=0;m[d]=0;for(var x=[d],_,g,b;x.length!==0;){var E=[];for(_=0,g=x.length;_<g;_++)b=x[_],!p.has(b)&&(p.add(b),t(E,h[c](b)),m[b]=v);v++,x=E}return m}var a=s.bind(null,"outboundNeighbors"),o=s.bind(null,"neighbors");function l(c,h){h=""+h;var d=[],p={},m={},v=c.nodes(),x,_,g,b,E,S,w,T,R;for(S=0,T=v.length;S<T;S++)b=v[S],p[b]=[],m[b]=0;var U={};m[h]=1,U[h]=0;for(var A=e.of(h);A.size;)for(b=A.dequeue(),d.push(b),x=U[b],_=m[b],g=c.outboundNeighbors(b),w=0,R=g.length;w<R;w++)E=g[w],E in U||(A.enqueue(E),U[E]=x+1),U[E]===x+1&&(m[E]+=_,p[E].push(b));return[d,p,m]}return ll.bidirectional=n,ll.singleSource=r,ll.singleSourceLength=a,ll.undirectedSingleSourceLength=o,ll.brandes=l,ll}var d_={},Lw;function oH(){if(Lw)return d_;Lw=1;var i=function(){return!0};return d_.edgePathFromNodePath=function(e,t){var n=t.length,r,s,a,o;if(n<2)return s=t[0],o=e.multi?e.findEdge(s,s,i):e.edge(s,s),o?[o]:[];n--;var l=new Array(n);for(r=0;r<n;r++){if(s=t[r],a=t[r+1],o=e.multi?e.findOutboundEdge(s,a,i):e.edge(s,a),o===void 0)throw new Error("graphology-shortest-path: given path is impossible in given graph.");l[r]=o}return l},d_}var Bh={},jc={},Iw;function lH(){if(Iw)return jc;Iw=1;var i=function(r,s){return r<s?-1:r>s?1:0},e=function(r,s){return r<s?1:r>s?-1:0};function t(r){return function(s,a){return r(a,s)}}function n(r){return r===2?function(s,a){return s[0]<a[0]?-1:s[0]>a[0]?1:s[1]<a[1]?-1:s[1]>a[1]?1:0}:function(s,a){for(var o=0;o<r;){if(s[o]<a[o])return-1;if(s[o]>a[o])return 1;o++}return 0}}return jc.DEFAULT_COMPARATOR=i,jc.DEFAULT_REVERSE_COMPARATOR=e,jc.reverseComparator=t,jc.createTupleComparator=n,jc}var qc={},Nw;function cH(){if(Nw)return qc;Nw=1;var i=F1(),e=aR();function t(a){return Array.isArray(a)||e.isTypedArray(a)}function n(a){if(typeof a.length=="number")return a.length;if(typeof a.size=="number")return a.size}function r(a){var o=n(a),l=typeof o=="number"?new Array(o):[],c=0;return i(a,function(h){l[c++]=h}),l}function s(a){var o=n(a),l=typeof o=="number"?e.getPointerArray(o):Array,c=typeof o=="number"?new Array(o):[],h=typeof o=="number"?new l(o):[],d=0;return i(a,function(p){c[d]=p,h[d]=d++}),[c,h]}return qc.isArrayLike=t,qc.guessLength=n,qc.toArray=r,qc.toArrayWithIndices=s,qc}var p_,Pw;function oR(){if(Pw)return p_;Pw=1;var i=F1(),e=lH(),t=cH(),n=e.DEFAULT_COMPARATOR,r=e.reverseComparator;function s(g,b,E,S){for(var w=b[S],T,R;S>E;){if(T=S-1>>1,R=b[T],g(w,R)<0){b[S]=R,S=T;continue}break}b[S]=w}function a(g,b,E){for(var S=b.length,w=E,T=b[E],R=2*E+1,U;R<S;)U=R+1,U<S&&g(b[R],b[U])>=0&&(R=U),b[E]=b[R],E=R,R=2*E+1;b[E]=T,s(g,b,w,E)}function o(g,b,E){b.push(E),s(g,b,0,b.length-1)}function l(g,b){var E=b.pop();if(b.length!==0){var S=b[0];return b[0]=E,a(g,b,0),S}return E}function c(g,b,E){if(b.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var S=b[0];return b[0]=E,a(g,b,0),S}function h(g,b,E){var S;return b.length!==0&&g(b[0],E)<0&&(S=b[0],b[0]=E,E=S,a(g,b,0)),E}function d(g,b){for(var E=b.length,S=E>>1,w=S;--w>=0;)a(g,b,w)}function p(g,b){for(var E=b.length,S=0,w=new Array(E);S<E;)w[S++]=l(g,b);return w}function m(g,b,E){arguments.length===2&&(E=b,b=g,g=n);var S=r(g),w,T,R,U=1/0,A;if(b===1){if(t.isArrayLike(E)){for(w=0,T=E.length;w<T;w++)R=E[w],(U===1/0||g(R,U)<0)&&(U=R);return A=new E.constructor(1),A[0]=U,A}return i(E,function(L){(U===1/0||g(L,U)<0)&&(U=L)}),[U]}if(t.isArrayLike(E)){if(b>=E.length)return E.slice().sort(g);for(A=E.slice(0,b),d(S,A),w=b,T=E.length;w<T;w++)S(E[w],A[0])>0&&c(S,A,E[w]);return A.sort(g)}var D=t.guessLength(E);return D!==null&&D<b&&(b=D),A=new Array(b),w=0,i(E,function(L){w<b?A[w]=L:(w===b&&d(S,A),S(L,A[0])>0&&c(S,A,L)),w++}),A.length>w&&(A.length=w),A.sort(g)}function v(g,b,E){arguments.length===2&&(E=b,b=g,g=n);var S=r(g),w,T,R,U=-1/0,A;if(b===1){if(t.isArrayLike(E)){for(w=0,T=E.length;w<T;w++)R=E[w],(U===-1/0||g(R,U)>0)&&(U=R);return A=new E.constructor(1),A[0]=U,A}return i(E,function(L){(U===-1/0||g(L,U)>0)&&(U=L)}),[U]}if(t.isArrayLike(E)){if(b>=E.length)return E.slice().sort(S);for(A=E.slice(0,b),d(g,A),w=b,T=E.length;w<T;w++)g(E[w],A[0])>0&&c(g,A,E[w]);return A.sort(S)}var D=t.guessLength(E);return D!==null&&D<b&&(b=D),A=new Array(b),w=0,i(E,function(L){w<b?A[w]=L:(w===b&&d(g,A),g(L,A[0])>0&&c(g,A,L)),w++}),A.length>w&&(A.length=w),A.sort(S)}function x(g){if(this.clear(),this.comparator=g||n,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}x.prototype.clear=function(){this.items=[],this.size=0},x.prototype.push=function(g){return o(this.comparator,this.items,g),++this.size},x.prototype.peek=function(){return this.items[0]},x.prototype.pop=function(){return this.size!==0&&this.size--,l(this.comparator,this.items)},x.prototype.replace=function(g){return c(this.comparator,this.items,g)},x.prototype.pushpop=function(g){return h(this.comparator,this.items,g)},x.prototype.consume=function(){return this.size=0,p(this.comparator,this.items)},x.prototype.toArray=function(){return p(this.comparator,this.items.slice())},x.prototype.inspect=function(){var g=this.toArray();return Object.defineProperty(g,"constructor",{value:x,enumerable:!1}),g},typeof Symbol<"u"&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=x.prototype.inspect);function _(g){if(this.clear(),this.comparator=g||n,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=r(this.comparator)}return _.prototype=x.prototype,x.from=function(g,b){var E=new x(b),S;return t.isArrayLike(g)?S=g.slice():S=t.toArray(g),d(E.comparator,S),E.items=S,E.size=S.length,E},_.from=function(g,b){var E=new _(b),S;return t.isArrayLike(g)?S=g.slice():S=t.toArray(g),d(E.comparator,S),E.items=S,E.size=S.length,E},x.siftUp=a,x.siftDown=s,x.push=o,x.pop=l,x.replace=c,x.pushpop=h,x.heapify=d,x.consume=p,x.nsmallest=m,x.nlargest=v,x.MinHeap=x,x.MaxHeap=_,p_=x,p_}var zw;function uH(){if(zw)return Bh;zw=1;var i=Ta(),e=d0().createEdgeWeightGetter,t=oR(),n="weight";function r(d,p){return d[0]>p[0]?1:d[0]<p[0]?-1:d[1]>p[1]?1:d[1]<p[1]?-1:d[2]>p[2]?1:d[2]<p[2]?-1:0}function s(d,p){return d[0]>p[0]?1:d[0]<p[0]?-1:d[1]>p[1]?1:d[1]<p[1]?-1:d[2]>p[2]?1:d[2]<p[2]?-1:d[3]>p[3]?1:d[3]<p[3]?-1:0}function a(d,p,m,v){if(p=""+p,m=""+m,!i(d))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(p&&!d.hasNode(p))throw new Error('graphology-shortest-path/dijkstra: the "'+p+'" source node does not exist in the given graph.');if(m&&!d.hasNode(m))throw new Error('graphology-shortest-path/dijkstra: the "'+m+'" target node does not exist in the given graph.');if(v=e(v||n).fromMinimalEntry,p===m)return[0,[p]];var x=[{},{}],_=[{},{}],g=[new t(r),new t(r)],b=[{},{}];_[0][p]=[p],_[1][m]=[m],b[0][p]=0,b[1][m]=0;var E=[],S=1/0,w=0,T=1,R,U,A,D,L,P,I,V,H;for(g[0].push([0,w++,p]),g[1].push([0,w++,m]);g[0].size&&g[1].size;)if(T=1-T,R=g[T].pop(),D=R[0],L=R[2],!(L in x[T])){if(x[T][L]=D,L in x[1-T])return[S,E];for(U=T===1?d.inboundEdges(L):d.outboundEdges(L),V=0,H=U.length;V<H;V++){if(I=U[V],P=d.opposite(L,I),A=x[T][L]+v(I,d.getEdgeAttributes(I)),P in x[T]&&A<x[T][P])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(P in b[T])||A<b[T][P])&&(b[T][P]=A,g[T].push([A,w++,P]),_[T][P]=_[T][L].concat(P),P in b[0]&&P in b[1]&&(D=b[0][P]+b[1][P],(E.length===0||S>D)&&(S=D,E=_[0][P].concat(_[1][P].slice(0,-1).reverse()))))}}return[1/0,null]}function o(d,p,m,v,x,_){if(!i(d))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");m=e(m||n).fromMinimalEntry;var g={},b={},E=new t(r),S=0,w,T,R,U,A,D,L,P,I,V,H;for(P=0,V=p.length;P<V;P++)U=p[P],b[U]=0,E.push([0,S++,U]),_&&(_[U]=[U]);for(;E.size;)if(T=E.pop(),L=T[0],U=T[2],!(U in g)){if(g[U]=L,U===x)break;for(w=d.outboundEdges(U),I=0,H=w.length;I<H;I++){if(D=w[I],A=d.opposite(U,D),R=m(D,d.getEdgeAttributes(D))+g[U],A in g&&R<g[A])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(A in b)||R<b[A])&&(b[A]=R,E.push([R,S++,A]),_&&(_[A]=_[U].concat(A)))}}return g}function l(d,p,m){var v={};return o(d,[p],m,0,null,v),v}function c(d,p,m,v){return a(d,p,m,v)[1]}function h(d,p,m){p=""+p,m=e(m||n).fromMinimalEntry;var v=[],x={},_={},g=d.nodes(),b,E,S,w,T,R,U,A,D,L;for(D=0,L=g.length;D<L;D++)R=g[D],x[R]=[],_[R]=0;var P={};_[p]=1;var I={};I[p]=0;var V=0,H=new t(s);for(H.push([0,V++,p,p]);H.size;)if(E=H.pop(),w=E[0],S=E[2],R=E[3],!(R in P))for(_[R]+=_[S],v.push(R),P[R]=w,b=d.outboundEdges(R),D=0,L=b.length;D<L;D++)A=b[D],U=d.opposite(R,A),T=w+m(A,d.getEdgeAttributes(A)),!(U in P)&&(!(U in I)||T<I[U])?(I[U]=T,H.push([T,V++,R,U]),_[U]=0,x[U]=[R]):T===I[U]&&(_[U]+=_[R],x[U].push(R));return[v,x,_]}return Bh.bidirectional=c,Bh.singleSource=l,Bh.brandes=h,Bh}var m_={},Fw;function hH(){if(Fw)return m_;Fw=1;var i=Ta(),e=d0().createEdgeWeightGetter,t=oR(),n="weight";function r(a,o){return a[0]>o[0]?1:a[0]<o[0]?-1:a[1]>o[1]?1:a[1]<o[1]?-1:0}function s(a,o,l,c,h,d){if(!i(a))throw new Error("graphology-shortest-path/astar: invalid graphology instance.");if(o&&!a.hasNode(o))throw new Error('graphology-shortest-path/astar: the "'+o+'" source node does not exist in the given graph.');if(l&&!a.hasNode(l))throw new Error('graphology-shortest-path/astar: the "'+l+'" target node does not exist in the given graph.');if(c=e(c||n).fromMinimalEntry,o===l)return[o];h=h||function(){return 0},d=d||{};var p=0,m=new t(r);m.push([0,p++,o,0,null]);var v={},x={},_,g,b,E,S,w,T,R,U,A,D,L;function P(I,V,H,z){if(L=g===H?z:H,A=c(I,V),A!==null){if(D=E+A,v.hasOwnProperty(L)){if(b=v[L],R=b[0],U=b[1],R<=D)return}else U=h(L,l);d.cutoff&&D+U>d.cutoff||(v[L]=[D,U],m.push([D+U,p++,L,D,g]))}}for(;m.size!==0;){if(_=m.pop(),g=_[2],E=_[3],S=_[4],g===l){for(w=[g],T=S;T!==null;)w.push(T),T=x[T];return w.reverse(),w}x.hasOwnProperty(g)&&(x[g]===null||(R=v[g][0],R<E))||(x[g]=S,a.forEachOutboundEdge(g,P))}return null}return m_.bidirectional=s,m_}var Bw;function fH(){if(Bw)return ts;Bw=1;var i=aH(),e=oH();return ts.unweighted=i,ts.dijkstra=uH(),ts.astar=hH(),ts.bidirectional=i.bidirectional,ts.singleSource=i.singleSource,ts.singleSourceLength=i.singleSourceLength,ts.undirectedSingleSourceLength=i.undirectedSingleSourceLength,ts.brandes=i.brandes,ts.edgePathFromNodePath=e.edgePathFromNodePath,ts}var dH=fH(),B1=od(),Ct=i=>ad(i,B1),k1=od();Ct.write=i=>ad(i,k1);var p0=od();Ct.onStart=i=>ad(i,p0);var G1=od();Ct.onFrame=i=>ad(i,G1);var H1=od();Ct.onFinish=i=>ad(i,H1);var au=[];Ct.setTimeout=(i,e)=>{const t=Ct.now()+e,n=()=>{const s=au.findIndex(a=>a.cancel==n);~s&&au.splice(s,1),ao-=~s?1:0},r={time:t,handler:i,cancel:n};return au.splice(lR(t),0,r),ao+=1,cR(),r};var lR=i=>~(~au.findIndex(e=>e.time>i)||~au.length);Ct.cancel=i=>{p0.delete(i),G1.delete(i),H1.delete(i),B1.delete(i),k1.delete(i)};Ct.sync=i=>{mx=!0,Ct.batchedUpdates(i),mx=!1};Ct.throttle=i=>{let e;function t(){try{i(...e)}finally{e=null}}function n(...r){e=r,Ct.onStart(t)}return n.handler=i,n.cancel=()=>{p0.delete(t),e=null},n};var V1=typeof window<"u"?window.requestAnimationFrame:(()=>{});Ct.use=i=>V1=i;Ct.now=typeof performance<"u"?()=>performance.now():Date.now;Ct.batchedUpdates=i=>i();Ct.catch=console.error;Ct.frameLoop="always";Ct.advance=()=>{Ct.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):hR()};var so=-1,ao=0,mx=!1;function ad(i,e){mx?(e.delete(i),i(0)):(e.add(i),cR())}function cR(){so<0&&(so=0,Ct.frameLoop!=="demand"&&V1(uR))}function pH(){so=-1}function uR(){~so&&(V1(uR),Ct.batchedUpdates(hR))}function hR(){const i=so;so=Ct.now();const e=lR(so);if(e&&(fR(au.splice(0,e),t=>t.handler()),ao-=e),!ao){pH();return}p0.flush(),B1.flush(i?Math.min(64,so-i):16.667),G1.flush(),k1.flush(),H1.flush()}function od(){let i=new Set,e=i;return{add(t){ao+=e==i&&!i.has(t)?1:0,i.add(t)},delete(t){return ao-=e==i&&i.has(t)?1:0,i.delete(t)},flush(t){e.size&&(i=new Set,ao-=e.size,fR(e,n=>n(t)&&i.add(n)),ao+=i.size,e=i)}}}function fR(i,e){i.forEach(t=>{try{e(t)}catch(n){Ct.catch(n)}})}var mH=Object.defineProperty,gH=(i,e)=>{for(var t in e)mH(i,t,{get:e[t],enumerable:!0})},cs={};gH(cs,{assign:()=>yH,colors:()=>lo,createStringInterpolator:()=>X1,skipAnimation:()=>pR,to:()=>dR,willAdvance:()=>j1});function gx(){}var vH=(i,e,t)=>Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0}),nt={arr:Array.isArray,obj:i=>!!i&&i.constructor.name==="Object",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",und:i=>i===void 0};function ca(i,e){if(nt.arr(i)){if(!nt.arr(e)||i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0}return i===e}var rn=(i,e)=>i.forEach(e);function Sa(i,e,t){if(nt.arr(i)){for(let n=0;n<i.length;n++)e.call(t,i[n],`${n}`);return}for(const n in i)i.hasOwnProperty(n)&&e.call(t,i[n],n)}var Br=i=>nt.und(i)?[]:nt.arr(i)?i:[i];function mf(i,e){if(i.size){const t=Array.from(i);i.clear(),rn(t,e)}}var Qh=(i,...e)=>mf(i,t=>t(...e)),W1=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),X1,dR,lo=null,pR=!1,j1=gx,yH=i=>{i.to&&(dR=i.to),i.now&&(Ct.now=i.now),i.colors!==void 0&&(lo=i.colors),i.skipAnimation!=null&&(pR=i.skipAnimation),i.createStringInterpolator&&(X1=i.createStringInterpolator),i.requestAnimationFrame&&Ct.use(i.requestAnimationFrame),i.batchedUpdates&&(Ct.batchedUpdates=i.batchedUpdates),i.willAdvance&&(j1=i.willAdvance),i.frameLoop&&(Ct.frameLoop=i.frameLoop)},gf=new Set,zr=[],g_=[],gg=0,m0={get idle(){return!gf.size&&!zr.length},start(i){gg>i.priority?(gf.add(i),Ct.onStart(_H)):(mR(i),Ct(vx))},advance:vx,sort(i){if(gg)Ct.onFrame(()=>m0.sort(i));else{const e=zr.indexOf(i);~e&&(zr.splice(e,1),gR(i))}},clear(){zr=[],gf.clear()}};function _H(){gf.forEach(mR),gf.clear(),Ct(vx)}function mR(i){zr.includes(i)||gR(i)}function gR(i){zr.splice(xH(zr,e=>e.priority>i.priority),0,i)}function vx(i){const e=g_;for(let t=0;t<zr.length;t++){const n=zr[t];gg=n.priority,n.idle||(j1(n),n.advance(i),n.idle||e.push(n))}return gg=0,g_=zr,g_.length=0,zr=e,zr.length>0}function xH(i,e){const t=i.findIndex(e);return t<0?i.length:t}var bH={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},ls="[-+]?\\d*\\.?\\d+",vg=ls+"%";function g0(...i){return"\\(\\s*("+i.join(")\\s*,\\s*(")+")\\s*\\)"}var SH=new RegExp("rgb"+g0(ls,ls,ls)),EH=new RegExp("rgba"+g0(ls,ls,ls,ls)),MH=new RegExp("hsl"+g0(ls,vg,vg)),wH=new RegExp("hsla"+g0(ls,vg,vg,ls)),TH=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,AH=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,CH=/^#([0-9a-fA-F]{6})$/,RH=/^#([0-9a-fA-F]{8})$/;function DH(i){let e;return typeof i=="number"?i>>>0===i&&i>=0&&i<=4294967295?i:null:(e=CH.exec(i))?parseInt(e[1]+"ff",16)>>>0:lo&&lo[i]!==void 0?lo[i]:(e=SH.exec(i))?(Yc(e[1])<<24|Yc(e[2])<<16|Yc(e[3])<<8|255)>>>0:(e=EH.exec(i))?(Yc(e[1])<<24|Yc(e[2])<<16|Yc(e[3])<<8|Hw(e[4]))>>>0:(e=TH.exec(i))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=RH.exec(i))?parseInt(e[1],16)>>>0:(e=AH.exec(i))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=MH.exec(i))?(kw(Gw(e[1]),Qp(e[2]),Qp(e[3]))|255)>>>0:(e=wH.exec(i))?(kw(Gw(e[1]),Qp(e[2]),Qp(e[3]))|Hw(e[4]))>>>0:null}function v_(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function kw(i,e,t){const n=t<.5?t*(1+e):t+e-t*e,r=2*t-n,s=v_(r,n,i+1/3),a=v_(r,n,i),o=v_(r,n,i-1/3);return Math.round(s*255)<<24|Math.round(a*255)<<16|Math.round(o*255)<<8}function Yc(i){const e=parseInt(i,10);return e<0?0:e>255?255:e}function Gw(i){return(parseFloat(i)%360+360)%360/360}function Hw(i){const e=parseFloat(i);return e<0?0:e>1?255:Math.round(e*255)}function Qp(i){const e=parseFloat(i);return e<0?0:e>100?1:e/100}function Vw(i){let e=DH(i);if(e===null)return i;e=e||0;const t=(e&4278190080)>>>24,n=(e&16711680)>>>16,r=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${n}, ${r}, ${s})`}var Gf=(i,e,t)=>{if(nt.fun(i))return i;if(nt.arr(i))return Gf({range:i,output:e,extrapolate:t});if(nt.str(i.output[0]))return X1(i);const n=i,r=n.output,s=n.range||[0,1],a=n.extrapolateLeft||n.extrapolate||"extend",o=n.extrapolateRight||n.extrapolate||"extend",l=n.easing||(c=>c);return c=>{const h=OH(c,s);return UH(c,s[h],s[h+1],r[h],r[h+1],l,a,o,n.map)}};function UH(i,e,t,n,r,s,a,o,l){let c=l?l(i):i;if(c<e){if(a==="identity")return c;a==="clamp"&&(c=e)}if(c>t){if(o==="identity")return c;o==="clamp"&&(c=t)}return n===r?n:e===t?i<=e?n:r:(e===-1/0?c=-c:t===1/0?c=c-e:c=(c-e)/(t-e),c=s(c),n===-1/0?c=-c:r===1/0?c=c+n:c=c*(r-n)+n,c)}function OH(i,e){for(var t=1;t<e.length-1&&!(e[t]>=i);++t);return t-1}var LH={linear:i=>i},Hf=Symbol.for("FluidValue.get"),_u=Symbol.for("FluidValue.observers"),Es=i=>!!(i&&i[Hf]),Ir=i=>i&&i[Hf]?i[Hf]():i,Ww=i=>i[_u]||null;function IH(i,e){i.eventObserved?i.eventObserved(e):i(e)}function yg(i,e){const t=i[_u];t&&t.forEach(n=>{IH(n,e)})}var NH=class{constructor(i){if(!i&&!(i=this.get))throw Error("Unknown getter");PH(this,i)}},PH=(i,e)=>vR(i,Hf,e);function ld(i,e){if(i[Hf]){let t=i[_u];t||vR(i,_u,t=new Set),t.has(e)||(t.add(e),i.observerAdded&&i.observerAdded(t.size,e))}return e}function _g(i,e){const t=i[_u];if(t&&t.has(e)){const n=t.size-1;n?t.delete(e):i[_u]=null,i.observerRemoved&&i.observerRemoved(n,e)}}var vR=(i,e,t)=>Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0}),um=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,zH=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,Xw=new RegExp(`(${um.source})(%|[a-z]+)`,"i"),FH=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,v0=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,yR=i=>{const[e,t]=BH(i);if(!e||W1())return i;const n=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(n)return n.trim();if(t&&t.startsWith("--")){const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r||i}else{if(t&&v0.test(t))return yR(t);if(t)return t}return i},BH=i=>{const e=v0.exec(i);if(!e)return[,];const[,t,n]=e;return[t,n]},y_,kH=(i,e,t,n,r)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${r})`,_R=i=>{y_||(y_=lo?new RegExp(`(${Object.keys(lo).join("|")})(?!\\w)`,"g"):/^\b$/);const e=i.output.map(s=>Ir(s).replace(v0,yR).replace(zH,Vw).replace(y_,Vw)),t=e.map(s=>s.match(um).map(Number)),r=t[0].map((s,a)=>t.map(o=>{if(!(a in o))throw Error('The arity of each "output" value must be equal');return o[a]})).map(s=>Gf({...i,output:s}));return s=>{const a=!Xw.test(e[0])&&e.find(l=>Xw.test(l))?.replace(um,"");let o=0;return e[0].replace(um,()=>`${r[o++](s)}${a||""}`).replace(FH,kH)}},q1="react-spring: ",xR=i=>{const e=i;let t=!1;if(typeof e!="function")throw new TypeError(`${q1}once requires a function parameter`);return(...n)=>{t||(e(...n),t=!0)}},GH=xR(console.warn);function HH(){GH(`${q1}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var VH=xR(console.warn);function WH(){VH(`${q1}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function y0(i){return nt.str(i)&&(i[0]=="#"||/\d/.test(i)||!W1()&&v0.test(i)||i in(lo||{}))}var Y1=W1()?K.useEffect:K.useLayoutEffect,XH=()=>{const i=K.useRef(!1);return Y1(()=>(i.current=!0,()=>{i.current=!1}),[]),i};function bR(){const i=K.useState()[1],e=XH();return()=>{e.current&&i(Math.random())}}var SR=i=>K.useEffect(i,jH),jH=[];function jw(i){const e=K.useRef(void 0);return K.useEffect(()=>{e.current=i}),e.current}var Vf=Symbol.for("Animated:node"),qH=i=>!!i&&i[Vf]===i,Ss=i=>i&&i[Vf],Z1=(i,e)=>vH(i,Vf,e),_0=i=>i&&i[Vf]&&i[Vf].getPayload(),ER=class{constructor(){Z1(this,this)}getPayload(){return this.payload||[]}},x0=class MR extends ER{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,nt.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new MR(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return nt.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,nt.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},xg=class wR extends x0{constructor(e){super(0),this._string=null,this._toString=Gf({output:[e,e]})}static create(e){return new wR(e)}getValue(){const e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(nt.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=Gf({output:[this.getValue(),e]})),this._value=0,super.reset()}},bg={dependencies:null},K1=class extends ER{constructor(i){super(),this.source=i,this.setValue(i)}getValue(i){const e={};return Sa(this.source,(t,n)=>{qH(t)?e[n]=t.getValue(i):Es(t)?e[n]=Ir(t):i||(e[n]=t)}),e}setValue(i){this.source=i,this.payload=this._makePayload(i)}reset(){this.payload&&rn(this.payload,i=>i.reset())}_makePayload(i){if(i){const e=new Set;return Sa(i,this._addToPayload,e),Array.from(e)}}_addToPayload(i){bg.dependencies&&Es(i)&&bg.dependencies.add(i);const e=_0(i);e&&rn(e,t=>this.add(t))}},YH=class TR extends K1{constructor(e){super(e)}static create(e){return new TR(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((n,r)=>n.setValue(e[r])).some(Boolean):(super.setValue(e.map(ZH)),!0)}};function ZH(i){return(y0(i)?xg:x0).create(i)}function yx(i){const e=Ss(i);return e?e.constructor:nt.arr(i)?YH:y0(i)?xg:x0}var qw=(i,e)=>{const t=!nt.fun(i)||i.prototype&&i.prototype.isReactComponent;return K.forwardRef((n,r)=>{const s=K.useRef(null),a=t&&K.useCallback(v=>{s.current=QH(r,v)},[r]),[o,l]=JH(n,e),c=bR(),h=()=>{const v=s.current;if(t&&!v)return;(v?e.applyAnimatedValues(v,o.getValue(!0)):!1)===!1&&c()},d=new KH(h,l),p=K.useRef(void 0);Y1(()=>(p.current=d,rn(l,v=>ld(v,d)),()=>{p.current&&(rn(p.current.deps,v=>_g(v,p.current)),Ct.cancel(p.current.update))})),K.useEffect(h,[]),SR(()=>()=>{const v=p.current;rn(v.deps,x=>_g(x,v))});const m=e.getComponentProps(o.getValue());return K.createElement(i,{...m,ref:a})})},KH=class{constructor(i,e){this.update=i,this.deps=e}eventObserved(i){i.type=="change"&&Ct.write(this.update)}};function JH(i,e){const t=new Set;return bg.dependencies=t,i.style&&(i={...i,style:e.createAnimatedStyle(i.style)}),i=new K1(i),bg.dependencies=null,[i,t]}function QH(i,e){return i&&(nt.fun(i)?i(e):i.current=e),e}var Yw=Symbol.for("AnimatedComponent"),$H=(i,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=r=>new K1(r),getComponentProps:n=r=>r}={})=>{const r={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:n},s=a=>{const o=Zw(a)||"Anonymous";return nt.str(a)?a=s[a]||(s[a]=qw(a,r)):a=a[Yw]||(a[Yw]=qw(a,r)),a.displayName=`Animated(${o})`,a};return Sa(i,(a,o)=>{nt.arr(i)&&(o=Zw(a)),s[o]=s(a)}),{animated:s}},Zw=i=>nt.str(i)?i:i&&nt.str(i.displayName)?i.displayName:nt.fun(i)&&i.name||null;function pl(i,...e){return nt.fun(i)?i(...e):i}var vf=(i,e)=>i===!0||!!(e&&i&&(nt.fun(i)?i(e):Br(i).includes(e))),AR=(i,e)=>nt.obj(i)?e&&i[e]:i,CR=(i,e)=>i.default===!0?i[e]:i.default?i.default[e]:void 0,eV=i=>i,J1=(i,e=eV)=>{let t=tV;i.default&&i.default!==!0&&(i=i.default,t=Object.keys(i));const n={};for(const r of t){const s=e(i[r],r);nt.und(s)||(n[r]=s)}return n},tV=["config","onProps","onStart","onChange","onPause","onResume","onRest"],nV={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function iV(i){const e={};let t=0;if(Sa(i,(n,r)=>{nV[r]||(e[r]=n,t++)}),t)return e}function RR(i){const e=iV(i);if(e){const t={to:e};return Sa(i,(n,r)=>r in e||(t[r]=n)),t}return{...i}}function Wf(i){return i=Ir(i),nt.arr(i)?i.map(Wf):y0(i)?cs.createStringInterpolator({range:[0,1],output:[i,i]})(1):i}function rV(i){for(const e in i)return!0;return!1}function _x(i){return nt.fun(i)||nt.arr(i)&&nt.obj(i[0])}function sV(i,e){i.ref?.delete(i),e?.delete(i)}function aV(i,e){e&&i.ref!==e&&(i.ref?.delete(i),e.add(i),i.ref=e)}var oV={default:{tension:170,friction:26}},xx={...oV.default,mass:1,damping:1,easing:LH.linear,clamp:!1},lV=class{constructor(){this.velocity=0,Object.assign(this,xx)}};function cV(i,e,t){t&&(t={...t},Kw(t,e),e={...t,...e}),Kw(i,e),Object.assign(i,e);for(const a in xx)i[a]==null&&(i[a]=xx[a]);let{frequency:n,damping:r}=i;const{mass:s}=i;return nt.und(n)||(n<.01&&(n=.01),r<0&&(r=0),i.tension=Math.pow(2*Math.PI/n,2)*s,i.friction=4*Math.PI*r*s/n),i}function Kw(i,e){if(!nt.und(e.decay))i.duration=void 0;else{const t=!nt.und(e.tension)||!nt.und(e.friction);(t||!nt.und(e.frequency)||!nt.und(e.damping)||!nt.und(e.mass))&&(i.duration=void 0,i.decay=void 0),t&&(i.frequency=void 0)}}var Jw=[],uV=class{constructor(){this.changed=!1,this.values=Jw,this.toValues=null,this.fromValues=Jw,this.config=new lV,this.immediate=!1}};function DR(i,{key:e,props:t,defaultProps:n,state:r,actions:s}){return new Promise((a,o)=>{let l,c,h=vf(t.cancel??n?.cancel,e);if(h)m();else{nt.und(t.pause)||(r.paused=vf(t.pause,e));let v=n?.pause;v!==!0&&(v=r.paused||vf(v,e)),l=pl(t.delay||0,e),v?(r.resumeQueue.add(p),s.pause()):(s.resume(),p())}function d(){r.resumeQueue.add(p),r.timeouts.delete(c),c.cancel(),l=c.time-Ct.now()}function p(){l>0&&!cs.skipAnimation?(r.delayed=!0,c=Ct.setTimeout(m,l),r.pauseQueue.add(d),r.timeouts.add(c)):m()}function m(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(d),r.timeouts.delete(c),i<=(r.cancelId||0)&&(h=!0);try{s.start({...t,callId:i,cancel:h},a)}catch(v){o(v)}}})}var Q1=(i,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?ou(i.get()):e.every(t=>t.noop)?UR(i.get()):ss(i.get(),e.every(t=>t.finished)),UR=i=>({value:i,noop:!0,finished:!0,cancelled:!1}),ss=(i,e,t=!1)=>({value:i,finished:e,cancelled:t}),ou=i=>({value:i,cancelled:!0,finished:!1});function OR(i,e,t,n){const{callId:r,parentId:s,onRest:a}=e,{asyncTo:o,promise:l}=t;return!s&&i===o&&!e.reset?l:t.promise=(async()=>{t.asyncId=r,t.asyncTo=i;const c=J1(e,(_,g)=>g==="onRest"?void 0:_);let h,d;const p=new Promise((_,g)=>(h=_,d=g)),m=_=>{const g=r<=(t.cancelId||0)&&ou(n)||r!==t.asyncId&&ss(n,!1);if(g)throw _.result=g,d(_),_},v=(_,g)=>{const b=new Qw,E=new $w;return(async()=>{if(cs.skipAnimation)throw Xf(t),E.result=ss(n,!1),d(E),E;m(b);const S=nt.obj(_)?{..._}:{...g,to:_};S.parentId=r,Sa(c,(T,R)=>{nt.und(S[R])&&(S[R]=T)});const w=await n.start(S);return m(b),t.paused&&await new Promise(T=>{t.resumeQueue.add(T)}),w})()};let x;if(cs.skipAnimation)return Xf(t),ss(n,!1);try{let _;nt.arr(i)?_=(async g=>{for(const b of g)await v(b)})(i):_=Promise.resolve(i(v,n.stop.bind(n))),await Promise.all([_.then(h),p]),x=ss(n.get(),!0,!1)}catch(_){if(_ instanceof Qw)x=_.result;else if(_ instanceof $w)x=_.result;else throw _}finally{r==t.asyncId&&(t.asyncId=s,t.asyncTo=s?o:void 0,t.promise=s?l:void 0)}return nt.fun(a)&&Ct.batchedUpdates(()=>{a(x,n,n.item)}),x})()}function Xf(i,e){mf(i.timeouts,t=>t.cancel()),i.pauseQueue.clear(),i.resumeQueue.clear(),i.asyncId=i.asyncTo=i.promise=void 0,e&&(i.cancelId=e)}var Qw=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},$w=class extends Error{constructor(){super("SkipAnimationSignal")}},bx=i=>i instanceof $1,hV=1,$1=class extends NH{constructor(){super(...arguments),this.id=hV++,this._priority=0}get priority(){return this._priority}set priority(i){this._priority!=i&&(this._priority=i,this._onPriorityChange(i))}get(){const i=Ss(this);return i&&i.getValue()}to(...i){return cs.to(this,i)}interpolate(...i){return HH(),cs.to(this,i)}toJSON(){return this.get()}observerAdded(i){i==1&&this._attach()}observerRemoved(i){i==0&&this._detach()}_attach(){}_detach(){}_onChange(i,e=!1){yg(this,{type:"change",parent:this,value:i,idle:e})}_onPriorityChange(i){this.idle||m0.sort(this),yg(this,{type:"priority",parent:this,priority:i})}},Dl=Symbol.for("SpringPhase"),LR=1,Sx=2,Ex=4,__=i=>(i[Dl]&LR)>0,eo=i=>(i[Dl]&Sx)>0,kh=i=>(i[Dl]&Ex)>0,eT=(i,e)=>e?i[Dl]|=Sx|LR:i[Dl]&=~Sx,tT=(i,e)=>e?i[Dl]|=Ex:i[Dl]&=~Ex,fV=class extends $1{constructor(i,e){if(super(),this.animation=new uV,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!nt.und(i)||!nt.und(e)){const t=nt.obj(i)?{...i}:{...e,from:i};nt.und(t.default)&&(t.default=!0),this.start(t)}}get idle(){return!(eo(this)||this._state.asyncTo)||kh(this)}get goal(){return Ir(this.animation.to)}get velocity(){const i=Ss(this);return i instanceof x0?i.lastVelocity||0:i.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return __(this)}get isAnimating(){return eo(this)}get isPaused(){return kh(this)}get isDelayed(){return this._state.delayed}advance(i){let e=!0,t=!1;const n=this.animation;let{toValues:r}=n;const{config:s}=n,a=_0(n.to);!a&&Es(n.to)&&(r=Br(Ir(n.to))),n.values.forEach((c,h)=>{if(c.done)return;const d=c.constructor==xg?1:a?a[h].lastPosition:r[h];let p=n.immediate,m=d;if(!p){if(m=c.lastPosition,s.tension<=0){c.done=!0;return}let v=c.elapsedTime+=i;const x=n.fromValues[h],_=c.v0!=null?c.v0:c.v0=nt.arr(s.velocity)?s.velocity[h]:s.velocity;let g;const b=s.precision||(x==d?.005:Math.min(1,Math.abs(d-x)*.001));if(nt.und(s.duration))if(s.decay){const E=s.decay===!0?.998:s.decay,S=Math.exp(-(1-E)*v);m=x+_/(1-E)*(1-S),p=Math.abs(c.lastPosition-m)<=b,g=_*S}else{g=c.lastVelocity==null?_:c.lastVelocity;const E=s.restVelocity||b/10,S=s.clamp?0:s.bounce,w=!nt.und(S),T=x==d?c.v0>0:x<d;let R,U=!1;const A=1,D=Math.ceil(i/A);for(let L=0;L<D&&(R=Math.abs(g)>E,!(!R&&(p=Math.abs(d-m)<=b,p)));++L){w&&(U=m==d||m>d==T,U&&(g=-g*S,m=d));const P=-s.tension*1e-6*(m-d),I=-s.friction*.001*g,V=(P+I)/s.mass;g=g+V*A,m=m+g*A}}else{let E=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,c.durationProgress>0&&(c.elapsedTime=s.duration*c.durationProgress,v=c.elapsedTime+=i)),E=(s.progress||0)+v/this._memoizedDuration,E=E>1?1:E<0?0:E,c.durationProgress=E),m=x+s.easing(E)*(d-x),g=(m-c.lastPosition)/i,p=E==1}c.lastVelocity=g,Number.isNaN(m)&&(console.warn("Got NaN while animating:",this),p=!0)}a&&!a[h].done&&(p=!1),p?c.done=!0:e=!1,c.setValue(m,s.round)&&(t=!0)});const o=Ss(this),l=o.getValue();if(e){const c=Ir(n.to);(l!==c||t)&&!s.decay?(o.setValue(c),this._onChange(c)):t&&s.decay&&this._onChange(l),this._stop()}else t&&this._onChange(l)}set(i){return Ct.batchedUpdates(()=>{this._stop(),this._focus(i),this._set(i)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(eo(this)){const{to:i,config:e}=this.animation;Ct.batchedUpdates(()=>{this._onStart(),e.decay||this._set(i,!1),this._stop()})}return this}update(i){return(this.queue||(this.queue=[])).push(i),this}start(i,e){let t;return nt.und(i)?(t=this.queue||[],this.queue=[]):t=[nt.obj(i)?i:{...e,to:i}],Promise.all(t.map(n=>this._update(n))).then(n=>Q1(this,n))}stop(i){const{to:e}=this.animation;return this._focus(this.get()),Xf(this._state,i&&this._lastCallId),Ct.batchedUpdates(()=>this._stop(e,i)),this}reset(){this._update({reset:!0})}eventObserved(i){i.type=="change"?this._start():i.type=="priority"&&(this.priority=i.priority+1)}_prepareNode(i){const e=this.key||"";let{to:t,from:n}=i;t=nt.obj(t)?t[e]:t,(t==null||_x(t))&&(t=void 0),n=nt.obj(n)?n[e]:n,n==null&&(n=void 0);const r={to:t,from:n};return __(this)||(i.reverse&&([t,n]=[n,t]),n=Ir(n),nt.und(n)?Ss(this)||this._set(t):this._set(n)),r}_update({...i},e){const{key:t,defaultProps:n}=this;i.default&&Object.assign(n,J1(i,(a,o)=>/^on/.test(o)?AR(a,t):a)),iT(this,i,"onProps"),Hh(this,"onProps",i,this);const r=this._prepareNode(i);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const s=this._state;return DR(++this._lastCallId,{key:t,props:i,defaultProps:n,state:s,actions:{pause:()=>{kh(this)||(tT(this,!0),Qh(s.pauseQueue),Hh(this,"onPause",ss(this,Gh(this,this.animation.to)),this))},resume:()=>{kh(this)&&(tT(this,!1),eo(this)&&this._resume(),Qh(s.resumeQueue),Hh(this,"onResume",ss(this,Gh(this,this.animation.to)),this))},start:this._merge.bind(this,r)}}).then(a=>{if(i.loop&&a.finished&&!(e&&a.noop)){const o=IR(i);if(o)return this._update(o,!0)}return a})}_merge(i,e,t){if(e.cancel)return this.stop(!0),t(ou(this));const n=!nt.und(i.to),r=!nt.und(i.from);if(n||r)if(e.callId>this._lastToId)this._lastToId=e.callId;else return t(ou(this));const{key:s,defaultProps:a,animation:o}=this,{to:l,from:c}=o;let{to:h=l,from:d=c}=i;r&&!n&&(!e.default||nt.und(h))&&(h=d),e.reverse&&([h,d]=[d,h]);const p=!ca(d,c);p&&(o.from=d),d=Ir(d);const m=!ca(h,l);m&&this._focus(h);const v=_x(e.to),{config:x}=o,{decay:_,velocity:g}=x;(n||r)&&(x.velocity=0),e.config&&!v&&cV(x,pl(e.config,s),e.config!==a.config?pl(a.config,s):void 0);let b=Ss(this);if(!b||nt.und(h))return t(ss(this,!0));const E=nt.und(e.reset)?r&&!e.default:!nt.und(d)&&vf(e.reset,s),S=E?d:this.get(),w=Wf(h),T=nt.num(w)||nt.arr(w)||y0(w),R=!v&&(!T||vf(a.immediate||e.immediate,s));if(m){const L=yx(h);if(L!==b.constructor)if(R)b=this._set(w);else throw Error(`Cannot animate between ${b.constructor.name} and ${L.name}, as the "to" prop suggests`)}const U=b.constructor;let A=Es(h),D=!1;if(!A){const L=E||!__(this)&&p;(m||L)&&(D=ca(Wf(S),w),A=!D),(!ca(o.immediate,R)&&!R||!ca(x.decay,_)||!ca(x.velocity,g))&&(A=!0)}if(D&&eo(this)&&(o.changed&&!E?A=!0:A||this._stop(l)),!v&&((A||Es(l))&&(o.values=b.getPayload(),o.toValues=Es(h)?null:U==xg?[1]:Br(w)),o.immediate!=R&&(o.immediate=R,!R&&!E&&this._set(l)),A)){const{onRest:L}=o;rn(pV,I=>iT(this,e,I));const P=ss(this,Gh(this,l));Qh(this._pendingCalls,P),this._pendingCalls.add(t),o.changed&&Ct.batchedUpdates(()=>{o.changed=!E,L?.(P,this),E?pl(a.onRest,P):o.onStart?.(P,this)})}E&&this._set(S),v?t(OR(e.to,e,this._state,this)):A?this._start():eo(this)&&!m?this._pendingCalls.add(t):t(UR(S))}_focus(i){const e=this.animation;i!==e.to&&(Ww(this)&&this._detach(),e.to=i,Ww(this)&&this._attach())}_attach(){let i=0;const{to:e}=this.animation;Es(e)&&(ld(e,this),bx(e)&&(i=e.priority+1)),this.priority=i}_detach(){const{to:i}=this.animation;Es(i)&&_g(i,this)}_set(i,e=!0){const t=Ir(i);if(!nt.und(t)){const n=Ss(this);if(!n||!ca(t,n.getValue())){const r=yx(t);!n||n.constructor!=r?Z1(this,r.create(t)):n.setValue(t),n&&Ct.batchedUpdates(()=>{this._onChange(t,e)})}}return Ss(this)}_onStart(){const i=this.animation;i.changed||(i.changed=!0,Hh(this,"onStart",ss(this,Gh(this,i.to)),this))}_onChange(i,e){e||(this._onStart(),pl(this.animation.onChange,i,this)),pl(this.defaultProps.onChange,i,this),super._onChange(i,e)}_start(){const i=this.animation;Ss(this).reset(Ir(i.to)),i.immediate||(i.fromValues=i.values.map(e=>e.lastPosition)),eo(this)||(eT(this,!0),kh(this)||this._resume())}_resume(){cs.skipAnimation?this.finish():m0.start(this)}_stop(i,e){if(eo(this)){eT(this,!1);const t=this.animation;rn(t.values,r=>{r.done=!0}),t.toValues&&(t.onChange=t.onPause=t.onResume=void 0),yg(this,{type:"idle",parent:this});const n=e?ou(this.get()):ss(this.get(),Gh(this,i??t.to));Qh(this._pendingCalls,n),t.changed&&(t.changed=!1,Hh(this,"onRest",n,this))}}};function Gh(i,e){const t=Wf(e),n=Wf(i.get());return ca(n,t)}function IR(i,e=i.loop,t=i.to){const n=pl(e);if(n){const r=n!==!0&&RR(n),s=(r||i).reverse,a=!r||r.reset;return jf({...i,loop:e,default:!1,pause:void 0,to:!s||_x(t)?t:void 0,from:a?i.from:void 0,reset:a,...r})}}function jf(i){const{to:e,from:t}=i=RR(i),n=new Set;return nt.obj(e)&&nT(e,n),nt.obj(t)&&nT(t,n),i.keys=n.size?Array.from(n):null,i}function dV(i){const e=jf(i);return nt.und(e.default)&&(e.default=J1(e)),e}function nT(i,e){Sa(i,(t,n)=>t!=null&&e.add(n))}var pV=["onStart","onRest","onChange","onPause","onResume"];function iT(i,e,t){i.animation[t]=e[t]!==CR(e,t)?AR(e[t],i.key):void 0}function Hh(i,e,...t){i.animation[e]?.(...t),i.defaultProps[e]?.(...t)}var mV=["onStart","onChange","onRest"],gV=1,vV=class{constructor(e,t){this.id=gV++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];nt.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(jf(e)),this}start(e){let{queue:t}=this;return e?t=Br(e).map(jf):this.queue=[],this._flush?this._flush(this,t):(BR(this,t),Mx(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;rn(Br(t),r=>n[r].stop(!!e))}else Xf(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(nt.und(e))this.start({pause:!0});else{const t=this.springs;rn(Br(e),n=>t[n].pause())}return this}resume(e){if(nt.und(e))this.start({pause:!1});else{const t=this.springs;rn(Br(e),n=>t[n].resume())}return this}each(e){Sa(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,s=this._changed.size>0;(r&&!this._started||s&&!this._started)&&(this._started=!0,mf(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const a=!r&&this._started,o=s||a&&n.size?this.get():null;s&&t.size&&mf(t,([l,c])=>{c.value=o,l(c,this,this._item)}),a&&(this._started=!1,mf(n,([l,c])=>{c.value=o,l(c,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Ct.onFrame(this._onFrame)}};function Mx(i,e){return Promise.all(e.map(t=>NR(i,t))).then(t=>Q1(i,t))}async function NR(i,e,t){const{keys:n,to:r,from:s,loop:a,onRest:o,onResolve:l}=e,c=nt.obj(e.default)&&e.default;a&&(e.loop=!1),r===!1&&(e.to=null),s===!1&&(e.from=null);const h=nt.arr(r)||nt.fun(r)?r:void 0;h?(e.to=void 0,e.onRest=void 0,c&&(c.onRest=void 0)):rn(mV,x=>{const _=e[x];if(nt.fun(_)){const g=i._events[x];e[x]=({finished:b,cancelled:E})=>{const S=g.get(_);S?(b||(S.finished=!1),E&&(S.cancelled=!0)):g.set(_,{value:null,finished:b||!1,cancelled:E||!1})},c&&(c[x]=e[x])}});const d=i._state;e.pause===!d.paused?(d.paused=e.pause,Qh(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);const p=(n||Object.keys(i.springs)).map(x=>i.springs[x].start(e)),m=e.cancel===!0||CR(e,"cancel")===!0;(h||m&&d.asyncId)&&p.push(DR(++i._lastAsyncId,{props:e,state:d,actions:{pause:gx,resume:gx,start(x,_){m?(Xf(d,i._lastAsyncId),_(ou(i))):(x.onRest=o,_(OR(h,x,d,i)))}}})),d.paused&&await new Promise(x=>{d.resumeQueue.add(x)});const v=Q1(i,await Promise.all(p));if(a&&v.finished&&!(t&&v.noop)){const x=IR(e,a,r);if(x)return BR(i,[x]),NR(i,x,!0)}return l&&Ct.batchedUpdates(()=>l(v,i,i.item)),v}function rT(i,e){const t={...i.springs};return e&&rn(Br(e),n=>{nt.und(n.keys)&&(n=jf(n)),nt.obj(n.to)||(n={...n,to:void 0}),FR(t,n,r=>zR(r))}),PR(i,t),t}function PR(i,e){Sa(e,(t,n)=>{i.springs[n]||(i.springs[n]=t,ld(t,i))})}function zR(i,e){const t=new fV;return t.key=i,e&&ld(t,e),t}function FR(i,e,t){e.keys&&rn(e.keys,n=>{(i[n]||(i[n]=t(n)))._prepareNode(e)})}function BR(i,e){rn(e,t=>{FR(i.springs,t,n=>zR(n,i))})}var yV=K.createContext({pause:!1,immediate:!1}),_V=()=>{const i=[],e=function(n){WH();const r=[];return rn(i,(s,a)=>{if(nt.und(n))r.push(s.start());else{const o=t(n,s,a);o&&r.push(s.start(o))}}),r};e.current=i,e.add=function(n){i.includes(n)||i.push(n)},e.delete=function(n){const r=i.indexOf(n);~r&&i.splice(r,1)},e.pause=function(){return rn(i,n=>n.pause(...arguments)),this},e.resume=function(){return rn(i,n=>n.resume(...arguments)),this},e.set=function(n){rn(i,(r,s)=>{const a=nt.fun(n)?n(s,r):n;a&&r.set(a)})},e.start=function(n){const r=[];return rn(i,(s,a)=>{if(nt.und(n))r.push(s.start());else{const o=this._getProps(n,s,a);o&&r.push(s.start(o))}}),r},e.stop=function(){return rn(i,n=>n.stop(...arguments)),this},e.update=function(n){return rn(i,(r,s)=>r.update(this._getProps(n,r,s))),this};const t=function(n,r,s){return nt.fun(n)?n(s,r):n};return e._getProps=t,e};function xV(i,e,t){const n=nt.fun(e)&&e;n&&!t&&(t=[]);const r=K.useMemo(()=>n||arguments.length==3?_V():void 0,[]),s=K.useRef(0),a=bR(),o=K.useMemo(()=>({ctrls:[],queue:[],flush(g,b){const E=rT(g,b);return s.current>0&&!o.queue.length&&!Object.keys(E).some(w=>!g.springs[w])?Mx(g,b):new Promise(w=>{PR(g,E),o.queue.push(()=>{w(Mx(g,b))}),a()})}}),[]),l=K.useRef([...o.ctrls]),c=K.useRef([]),h=jw(i)||0;K.useMemo(()=>{rn(l.current.slice(i,h),g=>{sV(g,r),g.stop(!0)}),l.current.length=i,d(h,i)},[i]),K.useMemo(()=>{d(0,Math.min(h,i))},t);function d(g,b){for(let E=g;E<b;E++){const S=l.current[E]||(l.current[E]=new vV(null,o.flush)),w=n?n(E,S):e[E];w&&(c.current[E]=dV(w))}}const p=l.current.map((g,b)=>rT(g,c.current[b])),m=K.useContext(yV),v=jw(m),x=m!==v&&rV(m);Y1(()=>{s.current++,o.ctrls=l.current;const{queue:g}=o;g.length&&(o.queue=[],rn(g,b=>b())),rn(l.current,(b,E)=>{r?.add(b),x&&b.start({default:m});const S=c.current[E];S&&(aV(b,S.ref),b.ref?b.queue.push(S):b.start(S))})}),SR(()=>()=>{rn(o.ctrls,g=>g.stop(!0))});const _=p.map(g=>({...g}));return r?[_,r]:_}function er(i,e){const t=nt.fun(i),[[n],r]=xV(1,t?i:[i],t?e||[]:e);return t||arguments.length==2?[n,r]:n}var bV=class extends $1{constructor(i,e){super(),this.source=i,this.idle=!0,this._active=new Set,this.calc=Gf(...e);const t=this._get(),n=yx(t);Z1(this,n.create(t))}advance(i){const e=this._get(),t=this.get();ca(e,t)||(Ss(this).setValue(e),this._onChange(e,this.idle)),!this.idle&&sT(this._active)&&x_(this)}_get(){const i=nt.arr(this.source)?this.source.map(Ir):Br(Ir(this.source));return this.calc(...i)}_start(){this.idle&&!sT(this._active)&&(this.idle=!1,rn(_0(this),i=>{i.done=!1}),cs.skipAnimation?(Ct.batchedUpdates(()=>this.advance()),x_(this)):m0.start(this))}_attach(){let i=1;rn(Br(this.source),e=>{Es(e)&&ld(e,this),bx(e)&&(e.idle||this._active.add(e),i=Math.max(i,e.priority+1))}),this.priority=i,this._start()}_detach(){rn(Br(this.source),i=>{Es(i)&&_g(i,this)}),this._active.clear(),x_(this)}eventObserved(i){i.type=="change"?i.idle?this.advance():(this._active.add(i.parent),this._start()):i.type=="idle"?this._active.delete(i.parent):i.type=="priority"&&(this.priority=Br(this.source).reduce((e,t)=>Math.max(e,(bx(t)?t.priority:0)+1),0))}};function SV(i){return i.idle!==!1}function sT(i){return!i.size||Array.from(i).every(SV)}function x_(i){i.idle||(i.idle=!0,rn(_0(i),e=>{e.done=!0}),yg(i,{type:"idle",parent:i}))}cs.assign({createStringInterpolator:_R,to:(i,e)=>new bV(i,e)});var EV=["primitive"].concat(Object.keys(gC).filter(i=>/^[A-Z]/.test(i)).map(i=>i[0].toLowerCase()+i.slice(1)));cs.assign({createStringInterpolator:_R,colors:bH,frameLoop:"demand"});w5(()=>{Ct.advance()});var MV=$H(EV,{applyAnimatedValues:da}),An=MV.animated;function Ul(){return Ul=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Ul.apply(null,arguments)}const cd=new j,eb=new j,wV=new j,aT=new ke;function TV(i,e,t){const n=cd.setFromMatrixPosition(i.matrixWorld);n.project(e);const r=t.width/2,s=t.height/2;return[n.x*r+r,-(n.y*s)+s]}function AV(i,e){const t=cd.setFromMatrixPosition(i.matrixWorld),n=eb.setFromMatrixPosition(e.matrixWorld),r=t.sub(n),s=e.getWorldDirection(wV);return r.angleTo(s)>Math.PI/2}function CV(i,e,t,n){const r=cd.setFromMatrixPosition(i.matrixWorld),s=r.clone();s.project(e),aT.set(s.x,s.y),t.setFromCamera(aT,e);const a=t.intersectObjects(n,!0);if(a.length){const o=a[0].distance;return r.distanceTo(t.ray.origin)<o}return!0}function RV(i,e){if(e instanceof Pl)return e.zoom;if(e instanceof Kn){const t=cd.setFromMatrixPosition(i.matrixWorld),n=eb.setFromMatrixPosition(e.matrixWorld),r=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(r/2)*s)}else return 1}function DV(i,e,t){if(e instanceof Kn||e instanceof Pl){const n=cd.setFromMatrixPosition(i.matrixWorld),r=eb.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(r),a=(t[1]-t[0])/(e.far-e.near),o=t[1]-a*e.far;return Math.round(a*s+o)}}const wx=i=>Math.abs(i)<1e-10?0:i;function kR(i,e,t=""){let n="matrix3d(";for(let r=0;r!==16;r++)n+=wx(e[r]*i.elements[r])+(r!==15?",":")");return t+n}const UV=(i=>e=>kR(e,i))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),OV=(i=>(e,t)=>kR(e,i(t),"translate(-50%,-50%)"))(i=>[1/i,1/i,1/i,1,-1/i,-1/i,-1/i,-1,1/i,1/i,1/i,1,1,1,1,1]);function LV(i){return i&&typeof i=="object"&&"current"in i}const tb=K.forwardRef(({children:i,eps:e=.001,style:t,className:n,prepend:r,center:s,fullscreen:a,portal:o,distanceFactor:l,sprite:c=!1,transform:h=!1,occlude:d,onOcclude:p,castShadow:m,receiveShadow:v,material:x,geometry:_,zIndexRange:g=[16777271,0],calculatePosition:b=TV,as:E="div",wrapperClass:S,pointerEvents:w="auto",...T},R)=>{const{gl:U,camera:A,scene:D,size:L,raycaster:P,events:I,viewport:V}=Jn(),[H]=K.useState(()=>document.createElement(E)),z=K.useRef(null),O=K.useRef(null),B=K.useRef(0),G=K.useRef([0,0]),X=K.useRef(null),k=K.useRef(null),Y=o?.current||I.connected||U.domElement.parentNode,Q=K.useRef(null),te=K.useRef(!1),ee=K.useMemo(()=>d&&d!=="blending"||Array.isArray(d)&&d.length&&LV(d[0]),[d]);K.useLayoutEffect(()=>{const Me=U.domElement;d&&d==="blending"?(Me.style.zIndex=`${Math.floor(g[0]/2)}`,Me.style.position="absolute",Me.style.pointerEvents="none"):(Me.style.zIndex=null,Me.style.position=null,Me.style.pointerEvents=null)},[d]),K.useLayoutEffect(()=>{if(O.current){const Me=z.current=FU.createRoot(H);if(D.updateMatrixWorld(),h)H.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const ve=b(O.current,A,L);H.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${ve[0]}px,${ve[1]}px,0);transform-origin:0 0;`}return Y&&(r?Y.prepend(H):Y.appendChild(H)),()=>{Y&&Y.removeChild(H),Me.unmount()}}},[Y,h]),K.useLayoutEffect(()=>{S&&(H.className=S)},[S]);const ie=K.useMemo(()=>h?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,a,L,h]),re=K.useMemo(()=>({position:"absolute",pointerEvents:w}),[w]);K.useLayoutEffect(()=>{if(te.current=!1,h){var Me;(Me=z.current)==null||Me.render(K.createElement("div",{ref:X,style:ie},K.createElement("div",{ref:k,style:re},K.createElement("div",{ref:R,className:n,style:t,children:i}))))}else{var ve;(ve=z.current)==null||ve.render(K.createElement("div",{ref:R,style:ie,className:n,children:i}))}});const de=K.useRef(!0);u0(Me=>{if(O.current){A.updateMatrixWorld(),O.current.updateWorldMatrix(!0,!1);const ve=h?G.current:b(O.current,A,L);if(h||Math.abs(B.current-A.zoom)>e||Math.abs(G.current[0]-ve[0])>e||Math.abs(G.current[1]-ve[1])>e){const fe=AV(O.current,A);let J=!1;ee&&(Array.isArray(d)?J=d.map(pe=>pe.current):d!=="blending"&&(J=[D]));const oe=de.current;if(J){const pe=CV(O.current,A,P,J);de.current=pe&&!fe}else de.current=!fe;oe!==de.current&&(p?p(!de.current):H.style.display=de.current?"block":"none");const se=Math.floor(g[0]/2),$=d?ee?[g[0],se]:[se-1,0]:g;if(H.style.zIndex=`${DV(O.current,A,$)}`,h){const[pe,ye]=[L.width/2,L.height/2],xe=A.projectionMatrix.elements[5]*ye,{isOrthographicCamera:be,top:ue,left:He,bottom:W,right:F}=A,ne=UV(A.matrixWorldInverse),Se=be?`scale(${xe})translate(${wx(-(F+He)/2)}px,${wx((ue+W)/2)}px)`:`translateZ(${xe}px)`;let _e=O.current.matrixWorld;c&&(_e=A.matrixWorldInverse.clone().transpose().copyPosition(_e).scale(O.current.scale),_e.elements[3]=_e.elements[7]=_e.elements[11]=0,_e.elements[15]=1),H.style.width=L.width+"px",H.style.height=L.height+"px",H.style.perspective=be?"":`${xe}px`,X.current&&k.current&&(X.current.style.transform=`${Se}${ne}translate(${pe}px,${ye}px)`,k.current.style.transform=OV(_e,1/((l||10)/400)))}else{const pe=l===void 0?1:RV(O.current,A)*l;H.style.transform=`translate3d(${ve[0]}px,${ve[1]}px,0) scale(${pe})`}G.current=ve,B.current=A.zoom}}if(!ee&&Q.current&&!te.current)if(h){if(X.current){const ve=X.current.children[0];if(ve!=null&&ve.clientWidth&&ve!=null&&ve.clientHeight){const{isOrthographicCamera:fe}=A;if(fe||_)T.scale&&(Array.isArray(T.scale)?T.scale instanceof j?Q.current.scale.copy(T.scale.clone().divideScalar(1)):Q.current.scale.set(1/T.scale[0],1/T.scale[1],1/T.scale[2]):Q.current.scale.setScalar(1/T.scale));else{const J=(l||10)/400,oe=ve.clientWidth*J,se=ve.clientHeight*J;Q.current.scale.set(oe,se,1)}te.current=!0}}}else{const ve=H.children[0];if(ve!=null&&ve.clientWidth&&ve!=null&&ve.clientHeight){const fe=1/V.factor,J=ve.clientWidth*fe,oe=ve.clientHeight*fe;Q.current.scale.set(J,oe,1),te.current=!0}Q.current.lookAt(Me.camera.position)}});const Ae=K.useMemo(()=>({vertexShader:h?void 0:`
|
|
3902
3844
|
/*
|
|
3903
3845
|
This shader is from the THREE's SpriteMaterial.
|
|
3904
3846
|
We need to turn the backing plane into a Sprite
|
|
@@ -3973,20 +3915,7 @@ void main() {
|
|
|
3973
3915
|
${n}
|
|
3974
3916
|
troikaOrigMain${e}();
|
|
3975
3917
|
${r}
|
|
3976
|
-
}`),i}function r8(i,e){return i==="uniforms"?void 0:typeof e=="function"?e.toString():e}let s8=0;const ET=new Map;function a8(i){const e=JSON.stringify(i,r8);let t=ET.get(e);return t==null&&ET.set(e,t=++s8),t}/*!
|
|
3977
|
-
Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
|
|
3978
|
-
Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
|
|
3979
|
-
*/function o8(){return typeof window>"u"&&(self.window=self),(function(i){var e={parse:function(r){var s=e._bin,a=new Uint8Array(r);if(s.readASCII(a,0,4)=="ttcf"){var o=4;s.readUshort(a,o),o+=2,s.readUshort(a,o),o+=2;var l=s.readUint(a,o);o+=4;for(var c=[],h=0;h<l;h++){var d=s.readUint(a,o);o+=4,c.push(e._readFont(a,d))}return c}return[e._readFont(a,0)]},_readFont:function(r,s){var a=e._bin,o=s;a.readFixed(r,s),s+=4;var l=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],h={_data:r,_offset:o},d={},p=0;p<l;p++){var m=a.readASCII(r,s,4);s+=4,a.readUint(r,s),s+=4;var v=a.readUint(r,s);s+=4;var x=a.readUint(r,s);s+=4,d[m]={offset:v,length:x}}for(p=0;p<c.length;p++){var _=c[p];d[_]&&(h[_.trim()]=e[_.trim()].parse(r,d[_].offset,d[_].length,h))}return h},_tabOffset:function(r,s,a){for(var o=e._bin,l=o.readUshort(r,a+4),c=a+12,h=0;h<l;h++){var d=o.readASCII(r,c,4);c+=4,o.readUint(r,c),c+=4;var p=o.readUint(r,c);if(c+=4,o.readUint(r,c),c+=4,d==s)return p}return 0}};e._bin={readFixed:function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<8|r[s+3])/65540},readF2dot14:function(r,s){return e._bin.readShort(r,s)/16384},readInt:function(r,s){return e._bin._view(r).getInt32(s)},readInt8:function(r,s){return e._bin._view(r).getInt8(s)},readShort:function(r,s){return e._bin._view(r).getInt16(s)},readUshort:function(r,s){return e._bin._view(r).getUint16(s)},readUshorts:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(e._bin.readUshort(r,s+2*l));return o},readUint:function(r,s){return e._bin._view(r).getUint32(s)},readUint64:function(r,s){return 4294967296*e._bin.readUint(r,s)+e._bin.readUint(r,s+4)},readASCII:function(r,s,a){for(var o="",l=0;l<a;l++)o+=String.fromCharCode(r[s+l]);return o},readUnicode:function(r,s,a){for(var o="",l=0;l<a;l++){var c=r[s++]<<8|r[s++];o+=String.fromCharCode(c)}return o},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(r,s,a){var o=e._bin._tdec;return o&&s==0&&a==r.length?o.decode(r):e._bin.readASCII(r,s,a)},readBytes:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(r[s+l]);return o},readASCIIArray:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(String.fromCharCode(r[s+l]));return o},_view:function(r){return r._dataView||(r._dataView=r.buffer?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(new Uint8Array(r).buffer))}},e._lctf={},e._lctf.parse=function(r,s,a,o,l){var c=e._bin,h={},d=s;c.readFixed(r,s),s+=4;var p=c.readUshort(r,s);s+=2;var m=c.readUshort(r,s);s+=2;var v=c.readUshort(r,s);return s+=2,h.scriptList=e._lctf.readScriptList(r,d+p),h.featureList=e._lctf.readFeatureList(r,d+m),h.lookupList=e._lctf.readLookupList(r,d+v,l),h},e._lctf.readLookupList=function(r,s,a){var o=e._bin,l=s,c=[],h=o.readUshort(r,s);s+=2;for(var d=0;d<h;d++){var p=o.readUshort(r,s);s+=2;var m=e._lctf.readLookupTable(r,l+p,a);c.push(m)}return c},e._lctf.readLookupTable=function(r,s,a){var o=e._bin,l=s,c={tabs:[]};c.ltype=o.readUshort(r,s),s+=2,c.flag=o.readUshort(r,s),s+=2;var h=o.readUshort(r,s);s+=2;for(var d=c.ltype,p=0;p<h;p++){var m=o.readUshort(r,s);s+=2;var v=a(r,d,l+m,c);c.tabs.push(v)}return c},e._lctf.numOfOnes=function(r){for(var s=0,a=0;a<32;a++)(r>>>a&1)!=0&&s++;return s},e._lctf.readClassDef=function(r,s){var a=e._bin,o=[],l=a.readUshort(r,s);if(s+=2,l==1){var c=a.readUshort(r,s);s+=2;var h=a.readUshort(r,s);s+=2;for(var d=0;d<h;d++)o.push(c+d),o.push(c+d),o.push(a.readUshort(r,s)),s+=2}if(l==2){var p=a.readUshort(r,s);for(s+=2,d=0;d<p;d++)o.push(a.readUshort(r,s)),s+=2,o.push(a.readUshort(r,s)),s+=2,o.push(a.readUshort(r,s)),s+=2}return o},e._lctf.getInterval=function(r,s){for(var a=0;a<r.length;a+=3){var o=r[a],l=r[a+1];if(r[a+2],o<=s&&s<=l)return a}return-1},e._lctf.readCoverage=function(r,s){var a=e._bin,o={};o.fmt=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);return s+=2,o.fmt==1&&(o.tab=a.readUshorts(r,s,l)),o.fmt==2&&(o.tab=a.readUshorts(r,s,3*l)),o},e._lctf.coverageIndex=function(r,s){var a=r.tab;if(r.fmt==1)return a.indexOf(s);if(r.fmt==2){var o=e._lctf.getInterval(a,s);if(o!=-1)return a[o+2]+(s-a[o])}return-1},e._lctf.readFeatureList=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readASCII(r,s,4);s+=4;var p=a.readUshort(r,s);s+=2;var m=e._lctf.readFeatureTable(r,o+p);m.tag=d.trim(),l.push(m)}return l},e._lctf.readFeatureTable=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2,c>0&&(l.featureParams=o+c);var h=a.readUshort(r,s);s+=2,l.tab=[];for(var d=0;d<h;d++)l.tab.push(a.readUshort(r,s+2*d));return l},e._lctf.readScriptList=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readASCII(r,s,4);s+=4;var p=a.readUshort(r,s);s+=2,l[d.trim()]=e._lctf.readScriptTable(r,o+p)}return l},e._lctf.readScriptTable=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(r,o+c));var h=a.readUshort(r,s);s+=2;for(var d=0;d<h;d++){var p=a.readASCII(r,s,4);s+=4;var m=a.readUshort(r,s);s+=2,l[p.trim()]=e._lctf.readLangSysTable(r,o+m)}return l},e._lctf.readLangSysTable=function(r,s){var a=e._bin,o={};a.readUshort(r,s),s+=2,o.reqFeature=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);return s+=2,o.features=a.readUshorts(r,s,l),o},e.CFF={},e.CFF.parse=function(r,s,a){var o=e._bin;(r=new Uint8Array(r.buffer,s,a))[s=0],r[++s],r[++s],r[++s],s++;var l=[];s=e.CFF.readIndex(r,s,l);for(var c=[],h=0;h<l.length-1;h++)c.push(o.readASCII(r,s+l[h],l[h+1]-l[h]));s+=l[l.length-1];var d=[];s=e.CFF.readIndex(r,s,d);var p=[];for(h=0;h<d.length-1;h++)p.push(e.CFF.readDict(r,s+d[h],s+d[h+1]));s+=d[d.length-1];var m=p[0],v=[];s=e.CFF.readIndex(r,s,v);var x=[];for(h=0;h<v.length-1;h++)x.push(o.readASCII(r,s+v[h],v[h+1]-v[h]));if(s+=v[v.length-1],e.CFF.readSubrs(r,s,m),m.CharStrings){s=m.CharStrings,v=[],s=e.CFF.readIndex(r,s,v);var _=[];for(h=0;h<v.length-1;h++)_.push(o.readBytes(r,s+v[h],v[h+1]-v[h]));m.CharStrings=_}if(m.ROS){s=m.FDArray;var g=[];for(s=e.CFF.readIndex(r,s,g),m.FDArray=[],h=0;h<g.length-1;h++){var b=e.CFF.readDict(r,s+g[h],s+g[h+1]);e.CFF._readFDict(r,b,x),m.FDArray.push(b)}s+=g[g.length-1],s=m.FDSelect,m.FDSelect=[];var E=r[s];if(s++,E!=3)throw E;var S=o.readUshort(r,s);for(s+=2,h=0;h<S+1;h++)m.FDSelect.push(o.readUshort(r,s),r[s+2]),s+=3}return m.Encoding&&(m.Encoding=e.CFF.readEncoding(r,m.Encoding,m.CharStrings.length)),m.charset&&(m.charset=e.CFF.readCharset(r,m.charset,m.CharStrings.length)),e.CFF._readFDict(r,m,x),m},e.CFF._readFDict=function(r,s,a){var o;for(var l in s.Private&&(o=s.Private[1],s.Private=e.CFF.readDict(r,o,o+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(r,o+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=a[s[l]-426+35])},e.CFF.readSubrs=function(r,s,a){var o=e._bin,l=[];s=e.CFF.readIndex(r,s,l);var c,h=l.length;c=h<1240?107:h<33900?1131:32768,a.Bias=c,a.Subrs=[];for(var d=0;d<l.length-1;d++)a.Subrs.push(o.readBytes(r,s+l[d],l[d+1]-l[d]))},e.CFF.tableSE=[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,0,0,0,0,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,52,53,54,55,56,57,58,59,60,61,62,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,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,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(r,s){for(var a=0;a<r.charset.length;a++)if(r.charset[a]==s)return a;return-1},e.CFF.glyphBySE=function(r,s){return s<0||s>255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,a){e._bin;var o=[".notdef"],l=r[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=r[s];s++;for(var h=0;h<c;h++)o.push(r[s+h]);return o},e.CFF.readCharset=function(r,s,a){var o=e._bin,l=[".notdef"],c=r[s];if(s++,c==0)for(var h=0;h<a;h++){var d=o.readUshort(r,s);s+=2,l.push(d)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<a;){d=o.readUshort(r,s),s+=2;var p=0;for(c==1?(p=r[s],s++):(p=o.readUshort(r,s),s+=2),h=0;h<=p;h++)l.push(d),d++}}return l},e.CFF.readIndex=function(r,s,a){var o=e._bin,l=o.readUshort(r,s)+1,c=r[s+=2];if(s++,c==1)for(var h=0;h<l;h++)a.push(r[s+h]);else if(c==2)for(h=0;h<l;h++)a.push(o.readUshort(r,s+2*h));else if(c==3)for(h=0;h<l;h++)a.push(16777215&o.readUint(r,s+3*h-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(r,s,a){var o=e._bin,l=r[s],c=r[s+1];r[s+2],r[s+3],r[s+4];var h=1,d=null,p=null;l<=20&&(d=l,h=1),l==12&&(d=100*l+c,h=2),21<=l&&l<=27&&(d=l,h=1),l==28&&(p=o.readShort(r,s+1),h=3),29<=l&&l<=31&&(d=l,h=1),32<=l&&l<=246&&(p=l-139,h=1),247<=l&&l<=250&&(p=256*(l-247)+c+108,h=2),251<=l&&l<=254&&(p=256*-(l-251)-c-108,h=2),l==255&&(p=o.readInt(r,s+1)/65535,h=5),a.val=p??"o"+d,a.size=h},e.CFF.readCharString=function(r,s,a){for(var o=s+a,l=e._bin,c=[];s<o;){var h=r[s],d=r[s+1];r[s+2],r[s+3],r[s+4];var p=1,m=null,v=null;h<=20&&(m=h,p=1),h==12&&(m=100*h+d,p=2),h!=19&&h!=20||(m=h,p=2),21<=h&&h<=27&&(m=h,p=1),h==28&&(v=l.readShort(r,s+1),p=3),29<=h&&h<=31&&(m=h,p=1),32<=h&&h<=246&&(v=h-139,p=1),247<=h&&h<=250&&(v=256*(h-247)+d+108,p=2),251<=h&&h<=254&&(v=256*-(h-251)-d-108,p=2),h==255&&(v=l.readInt(r,s+1)/65535,p=5),c.push(v??"o"+m),s+=p}return c},e.CFF.readDict=function(r,s,a){for(var o=e._bin,l={},c=[];s<a;){var h=r[s],d=r[s+1];r[s+2],r[s+3],r[s+4];var p=1,m=null,v=null;if(h==28&&(v=o.readShort(r,s+1),p=3),h==29&&(v=o.readInt(r,s+1),p=5),32<=h&&h<=246&&(v=h-139,p=1),247<=h&&h<=250&&(v=256*(h-247)+d+108,p=2),251<=h&&h<=254&&(v=256*-(h-251)-d-108,p=2),h==255)throw v=o.readInt(r,s+1)/65535,p=5,"unknown number";if(h==30){var x=[];for(p=1;;){var _=r[s+p];p++;var g=_>>4,b=15&_;if(g!=15&&x.push(g),b!=15&&x.push(b),b==15)break}for(var E="",S=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],w=0;w<x.length;w++)E+=S[x[w]];v=parseFloat(E)}h<=21&&(m=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][h],p=1,h==12&&(m=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][d],p=2)),m!=null?(l[m]=c.length==1?c[0]:c,c=[]):c.push(v),s+=p}return l},e.cmap={},e.cmap.parse=function(r,s,a){r=new Uint8Array(r.buffer,s,a),s=0;var o=e._bin,l={};o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2;var h=[];l.tables=[];for(var d=0;d<c;d++){var p=o.readUshort(r,s);s+=2;var m=o.readUshort(r,s);s+=2;var v=o.readUint(r,s);s+=4;var x="p"+p+"e"+m,_=h.indexOf(v);if(_==-1){var g;_=l.tables.length,h.push(v);var b=o.readUshort(r,v);b==0?g=e.cmap.parse0(r,v):b==4?g=e.cmap.parse4(r,v):b==6?g=e.cmap.parse6(r,v):b==12?g=e.cmap.parse12(r,v):console.debug("unknown format: "+b,p,m,v),l.tables.push(g)}if(l[x]!=null)throw"multiple tables for one platform+encoding";l[x]=_}return l},e.cmap.parse0=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,o.map=[];for(var c=0;c<l-6;c++)o.map.push(r[s+c]);return o},e.cmap.parse4=function(r,s){var a=e._bin,o=s,l={};l.format=a.readUshort(r,s),s+=2;var c=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2;var h=a.readUshort(r,s);s+=2;var d=h/2;l.searchRange=a.readUshort(r,s),s+=2,l.entrySelector=a.readUshort(r,s),s+=2,l.rangeShift=a.readUshort(r,s),s+=2,l.endCount=a.readUshorts(r,s,d),s+=2*d,s+=2,l.startCount=a.readUshorts(r,s,d),s+=2*d,l.idDelta=[];for(var p=0;p<d;p++)l.idDelta.push(a.readShort(r,s)),s+=2;for(l.idRangeOffset=a.readUshorts(r,s,d),s+=2*d,l.glyphIdArray=[];s<o+c;)l.glyphIdArray.push(a.readUshort(r,s)),s+=2;return l},e.cmap.parse6=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,o.firstCode=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2,o.glyphIdArray=[];for(var c=0;c<l;c++)o.glyphIdArray.push(a.readUshort(r,s)),s+=2;return o},e.cmap.parse12=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2,s+=2,a.readUint(r,s),s+=4,a.readUint(r,s),s+=4;var l=a.readUint(r,s);s+=4,o.groups=[];for(var c=0;c<l;c++){var h=s+12*c,d=a.readUint(r,h+0),p=a.readUint(r,h+4),m=a.readUint(r,h+8);o.groups.push([d,p,m])}return o},e.glyf={},e.glyf.parse=function(r,s,a,o){for(var l=[],c=0;c<o.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(r,s){var a=e._bin,o=r._data,l=e._tabOffset(o,"glyf",r._offset)+r.loca[s];if(r.loca[s]==r.loca[s+1])return null;var c={};if(c.noc=a.readShort(o,l),l+=2,c.xMin=a.readShort(o,l),l+=2,c.yMin=a.readShort(o,l),l+=2,c.xMax=a.readShort(o,l),l+=2,c.yMax=a.readShort(o,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var h=0;h<c.noc;h++)c.endPts.push(a.readUshort(o,l)),l+=2;var d=a.readUshort(o,l);if(l+=2,o.length-l<d)return null;c.instructions=a.readBytes(o,l,d),l+=d;var p=c.endPts[c.noc-1]+1;for(c.flags=[],h=0;h<p;h++){var m=o[l];if(l++,c.flags.push(m),(8&m)!=0){var v=o[l];l++;for(var x=0;x<v;x++)c.flags.push(m),h++}}for(c.xs=[],h=0;h<p;h++){var _=(2&c.flags[h])!=0,g=(16&c.flags[h])!=0;_?(c.xs.push(g?o[l]:-o[l]),l++):g?c.xs.push(0):(c.xs.push(a.readShort(o,l)),l+=2)}for(c.ys=[],h=0;h<p;h++)_=(4&c.flags[h])!=0,g=(32&c.flags[h])!=0,_?(c.ys.push(g?o[l]:-o[l]),l++):g?c.ys.push(0):(c.ys.push(a.readShort(o,l)),l+=2);var b=0,E=0;for(h=0;h<p;h++)b+=c.xs[h],E+=c.ys[h],c.xs[h]=b,c.ys[h]=E}else{var S;c.parts=[];do{S=a.readUshort(o,l),l+=2;var w={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(w),w.glyphIndex=a.readUshort(o,l),l+=2,1&S){var T=a.readShort(o,l);l+=2;var R=a.readShort(o,l);l+=2}else T=a.readInt8(o,l),l++,R=a.readInt8(o,l),l++;2&S?(w.m.tx=T,w.m.ty=R):(w.p1=T,w.p2=R),8&S?(w.m.a=w.m.d=a.readF2dot14(o,l),l+=2):64&S?(w.m.a=a.readF2dot14(o,l),l+=2,w.m.d=a.readF2dot14(o,l),l+=2):128&S&&(w.m.a=a.readF2dot14(o,l),l+=2,w.m.b=a.readF2dot14(o,l),l+=2,w.m.c=a.readF2dot14(o,l),l+=2,w.m.d=a.readF2dot14(o,l),l+=2)}while(32&S);if(256&S){var U=a.readUshort(o,l);for(l+=2,c.instr=[],h=0;h<U;h++)c.instr.push(o[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(r,s,a,o){var l=s;s+=4;var c=e._bin.readUshort(r,s);return{glyphClassDef:c===0?null:e._lctf.readClassDef(r,l+c)}},e.GPOS={},e.GPOS.parse=function(r,s,a,o){return e._lctf.parse(r,s,a,o,e.GPOS.subt)},e.GPOS.subt=function(r,s,a,o){var l=e._bin,c=a,h={};if(h.fmt=l.readUshort(r,a),a+=2,s==1||s==2||s==3||s==7||s==8&&h.fmt<=2){var d=l.readUshort(r,a);a+=2,h.coverage=e._lctf.readCoverage(r,d+c)}if(s==1&&h.fmt==1){var p=l.readUshort(r,a);a+=2,p!=0&&(h.pos=e.GPOS.readValueRecord(r,a,p))}else if(s==2&&h.fmt>=1&&h.fmt<=2){p=l.readUshort(r,a),a+=2;var m=l.readUshort(r,a);a+=2;var v=e._lctf.numOfOnes(p),x=e._lctf.numOfOnes(m);if(h.fmt==1){h.pairsets=[];var _=l.readUshort(r,a);a+=2;for(var g=0;g<_;g++){var b=c+l.readUshort(r,a);a+=2;var E=l.readUshort(r,b);b+=2;for(var S=[],w=0;w<E;w++){var T=l.readUshort(r,b);b+=2,p!=0&&(P=e.GPOS.readValueRecord(r,b,p),b+=2*v),m!=0&&(I=e.GPOS.readValueRecord(r,b,m),b+=2*x),S.push({gid2:T,val1:P,val2:I})}h.pairsets.push(S)}}if(h.fmt==2){var R=l.readUshort(r,a);a+=2;var U=l.readUshort(r,a);a+=2;var A=l.readUshort(r,a);a+=2;var D=l.readUshort(r,a);for(a+=2,h.classDef1=e._lctf.readClassDef(r,c+R),h.classDef2=e._lctf.readClassDef(r,c+U),h.matrix=[],g=0;g<A;g++){var L=[];for(w=0;w<D;w++){var P=null,I=null;p!=0&&(P=e.GPOS.readValueRecord(r,a,p),a+=2*v),m!=0&&(I=e.GPOS.readValueRecord(r,a,m),a+=2*x),L.push({val1:P,val2:I})}h.matrix.push(L)}}}else if(s==4&&h.fmt==1)h.markCoverage=e._lctf.readCoverage(r,l.readUshort(r,a)+c),h.baseCoverage=e._lctf.readCoverage(r,l.readUshort(r,a+2)+c),h.markClassCount=l.readUshort(r,a+4),h.markArray=e.GPOS.readMarkArray(r,l.readUshort(r,a+6)+c),h.baseArray=e.GPOS.readBaseArray(r,l.readUshort(r,a+8)+c,h.markClassCount);else if(s==6&&h.fmt==1)h.mark1Coverage=e._lctf.readCoverage(r,l.readUshort(r,a)+c),h.mark2Coverage=e._lctf.readCoverage(r,l.readUshort(r,a+2)+c),h.markClassCount=l.readUshort(r,a+4),h.mark1Array=e.GPOS.readMarkArray(r,l.readUshort(r,a+6)+c),h.mark2Array=e.GPOS.readBaseArray(r,l.readUshort(r,a+8)+c,h.markClassCount);else{if(s==9&&h.fmt==1){var V=l.readUshort(r,a);a+=2;var H=l.readUint(r,a);if(a+=4,o.ltype==9)o.ltype=V;else if(o.ltype!=V)throw"invalid extension substitution";return e.GPOS.subt(r,o.ltype,c+H)}console.debug("unsupported GPOS table LookupType",s,"format",h.fmt)}return h},e.GPOS.readValueRecord=function(r,s,a){var o=e._bin,l=[];return l.push(1&a?o.readShort(r,s):0),s+=1&a?2:0,l.push(2&a?o.readShort(r,s):0),s+=2&a?2:0,l.push(4&a?o.readShort(r,s):0),s+=4&a?2:0,l.push(8&a?o.readShort(r,s):0),s+=8&a?2:0,l},e.GPOS.readBaseArray=function(r,s,a){var o=e._bin,l=[],c=s,h=o.readUshort(r,s);s+=2;for(var d=0;d<h;d++){for(var p=[],m=0;m<a;m++)p.push(e.GPOS.readAnchorRecord(r,c+o.readUshort(r,s))),s+=2;l.push(p)}return l},e.GPOS.readMarkArray=function(r,s){var a=e._bin,o=[],l=s,c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=e.GPOS.readAnchorRecord(r,a.readUshort(r,s+2)+l);d.markClass=a.readUshort(r,s),o.push(d),s+=4}return o},e.GPOS.readAnchorRecord=function(r,s){var a=e._bin,o={};return o.fmt=a.readUshort(r,s),o.x=a.readShort(r,s+2),o.y=a.readShort(r,s+4),o},e.GSUB={},e.GSUB.parse=function(r,s,a,o){return e._lctf.parse(r,s,a,o,e.GSUB.subt)},e.GSUB.subt=function(r,s,a,o){var l=e._bin,c=a,h={};if(h.fmt=l.readUshort(r,a),a+=2,s!=1&&s!=2&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==2||s==4||s==5&&h.fmt<=2||s==6&&h.fmt<=2){var d=l.readUshort(r,a);a+=2,h.coverage=e._lctf.readCoverage(r,c+d)}if(s==1&&h.fmt>=1&&h.fmt<=2){if(h.fmt==1)h.delta=l.readShort(r,a),a+=2;else if(h.fmt==2){var p=l.readUshort(r,a);a+=2,h.newg=l.readUshorts(r,a,p),a+=2*h.newg.length}}else if(s==2&&h.fmt==1){p=l.readUshort(r,a),a+=2,h.seqs=[];for(var m=0;m<p;m++){var v=l.readUshort(r,a)+c;a+=2;var x=l.readUshort(r,v);h.seqs.push(l.readUshorts(r,v+2,x))}}else if(s==4)for(h.vals=[],p=l.readUshort(r,a),a+=2,m=0;m<p;m++){var _=l.readUshort(r,a);a+=2,h.vals.push(e.GSUB.readLigatureSet(r,c+_))}else if(s==5&&h.fmt==2){if(h.fmt==2){var g=l.readUshort(r,a);a+=2,h.cDef=e._lctf.readClassDef(r,c+g),h.scset=[];var b=l.readUshort(r,a);for(a+=2,m=0;m<b;m++){var E=l.readUshort(r,a);a+=2,h.scset.push(E==0?null:e.GSUB.readSubClassSet(r,c+E))}}}else if(s==6&&h.fmt==3){if(h.fmt==3){for(m=0;m<3;m++){p=l.readUshort(r,a),a+=2;for(var S=[],w=0;w<p;w++)S.push(e._lctf.readCoverage(r,c+l.readUshort(r,a+2*w)));a+=2*p,m==0&&(h.backCvg=S),m==1&&(h.inptCvg=S),m==2&&(h.ahedCvg=S)}p=l.readUshort(r,a),a+=2,h.lookupRec=e.GSUB.readSubstLookupRecords(r,a,p)}}else{if(s==7&&h.fmt==1){var T=l.readUshort(r,a);a+=2;var R=l.readUint(r,a);if(a+=4,o.ltype==9)o.ltype=T;else if(o.ltype!=T)throw"invalid extension substitution";return e.GSUB.subt(r,o.ltype,c+R)}console.debug("unsupported GSUB table LookupType",s,"format",h.fmt)}return h},e.GSUB.readSubClassSet=function(r,s){var a=e._bin.readUshort,o=s,l=[],c=a(r,s);s+=2;for(var h=0;h<c;h++){var d=a(r,s);s+=2,l.push(e.GSUB.readSubClassRule(r,o+d))}return l},e.GSUB.readSubClassRule=function(r,s){var a=e._bin.readUshort,o={},l=a(r,s),c=a(r,s+=2);s+=2,o.input=[];for(var h=0;h<l-1;h++)o.input.push(a(r,s)),s+=2;return o.substLookupRecords=e.GSUB.readSubstLookupRecords(r,s,c),o},e.GSUB.readSubstLookupRecords=function(r,s,a){for(var o=e._bin.readUshort,l=[],c=0;c<a;c++)l.push(o(r,s),o(r,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readUshort(r,s);s+=2,l.push(e.GSUB.readChainSubClassRule(r,o+d))}return l},e.GSUB.readChainSubClassRule=function(r,s){for(var a=e._bin,o={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var h=a.readUshort(r,s);s+=2,c==1&&h--,o[l[c]]=a.readUshorts(r,s,h),s+=2*o[l[c]].length}return h=a.readUshort(r,s),s+=2,o.subst=a.readUshorts(r,s,2*h),s+=2*o.subst.length,o},e.GSUB.readLigatureSet=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readUshort(r,s);s+=2,l.push(e.GSUB.readLigature(r,o+d))}return l},e.GSUB.readLigature=function(r,s){var a=e._bin,o={chain:[]};o.nglyph=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2;for(var c=0;c<l-1;c++)o.chain.push(a.readUshort(r,s)),s+=2;return o},e.head={},e.head.parse=function(r,s,a){var o=e._bin,l={};return o.readFixed(r,s),s+=4,l.fontRevision=o.readFixed(r,s),s+=4,o.readUint(r,s),s+=4,o.readUint(r,s),s+=4,l.flags=o.readUshort(r,s),s+=2,l.unitsPerEm=o.readUshort(r,s),s+=2,l.created=o.readUint64(r,s),s+=8,l.modified=o.readUint64(r,s),s+=8,l.xMin=o.readShort(r,s),s+=2,l.yMin=o.readShort(r,s),s+=2,l.xMax=o.readShort(r,s),s+=2,l.yMax=o.readShort(r,s),s+=2,l.macStyle=o.readUshort(r,s),s+=2,l.lowestRecPPEM=o.readUshort(r,s),s+=2,l.fontDirectionHint=o.readShort(r,s),s+=2,l.indexToLocFormat=o.readShort(r,s),s+=2,l.glyphDataFormat=o.readShort(r,s),s+=2,l},e.hhea={},e.hhea.parse=function(r,s,a){var o=e._bin,l={};return o.readFixed(r,s),s+=4,l.ascender=o.readShort(r,s),s+=2,l.descender=o.readShort(r,s),s+=2,l.lineGap=o.readShort(r,s),s+=2,l.advanceWidthMax=o.readUshort(r,s),s+=2,l.minLeftSideBearing=o.readShort(r,s),s+=2,l.minRightSideBearing=o.readShort(r,s),s+=2,l.xMaxExtent=o.readShort(r,s),s+=2,l.caretSlopeRise=o.readShort(r,s),s+=2,l.caretSlopeRun=o.readShort(r,s),s+=2,l.caretOffset=o.readShort(r,s),s+=2,s+=8,l.metricDataFormat=o.readShort(r,s),s+=2,l.numberOfHMetrics=o.readUshort(r,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(r,s,a,o){for(var l=e._bin,c={aWidth:[],lsBearing:[]},h=0,d=0,p=0;p<o.maxp.numGlyphs;p++)p<o.hhea.numberOfHMetrics&&(h=l.readUshort(r,s),s+=2,d=l.readShort(r,s),s+=2),c.aWidth.push(h),c.lsBearing.push(d);return c},e.kern={},e.kern.parse=function(r,s,a,o){var l=e._bin,c=l.readUshort(r,s);if(s+=2,c==1)return e.kern.parseV1(r,s-2,a,o);var h=l.readUshort(r,s);s+=2;for(var d={glyph1:[],rval:[]},p=0;p<h;p++){s+=2,a=l.readUshort(r,s),s+=2;var m=l.readUshort(r,s);s+=2;var v=m>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(r,s,d)}return d},e.kern.parseV1=function(r,s,a,o){var l=e._bin;l.readFixed(r,s),s+=4;var c=l.readUint(r,s);s+=4;for(var h={glyph1:[],rval:[]},d=0;d<c;d++){l.readUint(r,s),s+=4;var p=l.readUshort(r,s);s+=2,l.readUshort(r,s),s+=2;var m=p>>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(r,s,h)}return h},e.kern.readFormat0=function(r,s,a){var o=e._bin,l=-1,c=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2;for(var h=0;h<c;h++){var d=o.readUshort(r,s);s+=2;var p=o.readUshort(r,s);s+=2;var m=o.readShort(r,s);s+=2,d!=l&&(a.glyph1.push(d),a.rval.push({glyph2:[],vals:[]}));var v=a.rval[a.rval.length-1];v.glyph2.push(p),v.vals.push(m),l=d}return s},e.loca={},e.loca.parse=function(r,s,a,o){var l=e._bin,c=[],h=o.head.indexToLocFormat,d=o.maxp.numGlyphs+1;if(h==0)for(var p=0;p<d;p++)c.push(l.readUshort(r,s+(p<<1))<<1);if(h==1)for(p=0;p<d;p++)c.push(l.readUint(r,s+(p<<2)));return c},e.maxp={},e.maxp.parse=function(r,s,a){var o=e._bin,l={},c=o.readUint(r,s);return s+=4,l.numGlyphs=o.readUshort(r,s),s+=2,c==65536&&(l.maxPoints=o.readUshort(r,s),s+=2,l.maxContours=o.readUshort(r,s),s+=2,l.maxCompositePoints=o.readUshort(r,s),s+=2,l.maxCompositeContours=o.readUshort(r,s),s+=2,l.maxZones=o.readUshort(r,s),s+=2,l.maxTwilightPoints=o.readUshort(r,s),s+=2,l.maxStorage=o.readUshort(r,s),s+=2,l.maxFunctionDefs=o.readUshort(r,s),s+=2,l.maxInstructionDefs=o.readUshort(r,s),s+=2,l.maxStackElements=o.readUshort(r,s),s+=2,l.maxSizeOfInstructions=o.readUshort(r,s),s+=2,l.maxComponentElements=o.readUshort(r,s),s+=2,l.maxComponentDepth=o.readUshort(r,s),s+=2),l},e.name={},e.name.parse=function(r,s,a){var o=e._bin,l={};o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2,o.readUshort(r,s);for(var h,d=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],p=s+=2,m=0;m<c;m++){var v=o.readUshort(r,s);s+=2;var x=o.readUshort(r,s);s+=2;var _=o.readUshort(r,s);s+=2;var g=o.readUshort(r,s);s+=2;var b=o.readUshort(r,s);s+=2;var E=o.readUshort(r,s);s+=2;var S,w=d[g],T=p+12*c+E;if(v==0)S=o.readUnicode(r,T,b/2);else if(v==3&&x==0)S=o.readUnicode(r,T,b/2);else if(x==0)S=o.readASCII(r,T,b);else if(x==1)S=o.readUnicode(r,T,b/2);else if(x==3)S=o.readUnicode(r,T,b/2);else{if(v!=1)throw"unknown encoding "+x+", platformID: "+v;S=o.readASCII(r,T,b),console.debug("reading unknown MAC encoding "+x+" as ASCII")}var R="p"+v+","+_.toString(16);l[R]==null&&(l[R]={}),l[R][w!==void 0?w:g]=S,l[R]._lang=_}for(var U in l)if(l[U].postScriptName!=null&&l[U]._lang==1033)return l[U];for(var U in l)if(l[U].postScriptName!=null&&l[U]._lang==0)return l[U];for(var U in l)if(l[U].postScriptName!=null&&l[U]._lang==3084)return l[U];for(var U in l)if(l[U].postScriptName!=null)return l[U];for(var U in l){h=U;break}return console.debug("returning name table with languageID "+l[h]._lang),l[h]},e["OS/2"]={},e["OS/2"].parse=function(r,s,a){var o=e._bin.readUshort(r,s);s+=2;var l={};if(o==0)e["OS/2"].version0(r,s,l);else if(o==1)e["OS/2"].version1(r,s,l);else if(o==2||o==3||o==4)e["OS/2"].version2(r,s,l);else{if(o!=5)throw"unknown OS/2 table version: "+o;e["OS/2"].version5(r,s,l)}return l},e["OS/2"].version0=function(r,s,a){var o=e._bin;return a.xAvgCharWidth=o.readShort(r,s),s+=2,a.usWeightClass=o.readUshort(r,s),s+=2,a.usWidthClass=o.readUshort(r,s),s+=2,a.fsType=o.readUshort(r,s),s+=2,a.ySubscriptXSize=o.readShort(r,s),s+=2,a.ySubscriptYSize=o.readShort(r,s),s+=2,a.ySubscriptXOffset=o.readShort(r,s),s+=2,a.ySubscriptYOffset=o.readShort(r,s),s+=2,a.ySuperscriptXSize=o.readShort(r,s),s+=2,a.ySuperscriptYSize=o.readShort(r,s),s+=2,a.ySuperscriptXOffset=o.readShort(r,s),s+=2,a.ySuperscriptYOffset=o.readShort(r,s),s+=2,a.yStrikeoutSize=o.readShort(r,s),s+=2,a.yStrikeoutPosition=o.readShort(r,s),s+=2,a.sFamilyClass=o.readShort(r,s),s+=2,a.panose=o.readBytes(r,s,10),s+=10,a.ulUnicodeRange1=o.readUint(r,s),s+=4,a.ulUnicodeRange2=o.readUint(r,s),s+=4,a.ulUnicodeRange3=o.readUint(r,s),s+=4,a.ulUnicodeRange4=o.readUint(r,s),s+=4,a.achVendID=[o.readInt8(r,s),o.readInt8(r,s+1),o.readInt8(r,s+2),o.readInt8(r,s+3)],s+=4,a.fsSelection=o.readUshort(r,s),s+=2,a.usFirstCharIndex=o.readUshort(r,s),s+=2,a.usLastCharIndex=o.readUshort(r,s),s+=2,a.sTypoAscender=o.readShort(r,s),s+=2,a.sTypoDescender=o.readShort(r,s),s+=2,a.sTypoLineGap=o.readShort(r,s),s+=2,a.usWinAscent=o.readUshort(r,s),s+=2,a.usWinDescent=o.readUshort(r,s),s+=2},e["OS/2"].version1=function(r,s,a){var o=e._bin;return s=e["OS/2"].version0(r,s,a),a.ulCodePageRange1=o.readUint(r,s),s+=4,a.ulCodePageRange2=o.readUint(r,s),s+=4},e["OS/2"].version2=function(r,s,a){var o=e._bin;return s=e["OS/2"].version1(r,s,a),a.sxHeight=o.readShort(r,s),s+=2,a.sCapHeight=o.readShort(r,s),s+=2,a.usDefault=o.readUshort(r,s),s+=2,a.usBreak=o.readUshort(r,s),s+=2,a.usMaxContext=o.readUshort(r,s),s+=2},e["OS/2"].version5=function(r,s,a){var o=e._bin;return s=e["OS/2"].version2(r,s,a),a.usLowerOpticalPointSize=o.readUshort(r,s),s+=2,a.usUpperOpticalPointSize=o.readUshort(r,s),s+=2},e.post={},e.post.parse=function(r,s,a){var o=e._bin,l={};return l.version=o.readFixed(r,s),s+=4,l.italicAngle=o.readFixed(r,s),s+=4,l.underlinePosition=o.readShort(r,s),s+=2,l.underlineThickness=o.readShort(r,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(r,s){var a=r.cmap,o=-1;if(a.p0e4!=null?o=a.p0e4:a.p3e1!=null?o=a.p3e1:a.p1e0!=null?o=a.p1e0:a.p0e3!=null&&(o=a.p0e3),o==-1)throw"no familiar platform and encoding!";var l=a.tables[o];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,h=0;h<l.endCount.length;h++)if(s<=l.endCount[h]){c=h;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(h=0;h<l.groups.length;h++){var d=l.groups[h];if(d[0]<=s&&s<=d[1])return d[2]+(s-d[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(r,s){var a={cmds:[],crds:[]};if(r.SVG&&r.SVG.entries[s]){var o=r.SVG.entries[s];return o==null?a:(typeof o=="string"&&(o=e.SVG.toPath(o),r.SVG.entries[s]=o),o)}if(r.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:r.CFF.Private?r.CFF.Private.defaultWidthX:0,open:!1},c=r.CFF,h=r.CFF.Private;if(c.ROS){for(var d=0;c.FDSelect[d+2]<=s;)d+=2;h=c.FDArray[c.FDSelect[d+1]].Private}e.U._drawCFF(r.CFF.CharStrings[s],l,c,h,a)}else r.glyf&&e.U._drawGlyf(s,r,a);return a},e.U._drawGlyf=function(r,s,a){var o=s.glyf[r];o==null&&(o=s.glyf[r]=e.glyf._parseGlyf(s,r)),o!=null&&(o.noc>-1?e.U._simpleGlyph(o,a):e.U._compoGlyph(o,s,a))},e.U._simpleGlyph=function(r,s){for(var a=0;a<r.noc;a++){for(var o=a==0?0:r.endPts[a-1]+1,l=r.endPts[a],c=o;c<=l;c++){var h=c==o?l:c-1,d=c==l?o:c+1,p=1&r.flags[c],m=1&r.flags[h],v=1&r.flags[d],x=r.xs[c],_=r.ys[c];if(c==o)if(p){if(!m){e.U.P.moveTo(s,x,_);continue}e.U.P.moveTo(s,r.xs[h],r.ys[h])}else m?e.U.P.moveTo(s,r.xs[h],r.ys[h]):e.U.P.moveTo(s,(r.xs[h]+x)/2,(r.ys[h]+_)/2);p?m&&e.U.P.lineTo(s,x,_):v?e.U.P.qcurveTo(s,x,_,r.xs[d],r.ys[d]):e.U.P.qcurveTo(s,x,_,(x+r.xs[d])/2,(_+r.ys[d])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(r,s,a){for(var o=0;o<r.parts.length;o++){var l={cmds:[],crds:[]},c=r.parts[o];e.U._drawGlyf(c.glyphIndex,s,l);for(var h=c.m,d=0;d<l.crds.length;d+=2){var p=l.crds[d],m=l.crds[d+1];a.crds.push(p*h.a+m*h.b+h.tx),a.crds.push(p*h.c+m*h.d+h.ty)}for(d=0;d<l.cmds.length;d++)a.cmds.push(l.cmds[d])}},e.U._getGlyphClass=function(r,s){var a=e._lctf.getInterval(s,r);return a==-1?0:s[a+2]},e.U._applySubs=function(r,s,a,o){for(var l=r.length-s-1,c=0;c<a.tabs.length;c++)if(a.tabs[c]!=null){var h,d=a.tabs[c];if(!d.coverage||(h=e._lctf.coverageIndex(d.coverage,r[s]))!=-1){if(a.ltype==1)r[s],d.fmt==1?r[s]=r[s]+d.delta:r[s]=d.newg[h];else if(a.ltype==4)for(var p=d.vals[h],m=0;m<p.length;m++){var v=p[m],x=v.chain.length;if(!(x>l)){for(var _=!0,g=0,b=0;b<x;b++){for(;r[s+g+(1+b)]==-1;)g++;v.chain[b]!=r[s+g+(1+b)]&&(_=!1)}if(_){for(r[s]=v.nglyph,b=0;b<x+g;b++)r[s+b+1]=-1;break}}}else if(a.ltype==5&&d.fmt==2)for(var E=e._lctf.getInterval(d.cDef,r[s]),S=d.cDef[E+2],w=d.scset[S],T=0;T<w.length;T++){var R=w[T],U=R.input;if(!(U.length>l)){for(_=!0,b=0;b<U.length;b++){var A=e._lctf.getInterval(d.cDef,r[s+1+b]);if(E==-1&&d.cDef[A+2]!=U[b]){_=!1;break}}if(_){var D=R.substLookupRecords;for(m=0;m<D.length;m+=2)D[m],D[m+1]}}}else if(a.ltype==6&&d.fmt==3){if(!e.U._glsCovered(r,d.backCvg,s-d.backCvg.length)||!e.U._glsCovered(r,d.inptCvg,s)||!e.U._glsCovered(r,d.ahedCvg,s+d.inptCvg.length))continue;var L=d.lookupRec;for(T=0;T<L.length;T+=2){E=L[T];var P=o[L[T+1]];e.U._applySubs(r,s+E,P,o)}}}}},e.U._glsCovered=function(r,s,a){for(var o=0;o<s.length;o++)if(e._lctf.coverageIndex(s[o],r[a+o])==-1)return!1;return!0},e.U.glyphsToPath=function(r,s,a){for(var o={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var h=s[c];if(h!=-1){for(var d=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,p=e.U.glyphToPath(r,h),m=0;m<p.crds.length;m+=2)o.crds.push(p.crds[m]+l),o.crds.push(p.crds[m+1]);for(a&&o.cmds.push(a),m=0;m<p.cmds.length;m++)o.cmds.push(p.cmds[m]);a&&o.cmds.push("X"),l+=r.hmtx.aWidth[h],c<s.length-1&&(l+=e.U.getPairAdjustment(r,h,d))}}return o},e.U.P={},e.U.P.moveTo=function(r,s,a){r.cmds.push("M"),r.crds.push(s,a)},e.U.P.lineTo=function(r,s,a){r.cmds.push("L"),r.crds.push(s,a)},e.U.P.curveTo=function(r,s,a,o,l,c,h){r.cmds.push("C"),r.crds.push(s,a,o,l,c,h)},e.U.P.qcurveTo=function(r,s,a,o,l){r.cmds.push("Q"),r.crds.push(s,a,o,l)},e.U.P.closePath=function(r){r.cmds.push("Z")},e.U._drawCFF=function(r,s,a,o,l){for(var c=s.stack,h=s.nStems,d=s.haveWidth,p=s.width,m=s.open,v=0,x=s.x,_=s.y,g=0,b=0,E=0,S=0,w=0,T=0,R=0,U=0,A=0,D=0,L={val:0,size:0};v<r.length;){e.CFF.getCharString(r,v,L);var P=L.val;if(v+=L.size,P=="o1"||P=="o18")c.length%2!=0&&!d&&(p=c.shift()+o.nominalWidthX),h+=c.length>>1,c.length=0,d=!0;else if(P=="o3"||P=="o23")c.length%2!=0&&!d&&(p=c.shift()+o.nominalWidthX),h+=c.length>>1,c.length=0,d=!0;else if(P=="o4")c.length>1&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),m&&e.U.P.closePath(l),_+=c.pop(),e.U.P.moveTo(l,x,_),m=!0;else if(P=="o5")for(;c.length>0;)x+=c.shift(),_+=c.shift(),e.U.P.lineTo(l,x,_);else if(P=="o6"||P=="o7")for(var I=c.length,V=P=="o6",H=0;H<I;H++){var z=c.shift();V?x+=z:_+=z,V=!V,e.U.P.lineTo(l,x,_)}else if(P=="o8"||P=="o24"){I=c.length;for(var O=0;O+6<=I;)g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),x=E+c.shift(),_=S+c.shift(),e.U.P.curveTo(l,g,b,E,S,x,_),O+=6;P=="o24"&&(x+=c.shift(),_+=c.shift(),e.U.P.lineTo(l,x,_))}else{if(P=="o11")break;if(P=="o1234"||P=="o1235"||P=="o1236"||P=="o1237")P=="o1234"&&(b=_,E=(g=x+c.shift())+c.shift(),D=S=b+c.shift(),T=S,U=_,x=(R=(w=(A=E+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_)),P=="o1235"&&(g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),A=E+c.shift(),D=S+c.shift(),w=A+c.shift(),T=D+c.shift(),R=w+c.shift(),U=T+c.shift(),x=R+c.shift(),_=U+c.shift(),c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_)),P=="o1236"&&(g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),D=S=b+c.shift(),T=S,R=(w=(A=E+c.shift())+c.shift())+c.shift(),U=T+c.shift(),x=R+c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_)),P=="o1237"&&(g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),A=E+c.shift(),D=S+c.shift(),w=A+c.shift(),T=D+c.shift(),R=w+c.shift(),U=T+c.shift(),Math.abs(R-x)>Math.abs(U-_)?x=R+c.shift():_=U+c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_));else if(P=="o14"){if(c.length>0&&!d&&(p=c.shift()+a.nominalWidthX,d=!0),c.length==4){var B=c.shift(),G=c.shift(),X=c.shift(),k=c.shift(),Y=e.CFF.glyphBySE(a,X),Q=e.CFF.glyphBySE(a,k);e.U._drawCFF(a.CharStrings[Y],s,a,o,l),s.x=B,s.y=G,e.U._drawCFF(a.CharStrings[Q],s,a,o,l)}m&&(e.U.P.closePath(l),m=!1)}else if(P=="o19"||P=="o20")c.length%2!=0&&!d&&(p=c.shift()+o.nominalWidthX),h+=c.length>>1,c.length=0,d=!0,v+=h+7>>3;else if(P=="o21")c.length>2&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),_+=c.pop(),x+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,_),m=!0;else if(P=="o22")c.length>1&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),x+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,_),m=!0;else if(P=="o25"){for(;c.length>6;)x+=c.shift(),_+=c.shift(),e.U.P.lineTo(l,x,_);g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),x=E+c.shift(),_=S+c.shift(),e.U.P.curveTo(l,g,b,E,S,x,_)}else if(P=="o26")for(c.length%2&&(x+=c.shift());c.length>0;)g=x,b=_+c.shift(),x=E=g+c.shift(),_=(S=b+c.shift())+c.shift(),e.U.P.curveTo(l,g,b,E,S,x,_);else if(P=="o27")for(c.length%2&&(_+=c.shift());c.length>0;)b=_,E=(g=x+c.shift())+c.shift(),S=b+c.shift(),x=E+c.shift(),_=S,e.U.P.curveTo(l,g,b,E,S,x,_);else if(P=="o10"||P=="o29"){var te=P=="o10"?o:a;if(c.length==0)console.debug("error: empty stack");else{var ee=c.pop(),ie=te.Subrs[ee+te.Bias];s.x=x,s.y=_,s.nStems=h,s.haveWidth=d,s.width=p,s.open=m,e.U._drawCFF(ie,s,a,o,l),x=s.x,_=s.y,h=s.nStems,d=s.haveWidth,p=s.width,m=s.open}}else if(P=="o30"||P=="o31"){var re=c.length,de=(O=0,P=="o31");for(O+=re-(I=-3&re);O<I;)de?(b=_,E=(g=x+c.shift())+c.shift(),_=(S=b+c.shift())+c.shift(),I-O==5?(x=E+c.shift(),O++):x=E,de=!1):(g=x,b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),x=E+c.shift(),I-O==5?(_=S+c.shift(),O++):_=S,de=!0),e.U.P.curveTo(l,g,b,E,S,x,_),O+=4}else{if((P+"").charAt(0)=="o")throw console.debug("Unknown operation: "+P,r),P;c.push(P)}}}s.x=x,s.y=_,s.nStems=h,s.haveWidth=d,s.width=p,s.open=m};var t=e,n={Typr:t};return i.Typr=t,i.default=n,Object.defineProperty(i,"__esModule",{value:!0}),i})({}).Typr}/*!
|
|
3980
|
-
Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
|
|
3981
|
-
(https://github.com/101arrowz/fflate) for use in Troika text rendering.
|
|
3982
|
-
Original licenses apply:
|
|
3983
|
-
- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
|
|
3984
|
-
- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
|
|
3985
|
-
*/function l8(){return(function(i){var e=Uint8Array,t=Uint16Array,n=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(P,I){for(var V=new t(31),H=0;H<31;++H)V[H]=I+=1<<P[H-1];var z=new n(V[30]);for(H=1;H<30;++H)for(var O=V[H];O<V[H+1];++O)z[O]=O-V[H]<<5|H;return[V,z]},l=o(r,2),c=l[0],h=l[1];c[28]=258,h[258]=28;for(var d=o(s,0)[0],p=new t(32768),m=0;m<32768;++m){var v=(43690&m)>>>1|(21845&m)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,p[m]=((65280&v)>>>8|(255&v)<<8)>>>1}var x=function(P,I,V){for(var H=P.length,z=0,O=new t(I);z<H;++z)++O[P[z]-1];var B,G=new t(I);for(z=0;z<I;++z)G[z]=G[z-1]+O[z-1]<<1;{B=new t(1<<I);var X=15-I;for(z=0;z<H;++z)if(P[z])for(var k=z<<4|P[z],Y=I-P[z],Q=G[P[z]-1]++<<Y,te=Q|(1<<Y)-1;Q<=te;++Q)B[p[Q]>>>X]=k}return B},_=new e(288);for(m=0;m<144;++m)_[m]=8;for(m=144;m<256;++m)_[m]=9;for(m=256;m<280;++m)_[m]=7;for(m=280;m<288;++m)_[m]=8;var g=new e(32);for(m=0;m<32;++m)g[m]=5;var b=x(_,9),E=x(g,5),S=function(P){for(var I=P[0],V=1;V<P.length;++V)P[V]>I&&(I=P[V]);return I},w=function(P,I,V){var H=I/8|0;return(P[H]|P[H+1]<<8)>>(7&I)&V},T=function(P,I){var V=I/8|0;return(P[V]|P[V+1]<<8|P[V+2]<<16)>>(7&I)},R=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],U=function(P,I,V){var H=new Error(I||R[P]);if(H.code=P,Error.captureStackTrace&&Error.captureStackTrace(H,U),!V)throw H;return H},A=function(P,I,V){var H=P.length;if(!H||V&&!V.l&&H<5)return I||new e(0);var z=!I||V,O=!V||V.i;V||(V={}),I||(I=new e(3*H));var B,G=function(Ve){var Je=I.length;if(Ve>Je){var We=new e(Math.max(2*Je,Ve));We.set(I),I=We}},X=V.f||0,k=V.p||0,Y=V.b||0,Q=V.l,te=V.d,ee=V.m,ie=V.n,re=8*H;do{if(!Q){V.f=X=w(P,k,1);var de=w(P,k+1,3);if(k+=3,!de){var Ae=P[(be=((B=k)/8|0)+(7&B&&1)+4)-4]|P[be-3]<<8,Me=be+Ae;if(Me>H){O&&U(0);break}z&&G(Y+Ae),I.set(P.subarray(be,Me),Y),V.b=Y+=Ae,V.p=k=8*Me;continue}if(de==1)Q=b,te=E,ee=9,ie=5;else if(de==2){var ve=w(P,k,31)+257,fe=w(P,k+10,15)+4,J=ve+w(P,k+5,31)+1;k+=14;for(var oe=new e(J),se=new e(19),$=0;$<fe;++$)se[a[$]]=w(P,k+3*$,7);k+=3*fe;var pe=S(se),ye=(1<<pe)-1,xe=x(se,pe);for($=0;$<J;){var be,ue=xe[w(P,k,ye)];if(k+=15&ue,(be=ue>>>4)<16)oe[$++]=be;else{var He=0,W=0;for(be==16?(W=3+w(P,k,3),k+=2,He=oe[$-1]):be==17?(W=3+w(P,k,7),k+=3):be==18&&(W=11+w(P,k,127),k+=7);W--;)oe[$++]=He}}var F=oe.subarray(0,ve),ne=oe.subarray(ve);ee=S(F),ie=S(ne),Q=x(F,ee),te=x(ne,ie)}else U(1);if(k>re){O&&U(0);break}}z&&G(Y+131072);for(var Se=(1<<ee)-1,_e=(1<<ie)-1,me=k;;me=k){var ze=(He=Q[T(P,k)&Se])>>>4;if((k+=15&He)>re){O&&U(0);break}if(He||U(2),ze<256)I[Y++]=ze;else{if(ze==256){me=k,Q=null;break}var Ne=ze-254;if(ze>264){var je=r[$=ze-257];Ne=w(P,k,(1<<je)-1)+c[$],k+=je}var Ze=te[T(P,k)&_e],Le=Ze>>>4;if(Ze||U(3),k+=15&Ze,ne=d[Le],Le>3&&(je=s[Le],ne+=T(P,k)&(1<<je)-1,k+=je),k>re){O&&U(0);break}z&&G(Y+131072);for(var Be=Y+Ne;Y<Be;Y+=4)I[Y]=I[Y-ne],I[Y+1]=I[Y+1-ne],I[Y+2]=I[Y+2-ne],I[Y+3]=I[Y+3-ne];Y=Be}}V.l=Q,V.p=me,V.b=Y,Q&&(X=1,V.m=ee,V.d=te,V.n=ie)}while(!X);return Y==I.length?I:(function(Ve,Je,We){(We==null||We>Ve.length)&&(We=Ve.length);var dt=new(Ve instanceof t?t:Ve instanceof n?n:e)(We-Je);return dt.set(Ve.subarray(Je,We)),dt})(I,0,Y)},D=new e(0),L=typeof TextDecoder<"u"&&new TextDecoder;try{L.decode(D,{stream:!0})}catch{}return i.convert_streams=function(P){var I=new DataView(P),V=0;function H(){var ve=I.getUint16(V);return V+=2,ve}function z(){var ve=I.getUint32(V);return V+=4,ve}function O(ve){Ae.setUint16(Me,ve),Me+=2}function B(ve){Ae.setUint32(Me,ve),Me+=4}for(var G={signature:z(),flavor:z(),length:z(),numTables:H(),reserved:H(),totalSfntSize:z(),majorVersion:H(),minorVersion:H(),metaOffset:z(),metaLength:z(),metaOrigLength:z(),privOffset:z(),privLength:z()},X=0;Math.pow(2,X)<=G.numTables;)X++;X--;for(var k=16*Math.pow(2,X),Y=16*G.numTables-k,Q=12,te=[],ee=0;ee<G.numTables;ee++)te.push({tag:z(),offset:z(),compLength:z(),origLength:z(),origChecksum:z()}),Q+=16;var ie,re=new Uint8Array(12+16*te.length+te.reduce((function(ve,fe){return ve+fe.origLength+4}),0)),de=re.buffer,Ae=new DataView(de),Me=0;return B(G.flavor),O(G.numTables),O(k),O(X),O(Y),te.forEach((function(ve){B(ve.tag),B(ve.origChecksum),B(Q),B(ve.origLength),ve.outOffset=Q,(Q+=ve.origLength)%4!=0&&(Q+=4-Q%4)})),te.forEach((function(ve){var fe,J=P.slice(ve.offset,ve.offset+ve.compLength);if(ve.compLength!=ve.origLength){var oe=new Uint8Array(ve.origLength);fe=new Uint8Array(J,2),A(fe,oe)}else oe=new Uint8Array(J);re.set(oe,ve.outOffset);var se=0;(Q=ve.outOffset+ve.origLength)%4!=0&&(se=4-Q%4),re.set(new Uint8Array(se).buffer,ve.outOffset+ve.origLength),ie=Q+se})),de.slice(0,ie)},Object.defineProperty(i,"__esModule",{value:!0}),i})({}).convert_streams}function c8(i,e){const t={M:2,L:2,Q:4,C:6,Z:0},n={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},r=1,s=2,a=4,o=8,l=16,c=32;let h;function d(R){if(!h){const U={R:s,L:r,D:a,C:l,U:c,T:o};h=new Map;for(let A in n){let D=0;n[A].split(",").forEach(L=>{let[P,I]=L.split("+");P=parseInt(P,36),I=I?parseInt(I,36):0,h.set(D+=P,U[A]);for(let V=I;V--;)h.set(++D,U[A])})}}return h.get(R)||c}const p=1,m=2,v=3,x=4,_=[null,"isol","init","fina","medi"];function g(R){const U=new Uint8Array(R.length);let A=c,D=p,L=-1;for(let P=0;P<R.length;P++){const I=R.codePointAt(P);let V=d(I)|0,H=p;V&o||(A&(r|a|l)?V&(s|a|l)?(H=v,(D===p||D===v)&&U[L]++):V&(r|c)&&(D===m||D===x)&&U[L]--:A&(s|c)&&(D===m||D===x)&&U[L]--,D=U[P]=H,A=V,L=P,I>65535&&P++)}return U}function b(R,U){const A=[];for(let L=0;L<U.length;L++){const P=U.codePointAt(L);P>65535&&L++,A.push(i.U.codeToGlyph(R,P))}const D=R.GSUB;if(D){const{lookupList:L,featureList:P}=D;let I;const V=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,H=[];P.forEach(z=>{if(V.test(z.tag))for(let O=0;O<z.tab.length;O++){if(H[z.tab[O]])continue;H[z.tab[O]]=!0;const B=L[z.tab[O]],G=/^(isol|init|fina|medi)$/.test(z.tag);G&&!I&&(I=g(U));for(let X=0;X<A.length;X++)(!I||!G||_[I[X]]===z.tag)&&i.U._applySubs(A,X,B,L)}})}return A}function E(R,U){const A=new Int16Array(U.length*3);let D=0;for(;D<U.length;D++){const V=U[D];if(V===-1)continue;A[D*3+2]=R.hmtx.aWidth[V];const H=R.GPOS;if(H){const z=H.lookupList;for(let O=0;O<z.length;O++){const B=z[O];for(let G=0;G<B.tabs.length;G++){const X=B.tabs[G];if(B.ltype===1){if(i._lctf.coverageIndex(X.coverage,V)!==-1&&X.pos){I(X.pos,D);break}}else if(B.ltype===2){let k=null,Y=L();if(Y!==-1){const Q=i._lctf.coverageIndex(X.coverage,U[Y]);if(Q!==-1){if(X.fmt===1){const te=X.pairsets[Q];for(let ee=0;ee<te.length;ee++)te[ee].gid2===V&&(k=te[ee])}else if(X.fmt===2){const te=i.U._getGlyphClass(U[Y],X.classDef1),ee=i.U._getGlyphClass(V,X.classDef2);k=X.matrix[te][ee]}if(k){k.val1&&I(k.val1,Y),k.val2&&I(k.val2,D);break}}}}else if(B.ltype===4){const k=i._lctf.coverageIndex(X.markCoverage,V);if(k!==-1){const Y=L(P),Q=Y===-1?-1:i._lctf.coverageIndex(X.baseCoverage,U[Y]);if(Q!==-1){const te=X.markArray[k],ee=X.baseArray[Q][te.markClass];A[D*3]=ee.x-te.x+A[Y*3]-A[Y*3+2],A[D*3+1]=ee.y-te.y+A[Y*3+1];break}}}else if(B.ltype===6){const k=i._lctf.coverageIndex(X.mark1Coverage,V);if(k!==-1){const Y=L();if(Y!==-1){const Q=U[Y];if(S(R,Q)===3){const te=i._lctf.coverageIndex(X.mark2Coverage,Q);if(te!==-1){const ee=X.mark1Array[k],ie=X.mark2Array[te][ee.markClass];A[D*3]=ie.x-ee.x+A[Y*3]-A[Y*3+2],A[D*3+1]=ie.y-ee.y+A[Y*3+1];break}}}}}}}}else if(R.kern&&!R.cff){const z=L();if(z!==-1){const O=R.kern.glyph1.indexOf(U[z]);if(O!==-1){const B=R.kern.rval[O].glyph2.indexOf(V);B!==-1&&(A[z*3+2]+=R.kern.rval[O].vals[B])}}}}return A;function L(V){for(let H=D-1;H>=0;H--)if(U[H]!==-1&&(!V||V(U[H])))return H;return-1}function P(V){return S(R,V)===1}function I(V,H){for(let z=0;z<3;z++)A[H*3+z]+=V[z]||0}}function S(R,U){const A=R.GDEF&&R.GDEF.glyphClassDef;return A?i.U._getGlyphClass(U,A):0}function w(...R){for(let U=0;U<R.length;U++)if(typeof R[U]=="number")return R[U]}function T(R){const U=Object.create(null),A=R["OS/2"],D=R.hhea,L=R.head.unitsPerEm,P=w(A&&A.sTypoAscender,D&&D.ascender,L),I={unitsPerEm:L,ascender:P,descender:w(A&&A.sTypoDescender,D&&D.descender,0),capHeight:w(A&&A.sCapHeight,P),xHeight:w(A&&A.sxHeight,P),lineGap:w(A&&A.sTypoLineGap,D&&D.lineGap),supportsCodePoint(V){return i.U.codeToGlyph(R,V)>0},forEachGlyph(V,H,z,O){let B=0;const G=1/I.unitsPerEm*H,X=b(R,V);let k=0;const Y=E(R,X);return X.forEach((Q,te)=>{if(Q!==-1){let ee=U[Q];if(!ee){const{cmds:ie,crds:re}=i.U.glyphToPath(R,Q);let de="",Ae=0;for(let oe=0,se=ie.length;oe<se;oe++){const $=t[ie[oe]];de+=ie[oe];for(let pe=1;pe<=$;pe++)de+=(pe>1?",":"")+re[Ae++]}let Me,ve,fe,J;if(re.length){Me=ve=1/0,fe=J=-1/0;for(let oe=0,se=re.length;oe<se;oe+=2){let $=re[oe],pe=re[oe+1];$<Me&&(Me=$),pe<ve&&(ve=pe),$>fe&&(fe=$),pe>J&&(J=pe)}}else Me=fe=ve=J=0;ee=U[Q]={index:Q,advanceWidth:R.hmtx.aWidth[Q],xMin:Me,yMin:ve,xMax:fe,yMax:J,path:de}}O.call(null,ee,B+Y[te*3]*G,Y[te*3+1]*G,k),B+=Y[te*3+2]*G,z&&(B+=z*H)}k+=V.codePointAt(k)>65535?2:1}),B}};return I}return function(U){const A=new Uint8Array(U,0,4),D=i._bin.readASCII(A,0,4);if(D==="wOFF")U=e(U);else if(D==="wOF2")throw new Error("woff2 fonts not supported");return T(i.parse(U)[0])}}const u8=Iu({name:"Typr Font Parser",dependencies:[o8,l8,c8],init(i,e,t){const n=i(),r=e();return t(n,r)}});/*!
|
|
3986
|
-
Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
|
|
3987
|
-
for use in Troika text rendering.
|
|
3988
|
-
Original MIT license applies
|
|
3989
|
-
*/function h8(){return(function(i){var e=function(){this.buckets=new Map};e.prototype.add=function(E){var S=E>>5;this.buckets.set(S,(this.buckets.get(S)||0)|1<<(31&E))},e.prototype.has=function(E){var S=this.buckets.get(E>>5);return S!==void 0&&(S&1<<(31&E))!=0},e.prototype.serialize=function(){var E=[];return this.buckets.forEach((function(S,w){E.push((+w).toString(36)+":"+S.toString(36))})),E.join(",")},e.prototype.deserialize=function(E){var S=this;this.buckets.clear(),E.split(",").forEach((function(w){var T=w.split(":");S.buckets.set(parseInt(T[0],36),parseInt(T[1],36))}))};var t=Math.pow(2,8),n=t-1,r=~n;function s(E){var S=(function(T){return T&r})(E).toString(16),w=(function(T){return(T&r)+t-1})(E).toString(16);return"codepoint-index/plane"+(E>>16)+"/"+S+"-"+w+".json"}function a(E,S){var w=E&n,T=S.codePointAt(w/6|0);return((T=(T||48)-48)&1<<w%6)!=0}function o(E,S){var w;(w=E,w.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(T){return T.split("-").map((function(R){return parseInt(R.trim(),16)}))}))).forEach((function(T){var R=T[0],U=T[1];U===void 0&&(U=R),S(R,U)}))}function l(E,S){o(E,(function(w,T){for(var R=w;R<=T;R++)S(R)}))}var c={},h={},d=new WeakMap,p="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function m(E){var S=d.get(E);return S||(S=new e,l(E.ranges,(function(w){return S.add(w)})),d.set(E,S)),S}var v,x=new Map;function _(E,S,w){return E[S]?S:E[w]?w:(function(T){for(var R in T)return R})(E)}function g(E,S){var w=S;if(!E.includes(w)){w=1/0;for(var T=0;T<E.length;T++)Math.abs(E[T]-S)<Math.abs(w-S)&&(w=E[T])}return w}function b(E){return v||(v=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(S){v.add(S)}))),v.has(E)}return i.CodePointSet=e,i.clearCache=function(){c={},h={}},i.getFontsForString=function(E,S){S===void 0&&(S={});var w,T=S.lang;T===void 0&&(T=new RegExp("\\p{Script=Hangul}","u").test(w=E)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(w)?"ja":"en");var R=S.category;R===void 0&&(R="sans-serif");var U=S.style;U===void 0&&(U="normal");var A=S.weight;A===void 0&&(A=400);var D=(S.dataUrl||p).replace(/\/$/g,""),L=new Map,P=new Uint8Array(E.length),I={},V={},H=new Array(E.length),z=new Map,O=!1;function B(k){var Y=x.get(k);return Y||(Y=fetch(D+"/"+k).then((function(Q){if(!Q.ok)throw new Error(Q.statusText);return Q.json().then((function(te){if(!Array.isArray(te)||te[0]!==1)throw new Error("Incorrect schema version; need 1, got "+te[0]);return te[1]}))})).catch((function(Q){if(D!==p)return O||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+D+'", trying default CDN. '+Q.message),O=!0),D=p,x.delete(k),B(k);throw Q})),x.set(k,Y)),Y}for(var G=function(k){var Y=E.codePointAt(k),Q=s(Y);H[k]=Q,c[Q]||z.has(Q)||z.set(Q,B(Q).then((function(te){c[Q]=te}))),Y>65535&&(k++,X=k)},X=0;X<E.length;X++)G(X);return Promise.all(z.values()).then((function(){z.clear();for(var k=function(Q){var te=E.codePointAt(Q),ee=null,ie=c[H[Q]],re=void 0;for(var de in ie){var Ae=V[de];if(Ae===void 0&&(Ae=V[de]=new RegExp(de).test(T||"en")),Ae){for(var Me in re=de,ie[de])if(a(te,ie[de][Me])){ee=Me;break}break}}if(!ee){e:for(var ve in ie)if(ve!==re){for(var fe in ie[ve])if(a(te,ie[ve][fe])){ee=fe;break e}}}ee||(console.debug("No font coverage for U+"+te.toString(16)),ee="latin"),H[Q]=ee,h[ee]||z.has(ee)||z.set(ee,B("font-meta/"+ee+".json").then((function(J){h[ee]=J}))),te>65535&&(Q++,Y=Q)},Y=0;Y<E.length;Y++)k(Y);return Promise.all(z.values())})).then((function(){for(var k,Y=null,Q=0;Q<E.length;Q++){var te=E.codePointAt(Q);if(Y&&(b(te)||m(Y).has(te)))P[Q]=P[Q-1];else{Y=h[H[Q]];var ee=I[Y.id];if(!ee){var ie=Y.typeforms,re=_(ie,R,"sans-serif"),de=_(ie[re],U,"normal"),Ae=g((k=ie[re])===null||k===void 0?void 0:k[de],A);ee=I[Y.id]=D+"/font-files/"+Y.id+"/"+re+"."+de+"."+Ae+".woff"}var Me=L.get(ee);Me==null&&(Me=L.size,L.set(ee,Me)),P[Q]=Me}te>65535&&(Q++,P[Q]=P[Q-1])}return{fontUrls:Array.from(L.keys()),chars:P}}))},Object.defineProperty(i,"__esModule",{value:!0}),i})({})}function f8(i,e){const t=Object.create(null),n=Object.create(null);function r(a,o){const l=c=>{console.error(`Failure loading font ${a}`,c)};try{const c=new XMLHttpRequest;c.open("get",a,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{const h=i(c.response);h.src=a,o(h)}catch(h){l(h)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(a,o){let l=t[a];l?o(l):n[a]?n[a].push(o):(n[a]=[o],r(a,c=>{c.src=a,t[a]=c,n[a].forEach(h=>h(c)),delete n[a]}))}return function(a,o,{lang:l,fonts:c=[],style:h="normal",weight:d="normal",unicodeFontsURL:p}={}){const m=new Uint8Array(a.length),v=[];a.length||b();const x=new Map,_=[];if(h!=="italic"&&(h="normal"),typeof d!="number"&&(d=d==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(S=>!S.lang||S.lang.test(l)).reverse(),c.length){let R=0;(function U(A=0){for(let D=A,L=a.length;D<L;D++){const P=a.codePointAt(D);if(R===1&&v[m[D-1]].supportsCodePoint(P)||D>0&&/\s/.test(a[D]))m[D]=m[D-1],R===2&&(_[_.length-1][1]=D);else for(let I=m[D],V=c.length;I<=V;I++)if(I===V){const H=R===2?_[_.length-1]:_[_.length]=[D,D];H[1]=D,R=2}else{m[D]=I;const{src:H,unicodeRange:z}=c[I];if(!z||E(P,z)){const O=t[H];if(!O){s(H,()=>{U(D)});return}if(O.supportsCodePoint(P)){let B=x.get(O);typeof B!="number"&&(B=v.length,v.push(O),x.set(O,B)),m[D]=B,R=1;break}}}P>65535&&D+1<L&&(m[D+1]=m[D],D++,R===2&&(_[_.length-1][1]=D))}g()})()}else _.push([0,a.length-1]),g();function g(){if(_.length){const S=_.map(w=>a.substring(w[0],w[1]+1)).join(`
|
|
3918
|
+
}`),i}function r8(i,e){return i==="uniforms"?void 0:typeof e=="function"?e.toString():e}let s8=0;const ET=new Map;function a8(i){const e=JSON.stringify(i,r8);let t=ET.get(e);return t==null&&ET.set(e,t=++s8),t}function o8(){return typeof window>"u"&&(self.window=self),(function(i){var e={parse:function(r){var s=e._bin,a=new Uint8Array(r);if(s.readASCII(a,0,4)=="ttcf"){var o=4;s.readUshort(a,o),o+=2,s.readUshort(a,o),o+=2;var l=s.readUint(a,o);o+=4;for(var c=[],h=0;h<l;h++){var d=s.readUint(a,o);o+=4,c.push(e._readFont(a,d))}return c}return[e._readFont(a,0)]},_readFont:function(r,s){var a=e._bin,o=s;a.readFixed(r,s),s+=4;var l=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],h={_data:r,_offset:o},d={},p=0;p<l;p++){var m=a.readASCII(r,s,4);s+=4,a.readUint(r,s),s+=4;var v=a.readUint(r,s);s+=4;var x=a.readUint(r,s);s+=4,d[m]={offset:v,length:x}}for(p=0;p<c.length;p++){var _=c[p];d[_]&&(h[_.trim()]=e[_.trim()].parse(r,d[_].offset,d[_].length,h))}return h},_tabOffset:function(r,s,a){for(var o=e._bin,l=o.readUshort(r,a+4),c=a+12,h=0;h<l;h++){var d=o.readASCII(r,c,4);c+=4,o.readUint(r,c),c+=4;var p=o.readUint(r,c);if(c+=4,o.readUint(r,c),c+=4,d==s)return p}return 0}};e._bin={readFixed:function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<8|r[s+3])/65540},readF2dot14:function(r,s){return e._bin.readShort(r,s)/16384},readInt:function(r,s){return e._bin._view(r).getInt32(s)},readInt8:function(r,s){return e._bin._view(r).getInt8(s)},readShort:function(r,s){return e._bin._view(r).getInt16(s)},readUshort:function(r,s){return e._bin._view(r).getUint16(s)},readUshorts:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(e._bin.readUshort(r,s+2*l));return o},readUint:function(r,s){return e._bin._view(r).getUint32(s)},readUint64:function(r,s){return 4294967296*e._bin.readUint(r,s)+e._bin.readUint(r,s+4)},readASCII:function(r,s,a){for(var o="",l=0;l<a;l++)o+=String.fromCharCode(r[s+l]);return o},readUnicode:function(r,s,a){for(var o="",l=0;l<a;l++){var c=r[s++]<<8|r[s++];o+=String.fromCharCode(c)}return o},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(r,s,a){var o=e._bin._tdec;return o&&s==0&&a==r.length?o.decode(r):e._bin.readASCII(r,s,a)},readBytes:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(r[s+l]);return o},readASCIIArray:function(r,s,a){for(var o=[],l=0;l<a;l++)o.push(String.fromCharCode(r[s+l]));return o},_view:function(r){return r._dataView||(r._dataView=r.buffer?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(new Uint8Array(r).buffer))}},e._lctf={},e._lctf.parse=function(r,s,a,o,l){var c=e._bin,h={},d=s;c.readFixed(r,s),s+=4;var p=c.readUshort(r,s);s+=2;var m=c.readUshort(r,s);s+=2;var v=c.readUshort(r,s);return s+=2,h.scriptList=e._lctf.readScriptList(r,d+p),h.featureList=e._lctf.readFeatureList(r,d+m),h.lookupList=e._lctf.readLookupList(r,d+v,l),h},e._lctf.readLookupList=function(r,s,a){var o=e._bin,l=s,c=[],h=o.readUshort(r,s);s+=2;for(var d=0;d<h;d++){var p=o.readUshort(r,s);s+=2;var m=e._lctf.readLookupTable(r,l+p,a);c.push(m)}return c},e._lctf.readLookupTable=function(r,s,a){var o=e._bin,l=s,c={tabs:[]};c.ltype=o.readUshort(r,s),s+=2,c.flag=o.readUshort(r,s),s+=2;var h=o.readUshort(r,s);s+=2;for(var d=c.ltype,p=0;p<h;p++){var m=o.readUshort(r,s);s+=2;var v=a(r,d,l+m,c);c.tabs.push(v)}return c},e._lctf.numOfOnes=function(r){for(var s=0,a=0;a<32;a++)(r>>>a&1)!=0&&s++;return s},e._lctf.readClassDef=function(r,s){var a=e._bin,o=[],l=a.readUshort(r,s);if(s+=2,l==1){var c=a.readUshort(r,s);s+=2;var h=a.readUshort(r,s);s+=2;for(var d=0;d<h;d++)o.push(c+d),o.push(c+d),o.push(a.readUshort(r,s)),s+=2}if(l==2){var p=a.readUshort(r,s);for(s+=2,d=0;d<p;d++)o.push(a.readUshort(r,s)),s+=2,o.push(a.readUshort(r,s)),s+=2,o.push(a.readUshort(r,s)),s+=2}return o},e._lctf.getInterval=function(r,s){for(var a=0;a<r.length;a+=3){var o=r[a],l=r[a+1];if(r[a+2],o<=s&&s<=l)return a}return-1},e._lctf.readCoverage=function(r,s){var a=e._bin,o={};o.fmt=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);return s+=2,o.fmt==1&&(o.tab=a.readUshorts(r,s,l)),o.fmt==2&&(o.tab=a.readUshorts(r,s,3*l)),o},e._lctf.coverageIndex=function(r,s){var a=r.tab;if(r.fmt==1)return a.indexOf(s);if(r.fmt==2){var o=e._lctf.getInterval(a,s);if(o!=-1)return a[o+2]+(s-a[o])}return-1},e._lctf.readFeatureList=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readASCII(r,s,4);s+=4;var p=a.readUshort(r,s);s+=2;var m=e._lctf.readFeatureTable(r,o+p);m.tag=d.trim(),l.push(m)}return l},e._lctf.readFeatureTable=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2,c>0&&(l.featureParams=o+c);var h=a.readUshort(r,s);s+=2,l.tab=[];for(var d=0;d<h;d++)l.tab.push(a.readUshort(r,s+2*d));return l},e._lctf.readScriptList=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readASCII(r,s,4);s+=4;var p=a.readUshort(r,s);s+=2,l[d.trim()]=e._lctf.readScriptTable(r,o+p)}return l},e._lctf.readScriptTable=function(r,s){var a=e._bin,o=s,l={},c=a.readUshort(r,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(r,o+c));var h=a.readUshort(r,s);s+=2;for(var d=0;d<h;d++){var p=a.readASCII(r,s,4);s+=4;var m=a.readUshort(r,s);s+=2,l[p.trim()]=e._lctf.readLangSysTable(r,o+m)}return l},e._lctf.readLangSysTable=function(r,s){var a=e._bin,o={};a.readUshort(r,s),s+=2,o.reqFeature=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);return s+=2,o.features=a.readUshorts(r,s,l),o},e.CFF={},e.CFF.parse=function(r,s,a){var o=e._bin;(r=new Uint8Array(r.buffer,s,a))[s=0],r[++s],r[++s],r[++s],s++;var l=[];s=e.CFF.readIndex(r,s,l);for(var c=[],h=0;h<l.length-1;h++)c.push(o.readASCII(r,s+l[h],l[h+1]-l[h]));s+=l[l.length-1];var d=[];s=e.CFF.readIndex(r,s,d);var p=[];for(h=0;h<d.length-1;h++)p.push(e.CFF.readDict(r,s+d[h],s+d[h+1]));s+=d[d.length-1];var m=p[0],v=[];s=e.CFF.readIndex(r,s,v);var x=[];for(h=0;h<v.length-1;h++)x.push(o.readASCII(r,s+v[h],v[h+1]-v[h]));if(s+=v[v.length-1],e.CFF.readSubrs(r,s,m),m.CharStrings){s=m.CharStrings,v=[],s=e.CFF.readIndex(r,s,v);var _=[];for(h=0;h<v.length-1;h++)_.push(o.readBytes(r,s+v[h],v[h+1]-v[h]));m.CharStrings=_}if(m.ROS){s=m.FDArray;var g=[];for(s=e.CFF.readIndex(r,s,g),m.FDArray=[],h=0;h<g.length-1;h++){var b=e.CFF.readDict(r,s+g[h],s+g[h+1]);e.CFF._readFDict(r,b,x),m.FDArray.push(b)}s+=g[g.length-1],s=m.FDSelect,m.FDSelect=[];var E=r[s];if(s++,E!=3)throw E;var S=o.readUshort(r,s);for(s+=2,h=0;h<S+1;h++)m.FDSelect.push(o.readUshort(r,s),r[s+2]),s+=3}return m.Encoding&&(m.Encoding=e.CFF.readEncoding(r,m.Encoding,m.CharStrings.length)),m.charset&&(m.charset=e.CFF.readCharset(r,m.charset,m.CharStrings.length)),e.CFF._readFDict(r,m,x),m},e.CFF._readFDict=function(r,s,a){var o;for(var l in s.Private&&(o=s.Private[1],s.Private=e.CFF.readDict(r,o,o+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(r,o+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=a[s[l]-426+35])},e.CFF.readSubrs=function(r,s,a){var o=e._bin,l=[];s=e.CFF.readIndex(r,s,l);var c,h=l.length;c=h<1240?107:h<33900?1131:32768,a.Bias=c,a.Subrs=[];for(var d=0;d<l.length-1;d++)a.Subrs.push(o.readBytes(r,s+l[d],l[d+1]-l[d]))},e.CFF.tableSE=[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,0,0,0,0,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,52,53,54,55,56,57,58,59,60,61,62,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,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,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(r,s){for(var a=0;a<r.charset.length;a++)if(r.charset[a]==s)return a;return-1},e.CFF.glyphBySE=function(r,s){return s<0||s>255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,a){e._bin;var o=[".notdef"],l=r[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=r[s];s++;for(var h=0;h<c;h++)o.push(r[s+h]);return o},e.CFF.readCharset=function(r,s,a){var o=e._bin,l=[".notdef"],c=r[s];if(s++,c==0)for(var h=0;h<a;h++){var d=o.readUshort(r,s);s+=2,l.push(d)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<a;){d=o.readUshort(r,s),s+=2;var p=0;for(c==1?(p=r[s],s++):(p=o.readUshort(r,s),s+=2),h=0;h<=p;h++)l.push(d),d++}}return l},e.CFF.readIndex=function(r,s,a){var o=e._bin,l=o.readUshort(r,s)+1,c=r[s+=2];if(s++,c==1)for(var h=0;h<l;h++)a.push(r[s+h]);else if(c==2)for(h=0;h<l;h++)a.push(o.readUshort(r,s+2*h));else if(c==3)for(h=0;h<l;h++)a.push(16777215&o.readUint(r,s+3*h-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(r,s,a){var o=e._bin,l=r[s],c=r[s+1];r[s+2],r[s+3],r[s+4];var h=1,d=null,p=null;l<=20&&(d=l,h=1),l==12&&(d=100*l+c,h=2),21<=l&&l<=27&&(d=l,h=1),l==28&&(p=o.readShort(r,s+1),h=3),29<=l&&l<=31&&(d=l,h=1),32<=l&&l<=246&&(p=l-139,h=1),247<=l&&l<=250&&(p=256*(l-247)+c+108,h=2),251<=l&&l<=254&&(p=256*-(l-251)-c-108,h=2),l==255&&(p=o.readInt(r,s+1)/65535,h=5),a.val=p??"o"+d,a.size=h},e.CFF.readCharString=function(r,s,a){for(var o=s+a,l=e._bin,c=[];s<o;){var h=r[s],d=r[s+1];r[s+2],r[s+3],r[s+4];var p=1,m=null,v=null;h<=20&&(m=h,p=1),h==12&&(m=100*h+d,p=2),h!=19&&h!=20||(m=h,p=2),21<=h&&h<=27&&(m=h,p=1),h==28&&(v=l.readShort(r,s+1),p=3),29<=h&&h<=31&&(m=h,p=1),32<=h&&h<=246&&(v=h-139,p=1),247<=h&&h<=250&&(v=256*(h-247)+d+108,p=2),251<=h&&h<=254&&(v=256*-(h-251)-d-108,p=2),h==255&&(v=l.readInt(r,s+1)/65535,p=5),c.push(v??"o"+m),s+=p}return c},e.CFF.readDict=function(r,s,a){for(var o=e._bin,l={},c=[];s<a;){var h=r[s],d=r[s+1];r[s+2],r[s+3],r[s+4];var p=1,m=null,v=null;if(h==28&&(v=o.readShort(r,s+1),p=3),h==29&&(v=o.readInt(r,s+1),p=5),32<=h&&h<=246&&(v=h-139,p=1),247<=h&&h<=250&&(v=256*(h-247)+d+108,p=2),251<=h&&h<=254&&(v=256*-(h-251)-d-108,p=2),h==255)throw v=o.readInt(r,s+1)/65535,p=5,"unknown number";if(h==30){var x=[];for(p=1;;){var _=r[s+p];p++;var g=_>>4,b=15&_;if(g!=15&&x.push(g),b!=15&&x.push(b),b==15)break}for(var E="",S=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],w=0;w<x.length;w++)E+=S[x[w]];v=parseFloat(E)}h<=21&&(m=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][h],p=1,h==12&&(m=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][d],p=2)),m!=null?(l[m]=c.length==1?c[0]:c,c=[]):c.push(v),s+=p}return l},e.cmap={},e.cmap.parse=function(r,s,a){r=new Uint8Array(r.buffer,s,a),s=0;var o=e._bin,l={};o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2;var h=[];l.tables=[];for(var d=0;d<c;d++){var p=o.readUshort(r,s);s+=2;var m=o.readUshort(r,s);s+=2;var v=o.readUint(r,s);s+=4;var x="p"+p+"e"+m,_=h.indexOf(v);if(_==-1){var g;_=l.tables.length,h.push(v);var b=o.readUshort(r,v);b==0?g=e.cmap.parse0(r,v):b==4?g=e.cmap.parse4(r,v):b==6?g=e.cmap.parse6(r,v):b==12?g=e.cmap.parse12(r,v):console.debug("unknown format: "+b,p,m,v),l.tables.push(g)}if(l[x]!=null)throw"multiple tables for one platform+encoding";l[x]=_}return l},e.cmap.parse0=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,o.map=[];for(var c=0;c<l-6;c++)o.map.push(r[s+c]);return o},e.cmap.parse4=function(r,s){var a=e._bin,o=s,l={};l.format=a.readUshort(r,s),s+=2;var c=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2;var h=a.readUshort(r,s);s+=2;var d=h/2;l.searchRange=a.readUshort(r,s),s+=2,l.entrySelector=a.readUshort(r,s),s+=2,l.rangeShift=a.readUshort(r,s),s+=2,l.endCount=a.readUshorts(r,s,d),s+=2*d,s+=2,l.startCount=a.readUshorts(r,s,d),s+=2*d,l.idDelta=[];for(var p=0;p<d;p++)l.idDelta.push(a.readShort(r,s)),s+=2;for(l.idRangeOffset=a.readUshorts(r,s,d),s+=2*d,l.glyphIdArray=[];s<o+c;)l.glyphIdArray.push(a.readUshort(r,s)),s+=2;return l},e.cmap.parse6=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,o.firstCode=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2,o.glyphIdArray=[];for(var c=0;c<l;c++)o.glyphIdArray.push(a.readUshort(r,s)),s+=2;return o},e.cmap.parse12=function(r,s){var a=e._bin,o={};o.format=a.readUshort(r,s),s+=2,s+=2,a.readUint(r,s),s+=4,a.readUint(r,s),s+=4;var l=a.readUint(r,s);s+=4,o.groups=[];for(var c=0;c<l;c++){var h=s+12*c,d=a.readUint(r,h+0),p=a.readUint(r,h+4),m=a.readUint(r,h+8);o.groups.push([d,p,m])}return o},e.glyf={},e.glyf.parse=function(r,s,a,o){for(var l=[],c=0;c<o.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(r,s){var a=e._bin,o=r._data,l=e._tabOffset(o,"glyf",r._offset)+r.loca[s];if(r.loca[s]==r.loca[s+1])return null;var c={};if(c.noc=a.readShort(o,l),l+=2,c.xMin=a.readShort(o,l),l+=2,c.yMin=a.readShort(o,l),l+=2,c.xMax=a.readShort(o,l),l+=2,c.yMax=a.readShort(o,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var h=0;h<c.noc;h++)c.endPts.push(a.readUshort(o,l)),l+=2;var d=a.readUshort(o,l);if(l+=2,o.length-l<d)return null;c.instructions=a.readBytes(o,l,d),l+=d;var p=c.endPts[c.noc-1]+1;for(c.flags=[],h=0;h<p;h++){var m=o[l];if(l++,c.flags.push(m),(8&m)!=0){var v=o[l];l++;for(var x=0;x<v;x++)c.flags.push(m),h++}}for(c.xs=[],h=0;h<p;h++){var _=(2&c.flags[h])!=0,g=(16&c.flags[h])!=0;_?(c.xs.push(g?o[l]:-o[l]),l++):g?c.xs.push(0):(c.xs.push(a.readShort(o,l)),l+=2)}for(c.ys=[],h=0;h<p;h++)_=(4&c.flags[h])!=0,g=(32&c.flags[h])!=0,_?(c.ys.push(g?o[l]:-o[l]),l++):g?c.ys.push(0):(c.ys.push(a.readShort(o,l)),l+=2);var b=0,E=0;for(h=0;h<p;h++)b+=c.xs[h],E+=c.ys[h],c.xs[h]=b,c.ys[h]=E}else{var S;c.parts=[];do{S=a.readUshort(o,l),l+=2;var w={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(w),w.glyphIndex=a.readUshort(o,l),l+=2,1&S){var T=a.readShort(o,l);l+=2;var R=a.readShort(o,l);l+=2}else T=a.readInt8(o,l),l++,R=a.readInt8(o,l),l++;2&S?(w.m.tx=T,w.m.ty=R):(w.p1=T,w.p2=R),8&S?(w.m.a=w.m.d=a.readF2dot14(o,l),l+=2):64&S?(w.m.a=a.readF2dot14(o,l),l+=2,w.m.d=a.readF2dot14(o,l),l+=2):128&S&&(w.m.a=a.readF2dot14(o,l),l+=2,w.m.b=a.readF2dot14(o,l),l+=2,w.m.c=a.readF2dot14(o,l),l+=2,w.m.d=a.readF2dot14(o,l),l+=2)}while(32&S);if(256&S){var U=a.readUshort(o,l);for(l+=2,c.instr=[],h=0;h<U;h++)c.instr.push(o[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(r,s,a,o){var l=s;s+=4;var c=e._bin.readUshort(r,s);return{glyphClassDef:c===0?null:e._lctf.readClassDef(r,l+c)}},e.GPOS={},e.GPOS.parse=function(r,s,a,o){return e._lctf.parse(r,s,a,o,e.GPOS.subt)},e.GPOS.subt=function(r,s,a,o){var l=e._bin,c=a,h={};if(h.fmt=l.readUshort(r,a),a+=2,s==1||s==2||s==3||s==7||s==8&&h.fmt<=2){var d=l.readUshort(r,a);a+=2,h.coverage=e._lctf.readCoverage(r,d+c)}if(s==1&&h.fmt==1){var p=l.readUshort(r,a);a+=2,p!=0&&(h.pos=e.GPOS.readValueRecord(r,a,p))}else if(s==2&&h.fmt>=1&&h.fmt<=2){p=l.readUshort(r,a),a+=2;var m=l.readUshort(r,a);a+=2;var v=e._lctf.numOfOnes(p),x=e._lctf.numOfOnes(m);if(h.fmt==1){h.pairsets=[];var _=l.readUshort(r,a);a+=2;for(var g=0;g<_;g++){var b=c+l.readUshort(r,a);a+=2;var E=l.readUshort(r,b);b+=2;for(var S=[],w=0;w<E;w++){var T=l.readUshort(r,b);b+=2,p!=0&&(P=e.GPOS.readValueRecord(r,b,p),b+=2*v),m!=0&&(I=e.GPOS.readValueRecord(r,b,m),b+=2*x),S.push({gid2:T,val1:P,val2:I})}h.pairsets.push(S)}}if(h.fmt==2){var R=l.readUshort(r,a);a+=2;var U=l.readUshort(r,a);a+=2;var A=l.readUshort(r,a);a+=2;var D=l.readUshort(r,a);for(a+=2,h.classDef1=e._lctf.readClassDef(r,c+R),h.classDef2=e._lctf.readClassDef(r,c+U),h.matrix=[],g=0;g<A;g++){var L=[];for(w=0;w<D;w++){var P=null,I=null;p!=0&&(P=e.GPOS.readValueRecord(r,a,p),a+=2*v),m!=0&&(I=e.GPOS.readValueRecord(r,a,m),a+=2*x),L.push({val1:P,val2:I})}h.matrix.push(L)}}}else if(s==4&&h.fmt==1)h.markCoverage=e._lctf.readCoverage(r,l.readUshort(r,a)+c),h.baseCoverage=e._lctf.readCoverage(r,l.readUshort(r,a+2)+c),h.markClassCount=l.readUshort(r,a+4),h.markArray=e.GPOS.readMarkArray(r,l.readUshort(r,a+6)+c),h.baseArray=e.GPOS.readBaseArray(r,l.readUshort(r,a+8)+c,h.markClassCount);else if(s==6&&h.fmt==1)h.mark1Coverage=e._lctf.readCoverage(r,l.readUshort(r,a)+c),h.mark2Coverage=e._lctf.readCoverage(r,l.readUshort(r,a+2)+c),h.markClassCount=l.readUshort(r,a+4),h.mark1Array=e.GPOS.readMarkArray(r,l.readUshort(r,a+6)+c),h.mark2Array=e.GPOS.readBaseArray(r,l.readUshort(r,a+8)+c,h.markClassCount);else{if(s==9&&h.fmt==1){var V=l.readUshort(r,a);a+=2;var H=l.readUint(r,a);if(a+=4,o.ltype==9)o.ltype=V;else if(o.ltype!=V)throw"invalid extension substitution";return e.GPOS.subt(r,o.ltype,c+H)}console.debug("unsupported GPOS table LookupType",s,"format",h.fmt)}return h},e.GPOS.readValueRecord=function(r,s,a){var o=e._bin,l=[];return l.push(1&a?o.readShort(r,s):0),s+=1&a?2:0,l.push(2&a?o.readShort(r,s):0),s+=2&a?2:0,l.push(4&a?o.readShort(r,s):0),s+=4&a?2:0,l.push(8&a?o.readShort(r,s):0),s+=8&a?2:0,l},e.GPOS.readBaseArray=function(r,s,a){var o=e._bin,l=[],c=s,h=o.readUshort(r,s);s+=2;for(var d=0;d<h;d++){for(var p=[],m=0;m<a;m++)p.push(e.GPOS.readAnchorRecord(r,c+o.readUshort(r,s))),s+=2;l.push(p)}return l},e.GPOS.readMarkArray=function(r,s){var a=e._bin,o=[],l=s,c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=e.GPOS.readAnchorRecord(r,a.readUshort(r,s+2)+l);d.markClass=a.readUshort(r,s),o.push(d),s+=4}return o},e.GPOS.readAnchorRecord=function(r,s){var a=e._bin,o={};return o.fmt=a.readUshort(r,s),o.x=a.readShort(r,s+2),o.y=a.readShort(r,s+4),o},e.GSUB={},e.GSUB.parse=function(r,s,a,o){return e._lctf.parse(r,s,a,o,e.GSUB.subt)},e.GSUB.subt=function(r,s,a,o){var l=e._bin,c=a,h={};if(h.fmt=l.readUshort(r,a),a+=2,s!=1&&s!=2&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==2||s==4||s==5&&h.fmt<=2||s==6&&h.fmt<=2){var d=l.readUshort(r,a);a+=2,h.coverage=e._lctf.readCoverage(r,c+d)}if(s==1&&h.fmt>=1&&h.fmt<=2){if(h.fmt==1)h.delta=l.readShort(r,a),a+=2;else if(h.fmt==2){var p=l.readUshort(r,a);a+=2,h.newg=l.readUshorts(r,a,p),a+=2*h.newg.length}}else if(s==2&&h.fmt==1){p=l.readUshort(r,a),a+=2,h.seqs=[];for(var m=0;m<p;m++){var v=l.readUshort(r,a)+c;a+=2;var x=l.readUshort(r,v);h.seqs.push(l.readUshorts(r,v+2,x))}}else if(s==4)for(h.vals=[],p=l.readUshort(r,a),a+=2,m=0;m<p;m++){var _=l.readUshort(r,a);a+=2,h.vals.push(e.GSUB.readLigatureSet(r,c+_))}else if(s==5&&h.fmt==2){if(h.fmt==2){var g=l.readUshort(r,a);a+=2,h.cDef=e._lctf.readClassDef(r,c+g),h.scset=[];var b=l.readUshort(r,a);for(a+=2,m=0;m<b;m++){var E=l.readUshort(r,a);a+=2,h.scset.push(E==0?null:e.GSUB.readSubClassSet(r,c+E))}}}else if(s==6&&h.fmt==3){if(h.fmt==3){for(m=0;m<3;m++){p=l.readUshort(r,a),a+=2;for(var S=[],w=0;w<p;w++)S.push(e._lctf.readCoverage(r,c+l.readUshort(r,a+2*w)));a+=2*p,m==0&&(h.backCvg=S),m==1&&(h.inptCvg=S),m==2&&(h.ahedCvg=S)}p=l.readUshort(r,a),a+=2,h.lookupRec=e.GSUB.readSubstLookupRecords(r,a,p)}}else{if(s==7&&h.fmt==1){var T=l.readUshort(r,a);a+=2;var R=l.readUint(r,a);if(a+=4,o.ltype==9)o.ltype=T;else if(o.ltype!=T)throw"invalid extension substitution";return e.GSUB.subt(r,o.ltype,c+R)}console.debug("unsupported GSUB table LookupType",s,"format",h.fmt)}return h},e.GSUB.readSubClassSet=function(r,s){var a=e._bin.readUshort,o=s,l=[],c=a(r,s);s+=2;for(var h=0;h<c;h++){var d=a(r,s);s+=2,l.push(e.GSUB.readSubClassRule(r,o+d))}return l},e.GSUB.readSubClassRule=function(r,s){var a=e._bin.readUshort,o={},l=a(r,s),c=a(r,s+=2);s+=2,o.input=[];for(var h=0;h<l-1;h++)o.input.push(a(r,s)),s+=2;return o.substLookupRecords=e.GSUB.readSubstLookupRecords(r,s,c),o},e.GSUB.readSubstLookupRecords=function(r,s,a){for(var o=e._bin.readUshort,l=[],c=0;c<a;c++)l.push(o(r,s),o(r,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readUshort(r,s);s+=2,l.push(e.GSUB.readChainSubClassRule(r,o+d))}return l},e.GSUB.readChainSubClassRule=function(r,s){for(var a=e._bin,o={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var h=a.readUshort(r,s);s+=2,c==1&&h--,o[l[c]]=a.readUshorts(r,s,h),s+=2*o[l[c]].length}return h=a.readUshort(r,s),s+=2,o.subst=a.readUshorts(r,s,2*h),s+=2*o.subst.length,o},e.GSUB.readLigatureSet=function(r,s){var a=e._bin,o=s,l=[],c=a.readUshort(r,s);s+=2;for(var h=0;h<c;h++){var d=a.readUshort(r,s);s+=2,l.push(e.GSUB.readLigature(r,o+d))}return l},e.GSUB.readLigature=function(r,s){var a=e._bin,o={chain:[]};o.nglyph=a.readUshort(r,s),s+=2;var l=a.readUshort(r,s);s+=2;for(var c=0;c<l-1;c++)o.chain.push(a.readUshort(r,s)),s+=2;return o},e.head={},e.head.parse=function(r,s,a){var o=e._bin,l={};return o.readFixed(r,s),s+=4,l.fontRevision=o.readFixed(r,s),s+=4,o.readUint(r,s),s+=4,o.readUint(r,s),s+=4,l.flags=o.readUshort(r,s),s+=2,l.unitsPerEm=o.readUshort(r,s),s+=2,l.created=o.readUint64(r,s),s+=8,l.modified=o.readUint64(r,s),s+=8,l.xMin=o.readShort(r,s),s+=2,l.yMin=o.readShort(r,s),s+=2,l.xMax=o.readShort(r,s),s+=2,l.yMax=o.readShort(r,s),s+=2,l.macStyle=o.readUshort(r,s),s+=2,l.lowestRecPPEM=o.readUshort(r,s),s+=2,l.fontDirectionHint=o.readShort(r,s),s+=2,l.indexToLocFormat=o.readShort(r,s),s+=2,l.glyphDataFormat=o.readShort(r,s),s+=2,l},e.hhea={},e.hhea.parse=function(r,s,a){var o=e._bin,l={};return o.readFixed(r,s),s+=4,l.ascender=o.readShort(r,s),s+=2,l.descender=o.readShort(r,s),s+=2,l.lineGap=o.readShort(r,s),s+=2,l.advanceWidthMax=o.readUshort(r,s),s+=2,l.minLeftSideBearing=o.readShort(r,s),s+=2,l.minRightSideBearing=o.readShort(r,s),s+=2,l.xMaxExtent=o.readShort(r,s),s+=2,l.caretSlopeRise=o.readShort(r,s),s+=2,l.caretSlopeRun=o.readShort(r,s),s+=2,l.caretOffset=o.readShort(r,s),s+=2,s+=8,l.metricDataFormat=o.readShort(r,s),s+=2,l.numberOfHMetrics=o.readUshort(r,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(r,s,a,o){for(var l=e._bin,c={aWidth:[],lsBearing:[]},h=0,d=0,p=0;p<o.maxp.numGlyphs;p++)p<o.hhea.numberOfHMetrics&&(h=l.readUshort(r,s),s+=2,d=l.readShort(r,s),s+=2),c.aWidth.push(h),c.lsBearing.push(d);return c},e.kern={},e.kern.parse=function(r,s,a,o){var l=e._bin,c=l.readUshort(r,s);if(s+=2,c==1)return e.kern.parseV1(r,s-2,a,o);var h=l.readUshort(r,s);s+=2;for(var d={glyph1:[],rval:[]},p=0;p<h;p++){s+=2,a=l.readUshort(r,s),s+=2;var m=l.readUshort(r,s);s+=2;var v=m>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(r,s,d)}return d},e.kern.parseV1=function(r,s,a,o){var l=e._bin;l.readFixed(r,s),s+=4;var c=l.readUint(r,s);s+=4;for(var h={glyph1:[],rval:[]},d=0;d<c;d++){l.readUint(r,s),s+=4;var p=l.readUshort(r,s);s+=2,l.readUshort(r,s),s+=2;var m=p>>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(r,s,h)}return h},e.kern.readFormat0=function(r,s,a){var o=e._bin,l=-1,c=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2;for(var h=0;h<c;h++){var d=o.readUshort(r,s);s+=2;var p=o.readUshort(r,s);s+=2;var m=o.readShort(r,s);s+=2,d!=l&&(a.glyph1.push(d),a.rval.push({glyph2:[],vals:[]}));var v=a.rval[a.rval.length-1];v.glyph2.push(p),v.vals.push(m),l=d}return s},e.loca={},e.loca.parse=function(r,s,a,o){var l=e._bin,c=[],h=o.head.indexToLocFormat,d=o.maxp.numGlyphs+1;if(h==0)for(var p=0;p<d;p++)c.push(l.readUshort(r,s+(p<<1))<<1);if(h==1)for(p=0;p<d;p++)c.push(l.readUint(r,s+(p<<2)));return c},e.maxp={},e.maxp.parse=function(r,s,a){var o=e._bin,l={},c=o.readUint(r,s);return s+=4,l.numGlyphs=o.readUshort(r,s),s+=2,c==65536&&(l.maxPoints=o.readUshort(r,s),s+=2,l.maxContours=o.readUshort(r,s),s+=2,l.maxCompositePoints=o.readUshort(r,s),s+=2,l.maxCompositeContours=o.readUshort(r,s),s+=2,l.maxZones=o.readUshort(r,s),s+=2,l.maxTwilightPoints=o.readUshort(r,s),s+=2,l.maxStorage=o.readUshort(r,s),s+=2,l.maxFunctionDefs=o.readUshort(r,s),s+=2,l.maxInstructionDefs=o.readUshort(r,s),s+=2,l.maxStackElements=o.readUshort(r,s),s+=2,l.maxSizeOfInstructions=o.readUshort(r,s),s+=2,l.maxComponentElements=o.readUshort(r,s),s+=2,l.maxComponentDepth=o.readUshort(r,s),s+=2),l},e.name={},e.name.parse=function(r,s,a){var o=e._bin,l={};o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2,o.readUshort(r,s);for(var h,d=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],p=s+=2,m=0;m<c;m++){var v=o.readUshort(r,s);s+=2;var x=o.readUshort(r,s);s+=2;var _=o.readUshort(r,s);s+=2;var g=o.readUshort(r,s);s+=2;var b=o.readUshort(r,s);s+=2;var E=o.readUshort(r,s);s+=2;var S,w=d[g],T=p+12*c+E;if(v==0)S=o.readUnicode(r,T,b/2);else if(v==3&&x==0)S=o.readUnicode(r,T,b/2);else if(x==0)S=o.readASCII(r,T,b);else if(x==1)S=o.readUnicode(r,T,b/2);else if(x==3)S=o.readUnicode(r,T,b/2);else{if(v!=1)throw"unknown encoding "+x+", platformID: "+v;S=o.readASCII(r,T,b),console.debug("reading unknown MAC encoding "+x+" as ASCII")}var R="p"+v+","+_.toString(16);l[R]==null&&(l[R]={}),l[R][w!==void 0?w:g]=S,l[R]._lang=_}for(var U in l)if(l[U].postScriptName!=null&&l[U]._lang==1033)return l[U];for(var U in l)if(l[U].postScriptName!=null&&l[U]._lang==0)return l[U];for(var U in l)if(l[U].postScriptName!=null&&l[U]._lang==3084)return l[U];for(var U in l)if(l[U].postScriptName!=null)return l[U];for(var U in l){h=U;break}return console.debug("returning name table with languageID "+l[h]._lang),l[h]},e["OS/2"]={},e["OS/2"].parse=function(r,s,a){var o=e._bin.readUshort(r,s);s+=2;var l={};if(o==0)e["OS/2"].version0(r,s,l);else if(o==1)e["OS/2"].version1(r,s,l);else if(o==2||o==3||o==4)e["OS/2"].version2(r,s,l);else{if(o!=5)throw"unknown OS/2 table version: "+o;e["OS/2"].version5(r,s,l)}return l},e["OS/2"].version0=function(r,s,a){var o=e._bin;return a.xAvgCharWidth=o.readShort(r,s),s+=2,a.usWeightClass=o.readUshort(r,s),s+=2,a.usWidthClass=o.readUshort(r,s),s+=2,a.fsType=o.readUshort(r,s),s+=2,a.ySubscriptXSize=o.readShort(r,s),s+=2,a.ySubscriptYSize=o.readShort(r,s),s+=2,a.ySubscriptXOffset=o.readShort(r,s),s+=2,a.ySubscriptYOffset=o.readShort(r,s),s+=2,a.ySuperscriptXSize=o.readShort(r,s),s+=2,a.ySuperscriptYSize=o.readShort(r,s),s+=2,a.ySuperscriptXOffset=o.readShort(r,s),s+=2,a.ySuperscriptYOffset=o.readShort(r,s),s+=2,a.yStrikeoutSize=o.readShort(r,s),s+=2,a.yStrikeoutPosition=o.readShort(r,s),s+=2,a.sFamilyClass=o.readShort(r,s),s+=2,a.panose=o.readBytes(r,s,10),s+=10,a.ulUnicodeRange1=o.readUint(r,s),s+=4,a.ulUnicodeRange2=o.readUint(r,s),s+=4,a.ulUnicodeRange3=o.readUint(r,s),s+=4,a.ulUnicodeRange4=o.readUint(r,s),s+=4,a.achVendID=[o.readInt8(r,s),o.readInt8(r,s+1),o.readInt8(r,s+2),o.readInt8(r,s+3)],s+=4,a.fsSelection=o.readUshort(r,s),s+=2,a.usFirstCharIndex=o.readUshort(r,s),s+=2,a.usLastCharIndex=o.readUshort(r,s),s+=2,a.sTypoAscender=o.readShort(r,s),s+=2,a.sTypoDescender=o.readShort(r,s),s+=2,a.sTypoLineGap=o.readShort(r,s),s+=2,a.usWinAscent=o.readUshort(r,s),s+=2,a.usWinDescent=o.readUshort(r,s),s+=2},e["OS/2"].version1=function(r,s,a){var o=e._bin;return s=e["OS/2"].version0(r,s,a),a.ulCodePageRange1=o.readUint(r,s),s+=4,a.ulCodePageRange2=o.readUint(r,s),s+=4},e["OS/2"].version2=function(r,s,a){var o=e._bin;return s=e["OS/2"].version1(r,s,a),a.sxHeight=o.readShort(r,s),s+=2,a.sCapHeight=o.readShort(r,s),s+=2,a.usDefault=o.readUshort(r,s),s+=2,a.usBreak=o.readUshort(r,s),s+=2,a.usMaxContext=o.readUshort(r,s),s+=2},e["OS/2"].version5=function(r,s,a){var o=e._bin;return s=e["OS/2"].version2(r,s,a),a.usLowerOpticalPointSize=o.readUshort(r,s),s+=2,a.usUpperOpticalPointSize=o.readUshort(r,s),s+=2},e.post={},e.post.parse=function(r,s,a){var o=e._bin,l={};return l.version=o.readFixed(r,s),s+=4,l.italicAngle=o.readFixed(r,s),s+=4,l.underlinePosition=o.readShort(r,s),s+=2,l.underlineThickness=o.readShort(r,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(r,s){var a=r.cmap,o=-1;if(a.p0e4!=null?o=a.p0e4:a.p3e1!=null?o=a.p3e1:a.p1e0!=null?o=a.p1e0:a.p0e3!=null&&(o=a.p0e3),o==-1)throw"no familiar platform and encoding!";var l=a.tables[o];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,h=0;h<l.endCount.length;h++)if(s<=l.endCount[h]){c=h;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(h=0;h<l.groups.length;h++){var d=l.groups[h];if(d[0]<=s&&s<=d[1])return d[2]+(s-d[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(r,s){var a={cmds:[],crds:[]};if(r.SVG&&r.SVG.entries[s]){var o=r.SVG.entries[s];return o==null?a:(typeof o=="string"&&(o=e.SVG.toPath(o),r.SVG.entries[s]=o),o)}if(r.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:r.CFF.Private?r.CFF.Private.defaultWidthX:0,open:!1},c=r.CFF,h=r.CFF.Private;if(c.ROS){for(var d=0;c.FDSelect[d+2]<=s;)d+=2;h=c.FDArray[c.FDSelect[d+1]].Private}e.U._drawCFF(r.CFF.CharStrings[s],l,c,h,a)}else r.glyf&&e.U._drawGlyf(s,r,a);return a},e.U._drawGlyf=function(r,s,a){var o=s.glyf[r];o==null&&(o=s.glyf[r]=e.glyf._parseGlyf(s,r)),o!=null&&(o.noc>-1?e.U._simpleGlyph(o,a):e.U._compoGlyph(o,s,a))},e.U._simpleGlyph=function(r,s){for(var a=0;a<r.noc;a++){for(var o=a==0?0:r.endPts[a-1]+1,l=r.endPts[a],c=o;c<=l;c++){var h=c==o?l:c-1,d=c==l?o:c+1,p=1&r.flags[c],m=1&r.flags[h],v=1&r.flags[d],x=r.xs[c],_=r.ys[c];if(c==o)if(p){if(!m){e.U.P.moveTo(s,x,_);continue}e.U.P.moveTo(s,r.xs[h],r.ys[h])}else m?e.U.P.moveTo(s,r.xs[h],r.ys[h]):e.U.P.moveTo(s,(r.xs[h]+x)/2,(r.ys[h]+_)/2);p?m&&e.U.P.lineTo(s,x,_):v?e.U.P.qcurveTo(s,x,_,r.xs[d],r.ys[d]):e.U.P.qcurveTo(s,x,_,(x+r.xs[d])/2,(_+r.ys[d])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(r,s,a){for(var o=0;o<r.parts.length;o++){var l={cmds:[],crds:[]},c=r.parts[o];e.U._drawGlyf(c.glyphIndex,s,l);for(var h=c.m,d=0;d<l.crds.length;d+=2){var p=l.crds[d],m=l.crds[d+1];a.crds.push(p*h.a+m*h.b+h.tx),a.crds.push(p*h.c+m*h.d+h.ty)}for(d=0;d<l.cmds.length;d++)a.cmds.push(l.cmds[d])}},e.U._getGlyphClass=function(r,s){var a=e._lctf.getInterval(s,r);return a==-1?0:s[a+2]},e.U._applySubs=function(r,s,a,o){for(var l=r.length-s-1,c=0;c<a.tabs.length;c++)if(a.tabs[c]!=null){var h,d=a.tabs[c];if(!d.coverage||(h=e._lctf.coverageIndex(d.coverage,r[s]))!=-1){if(a.ltype==1)r[s],d.fmt==1?r[s]=r[s]+d.delta:r[s]=d.newg[h];else if(a.ltype==4)for(var p=d.vals[h],m=0;m<p.length;m++){var v=p[m],x=v.chain.length;if(!(x>l)){for(var _=!0,g=0,b=0;b<x;b++){for(;r[s+g+(1+b)]==-1;)g++;v.chain[b]!=r[s+g+(1+b)]&&(_=!1)}if(_){for(r[s]=v.nglyph,b=0;b<x+g;b++)r[s+b+1]=-1;break}}}else if(a.ltype==5&&d.fmt==2)for(var E=e._lctf.getInterval(d.cDef,r[s]),S=d.cDef[E+2],w=d.scset[S],T=0;T<w.length;T++){var R=w[T],U=R.input;if(!(U.length>l)){for(_=!0,b=0;b<U.length;b++){var A=e._lctf.getInterval(d.cDef,r[s+1+b]);if(E==-1&&d.cDef[A+2]!=U[b]){_=!1;break}}if(_){var D=R.substLookupRecords;for(m=0;m<D.length;m+=2)D[m],D[m+1]}}}else if(a.ltype==6&&d.fmt==3){if(!e.U._glsCovered(r,d.backCvg,s-d.backCvg.length)||!e.U._glsCovered(r,d.inptCvg,s)||!e.U._glsCovered(r,d.ahedCvg,s+d.inptCvg.length))continue;var L=d.lookupRec;for(T=0;T<L.length;T+=2){E=L[T];var P=o[L[T+1]];e.U._applySubs(r,s+E,P,o)}}}}},e.U._glsCovered=function(r,s,a){for(var o=0;o<s.length;o++)if(e._lctf.coverageIndex(s[o],r[a+o])==-1)return!1;return!0},e.U.glyphsToPath=function(r,s,a){for(var o={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var h=s[c];if(h!=-1){for(var d=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,p=e.U.glyphToPath(r,h),m=0;m<p.crds.length;m+=2)o.crds.push(p.crds[m]+l),o.crds.push(p.crds[m+1]);for(a&&o.cmds.push(a),m=0;m<p.cmds.length;m++)o.cmds.push(p.cmds[m]);a&&o.cmds.push("X"),l+=r.hmtx.aWidth[h],c<s.length-1&&(l+=e.U.getPairAdjustment(r,h,d))}}return o},e.U.P={},e.U.P.moveTo=function(r,s,a){r.cmds.push("M"),r.crds.push(s,a)},e.U.P.lineTo=function(r,s,a){r.cmds.push("L"),r.crds.push(s,a)},e.U.P.curveTo=function(r,s,a,o,l,c,h){r.cmds.push("C"),r.crds.push(s,a,o,l,c,h)},e.U.P.qcurveTo=function(r,s,a,o,l){r.cmds.push("Q"),r.crds.push(s,a,o,l)},e.U.P.closePath=function(r){r.cmds.push("Z")},e.U._drawCFF=function(r,s,a,o,l){for(var c=s.stack,h=s.nStems,d=s.haveWidth,p=s.width,m=s.open,v=0,x=s.x,_=s.y,g=0,b=0,E=0,S=0,w=0,T=0,R=0,U=0,A=0,D=0,L={val:0,size:0};v<r.length;){e.CFF.getCharString(r,v,L);var P=L.val;if(v+=L.size,P=="o1"||P=="o18")c.length%2!=0&&!d&&(p=c.shift()+o.nominalWidthX),h+=c.length>>1,c.length=0,d=!0;else if(P=="o3"||P=="o23")c.length%2!=0&&!d&&(p=c.shift()+o.nominalWidthX),h+=c.length>>1,c.length=0,d=!0;else if(P=="o4")c.length>1&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),m&&e.U.P.closePath(l),_+=c.pop(),e.U.P.moveTo(l,x,_),m=!0;else if(P=="o5")for(;c.length>0;)x+=c.shift(),_+=c.shift(),e.U.P.lineTo(l,x,_);else if(P=="o6"||P=="o7")for(var I=c.length,V=P=="o6",H=0;H<I;H++){var z=c.shift();V?x+=z:_+=z,V=!V,e.U.P.lineTo(l,x,_)}else if(P=="o8"||P=="o24"){I=c.length;for(var O=0;O+6<=I;)g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),x=E+c.shift(),_=S+c.shift(),e.U.P.curveTo(l,g,b,E,S,x,_),O+=6;P=="o24"&&(x+=c.shift(),_+=c.shift(),e.U.P.lineTo(l,x,_))}else{if(P=="o11")break;if(P=="o1234"||P=="o1235"||P=="o1236"||P=="o1237")P=="o1234"&&(b=_,E=(g=x+c.shift())+c.shift(),D=S=b+c.shift(),T=S,U=_,x=(R=(w=(A=E+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_)),P=="o1235"&&(g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),A=E+c.shift(),D=S+c.shift(),w=A+c.shift(),T=D+c.shift(),R=w+c.shift(),U=T+c.shift(),x=R+c.shift(),_=U+c.shift(),c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_)),P=="o1236"&&(g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),D=S=b+c.shift(),T=S,R=(w=(A=E+c.shift())+c.shift())+c.shift(),U=T+c.shift(),x=R+c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_)),P=="o1237"&&(g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),A=E+c.shift(),D=S+c.shift(),w=A+c.shift(),T=D+c.shift(),R=w+c.shift(),U=T+c.shift(),Math.abs(R-x)>Math.abs(U-_)?x=R+c.shift():_=U+c.shift(),e.U.P.curveTo(l,g,b,E,S,A,D),e.U.P.curveTo(l,w,T,R,U,x,_));else if(P=="o14"){if(c.length>0&&!d&&(p=c.shift()+a.nominalWidthX,d=!0),c.length==4){var B=c.shift(),G=c.shift(),X=c.shift(),k=c.shift(),Y=e.CFF.glyphBySE(a,X),Q=e.CFF.glyphBySE(a,k);e.U._drawCFF(a.CharStrings[Y],s,a,o,l),s.x=B,s.y=G,e.U._drawCFF(a.CharStrings[Q],s,a,o,l)}m&&(e.U.P.closePath(l),m=!1)}else if(P=="o19"||P=="o20")c.length%2!=0&&!d&&(p=c.shift()+o.nominalWidthX),h+=c.length>>1,c.length=0,d=!0,v+=h+7>>3;else if(P=="o21")c.length>2&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),_+=c.pop(),x+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,_),m=!0;else if(P=="o22")c.length>1&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),x+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,_),m=!0;else if(P=="o25"){for(;c.length>6;)x+=c.shift(),_+=c.shift(),e.U.P.lineTo(l,x,_);g=x+c.shift(),b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),x=E+c.shift(),_=S+c.shift(),e.U.P.curveTo(l,g,b,E,S,x,_)}else if(P=="o26")for(c.length%2&&(x+=c.shift());c.length>0;)g=x,b=_+c.shift(),x=E=g+c.shift(),_=(S=b+c.shift())+c.shift(),e.U.P.curveTo(l,g,b,E,S,x,_);else if(P=="o27")for(c.length%2&&(_+=c.shift());c.length>0;)b=_,E=(g=x+c.shift())+c.shift(),S=b+c.shift(),x=E+c.shift(),_=S,e.U.P.curveTo(l,g,b,E,S,x,_);else if(P=="o10"||P=="o29"){var te=P=="o10"?o:a;if(c.length==0)console.debug("error: empty stack");else{var ee=c.pop(),ie=te.Subrs[ee+te.Bias];s.x=x,s.y=_,s.nStems=h,s.haveWidth=d,s.width=p,s.open=m,e.U._drawCFF(ie,s,a,o,l),x=s.x,_=s.y,h=s.nStems,d=s.haveWidth,p=s.width,m=s.open}}else if(P=="o30"||P=="o31"){var re=c.length,de=(O=0,P=="o31");for(O+=re-(I=-3&re);O<I;)de?(b=_,E=(g=x+c.shift())+c.shift(),_=(S=b+c.shift())+c.shift(),I-O==5?(x=E+c.shift(),O++):x=E,de=!1):(g=x,b=_+c.shift(),E=g+c.shift(),S=b+c.shift(),x=E+c.shift(),I-O==5?(_=S+c.shift(),O++):_=S,de=!0),e.U.P.curveTo(l,g,b,E,S,x,_),O+=4}else{if((P+"").charAt(0)=="o")throw console.debug("Unknown operation: "+P,r),P;c.push(P)}}}s.x=x,s.y=_,s.nStems=h,s.haveWidth=d,s.width=p,s.open=m};var t=e,n={Typr:t};return i.Typr=t,i.default=n,Object.defineProperty(i,"__esModule",{value:!0}),i})({}).Typr}function l8(){return(function(i){var e=Uint8Array,t=Uint16Array,n=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(P,I){for(var V=new t(31),H=0;H<31;++H)V[H]=I+=1<<P[H-1];var z=new n(V[30]);for(H=1;H<30;++H)for(var O=V[H];O<V[H+1];++O)z[O]=O-V[H]<<5|H;return[V,z]},l=o(r,2),c=l[0],h=l[1];c[28]=258,h[258]=28;for(var d=o(s,0)[0],p=new t(32768),m=0;m<32768;++m){var v=(43690&m)>>>1|(21845&m)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,p[m]=((65280&v)>>>8|(255&v)<<8)>>>1}var x=function(P,I,V){for(var H=P.length,z=0,O=new t(I);z<H;++z)++O[P[z]-1];var B,G=new t(I);for(z=0;z<I;++z)G[z]=G[z-1]+O[z-1]<<1;{B=new t(1<<I);var X=15-I;for(z=0;z<H;++z)if(P[z])for(var k=z<<4|P[z],Y=I-P[z],Q=G[P[z]-1]++<<Y,te=Q|(1<<Y)-1;Q<=te;++Q)B[p[Q]>>>X]=k}return B},_=new e(288);for(m=0;m<144;++m)_[m]=8;for(m=144;m<256;++m)_[m]=9;for(m=256;m<280;++m)_[m]=7;for(m=280;m<288;++m)_[m]=8;var g=new e(32);for(m=0;m<32;++m)g[m]=5;var b=x(_,9),E=x(g,5),S=function(P){for(var I=P[0],V=1;V<P.length;++V)P[V]>I&&(I=P[V]);return I},w=function(P,I,V){var H=I/8|0;return(P[H]|P[H+1]<<8)>>(7&I)&V},T=function(P,I){var V=I/8|0;return(P[V]|P[V+1]<<8|P[V+2]<<16)>>(7&I)},R=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],U=function(P,I,V){var H=new Error(I||R[P]);if(H.code=P,Error.captureStackTrace&&Error.captureStackTrace(H,U),!V)throw H;return H},A=function(P,I,V){var H=P.length;if(!H||V&&!V.l&&H<5)return I||new e(0);var z=!I||V,O=!V||V.i;V||(V={}),I||(I=new e(3*H));var B,G=function(Ve){var Je=I.length;if(Ve>Je){var We=new e(Math.max(2*Je,Ve));We.set(I),I=We}},X=V.f||0,k=V.p||0,Y=V.b||0,Q=V.l,te=V.d,ee=V.m,ie=V.n,re=8*H;do{if(!Q){V.f=X=w(P,k,1);var de=w(P,k+1,3);if(k+=3,!de){var Ae=P[(be=((B=k)/8|0)+(7&B&&1)+4)-4]|P[be-3]<<8,Me=be+Ae;if(Me>H){O&&U(0);break}z&&G(Y+Ae),I.set(P.subarray(be,Me),Y),V.b=Y+=Ae,V.p=k=8*Me;continue}if(de==1)Q=b,te=E,ee=9,ie=5;else if(de==2){var ve=w(P,k,31)+257,fe=w(P,k+10,15)+4,J=ve+w(P,k+5,31)+1;k+=14;for(var oe=new e(J),se=new e(19),$=0;$<fe;++$)se[a[$]]=w(P,k+3*$,7);k+=3*fe;var pe=S(se),ye=(1<<pe)-1,xe=x(se,pe);for($=0;$<J;){var be,ue=xe[w(P,k,ye)];if(k+=15&ue,(be=ue>>>4)<16)oe[$++]=be;else{var He=0,W=0;for(be==16?(W=3+w(P,k,3),k+=2,He=oe[$-1]):be==17?(W=3+w(P,k,7),k+=3):be==18&&(W=11+w(P,k,127),k+=7);W--;)oe[$++]=He}}var F=oe.subarray(0,ve),ne=oe.subarray(ve);ee=S(F),ie=S(ne),Q=x(F,ee),te=x(ne,ie)}else U(1);if(k>re){O&&U(0);break}}z&&G(Y+131072);for(var Se=(1<<ee)-1,_e=(1<<ie)-1,me=k;;me=k){var ze=(He=Q[T(P,k)&Se])>>>4;if((k+=15&He)>re){O&&U(0);break}if(He||U(2),ze<256)I[Y++]=ze;else{if(ze==256){me=k,Q=null;break}var Ne=ze-254;if(ze>264){var je=r[$=ze-257];Ne=w(P,k,(1<<je)-1)+c[$],k+=je}var Ze=te[T(P,k)&_e],Le=Ze>>>4;if(Ze||U(3),k+=15&Ze,ne=d[Le],Le>3&&(je=s[Le],ne+=T(P,k)&(1<<je)-1,k+=je),k>re){O&&U(0);break}z&&G(Y+131072);for(var Be=Y+Ne;Y<Be;Y+=4)I[Y]=I[Y-ne],I[Y+1]=I[Y+1-ne],I[Y+2]=I[Y+2-ne],I[Y+3]=I[Y+3-ne];Y=Be}}V.l=Q,V.p=me,V.b=Y,Q&&(X=1,V.m=ee,V.d=te,V.n=ie)}while(!X);return Y==I.length?I:(function(Ve,Je,We){(We==null||We>Ve.length)&&(We=Ve.length);var dt=new(Ve instanceof t?t:Ve instanceof n?n:e)(We-Je);return dt.set(Ve.subarray(Je,We)),dt})(I,0,Y)},D=new e(0),L=typeof TextDecoder<"u"&&new TextDecoder;try{L.decode(D,{stream:!0})}catch{}return i.convert_streams=function(P){var I=new DataView(P),V=0;function H(){var ve=I.getUint16(V);return V+=2,ve}function z(){var ve=I.getUint32(V);return V+=4,ve}function O(ve){Ae.setUint16(Me,ve),Me+=2}function B(ve){Ae.setUint32(Me,ve),Me+=4}for(var G={signature:z(),flavor:z(),length:z(),numTables:H(),reserved:H(),totalSfntSize:z(),majorVersion:H(),minorVersion:H(),metaOffset:z(),metaLength:z(),metaOrigLength:z(),privOffset:z(),privLength:z()},X=0;Math.pow(2,X)<=G.numTables;)X++;X--;for(var k=16*Math.pow(2,X),Y=16*G.numTables-k,Q=12,te=[],ee=0;ee<G.numTables;ee++)te.push({tag:z(),offset:z(),compLength:z(),origLength:z(),origChecksum:z()}),Q+=16;var ie,re=new Uint8Array(12+16*te.length+te.reduce((function(ve,fe){return ve+fe.origLength+4}),0)),de=re.buffer,Ae=new DataView(de),Me=0;return B(G.flavor),O(G.numTables),O(k),O(X),O(Y),te.forEach((function(ve){B(ve.tag),B(ve.origChecksum),B(Q),B(ve.origLength),ve.outOffset=Q,(Q+=ve.origLength)%4!=0&&(Q+=4-Q%4)})),te.forEach((function(ve){var fe,J=P.slice(ve.offset,ve.offset+ve.compLength);if(ve.compLength!=ve.origLength){var oe=new Uint8Array(ve.origLength);fe=new Uint8Array(J,2),A(fe,oe)}else oe=new Uint8Array(J);re.set(oe,ve.outOffset);var se=0;(Q=ve.outOffset+ve.origLength)%4!=0&&(se=4-Q%4),re.set(new Uint8Array(se).buffer,ve.outOffset+ve.origLength),ie=Q+se})),de.slice(0,ie)},Object.defineProperty(i,"__esModule",{value:!0}),i})({}).convert_streams}function c8(i,e){const t={M:2,L:2,Q:4,C:6,Z:0},n={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},r=1,s=2,a=4,o=8,l=16,c=32;let h;function d(R){if(!h){const U={R:s,L:r,D:a,C:l,U:c,T:o};h=new Map;for(let A in n){let D=0;n[A].split(",").forEach(L=>{let[P,I]=L.split("+");P=parseInt(P,36),I=I?parseInt(I,36):0,h.set(D+=P,U[A]);for(let V=I;V--;)h.set(++D,U[A])})}}return h.get(R)||c}const p=1,m=2,v=3,x=4,_=[null,"isol","init","fina","medi"];function g(R){const U=new Uint8Array(R.length);let A=c,D=p,L=-1;for(let P=0;P<R.length;P++){const I=R.codePointAt(P);let V=d(I)|0,H=p;V&o||(A&(r|a|l)?V&(s|a|l)?(H=v,(D===p||D===v)&&U[L]++):V&(r|c)&&(D===m||D===x)&&U[L]--:A&(s|c)&&(D===m||D===x)&&U[L]--,D=U[P]=H,A=V,L=P,I>65535&&P++)}return U}function b(R,U){const A=[];for(let L=0;L<U.length;L++){const P=U.codePointAt(L);P>65535&&L++,A.push(i.U.codeToGlyph(R,P))}const D=R.GSUB;if(D){const{lookupList:L,featureList:P}=D;let I;const V=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,H=[];P.forEach(z=>{if(V.test(z.tag))for(let O=0;O<z.tab.length;O++){if(H[z.tab[O]])continue;H[z.tab[O]]=!0;const B=L[z.tab[O]],G=/^(isol|init|fina|medi)$/.test(z.tag);G&&!I&&(I=g(U));for(let X=0;X<A.length;X++)(!I||!G||_[I[X]]===z.tag)&&i.U._applySubs(A,X,B,L)}})}return A}function E(R,U){const A=new Int16Array(U.length*3);let D=0;for(;D<U.length;D++){const V=U[D];if(V===-1)continue;A[D*3+2]=R.hmtx.aWidth[V];const H=R.GPOS;if(H){const z=H.lookupList;for(let O=0;O<z.length;O++){const B=z[O];for(let G=0;G<B.tabs.length;G++){const X=B.tabs[G];if(B.ltype===1){if(i._lctf.coverageIndex(X.coverage,V)!==-1&&X.pos){I(X.pos,D);break}}else if(B.ltype===2){let k=null,Y=L();if(Y!==-1){const Q=i._lctf.coverageIndex(X.coverage,U[Y]);if(Q!==-1){if(X.fmt===1){const te=X.pairsets[Q];for(let ee=0;ee<te.length;ee++)te[ee].gid2===V&&(k=te[ee])}else if(X.fmt===2){const te=i.U._getGlyphClass(U[Y],X.classDef1),ee=i.U._getGlyphClass(V,X.classDef2);k=X.matrix[te][ee]}if(k){k.val1&&I(k.val1,Y),k.val2&&I(k.val2,D);break}}}}else if(B.ltype===4){const k=i._lctf.coverageIndex(X.markCoverage,V);if(k!==-1){const Y=L(P),Q=Y===-1?-1:i._lctf.coverageIndex(X.baseCoverage,U[Y]);if(Q!==-1){const te=X.markArray[k],ee=X.baseArray[Q][te.markClass];A[D*3]=ee.x-te.x+A[Y*3]-A[Y*3+2],A[D*3+1]=ee.y-te.y+A[Y*3+1];break}}}else if(B.ltype===6){const k=i._lctf.coverageIndex(X.mark1Coverage,V);if(k!==-1){const Y=L();if(Y!==-1){const Q=U[Y];if(S(R,Q)===3){const te=i._lctf.coverageIndex(X.mark2Coverage,Q);if(te!==-1){const ee=X.mark1Array[k],ie=X.mark2Array[te][ee.markClass];A[D*3]=ie.x-ee.x+A[Y*3]-A[Y*3+2],A[D*3+1]=ie.y-ee.y+A[Y*3+1];break}}}}}}}}else if(R.kern&&!R.cff){const z=L();if(z!==-1){const O=R.kern.glyph1.indexOf(U[z]);if(O!==-1){const B=R.kern.rval[O].glyph2.indexOf(V);B!==-1&&(A[z*3+2]+=R.kern.rval[O].vals[B])}}}}return A;function L(V){for(let H=D-1;H>=0;H--)if(U[H]!==-1&&(!V||V(U[H])))return H;return-1}function P(V){return S(R,V)===1}function I(V,H){for(let z=0;z<3;z++)A[H*3+z]+=V[z]||0}}function S(R,U){const A=R.GDEF&&R.GDEF.glyphClassDef;return A?i.U._getGlyphClass(U,A):0}function w(...R){for(let U=0;U<R.length;U++)if(typeof R[U]=="number")return R[U]}function T(R){const U=Object.create(null),A=R["OS/2"],D=R.hhea,L=R.head.unitsPerEm,P=w(A&&A.sTypoAscender,D&&D.ascender,L),I={unitsPerEm:L,ascender:P,descender:w(A&&A.sTypoDescender,D&&D.descender,0),capHeight:w(A&&A.sCapHeight,P),xHeight:w(A&&A.sxHeight,P),lineGap:w(A&&A.sTypoLineGap,D&&D.lineGap),supportsCodePoint(V){return i.U.codeToGlyph(R,V)>0},forEachGlyph(V,H,z,O){let B=0;const G=1/I.unitsPerEm*H,X=b(R,V);let k=0;const Y=E(R,X);return X.forEach((Q,te)=>{if(Q!==-1){let ee=U[Q];if(!ee){const{cmds:ie,crds:re}=i.U.glyphToPath(R,Q);let de="",Ae=0;for(let oe=0,se=ie.length;oe<se;oe++){const $=t[ie[oe]];de+=ie[oe];for(let pe=1;pe<=$;pe++)de+=(pe>1?",":"")+re[Ae++]}let Me,ve,fe,J;if(re.length){Me=ve=1/0,fe=J=-1/0;for(let oe=0,se=re.length;oe<se;oe+=2){let $=re[oe],pe=re[oe+1];$<Me&&(Me=$),pe<ve&&(ve=pe),$>fe&&(fe=$),pe>J&&(J=pe)}}else Me=fe=ve=J=0;ee=U[Q]={index:Q,advanceWidth:R.hmtx.aWidth[Q],xMin:Me,yMin:ve,xMax:fe,yMax:J,path:de}}O.call(null,ee,B+Y[te*3]*G,Y[te*3+1]*G,k),B+=Y[te*3+2]*G,z&&(B+=z*H)}k+=V.codePointAt(k)>65535?2:1}),B}};return I}return function(U){const A=new Uint8Array(U,0,4),D=i._bin.readASCII(A,0,4);if(D==="wOFF")U=e(U);else if(D==="wOF2")throw new Error("woff2 fonts not supported");return T(i.parse(U)[0])}}const u8=Iu({name:"Typr Font Parser",dependencies:[o8,l8,c8],init(i,e,t){const n=i(),r=e();return t(n,r)}});function h8(){return(function(i){var e=function(){this.buckets=new Map};e.prototype.add=function(E){var S=E>>5;this.buckets.set(S,(this.buckets.get(S)||0)|1<<(31&E))},e.prototype.has=function(E){var S=this.buckets.get(E>>5);return S!==void 0&&(S&1<<(31&E))!=0},e.prototype.serialize=function(){var E=[];return this.buckets.forEach((function(S,w){E.push((+w).toString(36)+":"+S.toString(36))})),E.join(",")},e.prototype.deserialize=function(E){var S=this;this.buckets.clear(),E.split(",").forEach((function(w){var T=w.split(":");S.buckets.set(parseInt(T[0],36),parseInt(T[1],36))}))};var t=Math.pow(2,8),n=t-1,r=~n;function s(E){var S=(function(T){return T&r})(E).toString(16),w=(function(T){return(T&r)+t-1})(E).toString(16);return"codepoint-index/plane"+(E>>16)+"/"+S+"-"+w+".json"}function a(E,S){var w=E&n,T=S.codePointAt(w/6|0);return((T=(T||48)-48)&1<<w%6)!=0}function o(E,S){var w;(w=E,w.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(T){return T.split("-").map((function(R){return parseInt(R.trim(),16)}))}))).forEach((function(T){var R=T[0],U=T[1];U===void 0&&(U=R),S(R,U)}))}function l(E,S){o(E,(function(w,T){for(var R=w;R<=T;R++)S(R)}))}var c={},h={},d=new WeakMap,p="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function m(E){var S=d.get(E);return S||(S=new e,l(E.ranges,(function(w){return S.add(w)})),d.set(E,S)),S}var v,x=new Map;function _(E,S,w){return E[S]?S:E[w]?w:(function(T){for(var R in T)return R})(E)}function g(E,S){var w=S;if(!E.includes(w)){w=1/0;for(var T=0;T<E.length;T++)Math.abs(E[T]-S)<Math.abs(w-S)&&(w=E[T])}return w}function b(E){return v||(v=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(S){v.add(S)}))),v.has(E)}return i.CodePointSet=e,i.clearCache=function(){c={},h={}},i.getFontsForString=function(E,S){S===void 0&&(S={});var w,T=S.lang;T===void 0&&(T=new RegExp("\\p{Script=Hangul}","u").test(w=E)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(w)?"ja":"en");var R=S.category;R===void 0&&(R="sans-serif");var U=S.style;U===void 0&&(U="normal");var A=S.weight;A===void 0&&(A=400);var D=(S.dataUrl||p).replace(/\/$/g,""),L=new Map,P=new Uint8Array(E.length),I={},V={},H=new Array(E.length),z=new Map,O=!1;function B(k){var Y=x.get(k);return Y||(Y=fetch(D+"/"+k).then((function(Q){if(!Q.ok)throw new Error(Q.statusText);return Q.json().then((function(te){if(!Array.isArray(te)||te[0]!==1)throw new Error("Incorrect schema version; need 1, got "+te[0]);return te[1]}))})).catch((function(Q){if(D!==p)return O||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+D+'", trying default CDN. '+Q.message),O=!0),D=p,x.delete(k),B(k);throw Q})),x.set(k,Y)),Y}for(var G=function(k){var Y=E.codePointAt(k),Q=s(Y);H[k]=Q,c[Q]||z.has(Q)||z.set(Q,B(Q).then((function(te){c[Q]=te}))),Y>65535&&(k++,X=k)},X=0;X<E.length;X++)G(X);return Promise.all(z.values()).then((function(){z.clear();for(var k=function(Q){var te=E.codePointAt(Q),ee=null,ie=c[H[Q]],re=void 0;for(var de in ie){var Ae=V[de];if(Ae===void 0&&(Ae=V[de]=new RegExp(de).test(T||"en")),Ae){for(var Me in re=de,ie[de])if(a(te,ie[de][Me])){ee=Me;break}break}}if(!ee){e:for(var ve in ie)if(ve!==re){for(var fe in ie[ve])if(a(te,ie[ve][fe])){ee=fe;break e}}}ee||(console.debug("No font coverage for U+"+te.toString(16)),ee="latin"),H[Q]=ee,h[ee]||z.has(ee)||z.set(ee,B("font-meta/"+ee+".json").then((function(J){h[ee]=J}))),te>65535&&(Q++,Y=Q)},Y=0;Y<E.length;Y++)k(Y);return Promise.all(z.values())})).then((function(){for(var k,Y=null,Q=0;Q<E.length;Q++){var te=E.codePointAt(Q);if(Y&&(b(te)||m(Y).has(te)))P[Q]=P[Q-1];else{Y=h[H[Q]];var ee=I[Y.id];if(!ee){var ie=Y.typeforms,re=_(ie,R,"sans-serif"),de=_(ie[re],U,"normal"),Ae=g((k=ie[re])===null||k===void 0?void 0:k[de],A);ee=I[Y.id]=D+"/font-files/"+Y.id+"/"+re+"."+de+"."+Ae+".woff"}var Me=L.get(ee);Me==null&&(Me=L.size,L.set(ee,Me)),P[Q]=Me}te>65535&&(Q++,P[Q]=P[Q-1])}return{fontUrls:Array.from(L.keys()),chars:P}}))},Object.defineProperty(i,"__esModule",{value:!0}),i})({})}function f8(i,e){const t=Object.create(null),n=Object.create(null);function r(a,o){const l=c=>{console.error(`Failure loading font ${a}`,c)};try{const c=new XMLHttpRequest;c.open("get",a,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{const h=i(c.response);h.src=a,o(h)}catch(h){l(h)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(a,o){let l=t[a];l?o(l):n[a]?n[a].push(o):(n[a]=[o],r(a,c=>{c.src=a,t[a]=c,n[a].forEach(h=>h(c)),delete n[a]}))}return function(a,o,{lang:l,fonts:c=[],style:h="normal",weight:d="normal",unicodeFontsURL:p}={}){const m=new Uint8Array(a.length),v=[];a.length||b();const x=new Map,_=[];if(h!=="italic"&&(h="normal"),typeof d!="number"&&(d=d==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(S=>!S.lang||S.lang.test(l)).reverse(),c.length){let R=0;(function U(A=0){for(let D=A,L=a.length;D<L;D++){const P=a.codePointAt(D);if(R===1&&v[m[D-1]].supportsCodePoint(P)||D>0&&/\s/.test(a[D]))m[D]=m[D-1],R===2&&(_[_.length-1][1]=D);else for(let I=m[D],V=c.length;I<=V;I++)if(I===V){const H=R===2?_[_.length-1]:_[_.length]=[D,D];H[1]=D,R=2}else{m[D]=I;const{src:H,unicodeRange:z}=c[I];if(!z||E(P,z)){const O=t[H];if(!O){s(H,()=>{U(D)});return}if(O.supportsCodePoint(P)){let B=x.get(O);typeof B!="number"&&(B=v.length,v.push(O),x.set(O,B)),m[D]=B,R=1;break}}}P>65535&&D+1<L&&(m[D+1]=m[D],D++,R===2&&(_[_.length-1][1]=D))}g()})()}else _.push([0,a.length-1]),g();function g(){if(_.length){const S=_.map(w=>a.substring(w[0],w[1]+1)).join(`
|
|
3990
3919
|
`);e.getFontsForString(S,{lang:l||void 0,style:h,weight:d,dataUrl:p}).then(({fontUrls:w,chars:T})=>{const R=v.length;let U=0;_.forEach(D=>{for(let L=0,P=D[1]-D[0];L<=P;L++)m[D[0]+L]=T[U++]+R;U++});let A=0;w.forEach((D,L)=>{s(D,P=>{v[L+R]=P,++A===w.length&&b()})})})}else b()}function b(){o({chars:m,fonts:v})}function E(S,w){for(let T=0;T<w.length;T++){const[R,U=R]=w[T];if(R<=S&&S<=U)return!0}return!1}}}const d8=Iu({name:"FontResolver",dependencies:[f8,u8,h8],init(i,e,t){return i(e,t())}});function p8(i,e){const n=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,r="[^\\S\\u00A0]",s=new RegExp(`${r}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function a({text:v,lang:x,fonts:_,style:g,weight:b,preResolvedFonts:E,unicodeFontsURL:S},w){const T=({chars:R,fonts:U})=>{let A,D;const L=[];for(let P=0;P<R.length;P++)R[P]!==D?(D=R[P],L.push(A={start:P,end:P,fontObj:U[R[P]]})):A.end=P;w(L)};E?T(E):i(v,T,{lang:x,fonts:_,style:g,weight:b,unicodeFontsURL:S})}function o({text:v="",font:x,lang:_,sdfGlyphSize:g=64,fontSize:b=400,fontWeight:E=1,fontStyle:S="normal",letterSpacing:w=0,lineHeight:T="normal",maxWidth:R=1/0,direction:U,textAlign:A="left",textIndent:D=0,whiteSpace:L="normal",overflowWrap:P="normal",anchorX:I=0,anchorY:V=0,metricsOnly:H=!1,unicodeFontsURL:z,preResolvedFonts:O=null,includeCaretPositions:B=!1,chunkedBoundsSize:G=8192,colorRanges:X=null},k){const Y=d(),Q={fontLoad:0,typesetting:0};v.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),v=v.replace(/\r\n/g,`
|
|
3991
3920
|
`).replace(/\r/g,`
|
|
3992
3921
|
`)),b=+b,w=+w,R=+R,T=T||"normal",D=+D,a({text:v,lang:_,style:S,weight:E,fonts:typeof x=="string"?[{src:x}]:x,unicodeFontsURL:z,preResolvedFonts:O},te=>{Q.fontLoad=d()-Y;const ee=isFinite(R);let ie=null,re=null,de=null,Ae=null,Me=null,ve=null,fe=null,J=null,oe=0,se=0,$=L!=="nowrap";const pe=new Map,ye=d();let xe=D,be=0,ue=new p;const He=[ue];te.forEach(_e=>{const{fontObj:me}=_e,{ascender:ze,descender:Ne,unitsPerEm:je,lineGap:Ze,capHeight:Le,xHeight:Be}=me;let Ve=pe.get(me);if(!Ve){const Ie=b/je,Ge=T==="normal"?(ze-Ne+Ze)*Ie:T*b,rt=(Ge-(ze-Ne)*Ie)/2,Pe=Math.min(Ge,(ze-Ne)*Ie),De=(ze+Ne)/2*Ie+Pe/2;Ve={index:pe.size,src:me.src,fontObj:me,fontSizeMult:Ie,unitsPerEm:je,ascender:ze*Ie,descender:Ne*Ie,capHeight:Le*Ie,xHeight:Be*Ie,lineHeight:Ge,baseline:-rt-ze*Ie,caretTop:De,caretBottom:De-Pe},pe.set(me,Ve)}const{fontSizeMult:Je}=Ve,We=v.slice(_e.start,_e.end+1);let dt,ce;me.forEachGlyph(We,b,w,(Ie,Ge,rt,Pe)=>{Ge+=be,Pe+=_e.start,dt=Ge,ce=Ie;const De=v.charAt(Pe),Qe=Ie.advanceWidth*Je,ot=ue.count;let st;if("isEmpty"in Ie||(Ie.isWhitespace=!!De&&new RegExp(r).test(De),Ie.canBreakAfter=!!De&&s.test(De),Ie.isEmpty=Ie.xMin===Ie.xMax||Ie.yMin===Ie.yMax||n.test(De)),!Ie.isWhitespace&&!Ie.isEmpty&&se++,$&&ee&&!Ie.isWhitespace&&Ge+Qe+xe>R&&ot){if(ue.glyphAt(ot-1).glyphObj.canBreakAfter)st=new p,xe=-Ge;else for(let on=ot;on--;)if(on===0&&P==="break-word"){st=new p,xe=-Ge;break}else if(ue.glyphAt(on).glyphObj.canBreakAfter){st=ue.splitAt(on+1);const en=st.glyphAt(0).x;xe-=en;for(let gn=st.count;gn--;)st.glyphAt(gn).x-=en;break}st&&(ue.isSoftWrapped=!0,ue=st,He.push(ue),oe=R)}let mt=ue.glyphAt(ue.count);mt.glyphObj=Ie,mt.x=Ge+xe,mt.y=rt,mt.width=Qe,mt.charIndex=Pe,mt.fontData=Ve,De===`
|
|
@@ -4151,11 +4080,7 @@ if (edgeAlpha == 0.0) {
|
|
|
4151
4080
|
`;function z8(i){const e=Dx(i,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new ke},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Bt(0,0,0,0)},uTroikaClipRect:{value:new Bt(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new ke},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ye},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new At},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:L8,vertexTransform:I8,fragmentDefs:N8,fragmentColorTransform:P8,customRewriter({vertexShader:t,fragmentShader:n}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(n)&&(n=n.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace($R,`uniform vec3 diffuse;
|
|
4152
4081
|
$&
|
|
4153
4082
|
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
|
|
4154
|
-
`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const ib=new Ea({color:16777215,side:zn,transparent:!0}),DT=8421504,UT=new bt,em=new j,E_=new j,Vh=[],F8=new j,M_="+x+y";function OT(i){return Array.isArray(i)?i[0]:i}let sD=()=>{const i=new mn(new Ma(1,1),ib);return sD=()=>i,i},aD=()=>{const i=new mn(new Ma(1,1,32,1),ib);return aD=()=>i,i};const B8={type:"syncstart"},k8={type:"synccomplete"},oD=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],G8=oD.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let lD=class extends mn{constructor(){const e=new O8;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=DT,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=M_,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(B8),tD({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(r=>r&&r())})),this.dispatchEvent(k8),e&&e()})))}onBeforeRender(e,t,n,r,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return z8(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=ib.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.hasOutline()){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return OT(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return OT(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:o,blockBounds:l}=r;n.uTroikaSDFTexture.value=o,n.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),n.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,n.uTroikaSDFExponent.value=r.sdfExponent,n.uTroikaTotalBounds.value.fromArray(l),n.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let c=0,h=0,d=0,p,m,v,x=0,_=0;if(t){let{outlineWidth:b,outlineOffsetX:E,outlineOffsetY:S,outlineBlur:w,outlineOpacity:T}=this;c=this._parsePercent(b)||0,h=Math.max(0,this._parsePercent(w)||0),p=T,x=this._parsePercent(E)||0,_=this._parsePercent(S)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(v=this.strokeColor,n.uTroikaStrokeColor.value.set(v??DT),m=this.strokeOpacity,m==null&&(m=1)),p=this.fillOpacity;n.uTroikaEdgeOffset.value=c,n.uTroikaPositionOffset.value.set(x,_),n.uTroikaBlurRadius.value=h,n.uTroikaStrokeWidth.value=d,n.uTroikaStrokeOpacity.value=m,n.uTroikaFillOpacity.value=p??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let g=this.clipRect;if(g&&Array.isArray(g)&&g.length===4)n.uTroikaClipRect.value.fromArray(g);else{const b=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(l[0]-b,l[1]-b,l[2]+b,l[3]+b)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const o=e.hasOwnProperty("color")?e.color:e.color=new Ye;(s!==o._input||typeof s=="object")&&o.set(o._input=s)}let a=this.orientation||M_;if(a!==e._orientation){let o=n.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==M_&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,h,d,p]=l;em.set(0,0,0)[h]=c==="-"?1:-1,E_.set(0,0,0)[p]=d==="-"?-1:1,UT.lookAt(F8,em.cross(E_),E_),o.setFromMatrix4(UT)}else o.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new ke){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new ke){return em.copy(e),this.localPositionToTextCoords(this.worldToLocal(em),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:r}=this;if(n){const s=n.blockBounds,a=r?aD():sD(),o=a.geometry,{position:l,uv:c}=o.attributes;for(let h=0;h<c.count;h++){let d=s[0]+c.getX(h)*(s[2]-s[0]);const p=s[1]+c.getY(h)*(s[3]-s[1]);let m=0;r&&(m=r-Math.cos(d/r)*r,d=Math.sin(d/r)*r),l.setXYZ(h,d,p,m)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,Vh.length=0,a.raycast(e,Vh);for(let h=0;h<Vh.length;h++)Vh[h].object=this,t.push(Vh[h])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,G8.forEach(n=>{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};oD.forEach(i=>{const e="_private_"+i;Object.defineProperty(lD.prototype,i,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new Qn;new Ye;const H8=K.forwardRef(({sdfGlyphSize:i=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:r=1,children:s,characters:a,onSync:o,...l},c)=>{const h=Jn(({invalidate:v})=>v),[d]=K.useState(()=>new lD),[p,m]=K.useMemo(()=>{const v=[];let x="";return K.Children.forEach(s,_=>{typeof _=="string"||typeof _=="number"?x+=_:v.push(_)}),[v,x]},[s]);return N4(()=>new Promise(v=>w8({font:n,characters:a},v)),["troika-text",n,a]),K.useLayoutEffect(()=>void d.sync(()=>{h(),o&&o(d)})),K.useEffect(()=>()=>d.dispose(),[d]),K.createElement("primitive",Ul({object:d,ref:c,font:n,text:m,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:i},l),p)}),bs=1e-5;function V8(i,e,t){const n=new oo,r=t-bs;return n.absarc(bs,bs,bs,-Math.PI/2,-Math.PI,!0),n.absarc(bs,e-r*2,bs,Math.PI,Math.PI/2,!0),n.absarc(i-r*2,e-r*2,bs,Math.PI/2,0,!0),n.absarc(i-r*2,bs,bs,0,-Math.PI/2,!0),n}const LT=K.forwardRef(function({args:[e=1,t=1,n=1]=[],radius:r=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,children:c,...h},d){return K.createElement("mesh",Ul({ref:d},h),K.createElement(W8,{args:[e,t,n],radius:r,steps:s,smoothness:a,bevelSegments:o,creaseAngle:l}),c)}),W8=K.forwardRef(function({args:[e=1,t=1,n=1]=[],radius:r=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,...c},h){const d=K.useMemo(()=>V8(e,t,r),[e,t,r]),p=K.useMemo(()=>({depth:n-r*2,bevelEnabled:!0,bevelSegments:o*2,steps:s,bevelSize:r-bs,bevelThickness:r,curveSegments:a}),[n,r,a,o,s]),m=K.useRef(null);return K.useLayoutEffect(()=>{m.current&&(m.current.center(),qk(m.current,l))},[d,p,l]),K.useImperativeHandle(h,()=>m.current),K.createElement("extrudeGeometry",Ul({ref:m,args:[d,p]},c))});var Wh={exports:{}},IT;function X8(){if(IT)return Wh.exports;IT=1;const i={ellipse:"…",chars:[" ","-"],max:140,truncate:!0};function e(n,r,s,a){if(n.length<=r)return n;if(r<2)return n.slice(0,r-s.length)+s;const o=r-s.length,l=Math.floor(o/2);let c=l,h=n.length-l;for(let d=0;d<l;d++){const p=n.charAt(d),m=n.length-d,v=n.charAt(m);a.indexOf(p)!==-1&&(c=d),a.indexOf(v)!==-1&&(h=m)}return n.slice(0,c)+s+n.slice(h)}function t(n,r,s,a,o){if(n.length<=r)return n;const l=r-s.length;let c=l,h=!1;for(let d=0;d<=l;d++){const p=n.charAt(d);a.indexOf(p)!==-1&&(c=d,h=!0)}return!o&&!h?"":n.slice(0,c)+s}return Wh.exports=(n,r,s)=>{if(typeof n!="string"||n.length===0||r===0)return"";s=s||{};for(var a in i)(s[a]===null||typeof s[a]>"u")&&(s[a]=i[a]);return s.max=r||s.max,s.truncate==="middle"?e(n,s.max,s.ellipse,s.chars):t(n,s.max,s.ellipse,s.chars,s.truncate)},Wh.exports.ellipsizeMiddle=e,Wh.exports.ellipsize=t,Wh.exports}var j8=X8();const q8=po(j8);var w_,NT;function Y8(){if(NT)return w_;NT=1;var i=z1(),e=Ta(),t={dimensions:["x","y"],center:.5,scale:1};function n(s,a,o){if(!e(a))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");o=i(o,t);var l=o.dimensions;if(!Array.isArray(l)||l.length!==2)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=o.center,h=o.scale,d=Math.PI*2,p=(c-.5)*h,m=a.order,v=l[0],x=l[1];function _(E,S){return S[v]=h*Math.cos(E*d/m)+p,S[x]=h*Math.sin(E*d/m)+p,S}var g=0;if(!s){var b={};return a.forEachNode(function(E){b[E]=_(g++,{})}),b}a.updateEachNodeAttributes(function(E,S){return _(g++,S),S},{attributes:l})}var r=n.bind(null,!1);return r.assign=n.bind(null,!0),w_=r,w_}var Z8=Y8();const K8=po(Z8);var T_,PT;function J8(){if(PT)return T_;PT=1;var i=z1(),e=Ta(),t={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(s,a,o){if(!e(a))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");o=i(o,t);var l=o.dimensions;if(!Array.isArray(l)||l.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=l.length,h=o.center,d=o.rng,p=o.scale,m=(h-.5)*p;function v(_){for(var g=0;g<c;g++)_[l[g]]=d()*p+m;return _}if(!s){var x={};return a.forEachNode(function(_){x[_]=v({})}),x}a.updateEachNodeAttributes(function(_,g){return v(g),g},{attributes:l})}var r=n.bind(null,!1);return r.assign=n.bind(null,!0),T_=r,T_}var Q8=J8();const $8=po(Q8);var A_,zT;function e7(){if(zT)return A_;zT=1;var i=0,e=1,t=2,n=3,r=4,s=5,a=6,o=7,l=8,c=9,h=0,d=1,p=2,m=0,v=1,x=2,_=3,g=4,b=5,E=6,S=7,w=8,T=3,R=10,U=3,A=9,D=10;return A_=function(P,I,V){var H,z,O,B,G,X,k,Y,Q,te,ee=I.length,ie=V.length,re=P.adjustSizes,de=P.barnesHutTheta*P.barnesHutTheta,Ae,Me,ve,fe,J,oe,se,$=[];for(O=0;O<ee;O+=R)I[O+r]=I[O+t],I[O+s]=I[O+n],I[O+t]=0,I[O+n]=0;if(P.outboundAttractionDistribution){for(Ae=0,O=0;O<ee;O+=R)Ae+=I[O+a];Ae/=ee/R}if(P.barnesHutOptimize){var pe=1/0,ye=-1/0,xe=1/0,be=-1/0,ue,He,W;for(O=0;O<ee;O+=R)pe=Math.min(pe,I[O+i]),ye=Math.max(ye,I[O+i]),xe=Math.min(xe,I[O+e]),be=Math.max(be,I[O+e]);var F=ye-pe,ne=be-xe;for(F>ne?(xe-=(F-ne)/2,be=xe+F):(pe-=(ne-F)/2,ye=pe+ne),$[0+m]=-1,$[0+v]=(pe+ye)/2,$[0+x]=(xe+be)/2,$[0+_]=Math.max(ye-pe,be-xe),$[0+g]=-1,$[0+b]=-1,$[0+E]=0,$[0+S]=0,$[0+w]=0,H=1,O=0;O<ee;O+=R)for(z=0,W=T;;)if($[z+b]>=0){I[O+i]<$[z+v]?I[O+e]<$[z+x]?ue=$[z+b]:ue=$[z+b]+A:I[O+e]<$[z+x]?ue=$[z+b]+A*2:ue=$[z+b]+A*3,$[z+S]=($[z+S]*$[z+E]+I[O+i]*I[O+a])/($[z+E]+I[O+a]),$[z+w]=($[z+w]*$[z+E]+I[O+e]*I[O+a])/($[z+E]+I[O+a]),$[z+E]+=I[O+a],z=ue;continue}else if($[z+m]<0){$[z+m]=O;break}else{if($[z+b]=H*A,Y=$[z+_]/2,Q=$[z+b],$[Q+m]=-1,$[Q+v]=$[z+v]-Y,$[Q+x]=$[z+x]-Y,$[Q+_]=Y,$[Q+g]=Q+A,$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,Q+=A,$[Q+m]=-1,$[Q+v]=$[z+v]-Y,$[Q+x]=$[z+x]+Y,$[Q+_]=Y,$[Q+g]=Q+A,$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,Q+=A,$[Q+m]=-1,$[Q+v]=$[z+v]+Y,$[Q+x]=$[z+x]-Y,$[Q+_]=Y,$[Q+g]=Q+A,$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,Q+=A,$[Q+m]=-1,$[Q+v]=$[z+v]+Y,$[Q+x]=$[z+x]+Y,$[Q+_]=Y,$[Q+g]=$[z+g],$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,H+=4,I[$[z+m]+i]<$[z+v]?I[$[z+m]+e]<$[z+x]?ue=$[z+b]:ue=$[z+b]+A:I[$[z+m]+e]<$[z+x]?ue=$[z+b]+A*2:ue=$[z+b]+A*3,$[z+E]=I[$[z+m]+a],$[z+S]=I[$[z+m]+i],$[z+w]=I[$[z+m]+e],$[ue+m]=$[z+m],$[z+m]=-1,I[O+i]<$[z+v]?I[O+e]<$[z+x]?He=$[z+b]:He=$[z+b]+A:I[O+e]<$[z+x]?He=$[z+b]+A*2:He=$[z+b]+A*3,ue===He)if(W--){z=ue;continue}else{W=T;break}$[He+m]=O;break}}if(P.barnesHutOptimize)for(Me=P.scalingRatio,O=0;O<ee;O+=R)for(z=0;;)if($[z+b]>=0)if(oe=Math.pow(I[O+i]-$[z+S],2)+Math.pow(I[O+e]-$[z+w],2),te=$[z+_],4*te*te/oe<de){if(ve=I[O+i]-$[z+S],fe=I[O+e]-$[z+w],re===!0?oe>0?(se=Me*I[O+a]*$[z+E]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se):oe<0&&(se=-Me*I[O+a]*$[z+E]/Math.sqrt(oe),I[O+t]+=ve*se,I[O+n]+=fe*se):oe>0&&(se=Me*I[O+a]*$[z+E]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se),z=$[z+g],z<0)break;continue}else{z=$[z+b];continue}else{if(X=$[z+m],X>=0&&X!==O&&(ve=I[O+i]-I[X+i],fe=I[O+e]-I[X+e],oe=ve*ve+fe*fe,re===!0?oe>0?(se=Me*I[O+a]*I[X+a]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se):oe<0&&(se=-Me*I[O+a]*I[X+a]/Math.sqrt(oe),I[O+t]+=ve*se,I[O+n]+=fe*se):oe>0&&(se=Me*I[O+a]*I[X+a]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se)),z=$[z+g],z<0)break;continue}else for(Me=P.scalingRatio,B=0;B<ee;B+=R)for(G=0;G<B;G+=R)ve=I[B+i]-I[G+i],fe=I[B+e]-I[G+e],re===!0?(oe=Math.sqrt(ve*ve+fe*fe)-I[B+l]-I[G+l],oe>0?(se=Me*I[B+a]*I[G+a]/oe/oe,I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se):oe<0&&(se=100*Me*I[B+a]*I[G+a],I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se)):(oe=Math.sqrt(ve*ve+fe*fe),oe>0&&(se=Me*I[B+a]*I[G+a]/oe/oe,I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se));for(Q=P.gravity/P.scalingRatio,Me=P.scalingRatio,O=0;O<ee;O+=R)se=0,ve=I[O+i],fe=I[O+e],oe=Math.sqrt(Math.pow(ve,2)+Math.pow(fe,2)),P.strongGravityMode?oe>0&&(se=Me*I[O+a]*Q):oe>0&&(se=Me*I[O+a]*Q/oe),I[O+t]-=ve*se,I[O+n]-=fe*se;for(Me=1*(P.outboundAttractionDistribution?Ae:1),k=0;k<ie;k+=U)B=V[k+h],G=V[k+d],Y=V[k+p],J=Math.pow(Y,P.edgeWeightInfluence),ve=I[B+i]-I[G+i],fe=I[B+e]-I[G+e],re===!0?(oe=Math.sqrt(ve*ve+fe*fe)-I[B+l]-I[G+l],P.linLogMode?P.outboundAttractionDistribution?oe>0&&(se=-Me*J*Math.log(1+oe)/oe/I[B+a]):oe>0&&(se=-Me*J*Math.log(1+oe)/oe):P.outboundAttractionDistribution?oe>0&&(se=-Me*J/I[B+a]):oe>0&&(se=-Me*J)):(oe=Math.sqrt(Math.pow(ve,2)+Math.pow(fe,2)),P.linLogMode?P.outboundAttractionDistribution?oe>0&&(se=-Me*J*Math.log(1+oe)/oe/I[B+a]):oe>0&&(se=-Me*J*Math.log(1+oe)/oe):P.outboundAttractionDistribution?(oe=1,se=-Me*J/I[B+a]):(oe=1,se=-Me*J)),oe>0&&(I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se);var Se,_e,me,ze,Ne,je;if(re===!0)for(O=0;O<ee;O+=R)I[O+c]!==1&&(Se=Math.sqrt(Math.pow(I[O+t],2)+Math.pow(I[O+n],2)),Se>D&&(I[O+t]=I[O+t]*D/Se,I[O+n]=I[O+n]*D/Se),_e=I[O+a]*Math.sqrt((I[O+r]-I[O+t])*(I[O+r]-I[O+t])+(I[O+s]-I[O+n])*(I[O+s]-I[O+n])),me=Math.sqrt((I[O+r]+I[O+t])*(I[O+r]+I[O+t])+(I[O+s]+I[O+n])*(I[O+s]+I[O+n]))/2,ze=.1*Math.log(1+me)/(1+Math.sqrt(_e)),Ne=I[O+i]+I[O+t]*(ze/P.slowDown),I[O+i]=Ne,je=I[O+e]+I[O+n]*(ze/P.slowDown),I[O+e]=je);else for(O=0;O<ee;O+=R)I[O+c]!==1&&(_e=I[O+a]*Math.sqrt((I[O+r]-I[O+t])*(I[O+r]-I[O+t])+(I[O+s]-I[O+n])*(I[O+s]-I[O+n])),me=Math.sqrt((I[O+r]+I[O+t])*(I[O+r]+I[O+t])+(I[O+s]+I[O+n])*(I[O+s]+I[O+n]))/2,ze=I[O+o]*Math.log(1+me)/(1+Math.sqrt(_e)),I[O+o]=Math.min(1,Math.sqrt(ze*(Math.pow(I[O+t],2)+Math.pow(I[O+n],2))/(1+Math.sqrt(_e)))),Ne=I[O+i]+I[O+t]*(ze/P.slowDown),I[O+i]=Ne,je=I[O+e]+I[O+n]*(ze/P.slowDown),I[O+e]=je);return{}},A_}var la={},FT;function t7(){if(FT)return la;FT=1;var i=10,e=3;return la.assign=function(t){t=t||{};var n=Array.prototype.slice.call(arguments).slice(1),r,s,a;for(r=0,a=n.length;r<a;r++)if(n[r])for(s in n[r])t[s]=n[r][s];return t},la.validateSettings=function(t){return"linLogMode"in t&&typeof t.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&typeof t.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&typeof t.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&typeof t.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in t&&!(typeof t.scalingRatio=="number"&&t.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},la.graphToByteArrays=function(t,n){var r=t.order,s=t.size,a={},o,l=new Float32Array(r*i),c=new Float32Array(s*e);return o=0,t.forEachNode(function(h,d){a[h]=o,l[o]=d.x,l[o+1]=d.y,l[o+2]=0,l[o+3]=0,l[o+4]=0,l[o+5]=0,l[o+6]=1,l[o+7]=1,l[o+8]=d.size||1,l[o+9]=d.fixed?1:0,o+=i}),o=0,t.forEachEdge(function(h,d,p,m,v,x,_){var g=a[p],b=a[m],E=n(h,d,p,m,v,x,_);l[g+6]+=E,l[b+6]+=E,c[o]=g,c[o+1]=b,c[o+2]=E,o+=e}),{nodes:l,edges:c}},la.assignLayoutChanges=function(t,n,r){var s=0;t.updateEachNodeAttributes(function(a,o){return o.x=n[s],o.y=n[s+1],s+=i,r?r(a,o):o})},la.readGraphPositions=function(t,n){var r=0;t.forEachNode(function(s,a){n[r]=a.x,n[r+1]=a.y,r+=i})},la.collectLayoutChanges=function(t,n,r){for(var s=t.nodes(),a={},o=0,l=0,c=n.length;o<c;o+=i){if(r){var h=Object.assign({},t.getNodeAttributes(s[l]));h.x=n[o],h.y=n[o+1],h=r(s[l],h),a[s[l]]={x:h.x,y:h.y}}else a[s[l]]={x:n[o],y:n[o+1]};l++}return a},la.createWorker=function(n){var r=window.URL||window.webkitURL,s=n.toString(),a=r.createObjectURL(new Blob(["("+s+").call(this);"],{type:"text/javascript"})),o=new Worker(a);return r.revokeObjectURL(a),o},la}var C_,BT;function n7(){return BT||(BT=1,C_={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),C_}var R_,kT;function i7(){if(kT)return R_;kT=1;var i=Ta(),e=d0().createEdgeWeightGetter,t=e7(),n=t7(),r=n7();function s(l,c,h){if(!i(c))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof h=="number"&&(h={iterations:h});var d=h.iterations;if(typeof d!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(d<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var p=e("getEdgeWeight"in h?h.getEdgeWeight:"weight").fromEntry,m=typeof h.outputReducer=="function"?h.outputReducer:null,v=n.assign({},r,h.settings),x=n.validateSettings(v);if(x)throw new Error("graphology-layout-forceatlas2: "+x.message);var _=n.graphToByteArrays(c,p),g;for(g=0;g<d;g++)t(v,_.nodes,_.edges);if(l){n.assignLayoutChanges(c,_.nodes,m);return}return n.collectLayoutChanges(c,_.nodes)}function a(l){var c=typeof l=="number"?l:l.order;return{barnesHutOptimize:c>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(c)}}var o=s.bind(null,!1);return o.assign=s.bind(null,!0),o.inferSettings=a,R_=o,R_}var r7=i7();const s7=po(r7);function a7(i,e,t){var n,r=1;i==null&&(i=0),e==null&&(e=0),t==null&&(t=0);function s(){var a,o=n.length,l,c=0,h=0,d=0;for(a=0;a<o;++a)l=n[a],c+=l.x||0,h+=l.y||0,d+=l.z||0;for(c=(c/o-i)*r,h=(h/o-e)*r,d=(d/o-t)*r,a=0;a<o;++a)l=n[a],c&&(l.x-=c),h&&(l.y-=h),d&&(l.z-=d)}return s.initialize=function(a){n=a},s.x=function(a){return arguments.length?(i=+a,s):i},s.y=function(a){return arguments.length?(e=+a,s):e},s.z=function(a){return arguments.length?(t=+a,s):t},s.strength=function(a){return arguments.length?(r=+a,s):r},s}function o7(i){const e=+this._x.call(null,i);return cD(this.cover(e),e,i)}function cD(i,e,t){if(isNaN(e))return i;var n,r=i._root,s={data:t},a=i._x0,o=i._x1,l,c,h,d,p;if(!r)return i._root=s,i;for(;r.length;)if((h=e>=(l=(a+o)/2))?a=l:o=l,n=r,!(r=r[d=+h]))return n[d]=s,i;if(c=+i._x.call(null,r.data),e===c)return s.next=r,n?n[d]=s:i._root=s,i;do n=n?n[d]=new Array(2):i._root=new Array(2),(h=e>=(l=(a+o)/2))?a=l:o=l;while((d=+h)==(p=+(c>=l)));return n[p]=r,n[d]=s,i}function l7(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e);let n=1/0,r=-1/0;for(let s=0,a;s<e;++s)isNaN(a=+this._x.call(null,i[s]))||(t[s]=a,a<n&&(n=a),a>r&&(r=a));if(n>r)return this;this.cover(n).cover(r);for(let s=0;s<e;++s)cD(this,t[s],i[s]);return this}function c7(i){if(isNaN(i=+i))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(i))+1;else{for(var n=t-e||1,r=this._root,s,a;e>i||i>=t;)switch(a=+(i<e),s=new Array(2),s[a]=r,r=s,n*=2,a){case 0:t=e+n;break;case 1:e=t-n;break}this._root&&this._root.length&&(this._root=r)}return this._x0=e,this._x1=t,this}function u7(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function h7(i){return arguments.length?this.cover(+i[0][0]).cover(+i[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function va(i,e,t){this.node=i,this.x0=e,this.x1=t}function f7(i,e){var t,n=this._x0,r,s,a=this._x1,o=[],l=this._root,c,h;for(l&&o.push(new va(l,n,a)),e==null?e=1/0:(n=i-e,a=i+e);c=o.pop();)if(!(!(l=c.node)||(r=c.x0)>a||(s=c.x1)<n))if(l.length){var d=(r+s)/2;o.push(new va(l[1],d,s),new va(l[0],r,d)),(h=+(i>=d))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-h],o[o.length-1-h]=c)}else{var p=Math.abs(i-+this._x.call(null,l.data));p<e&&(e=p,n=i-p,a=i+p,t=l.data)}return t}function d7(i){if(isNaN(l=+this._x.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,o=this._x1,l,c,h,d,p;if(!t)return this;if(t.length)for(;;){if((h=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[d=+h]))return this;if(!t.length)break;e[d+1&1]&&(n=e,p=d)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[d]=s:delete e[d],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(n?n[p]=t:this._root=t),this):(this._root=s,this)}function p7(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function m7(){return this._root}function g7(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function v7(i){var e=[],t,n=this._root,r,s,a;for(n&&e.push(new va(n,this._x0,this._x1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.x1)&&n.length){var o=(s+a)/2;(r=n[1])&&e.push(new va(r,o,a)),(r=n[0])&&e.push(new va(r,s,o))}return this}function y7(i){var e=[],t=[],n;for(this._root&&e.push(new va(this._root,this._x0,this._x1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,o=n.x1,l=(a+o)/2;(s=r[0])&&e.push(new va(s,a,l)),(s=r[1])&&e.push(new va(s,l,o))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.x1);return this}function _7(i){return i[0]}function x7(i){return arguments.length?(this._x=i,this):this._x}function rb(i,e){var t=new sb(e??_7,NaN,NaN);return i==null?t:t.addAll(i)}function sb(i,e,t){this._x=i,this._x0=e,this._x1=t,this._root=void 0}function GT(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var ir=rb.prototype=sb.prototype;ir.copy=function(){var i=new sb(this._x,this._x0,this._x1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=GT(e),i;for(t=[{source:e,target:i._root=new Array(2)}];e=t.pop();)for(var r=0;r<2;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(2)}):e.target[r]=GT(n));return i};ir.add=o7;ir.addAll=l7;ir.cover=c7;ir.data=u7;ir.extent=h7;ir.find=f7;ir.remove=d7;ir.removeAll=p7;ir.root=m7;ir.size=g7;ir.visit=v7;ir.visitAfter=y7;ir.x=x7;function b7(i){const e=+this._x.call(null,i),t=+this._y.call(null,i);return uD(this.cover(e,t),e,t,i)}function uD(i,e,t,n){if(isNaN(e)||isNaN(t))return i;var r,s=i._root,a={data:n},o=i._x0,l=i._y0,c=i._x1,h=i._y1,d,p,m,v,x,_,g,b;if(!s)return i._root=a,i;for(;s.length;)if((x=e>=(d=(o+c)/2))?o=d:c=d,(_=t>=(p=(l+h)/2))?l=p:h=p,r=s,!(s=s[g=_<<1|x]))return r[g]=a,i;if(m=+i._x.call(null,s.data),v=+i._y.call(null,s.data),e===m&&t===v)return a.next=s,r?r[g]=a:i._root=a,i;do r=r?r[g]=new Array(4):i._root=new Array(4),(x=e>=(d=(o+c)/2))?o=d:c=d,(_=t>=(p=(l+h)/2))?l=p:h=p;while((g=_<<1|x)===(b=(v>=p)<<1|m>=d));return r[b]=s,r[g]=a,i}function S7(i){var e,t,n=i.length,r,s,a=new Array(n),o=new Array(n),l=1/0,c=1/0,h=-1/0,d=-1/0;for(t=0;t<n;++t)isNaN(r=+this._x.call(null,e=i[t]))||isNaN(s=+this._y.call(null,e))||(a[t]=r,o[t]=s,r<l&&(l=r),r>h&&(h=r),s<c&&(c=s),s>d&&(d=s));if(l>h||c>d)return this;for(this.cover(l,c).cover(h,d),t=0;t<n;++t)uD(this,a[t],o[t],i[t]);return this}function E7(i,e){if(isNaN(i=+i)||isNaN(e=+e))return this;var t=this._x0,n=this._y0,r=this._x1,s=this._y1;if(isNaN(t))r=(t=Math.floor(i))+1,s=(n=Math.floor(e))+1;else{for(var a=r-t||1,o=this._root,l,c;t>i||i>=r||n>e||e>=s;)switch(c=(e<n)<<1|i<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:r=t+a,s=n+a;break;case 1:t=r-a,s=n+a;break;case 2:r=t+a,n=s-a;break;case 3:t=r-a,n=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=n,this._x1=r,this._y1=s,this}function M7(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function w7(i){return arguments.length?this.cover(+i[0][0],+i[0][1]).cover(+i[1][0],+i[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function zi(i,e,t,n,r){this.node=i,this.x0=e,this.y0=t,this.x1=n,this.y1=r}function T7(i,e,t){var n,r=this._x0,s=this._y0,a,o,l,c,h=this._x1,d=this._y1,p=[],m=this._root,v,x;for(m&&p.push(new zi(m,r,s,h,d)),t==null?t=1/0:(r=i-t,s=e-t,h=i+t,d=e+t,t*=t);v=p.pop();)if(!(!(m=v.node)||(a=v.x0)>h||(o=v.y0)>d||(l=v.x1)<r||(c=v.y1)<s))if(m.length){var _=(a+l)/2,g=(o+c)/2;p.push(new zi(m[3],_,g,l,c),new zi(m[2],a,g,_,c),new zi(m[1],_,o,l,g),new zi(m[0],a,o,_,g)),(x=(e>=g)<<1|i>=_)&&(v=p[p.length-1],p[p.length-1]=p[p.length-1-x],p[p.length-1-x]=v)}else{var b=i-+this._x.call(null,m.data),E=e-+this._y.call(null,m.data),S=b*b+E*E;if(S<t){var w=Math.sqrt(t=S);r=i-w,s=e-w,h=i+w,d=e+w,n=m.data}}return n}function A7(i){if(isNaN(h=+this._x.call(null,i))||isNaN(d=+this._y.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,o=this._y0,l=this._x1,c=this._y1,h,d,p,m,v,x,_,g;if(!t)return this;if(t.length)for(;;){if((v=h>=(p=(a+l)/2))?a=p:l=p,(x=d>=(m=(o+c)/2))?o=m:c=m,e=t,!(t=t[_=x<<1|v]))return this;if(!t.length)break;(e[_+1&3]||e[_+2&3]||e[_+3&3])&&(n=e,g=_)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[_]=s:delete e[_],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[g]=t:this._root=t),this):(this._root=s,this)}function C7(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function R7(){return this._root}function D7(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function U7(i){var e=[],t,n=this._root,r,s,a,o,l;for(n&&e.push(new zi(n,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.y0,o=t.x1,l=t.y1)&&n.length){var c=(s+o)/2,h=(a+l)/2;(r=n[3])&&e.push(new zi(r,c,h,o,l)),(r=n[2])&&e.push(new zi(r,s,h,c,l)),(r=n[1])&&e.push(new zi(r,c,a,o,h)),(r=n[0])&&e.push(new zi(r,s,a,c,h))}return this}function O7(i){var e=[],t=[],n;for(this._root&&e.push(new zi(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,o=n.y0,l=n.x1,c=n.y1,h=(a+l)/2,d=(o+c)/2;(s=r[0])&&e.push(new zi(s,a,o,h,d)),(s=r[1])&&e.push(new zi(s,h,o,l,d)),(s=r[2])&&e.push(new zi(s,a,d,h,c)),(s=r[3])&&e.push(new zi(s,h,d,l,c))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.x1,n.y1);return this}function L7(i){return i[0]}function I7(i){return arguments.length?(this._x=i,this):this._x}function N7(i){return i[1]}function P7(i){return arguments.length?(this._y=i,this):this._y}function ab(i,e,t){var n=new ob(e??L7,t??N7,NaN,NaN,NaN,NaN);return i==null?n:n.addAll(i)}function ob(i,e,t,n,r,s){this._x=i,this._y=e,this._x0=t,this._y0=n,this._x1=r,this._y1=s,this._root=void 0}function HT(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var Gi=ab.prototype=ob.prototype;Gi.copy=function(){var i=new ob(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=HT(e),i;for(t=[{source:e,target:i._root=new Array(4)}];e=t.pop();)for(var r=0;r<4;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(4)}):e.target[r]=HT(n));return i};Gi.add=b7;Gi.addAll=S7;Gi.cover=E7;Gi.data=M7;Gi.extent=w7;Gi.find=T7;Gi.remove=A7;Gi.removeAll=C7;Gi.root=R7;Gi.size=D7;Gi.visit=U7;Gi.visitAfter=O7;Gi.x=I7;Gi.y=P7;function z7(i){const e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return hD(this.cover(e,t,n),e,t,n,i)}function hD(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,a=i._root,o={data:r},l=i._x0,c=i._y0,h=i._z0,d=i._x1,p=i._y1,m=i._z1,v,x,_,g,b,E,S,w,T,R,U;if(!a)return i._root=o,i;for(;a.length;)if((S=e>=(v=(l+d)/2))?l=v:d=v,(w=t>=(x=(c+p)/2))?c=x:p=x,(T=n>=(_=(h+m)/2))?h=_:m=_,s=a,!(a=a[R=T<<2|w<<1|S]))return s[R]=o,i;if(g=+i._x.call(null,a.data),b=+i._y.call(null,a.data),E=+i._z.call(null,a.data),e===g&&t===b&&n===E)return o.next=a,s?s[R]=o:i._root=o,i;do s=s?s[R]=new Array(8):i._root=new Array(8),(S=e>=(v=(l+d)/2))?l=v:d=v,(w=t>=(x=(c+p)/2))?c=x:p=x,(T=n>=(_=(h+m)/2))?h=_:m=_;while((R=T<<2|w<<1|S)===(U=(E>=_)<<2|(b>=x)<<1|g>=v));return s[U]=a,s[R]=o,i}function F7(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=0,p,m,v,x;d<e;++d)isNaN(m=+this._x.call(null,p=i[d]))||isNaN(v=+this._y.call(null,p))||isNaN(x=+this._z.call(null,p))||(t[d]=m,n[d]=v,r[d]=x,m<s&&(s=m),m>l&&(l=m),v<a&&(a=v),v>c&&(c=v),x<o&&(o=x),x>h&&(h=x));if(s>l||a>c||o>h)return this;this.cover(s,a,o).cover(l,c,h);for(let d=0;d<e;++d)hD(this,t[d],n[d],r[d],i[d]);return this}function B7(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(n))a=(n=Math.floor(i))+1,o=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=a-n||1,h=this._root,d,p;n>i||i>=a||r>e||e>=o||s>t||t>=l;)switch(p=(t<s)<<2|(e<r)<<1|i<n,d=new Array(8),d[p]=h,h=d,c*=2,p){case 0:a=n+c,o=r+c,l=s+c;break;case 1:n=a-c,o=r+c,l=s+c;break;case 2:a=n+c,r=o-c,l=s+c;break;case 3:n=a-c,r=o-c,l=s+c;break;case 4:a=n+c,o=r+c,s=l-c;break;case 5:n=a-c,o=r+c,s=l-c;break;case 6:a=n+c,r=o-c,s=l-c;break;case 7:n=a-c,r=o-c,s=l-c;break}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this}function k7(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function G7(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function hn(i,e,t,n,r,s,a){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=a}function H7(i,e,t,n){var r,s=this._x0,a=this._y0,o=this._z0,l,c,h,d,p,m,v=this._x1,x=this._y1,_=this._z1,g=[],b=this._root,E,S;for(b&&g.push(new hn(b,s,a,o,v,x,_)),n==null?n=1/0:(s=i-n,a=e-n,o=t-n,v=i+n,x=e+n,_=t+n,n*=n);E=g.pop();)if(!(!(b=E.node)||(l=E.x0)>v||(c=E.y0)>x||(h=E.z0)>_||(d=E.x1)<s||(p=E.y1)<a||(m=E.z1)<o))if(b.length){var w=(l+d)/2,T=(c+p)/2,R=(h+m)/2;g.push(new hn(b[7],w,T,R,d,p,m),new hn(b[6],l,T,R,w,p,m),new hn(b[5],w,c,R,d,T,m),new hn(b[4],l,c,R,w,T,m),new hn(b[3],w,T,h,d,p,R),new hn(b[2],l,T,h,w,p,R),new hn(b[1],w,c,h,d,T,R),new hn(b[0],l,c,h,w,T,R)),(S=(t>=R)<<2|(e>=T)<<1|i>=w)&&(E=g[g.length-1],g[g.length-1]=g[g.length-1-S],g[g.length-1-S]=E)}else{var U=i-+this._x.call(null,b.data),A=e-+this._y.call(null,b.data),D=t-+this._z.call(null,b.data),L=U*U+A*A+D*D;if(L<n){var P=Math.sqrt(n=L);s=i-P,a=e-P,o=t-P,v=i+P,x=e+P,_=t+P,r=b.data}}return r}const V7=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function W7(i,e,t,n){const r=[],s=i-n,a=e-n,o=t-n,l=i+n,c=e+n,h=t+n;return this.visit((d,p,m,v,x,_,g)=>{if(!d.length)do{const b=d.data;V7(i,e,t,this._x(b),this._y(b),this._z(b))<=n&&r.push(b)}while(d=d.next);return p>l||m>c||v>h||x<s||_<a||g<o}),r}function X7(i){if(isNaN(p=+this._x.call(null,i))||isNaN(m=+this._y.call(null,i))||isNaN(v=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,o=this._y0,l=this._z0,c=this._x1,h=this._y1,d=this._z1,p,m,v,x,_,g,b,E,S,w,T;if(!t)return this;if(t.length)for(;;){if((b=p>=(x=(a+c)/2))?a=x:c=x,(E=m>=(_=(o+h)/2))?o=_:h=_,(S=v>=(g=(l+d)/2))?l=g:d=g,e=t,!(t=t[w=S<<2|E<<1|b]))return this;if(!t.length)break;(e[w+1&7]||e[w+2&7]||e[w+3&7]||e[w+4&7]||e[w+5&7]||e[w+6&7]||e[w+7&7])&&(n=e,T=w)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[w]=s:delete e[w],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[T]=t:this._root=t),this):(this._root=s,this)}function j7(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function q7(){return this._root}function Y7(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function Z7(i){var e=[],t,n=this._root,r,s,a,o,l,c,h;for(n&&e.push(new hn(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,h=t.z1)&&n.length){var d=(s+l)/2,p=(a+c)/2,m=(o+h)/2;(r=n[7])&&e.push(new hn(r,d,p,m,l,c,h)),(r=n[6])&&e.push(new hn(r,s,p,m,d,c,h)),(r=n[5])&&e.push(new hn(r,d,a,m,l,p,h)),(r=n[4])&&e.push(new hn(r,s,a,m,d,p,h)),(r=n[3])&&e.push(new hn(r,d,p,o,l,c,m)),(r=n[2])&&e.push(new hn(r,s,p,o,d,c,m)),(r=n[1])&&e.push(new hn(r,d,a,o,l,p,m)),(r=n[0])&&e.push(new hn(r,s,a,o,d,p,m))}return this}function K7(i){var e=[],t=[],n;for(this._root&&e.push(new hn(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,o=n.y0,l=n.z0,c=n.x1,h=n.y1,d=n.z1,p=(a+c)/2,m=(o+h)/2,v=(l+d)/2;(s=r[0])&&e.push(new hn(s,a,o,l,p,m,v)),(s=r[1])&&e.push(new hn(s,p,o,l,c,m,v)),(s=r[2])&&e.push(new hn(s,a,m,l,p,h,v)),(s=r[3])&&e.push(new hn(s,p,m,l,c,h,v)),(s=r[4])&&e.push(new hn(s,a,o,v,p,m,d)),(s=r[5])&&e.push(new hn(s,p,o,v,c,m,d)),(s=r[6])&&e.push(new hn(s,a,m,v,p,h,d)),(s=r[7])&&e.push(new hn(s,p,m,v,c,h,d))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function J7(i){return i[0]}function Q7(i){return arguments.length?(this._x=i,this):this._x}function $7(i){return i[1]}function e9(i){return arguments.length?(this._y=i,this):this._y}function t9(i){return i[2]}function n9(i){return arguments.length?(this._z=i,this):this._z}function lb(i,e,t,n){var r=new cb(e??J7,t??$7,n??t9,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function cb(i,e,t,n,r,s,a,o,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function VT(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var _i=lb.prototype=cb.prototype;_i.copy=function(){var i=new cb(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=VT(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=VT(n));return i};_i.add=z7;_i.addAll=F7;_i.cover=B7;_i.data=k7;_i.extent=G7;_i.find=H7;_i.findAllWithinRadius=W7;_i.remove=X7;_i.removeAll=j7;_i.root=q7;_i.size=Y7;_i.visit=Z7;_i.visitAfter=K7;_i.x=Q7;_i.y=e9;_i.z=n9;function Rn(i){return function(){return i}}function Pr(i){return(i()-.5)*1e-6}function D_(i){return i.x+i.vx}function WT(i){return i.y+i.vy}function i9(i){return i.z+i.vz}function fD(i){var e,t,n,r,s=1,a=1;typeof i!="function"&&(i=Rn(i==null?1:+i));function o(){for(var h,d=e.length,p,m,v,x,_,g,b,E=0;E<a;++E)for(p=(t===1?rb(e,D_):t===2?ab(e,D_,WT):t===3?lb(e,D_,WT,i9):null).visitAfter(l),h=0;h<d;++h)m=e[h],g=n[m.index],b=g*g,v=m.x+m.vx,t>1&&(x=m.y+m.vy),t>2&&(_=m.z+m.vz),p.visit(S);function S(w,T,R,U,A,D,L){var P=[T,R,U,A,D,L],I=P[0],V=P[1],H=P[2],z=P[t],O=P[t+1],B=P[t+2],G=w.data,X=w.r,k=g+X;if(G){if(G.index>m.index){var Y=v-G.x-G.vx,Q=t>1?x-G.y-G.vy:0,te=t>2?_-G.z-G.vz:0,ee=Y*Y+Q*Q+te*te;ee<k*k&&(Y===0&&(Y=Pr(r),ee+=Y*Y),t>1&&Q===0&&(Q=Pr(r),ee+=Q*Q),t>2&&te===0&&(te=Pr(r),ee+=te*te),ee=(k-(ee=Math.sqrt(ee)))/ee*s,m.vx+=(Y*=ee)*(k=(X*=X)/(b+X)),t>1&&(m.vy+=(Q*=ee)*k),t>2&&(m.vz+=(te*=ee)*k),G.vx-=Y*(k=1-k),t>1&&(G.vy-=Q*k),t>2&&(G.vz-=te*k))}return}return I>v+k||z<v-k||t>1&&(V>x+k||O<x-k)||t>2&&(H>_+k||B<_-k)}}function l(h){if(h.data)return h.r=n[h.data.index];for(var d=h.r=0;d<Math.pow(2,t);++d)h[d]&&h[d].r>h.r&&(h.r=h[d].r)}function c(){if(e){var h,d=e.length,p;for(n=new Array(d),h=0;h<d;++h)p=e[h],n[p.index]=+i(p,h,e)}}return o.initialize=function(h,...d){e=h,r=d.find(p=>typeof p=="function")||Math.random,t=d.find(p=>[1,2,3].includes(p))||2,c()},o.iterations=function(h){return arguments.length?(a=+h,o):a},o.strength=function(h){return arguments.length?(s=+h,o):s},o.radius=function(h){return arguments.length?(i=typeof h=="function"?h:Rn(+h),c(),o):i},o}function r9(i){return i.index}function XT(i,e){var t=i.get(e);if(!t)throw new Error("node not found: "+e);return t}function dD(i){var e=r9,t=p,n,r=Rn(30),s,a,o,l,c,h,d=1;i==null&&(i=[]);function p(g){return 1/Math.min(l[g.source.index],l[g.target.index])}function m(g){for(var b=0,E=i.length;b<d;++b)for(var S=0,w,T,R,U=0,A=0,D=0,L,P;S<E;++S)w=i[S],T=w.source,R=w.target,U=R.x+R.vx-T.x-T.vx||Pr(h),o>1&&(A=R.y+R.vy-T.y-T.vy||Pr(h)),o>2&&(D=R.z+R.vz-T.z-T.vz||Pr(h)),L=Math.sqrt(U*U+A*A+D*D),L=(L-s[S])/L*g*n[S],U*=L,A*=L,D*=L,R.vx-=U*(P=c[S]),o>1&&(R.vy-=A*P),o>2&&(R.vz-=D*P),T.vx+=U*(P=1-P),o>1&&(T.vy+=A*P),o>2&&(T.vz+=D*P)}function v(){if(a){var g,b=a.length,E=i.length,S=new Map(a.map((T,R)=>[e(T,R,a),T])),w;for(g=0,l=new Array(b);g<E;++g)w=i[g],w.index=g,typeof w.source!="object"&&(w.source=XT(S,w.source)),typeof w.target!="object"&&(w.target=XT(S,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(g=0,c=new Array(E);g<E;++g)w=i[g],c[g]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);n=new Array(E),x(),s=new Array(E),_()}}function x(){if(a)for(var g=0,b=i.length;g<b;++g)n[g]=+t(i[g],g,i)}function _(){if(a)for(var g=0,b=i.length;g<b;++g)s[g]=+r(i[g],g,i)}return m.initialize=function(g,...b){a=g,h=b.find(E=>typeof E=="function")||Math.random,o=b.find(E=>[1,2,3].includes(E))||2,v()},m.links=function(g){return arguments.length?(i=g,v(),m):i},m.id=function(g){return arguments.length?(e=g,m):e},m.iterations=function(g){return arguments.length?(d=+g,m):d},m.strength=function(g){return arguments.length?(t=typeof g=="function"?g:Rn(+g),x(),m):t},m.distance=function(g){return arguments.length?(r=typeof g=="function"?g:Rn(+g),_(),m):r},m}var s9={value:()=>{}};function pD(){for(var i=0,e=arguments.length,t={},n;i<e;++i){if(!(n=arguments[i]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new pm(t)}function pm(i){this._=i}function a9(i,e){return i.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}pm.prototype=pD.prototype={constructor:pm,on:function(i,e){var t=this._,n=a9(i+"",t),r,s=-1,a=n.length;if(arguments.length<2){for(;++s<a;)if((r=(i=n[s]).type)&&(r=o9(t[r],i.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(i=n[s]).type)t[r]=jT(t[r],i.name,e);else if(e==null)for(r in t)t[r]=jT(t[r],i.name,null);return this},copy:function(){var i={},e=this._;for(var t in e)i[t]=e[t].slice();return new pm(i)},call:function(i,e){if((r=arguments.length-2)>0)for(var t=new Array(r),n=0,r,s;n<r;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(i))throw new Error("unknown type: "+i);for(s=this._[i],n=0,r=s.length;n<r;++n)s[n].value.apply(e,t)},apply:function(i,e,t){if(!this._.hasOwnProperty(i))throw new Error("unknown type: "+i);for(var n=this._[i],r=0,s=n.length;r<s;++r)n[r].value.apply(e,t)}};function o9(i,e){for(var t=0,n=i.length,r;t<n;++t)if((r=i[t]).name===e)return r.value}function jT(i,e,t){for(var n=0,r=i.length;n<r;++n)if(i[n].name===e){i[n]=s9,i=i.slice(0,n).concat(i.slice(n+1));break}return t!=null&&i.push({name:e,value:t}),i}var bu=0,ef=0,Xh=0,mD=1e3,Eg,tf,Mg=0,Ol=0,E0=0,qf=typeof performance=="object"&&performance.now?performance:Date,gD=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(i){setTimeout(i,17)};function vD(){return Ol||(gD(l9),Ol=qf.now()+E0)}function l9(){Ol=0}function Ox(){this._call=this._time=this._next=null}Ox.prototype=yD.prototype={constructor:Ox,restart:function(i,e,t){if(typeof i!="function")throw new TypeError("callback is not a function");t=(t==null?vD():+t)+(e==null?0:+e),!this._next&&tf!==this&&(tf?tf._next=this:Eg=this,tf=this),this._call=i,this._time=t,Lx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lx())}};function yD(i,e,t){var n=new Ox;return n.restart(i,e,t),n}function c9(){vD(),++bu;for(var i=Eg,e;i;)(e=Ol-i._time)>=0&&i._call.call(void 0,e),i=i._next;--bu}function qT(){Ol=(Mg=qf.now())+E0,bu=ef=0;try{c9()}finally{bu=0,h9(),Ol=0}}function u9(){var i=qf.now(),e=i-Mg;e>mD&&(E0-=e,Mg=i)}function h9(){for(var i,e=Eg,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),i=e,e=e._next):(t=e._next,e._next=null,e=i?i._next=t:Eg=t);tf=i,Lx(n)}function Lx(i){if(!bu){ef&&(ef=clearTimeout(ef));var e=i-Ol;e>24?(i<1/0&&(ef=setTimeout(qT,i-qf.now()-E0)),Xh&&(Xh=clearInterval(Xh))):(Xh||(Mg=qf.now(),Xh=setInterval(u9,mD)),bu=1,gD(qT))}}const f9=1664525,d9=1013904223,YT=4294967296;function p9(){let i=1;return()=>(i=(f9*i+d9)%YT)/YT}var ZT=3;function U_(i){return i.x}function KT(i){return i.y}function m9(i){return i.z}var g9=10,v9=Math.PI*(3-Math.sqrt(5)),y9=Math.PI*20/(9+Math.sqrt(221));function _D(i,e){e=e||2;var t=Math.min(ZT,Math.max(1,Math.round(e))),n,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,l=.6,c=new Map,h=yD(m),d=pD("tick","end"),p=p9();i==null&&(i=[]);function m(){v(),d.call("tick",n),r<s&&(h.stop(),d.call("end",n))}function v(g){var b,E=i.length,S;g===void 0&&(g=1);for(var w=0;w<g;++w)for(r+=(o-r)*a,c.forEach(function(T){T(r)}),b=0;b<E;++b)S=i[b],S.fx==null?S.x+=S.vx*=l:(S.x=S.fx,S.vx=0),t>1&&(S.fy==null?S.y+=S.vy*=l:(S.y=S.fy,S.vy=0)),t>2&&(S.fz==null?S.z+=S.vz*=l:(S.z=S.fz,S.vz=0));return n}function x(){for(var g=0,b=i.length,E;g<b;++g){if(E=i[g],E.index=g,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),E.fz!=null&&(E.z=E.fz),isNaN(E.x)||t>1&&isNaN(E.y)||t>2&&isNaN(E.z)){var S=g9*(t>2?Math.cbrt(.5+g):t>1?Math.sqrt(.5+g):g),w=g*v9,T=g*y9;t===1?E.x=S:t===2?(E.x=S*Math.cos(w),E.y=S*Math.sin(w)):(E.x=S*Math.sin(w)*Math.cos(T),E.y=S*Math.cos(w),E.z=S*Math.sin(w)*Math.sin(T))}(isNaN(E.vx)||t>1&&isNaN(E.vy)||t>2&&isNaN(E.vz))&&(E.vx=0,t>1&&(E.vy=0),t>2&&(E.vz=0))}}function _(g){return g.initialize&&g.initialize(i,p,t),g}return x(),n={tick:v,restart:function(){return h.restart(m),n},stop:function(){return h.stop(),n},numDimensions:function(g){return arguments.length?(t=Math.min(ZT,Math.max(1,Math.round(g))),c.forEach(_),n):t},nodes:function(g){return arguments.length?(i=g,x(),c.forEach(_),n):i},alpha:function(g){return arguments.length?(r=+g,n):r},alphaMin:function(g){return arguments.length?(s=+g,n):s},alphaDecay:function(g){return arguments.length?(a=+g,n):+a},alphaTarget:function(g){return arguments.length?(o=+g,n):o},velocityDecay:function(g){return arguments.length?(l=1-g,n):1-l},randomSource:function(g){return arguments.length?(p=g,c.forEach(_),n):p},force:function(g,b){return arguments.length>1?(b==null?c.delete(g):c.set(g,_(b)),n):c.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),b=g.shift()||0,E=(t>1?g.shift():null)||0,S=(t>2?g.shift():null)||0,w=g.shift()||1/0,T=0,R=i.length,U,A,D,L,P,I;for(w*=w,T=0;T<R;++T)P=i[T],U=b-P.x,A=E-(P.y||0),D=S-(P.z||0),L=U*U+A*A+D*D,L<w&&(I=P,w=L);return I},on:function(g,b){return arguments.length>1?(d.on(g,b),n):d.on(g)}}}function xD(){var i,e,t,n,r,s=Rn(-30),a,o=1,l=1/0,c=.81;function h(v){var x,_=i.length,g=(e===1?rb(i,U_):e===2?ab(i,U_,KT):e===3?lb(i,U_,KT,m9):null).visitAfter(p);for(r=v,x=0;x<_;++x)t=i[x],g.visit(m)}function d(){if(i){var v,x=i.length,_;for(a=new Array(x),v=0;v<x;++v)_=i[v],a[_.index]=+s(_,v,i)}}function p(v){var x=0,_,g,b=0,E,S,w,T,R=v.length;if(R){for(E=S=w=T=0;T<R;++T)(_=v[T])&&(g=Math.abs(_.value))&&(x+=_.value,b+=g,E+=g*(_.x||0),S+=g*(_.y||0),w+=g*(_.z||0));x*=Math.sqrt(4/R),v.x=E/b,e>1&&(v.y=S/b),e>2&&(v.z=w/b)}else{_=v,_.x=_.data.x,e>1&&(_.y=_.data.y),e>2&&(_.z=_.data.z);do x+=a[_.data.index];while(_=_.next)}v.value=x}function m(v,x,_,g,b){if(!v.value)return!0;var E=[_,g,b][e-1],S=v.x-t.x,w=e>1?v.y-t.y:0,T=e>2?v.z-t.z:0,R=E-x,U=S*S+w*w+T*T;if(R*R/c<U)return U<l&&(S===0&&(S=Pr(n),U+=S*S),e>1&&w===0&&(w=Pr(n),U+=w*w),e>2&&T===0&&(T=Pr(n),U+=T*T),U<o&&(U=Math.sqrt(o*U)),t.vx+=S*v.value*r/U,e>1&&(t.vy+=w*v.value*r/U),e>2&&(t.vz+=T*v.value*r/U)),!0;if(v.length||U>=l)return;(v.data!==t||v.next)&&(S===0&&(S=Pr(n),U+=S*S),e>1&&w===0&&(w=Pr(n),U+=w*w),e>2&&T===0&&(T=Pr(n),U+=T*T),U<o&&(U=Math.sqrt(o*U)));do v.data!==t&&(R=a[v.data.index]*r/U,t.vx+=S*R,e>1&&(t.vy+=w*R),e>2&&(t.vz+=T*R));while(v=v.next)}return h.initialize=function(v,...x){i=v,n=x.find(_=>typeof _=="function")||Math.random,e=x.find(_=>[1,2,3].includes(_))||2,d()},h.strength=function(v){return arguments.length?(s=typeof v=="function"?v:Rn(+v),d(),h):s},h.distanceMin=function(v){return arguments.length?(o=v*v,h):Math.sqrt(o)},h.distanceMax=function(v){return arguments.length?(l=v*v,h):Math.sqrt(l)},h.theta=function(v){return arguments.length?(c=v*v,h):Math.sqrt(c)},h}function _9(i,e,t,n){var r,s,a=Rn(.1),o,l;typeof i!="function"&&(i=Rn(+i)),e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function c(d){for(var p=0,m=r.length;p<m;++p){var v=r[p],x=v.x-e||1e-6,_=(v.y||0)-t||1e-6,g=(v.z||0)-n||1e-6,b=Math.sqrt(x*x+_*_+g*g),E=(l[p]-b)*o[p]*d/b;v.vx+=x*E,s>1&&(v.vy+=_*E),s>2&&(v.vz+=g*E)}}function h(){if(r){var d,p=r.length;for(o=new Array(p),l=new Array(p),d=0;d<p;++d)l[d]=+i(r[d],d,r),o[d]=isNaN(l[d])?0:+a(r[d],d,r)}}return c.initialize=function(d,...p){r=d,s=p.find(m=>[1,2,3].includes(m))||2,h()},c.strength=function(d){return arguments.length?(a=typeof d=="function"?d:Rn(+d),h(),c):a},c.radius=function(d){return arguments.length?(i=typeof d=="function"?d:Rn(+d),h(),c):i},c.x=function(d){return arguments.length?(e=+d,c):e},c.y=function(d){return arguments.length?(t=+d,c):t},c.z=function(d){return arguments.length?(n=+d,c):n},c}function Ix(i){var e=Rn(.1),t,n,r;typeof i!="function"&&(i=Rn(i==null?0:+i));function s(o){for(var l=0,c=t.length,h;l<c;++l)h=t[l],h.vx+=(r[l]-h.x)*n[l]*o}function a(){if(t){var o,l=t.length;for(n=new Array(l),r=new Array(l),o=0;o<l;++o)n[o]=isNaN(r[o]=+i(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Rn(+o),a(),s):e},s.x=function(o){return arguments.length?(i=typeof o=="function"?o:Rn(+o),a(),s):i},s}function Nx(i){var e=Rn(.1),t,n,r;typeof i!="function"&&(i=Rn(i==null?0:+i));function s(o){for(var l=0,c=t.length,h;l<c;++l)h=t[l],h.vy+=(r[l]-h.y)*n[l]*o}function a(){if(t){var o,l=t.length;for(n=new Array(l),r=new Array(l),o=0;o<l;++o)n[o]=isNaN(r[o]=+i(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Rn(+o),a(),s):e},s.y=function(o){return arguments.length?(i=typeof o=="function"?o:Rn(+o),a(),s):i},s}function x9(i){var e=Rn(.1),t,n,r;typeof i!="function"&&(i=Rn(i==null?0:+i));function s(o){for(var l=0,c=t.length,h;l<c;++l)h=t[l],h.vz+=(r[l]-h.z)*n[l]*o}function a(){if(t){var o,l=t.length;for(n=new Array(l),r=new Array(l),o=0;o<l;++o)n[o]=isNaN(r[o]=+i(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Rn(+o),a(),s):e},s.z=function(o){return arguments.length?(i=typeof o=="function"?o:Rn(+o),a(),s):i},s}function b9(i){var e=0,t=i.children,n=t&&t.length;if(!n)e=1;else for(;--n>=0;)e+=t[n].value;i.value=e}function S9(){return this.eachAfter(b9)}function E9(i,e){let t=-1;for(const n of this)i.call(e,n,++t,this);return this}function M9(i,e){for(var t=this,n=[t],r,s,a=-1;t=n.pop();)if(i.call(e,t,++a,this),r=t.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function w9(i,e){for(var t=this,n=[t],r=[],s,a,o,l=-1;t=n.pop();)if(r.push(t),s=t.children)for(a=0,o=s.length;a<o;++a)n.push(s[a]);for(;t=r.pop();)i.call(e,t,++l,this);return this}function T9(i,e){let t=-1;for(const n of this)if(i.call(e,n,++t,this))return n}function A9(i){return this.eachAfter(function(e){for(var t=+i(e.data)||0,n=e.children,r=n&&n.length;--r>=0;)t+=n[r].value;e.value=t})}function C9(i){return this.eachBefore(function(e){e.children&&e.children.sort(i)})}function R9(i){for(var e=this,t=D9(e,i),n=[e];e!==t;)e=e.parent,n.push(e);for(var r=n.length;i!==t;)n.splice(r,0,i),i=i.parent;return n}function D9(i,e){if(i===e)return i;var t=i.ancestors(),n=e.ancestors(),r=null;for(i=t.pop(),e=n.pop();i===e;)r=i,i=t.pop(),e=n.pop();return r}function U9(){for(var i=this,e=[i];i=i.parent;)e.push(i);return e}function O9(){return Array.from(this)}function L9(){var i=[];return this.eachBefore(function(e){e.children||i.push(e)}),i}function I9(){var i=this,e=[];return i.each(function(t){t!==i&&e.push({source:t.parent,target:t})}),e}function*N9(){var i=this,e,t=[i],n,r,s;do for(e=t.reverse(),t=[];i=e.pop();)if(yield i,n=i.children)for(r=0,s=n.length;r<s;++r)t.push(n[r]);while(t.length)}function M0(i,e){i instanceof Map?(i=[void 0,i],e===void 0&&(e=F9)):e===void 0&&(e=z9);for(var t=new Su(i),n,r=[t],s,a,o,l;n=r.pop();)if((a=e(n.data))&&(l=(a=Array.from(a)).length))for(n.children=a,o=l-1;o>=0;--o)r.push(s=a[o]=new Su(a[o])),s.parent=n,s.depth=n.depth+1;return t.eachBefore(bD)}function P9(){return M0(this).eachBefore(B9)}function z9(i){return i.children}function F9(i){return Array.isArray(i)?i[1]:null}function B9(i){i.data.value!==void 0&&(i.value=i.data.value),i.data=i.data.data}function bD(i){var e=0;do i.height=e;while((i=i.parent)&&i.height<++e)}function Su(i){this.data=i,this.depth=this.height=0,this.parent=null}Su.prototype=M0.prototype={constructor:Su,count:S9,each:E9,eachAfter:w9,eachBefore:M9,find:T9,sum:A9,sort:C9,path:R9,ancestors:U9,descendants:O9,leaves:L9,links:I9,copy:P9,[Symbol.iterator]:N9};function O_(i){return i==null?null:SD(i)}function SD(i){if(typeof i!="function")throw new Error;return i}function jh(){return 0}function qh(i){return function(){return i}}function k9(i){i.x0=Math.round(i.x0),i.y0=Math.round(i.y0),i.x1=Math.round(i.x1),i.y1=Math.round(i.y1)}function G9(i,e,t,n,r){for(var s=i.children,a,o=-1,l=s.length,c=i.value&&(n-e)/i.value;++o<l;)a=s[o],a.y0=t,a.y1=r,a.x0=e,a.x1=e+=a.value*c}var H9={depth:-1},JT={},L_={};function V9(i){return i.id}function W9(i){return i.parentId}function X9(){var i=V9,e=W9,t;function n(r){var s=Array.from(r),a=i,o=e,l,c,h,d,p,m,v,x,_=new Map;if(t!=null){const g=s.map((S,w)=>j9(t(S,w,r))),b=g.map(QT),E=new Set(g).add("");for(const S of b)E.has(S)||(E.add(S),g.push(S),b.push(QT(S)),s.push(L_));a=(S,w)=>g[w],o=(S,w)=>b[w]}for(h=0,l=s.length;h<l;++h)c=s[h],m=s[h]=new Su(c),(v=a(c,h,r))!=null&&(v+="")&&(x=m.id=v,_.set(x,_.has(x)?JT:m)),(v=o(c,h,r))!=null&&(v+="")&&(m.parent=v);for(h=0;h<l;++h)if(m=s[h],v=m.parent){if(p=_.get(v),!p)throw new Error("missing: "+v);if(p===JT)throw new Error("ambiguous: "+v);p.children?p.children.push(m):p.children=[m],m.parent=p}else{if(d)throw new Error("multiple roots");d=m}if(!d)throw new Error("no root");if(t!=null){for(;d.data===L_&&d.children.length===1;)d=d.children[0],--l;for(let g=s.length-1;g>=0&&(m=s[g],m.data===L_);--g)m.data=null}if(d.parent=H9,d.eachBefore(function(g){g.depth=g.parent.depth+1,--l}).eachBefore(bD),d.parent=null,l>0)throw new Error("cycle");return d}return n.id=function(r){return arguments.length?(i=O_(r),n):i},n.parentId=function(r){return arguments.length?(e=O_(r),n):e},n.path=function(r){return arguments.length?(t=O_(r),n):t},n}function j9(i){i=`${i}`;let e=i.length;return Px(i,e-1)&&!Px(i,e-2)&&(i=i.slice(0,-1)),i[0]==="/"?i:`/${i}`}function QT(i){let e=i.length;if(e<2)return"";for(;--e>1&&!Px(i,e););return i.slice(0,e)}function Px(i,e){if(i[e]==="/"){let t=0;for(;e>0&&i[--e]==="\\";)++t;if((t&1)===0)return!0}return!1}function q9(i,e){return i.parent===e.parent?1:2}function I_(i){var e=i.children;return e?e[0]:i.t}function N_(i){var e=i.children;return e?e[e.length-1]:i.t}function Y9(i,e,t){var n=t/(e.i-i.i);e.c-=n,e.s+=t,i.c+=n,e.z+=t,e.m+=t}function Z9(i){for(var e=0,t=0,n=i.children,r=n.length,s;--r>=0;)s=n[r],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function K9(i,e,t){return i.a.parent===e.parent?i.a:t}function mm(i,e){this._=i,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=e}mm.prototype=Object.create(Su.prototype);function J9(i){for(var e=new mm(i,0),t,n=[e],r,s,a,o;t=n.pop();)if(s=t._.children)for(t.children=new Array(o=s.length),a=o-1;a>=0;--a)n.push(r=t.children[a]=new mm(s[a],a)),r.parent=t;return(e.parent=new mm(null,0)).children=[e],e}function Q9(){var i=q9,e=1,t=1,n=null;function r(c){var h=J9(c);if(h.eachAfter(s),h.parent.m=-h.z,h.eachBefore(a),n)c.eachBefore(l);else{var d=c,p=c,m=c;c.eachBefore(function(b){b.x<d.x&&(d=b),b.x>p.x&&(p=b),b.depth>m.depth&&(m=b)});var v=d===p?1:i(d,p)/2,x=v-d.x,_=e/(p.x+v+x),g=t/(m.depth||1);c.eachBefore(function(b){b.x=(b.x+x)*_,b.y=b.depth*g})}return c}function s(c){var h=c.children,d=c.parent.children,p=c.i?d[c.i-1]:null;if(h){Z9(c);var m=(h[0].z+h[h.length-1].z)/2;p?(c.z=p.z+i(c._,p._),c.m=c.z-m):c.z=m}else p&&(c.z=p.z+i(c._,p._));c.parent.A=o(c,p,c.parent.A||d[0])}function a(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function o(c,h,d){if(h){for(var p=c,m=c,v=h,x=p.parent.children[0],_=p.m,g=m.m,b=v.m,E=x.m,S;v=N_(v),p=I_(p),v&&p;)x=I_(x),m=N_(m),m.a=c,S=v.z+b-p.z-_+i(v._,p._),S>0&&(Y9(K9(v,c,d),c,S),_+=S,g+=S),b+=v.m,_+=p.m,E+=x.m,g+=m.m;v&&!N_(m)&&(m.t=v,m.m+=b-g),p&&!I_(x)&&(x.t=p,x.m+=_-E,d=c)}return d}function l(c){c.x*=e,c.y=c.depth*t}return r.separation=function(c){return arguments.length?(i=c,r):i},r.size=function(c){return arguments.length?(n=!1,e=+c[0],t=+c[1],r):n?null:[e,t]},r.nodeSize=function(c){return arguments.length?(n=!0,e=+c[0],t=+c[1],r):n?[e,t]:null},r}function $9(i,e,t,n,r){for(var s=i.children,a,o=-1,l=s.length,c=i.value&&(r-t)/i.value;++o<l;)a=s[o],a.x0=e,a.x1=n,a.y0=t,a.y1=t+=a.value*c}var eW=(1+Math.sqrt(5))/2;function tW(i,e,t,n,r,s){for(var a=[],o=e.children,l,c,h=0,d=0,p=o.length,m,v,x=e.value,_,g,b,E,S,w,T;h<p;){m=r-t,v=s-n;do _=o[d++].value;while(!_&&d<p);for(g=b=_,w=Math.max(v/m,m/v)/(x*i),T=_*_*w,S=Math.max(b/T,T/g);d<p;++d){if(_+=c=o[d].value,c<g&&(g=c),c>b&&(b=c),T=_*_*w,E=Math.max(b/T,T/g),E>S){_-=c;break}S=E}a.push(l={value:_,dice:m<v,children:o.slice(h,d)}),l.dice?G9(l,t,n,r,x?n+=v*_/x:s):$9(l,t,n,x?t+=m*_/x:r,s),x-=_,h=d}return a}const nW=(function i(e){function t(n,r,s,a,o){tW(e,n,r,s,a,o)}return t.ratio=function(n){return i((n=+n)>1?n:1)},t})(eW);function iW(){var i=nW,e=!1,t=1,n=1,r=[0],s=jh,a=jh,o=jh,l=jh,c=jh;function h(p){return p.x0=p.y0=0,p.x1=t,p.y1=n,p.eachBefore(d),r=[0],e&&p.eachBefore(k9),p}function d(p){var m=r[p.depth],v=p.x0+m,x=p.y0+m,_=p.x1-m,g=p.y1-m;_<v&&(v=_=(v+_)/2),g<x&&(x=g=(x+g)/2),p.x0=v,p.y0=x,p.x1=_,p.y1=g,p.children&&(m=r[p.depth+1]=s(p)/2,v+=c(p)-m,x+=a(p)-m,_-=o(p)-m,g-=l(p)-m,_<v&&(v=_=(v+_)/2),g<x&&(x=g=(x+g)/2),i(p,v,x,_,g))}return h.round=function(p){return arguments.length?(e=!!p,h):e},h.size=function(p){return arguments.length?(t=+p[0],n=+p[1],h):[t,n]},h.tile=function(p){return arguments.length?(i=SD(p),h):i},h.padding=function(p){return arguments.length?h.paddingInner(p).paddingOuter(p):h.paddingInner()},h.paddingInner=function(p){return arguments.length?(s=typeof p=="function"?p:qh(+p),h):s},h.paddingOuter=function(p){return arguments.length?h.paddingTop(p).paddingRight(p).paddingBottom(p).paddingLeft(p):h.paddingTop()},h.paddingTop=function(p){return arguments.length?(a=typeof p=="function"?p:qh(+p),h):a},h.paddingRight=function(p){return arguments.length?(o=typeof p=="function"?p:qh(+p),h):o},h.paddingBottom=function(p){return arguments.length?(l=typeof p=="function"?p:qh(+p),h):l},h.paddingLeft=function(p){return arguments.length?(c=typeof p=="function"?p:qh(+p),h):c},h}var P_,$T;function rW(){if($T)return P_;$T=1;var i=0,e=1,t=2,n=3;function r(a,o){return a+"§"+o}function s(){return .01*(.5-Math.random())}return P_=function(o,l){var c=o.margin,h=o.ratio,d=o.expansion,p=o.gridSize,m=o.speed,v,x,_,g,b,E,S=!0,w=l.length,T=w/n|0,R=new Float32Array(T),U=new Float32Array(T),A=1/0,D=1/0,L=-1/0,P=-1/0;for(v=0;v<w;v+=n)_=l[v+i],g=l[v+e],E=l[v+t]*h+c,A=Math.min(A,_-E),L=Math.max(L,_+E),D=Math.min(D,g-E),P=Math.max(P,g+E);var I=L-A,V=P-D,H=(A+L)/2,z=(D+P)/2;A=H-d*I/2,L=H+d*I/2,D=z-d*V/2,P=z+d*V/2;var O=new Array(p*p),B=O.length,G;for(G=0;G<B;G++)O[G]=[];var X,k,Y,Q,te,ee,ie,re,de,Ae;for(v=0;v<w;v+=n)for(_=l[v+i],g=l[v+e],E=l[v+t]*h+c,X=_-E,k=_+E,Y=g-E,Q=g+E,te=Math.floor(p*(X-A)/(L-A)),ee=Math.floor(p*(k-A)/(L-A)),ie=Math.floor(p*(Y-D)/(P-D)),re=Math.floor(p*(Q-D)/(P-D)),de=te;de<=ee;de++)for(Ae=ie;Ae<=re;Ae++)O[de*p+Ae].push(v);var Me,ve=new Set,fe,J,oe,se,$,pe,ye,xe,be,ue,He,W,F;for(G=0;G<B;G++)for(Me=O[G],v=0,b=Me.length;v<b;v++)for(fe=Me[v],oe=l[fe+i],$=l[fe+e],ye=l[fe+t],x=v+1;x<b;x++)J=Me[x],be=r(fe,J),!(B>1&&ve.has(be))&&(B>1&&ve.add(be),se=l[J+i],pe=l[J+e],xe=l[J+t],ue=se-oe,He=pe-$,W=Math.sqrt(ue*ue+He*He),F=W<ye*h+c+(xe*h+c),F&&(S=!1,J=J/n|0,W>0?(R[J]+=ue/W*(1+ye),U[J]+=He/W*(1+ye)):(R[J]+=I*s(),U[J]+=V*s())));for(v=0,x=0;v<w;v+=n,x++)l[v+i]+=R[x]*.1*m,l[v+e]+=U[x]*.1*m;return{converged:S}},P_}var ul={},eA;function sW(){if(eA)return ul;eA=1;var i=3;return ul.validateSettings=function(e){return"gridSize"in e&&typeof e.gridSize!="number"||e.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in e&&typeof e.margin!="number"||e.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in e&&typeof e.expansion!="number"||e.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in e&&typeof e.ratio!="number"||e.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in e&&typeof e.speed!="number"||e.speed<=0?{message:"the `speed` setting should be a positive number."}:null},ul.graphToByteArray=function(e,t){var n=e.order,r=new Float32Array(n*i),s=0;return e.forEachNode(function(a,o){typeof t=="function"&&(o=t(a,o)),r[s]=o.x,r[s+1]=o.y,r[s+2]=o.size||1,s+=i}),r},ul.assignLayoutChanges=function(e,t,n){var r=0;e.forEachNode(function(s){var a={x:t[r],y:t[r+1]};typeof n=="function"&&(a=n(s,a)),e.mergeNodeAttributes(s,a),r+=i})},ul.collectLayoutChanges=function(e,t,n){var r={},s=0;return e.forEachNode(function(a){var o={x:t[s],y:t[s+1]};typeof n=="function"&&(o=n(a,o)),r[a]=o,s+=i}),r},ul.createWorker=function(t){var n=window.URL||window.webkitURL,r=t.toString(),s=n.createObjectURL(new Blob(["("+r+").call(this);"],{type:"text/javascript"})),a=new Worker(s);return n.revokeObjectURL(s),a},ul}var z_,tA;function aW(){return tA||(tA=1,z_={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}),z_}var F_,nA;function oW(){if(nA)return F_;nA=1;var i=Ta(),e=rW(),t=sW(),n=aW(),r=500;function s(o,l,c){if(!i(l))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");typeof c=="number"?c={maxIterations:c}:c=c||{};var h=c.maxIterations||r;if(typeof h!="number"||h<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var d=Object.assign({},n,c.settings),p=t.validateSettings(d);if(p)throw new Error("graphology-layout-noverlap: "+p.message);var m=t.graphToByteArray(l,c.inputReducer),v=!1,x;for(x=0;x<h&&!v;x++)v=e(d,m).converged;if(o){t.assignLayoutChanges(l,m,c.outputReducer);return}return t.collectLayoutChanges(l,m,c.outputReducer)}var a=s.bind(null,!1);return a.assign=s.bind(null,!0),F_=a,F_}var lW=oW();const cW=po(lW);var B_={exports:{}};/*!
|
|
4155
|
-
Copyright (c) 2018 Jed Watson.
|
|
4156
|
-
Licensed under the MIT License (MIT), see
|
|
4157
|
-
http://jedwatson.github.io/classnames
|
|
4158
|
-
*/var iA;function uW(){return iA||(iA=1,(function(i){(function(){var e={}.hasOwnProperty;function t(){for(var s="",a=0;a<arguments.length;a++){var o=arguments[a];o&&(s=r(s,n(o)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return t.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var o in s)e.call(s,o)&&s[o]&&(a=r(a,o));return a}function r(s,a){return a?s?s+" "+a:s+a:s}i.exports?(t.default=t,i.exports=t):window.classNames=t})()})(B_)),B_.exports}uW();(function(){try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(`._canvas_670zp_1 {
|
|
4083
|
+
`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const ib=new Ea({color:16777215,side:zn,transparent:!0}),DT=8421504,UT=new bt,em=new j,E_=new j,Vh=[],F8=new j,M_="+x+y";function OT(i){return Array.isArray(i)?i[0]:i}let sD=()=>{const i=new mn(new Ma(1,1),ib);return sD=()=>i,i},aD=()=>{const i=new mn(new Ma(1,1,32,1),ib);return aD=()=>i,i};const B8={type:"syncstart"},k8={type:"synccomplete"},oD=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],G8=oD.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let lD=class extends mn{constructor(){const e=new O8;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=DT,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=M_,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(B8),tD({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(r=>r&&r())})),this.dispatchEvent(k8),e&&e()})))}onBeforeRender(e,t,n,r,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return z8(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=ib.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.hasOutline()){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return OT(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return OT(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:o,blockBounds:l}=r;n.uTroikaSDFTexture.value=o,n.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),n.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,n.uTroikaSDFExponent.value=r.sdfExponent,n.uTroikaTotalBounds.value.fromArray(l),n.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let c=0,h=0,d=0,p,m,v,x=0,_=0;if(t){let{outlineWidth:b,outlineOffsetX:E,outlineOffsetY:S,outlineBlur:w,outlineOpacity:T}=this;c=this._parsePercent(b)||0,h=Math.max(0,this._parsePercent(w)||0),p=T,x=this._parsePercent(E)||0,_=this._parsePercent(S)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(v=this.strokeColor,n.uTroikaStrokeColor.value.set(v??DT),m=this.strokeOpacity,m==null&&(m=1)),p=this.fillOpacity;n.uTroikaEdgeOffset.value=c,n.uTroikaPositionOffset.value.set(x,_),n.uTroikaBlurRadius.value=h,n.uTroikaStrokeWidth.value=d,n.uTroikaStrokeOpacity.value=m,n.uTroikaFillOpacity.value=p??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let g=this.clipRect;if(g&&Array.isArray(g)&&g.length===4)n.uTroikaClipRect.value.fromArray(g);else{const b=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(l[0]-b,l[1]-b,l[2]+b,l[3]+b)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const o=e.hasOwnProperty("color")?e.color:e.color=new Ye;(s!==o._input||typeof s=="object")&&o.set(o._input=s)}let a=this.orientation||M_;if(a!==e._orientation){let o=n.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==M_&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,h,d,p]=l;em.set(0,0,0)[h]=c==="-"?1:-1,E_.set(0,0,0)[p]=d==="-"?-1:1,UT.lookAt(F8,em.cross(E_),E_),o.setFromMatrix4(UT)}else o.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new ke){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new ke){return em.copy(e),this.localPositionToTextCoords(this.worldToLocal(em),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:r}=this;if(n){const s=n.blockBounds,a=r?aD():sD(),o=a.geometry,{position:l,uv:c}=o.attributes;for(let h=0;h<c.count;h++){let d=s[0]+c.getX(h)*(s[2]-s[0]);const p=s[1]+c.getY(h)*(s[3]-s[1]);let m=0;r&&(m=r-Math.cos(d/r)*r,d=Math.sin(d/r)*r),l.setXYZ(h,d,p,m)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,Vh.length=0,a.raycast(e,Vh);for(let h=0;h<Vh.length;h++)Vh[h].object=this,t.push(Vh[h])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,G8.forEach(n=>{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};oD.forEach(i=>{const e="_private_"+i;Object.defineProperty(lD.prototype,i,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new Qn;new Ye;const H8=K.forwardRef(({sdfGlyphSize:i=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:r=1,children:s,characters:a,onSync:o,...l},c)=>{const h=Jn(({invalidate:v})=>v),[d]=K.useState(()=>new lD),[p,m]=K.useMemo(()=>{const v=[];let x="";return K.Children.forEach(s,_=>{typeof _=="string"||typeof _=="number"?x+=_:v.push(_)}),[v,x]},[s]);return N4(()=>new Promise(v=>w8({font:n,characters:a},v)),["troika-text",n,a]),K.useLayoutEffect(()=>void d.sync(()=>{h(),o&&o(d)})),K.useEffect(()=>()=>d.dispose(),[d]),K.createElement("primitive",Ul({object:d,ref:c,font:n,text:m,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:i},l),p)}),bs=1e-5;function V8(i,e,t){const n=new oo,r=t-bs;return n.absarc(bs,bs,bs,-Math.PI/2,-Math.PI,!0),n.absarc(bs,e-r*2,bs,Math.PI,Math.PI/2,!0),n.absarc(i-r*2,e-r*2,bs,Math.PI/2,0,!0),n.absarc(i-r*2,bs,bs,0,-Math.PI/2,!0),n}const LT=K.forwardRef(function({args:[e=1,t=1,n=1]=[],radius:r=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,children:c,...h},d){return K.createElement("mesh",Ul({ref:d},h),K.createElement(W8,{args:[e,t,n],radius:r,steps:s,smoothness:a,bevelSegments:o,creaseAngle:l}),c)}),W8=K.forwardRef(function({args:[e=1,t=1,n=1]=[],radius:r=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,...c},h){const d=K.useMemo(()=>V8(e,t,r),[e,t,r]),p=K.useMemo(()=>({depth:n-r*2,bevelEnabled:!0,bevelSegments:o*2,steps:s,bevelSize:r-bs,bevelThickness:r,curveSegments:a}),[n,r,a,o,s]),m=K.useRef(null);return K.useLayoutEffect(()=>{m.current&&(m.current.center(),qk(m.current,l))},[d,p,l]),K.useImperativeHandle(h,()=>m.current),K.createElement("extrudeGeometry",Ul({ref:m,args:[d,p]},c))});var Wh={exports:{}},IT;function X8(){if(IT)return Wh.exports;IT=1;const i={ellipse:"…",chars:[" ","-"],max:140,truncate:!0};function e(n,r,s,a){if(n.length<=r)return n;if(r<2)return n.slice(0,r-s.length)+s;const o=r-s.length,l=Math.floor(o/2);let c=l,h=n.length-l;for(let d=0;d<l;d++){const p=n.charAt(d),m=n.length-d,v=n.charAt(m);a.indexOf(p)!==-1&&(c=d),a.indexOf(v)!==-1&&(h=m)}return n.slice(0,c)+s+n.slice(h)}function t(n,r,s,a,o){if(n.length<=r)return n;const l=r-s.length;let c=l,h=!1;for(let d=0;d<=l;d++){const p=n.charAt(d);a.indexOf(p)!==-1&&(c=d,h=!0)}return!o&&!h?"":n.slice(0,c)+s}return Wh.exports=(n,r,s)=>{if(typeof n!="string"||n.length===0||r===0)return"";s=s||{};for(var a in i)(s[a]===null||typeof s[a]>"u")&&(s[a]=i[a]);return s.max=r||s.max,s.truncate==="middle"?e(n,s.max,s.ellipse,s.chars):t(n,s.max,s.ellipse,s.chars,s.truncate)},Wh.exports.ellipsizeMiddle=e,Wh.exports.ellipsize=t,Wh.exports}var j8=X8();const q8=po(j8);var w_,NT;function Y8(){if(NT)return w_;NT=1;var i=z1(),e=Ta(),t={dimensions:["x","y"],center:.5,scale:1};function n(s,a,o){if(!e(a))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");o=i(o,t);var l=o.dimensions;if(!Array.isArray(l)||l.length!==2)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=o.center,h=o.scale,d=Math.PI*2,p=(c-.5)*h,m=a.order,v=l[0],x=l[1];function _(E,S){return S[v]=h*Math.cos(E*d/m)+p,S[x]=h*Math.sin(E*d/m)+p,S}var g=0;if(!s){var b={};return a.forEachNode(function(E){b[E]=_(g++,{})}),b}a.updateEachNodeAttributes(function(E,S){return _(g++,S),S},{attributes:l})}var r=n.bind(null,!1);return r.assign=n.bind(null,!0),w_=r,w_}var Z8=Y8();const K8=po(Z8);var T_,PT;function J8(){if(PT)return T_;PT=1;var i=z1(),e=Ta(),t={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(s,a,o){if(!e(a))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");o=i(o,t);var l=o.dimensions;if(!Array.isArray(l)||l.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=l.length,h=o.center,d=o.rng,p=o.scale,m=(h-.5)*p;function v(_){for(var g=0;g<c;g++)_[l[g]]=d()*p+m;return _}if(!s){var x={};return a.forEachNode(function(_){x[_]=v({})}),x}a.updateEachNodeAttributes(function(_,g){return v(g),g},{attributes:l})}var r=n.bind(null,!1);return r.assign=n.bind(null,!0),T_=r,T_}var Q8=J8();const $8=po(Q8);var A_,zT;function e7(){if(zT)return A_;zT=1;var i=0,e=1,t=2,n=3,r=4,s=5,a=6,o=7,l=8,c=9,h=0,d=1,p=2,m=0,v=1,x=2,_=3,g=4,b=5,E=6,S=7,w=8,T=3,R=10,U=3,A=9,D=10;return A_=function(P,I,V){var H,z,O,B,G,X,k,Y,Q,te,ee=I.length,ie=V.length,re=P.adjustSizes,de=P.barnesHutTheta*P.barnesHutTheta,Ae,Me,ve,fe,J,oe,se,$=[];for(O=0;O<ee;O+=R)I[O+r]=I[O+t],I[O+s]=I[O+n],I[O+t]=0,I[O+n]=0;if(P.outboundAttractionDistribution){for(Ae=0,O=0;O<ee;O+=R)Ae+=I[O+a];Ae/=ee/R}if(P.barnesHutOptimize){var pe=1/0,ye=-1/0,xe=1/0,be=-1/0,ue,He,W;for(O=0;O<ee;O+=R)pe=Math.min(pe,I[O+i]),ye=Math.max(ye,I[O+i]),xe=Math.min(xe,I[O+e]),be=Math.max(be,I[O+e]);var F=ye-pe,ne=be-xe;for(F>ne?(xe-=(F-ne)/2,be=xe+F):(pe-=(ne-F)/2,ye=pe+ne),$[0+m]=-1,$[0+v]=(pe+ye)/2,$[0+x]=(xe+be)/2,$[0+_]=Math.max(ye-pe,be-xe),$[0+g]=-1,$[0+b]=-1,$[0+E]=0,$[0+S]=0,$[0+w]=0,H=1,O=0;O<ee;O+=R)for(z=0,W=T;;)if($[z+b]>=0){I[O+i]<$[z+v]?I[O+e]<$[z+x]?ue=$[z+b]:ue=$[z+b]+A:I[O+e]<$[z+x]?ue=$[z+b]+A*2:ue=$[z+b]+A*3,$[z+S]=($[z+S]*$[z+E]+I[O+i]*I[O+a])/($[z+E]+I[O+a]),$[z+w]=($[z+w]*$[z+E]+I[O+e]*I[O+a])/($[z+E]+I[O+a]),$[z+E]+=I[O+a],z=ue;continue}else if($[z+m]<0){$[z+m]=O;break}else{if($[z+b]=H*A,Y=$[z+_]/2,Q=$[z+b],$[Q+m]=-1,$[Q+v]=$[z+v]-Y,$[Q+x]=$[z+x]-Y,$[Q+_]=Y,$[Q+g]=Q+A,$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,Q+=A,$[Q+m]=-1,$[Q+v]=$[z+v]-Y,$[Q+x]=$[z+x]+Y,$[Q+_]=Y,$[Q+g]=Q+A,$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,Q+=A,$[Q+m]=-1,$[Q+v]=$[z+v]+Y,$[Q+x]=$[z+x]-Y,$[Q+_]=Y,$[Q+g]=Q+A,$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,Q+=A,$[Q+m]=-1,$[Q+v]=$[z+v]+Y,$[Q+x]=$[z+x]+Y,$[Q+_]=Y,$[Q+g]=$[z+g],$[Q+b]=-1,$[Q+E]=0,$[Q+S]=0,$[Q+w]=0,H+=4,I[$[z+m]+i]<$[z+v]?I[$[z+m]+e]<$[z+x]?ue=$[z+b]:ue=$[z+b]+A:I[$[z+m]+e]<$[z+x]?ue=$[z+b]+A*2:ue=$[z+b]+A*3,$[z+E]=I[$[z+m]+a],$[z+S]=I[$[z+m]+i],$[z+w]=I[$[z+m]+e],$[ue+m]=$[z+m],$[z+m]=-1,I[O+i]<$[z+v]?I[O+e]<$[z+x]?He=$[z+b]:He=$[z+b]+A:I[O+e]<$[z+x]?He=$[z+b]+A*2:He=$[z+b]+A*3,ue===He)if(W--){z=ue;continue}else{W=T;break}$[He+m]=O;break}}if(P.barnesHutOptimize)for(Me=P.scalingRatio,O=0;O<ee;O+=R)for(z=0;;)if($[z+b]>=0)if(oe=Math.pow(I[O+i]-$[z+S],2)+Math.pow(I[O+e]-$[z+w],2),te=$[z+_],4*te*te/oe<de){if(ve=I[O+i]-$[z+S],fe=I[O+e]-$[z+w],re===!0?oe>0?(se=Me*I[O+a]*$[z+E]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se):oe<0&&(se=-Me*I[O+a]*$[z+E]/Math.sqrt(oe),I[O+t]+=ve*se,I[O+n]+=fe*se):oe>0&&(se=Me*I[O+a]*$[z+E]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se),z=$[z+g],z<0)break;continue}else{z=$[z+b];continue}else{if(X=$[z+m],X>=0&&X!==O&&(ve=I[O+i]-I[X+i],fe=I[O+e]-I[X+e],oe=ve*ve+fe*fe,re===!0?oe>0?(se=Me*I[O+a]*I[X+a]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se):oe<0&&(se=-Me*I[O+a]*I[X+a]/Math.sqrt(oe),I[O+t]+=ve*se,I[O+n]+=fe*se):oe>0&&(se=Me*I[O+a]*I[X+a]/oe,I[O+t]+=ve*se,I[O+n]+=fe*se)),z=$[z+g],z<0)break;continue}else for(Me=P.scalingRatio,B=0;B<ee;B+=R)for(G=0;G<B;G+=R)ve=I[B+i]-I[G+i],fe=I[B+e]-I[G+e],re===!0?(oe=Math.sqrt(ve*ve+fe*fe)-I[B+l]-I[G+l],oe>0?(se=Me*I[B+a]*I[G+a]/oe/oe,I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se):oe<0&&(se=100*Me*I[B+a]*I[G+a],I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se)):(oe=Math.sqrt(ve*ve+fe*fe),oe>0&&(se=Me*I[B+a]*I[G+a]/oe/oe,I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se));for(Q=P.gravity/P.scalingRatio,Me=P.scalingRatio,O=0;O<ee;O+=R)se=0,ve=I[O+i],fe=I[O+e],oe=Math.sqrt(Math.pow(ve,2)+Math.pow(fe,2)),P.strongGravityMode?oe>0&&(se=Me*I[O+a]*Q):oe>0&&(se=Me*I[O+a]*Q/oe),I[O+t]-=ve*se,I[O+n]-=fe*se;for(Me=1*(P.outboundAttractionDistribution?Ae:1),k=0;k<ie;k+=U)B=V[k+h],G=V[k+d],Y=V[k+p],J=Math.pow(Y,P.edgeWeightInfluence),ve=I[B+i]-I[G+i],fe=I[B+e]-I[G+e],re===!0?(oe=Math.sqrt(ve*ve+fe*fe)-I[B+l]-I[G+l],P.linLogMode?P.outboundAttractionDistribution?oe>0&&(se=-Me*J*Math.log(1+oe)/oe/I[B+a]):oe>0&&(se=-Me*J*Math.log(1+oe)/oe):P.outboundAttractionDistribution?oe>0&&(se=-Me*J/I[B+a]):oe>0&&(se=-Me*J)):(oe=Math.sqrt(Math.pow(ve,2)+Math.pow(fe,2)),P.linLogMode?P.outboundAttractionDistribution?oe>0&&(se=-Me*J*Math.log(1+oe)/oe/I[B+a]):oe>0&&(se=-Me*J*Math.log(1+oe)/oe):P.outboundAttractionDistribution?(oe=1,se=-Me*J/I[B+a]):(oe=1,se=-Me*J)),oe>0&&(I[B+t]+=ve*se,I[B+n]+=fe*se,I[G+t]-=ve*se,I[G+n]-=fe*se);var Se,_e,me,ze,Ne,je;if(re===!0)for(O=0;O<ee;O+=R)I[O+c]!==1&&(Se=Math.sqrt(Math.pow(I[O+t],2)+Math.pow(I[O+n],2)),Se>D&&(I[O+t]=I[O+t]*D/Se,I[O+n]=I[O+n]*D/Se),_e=I[O+a]*Math.sqrt((I[O+r]-I[O+t])*(I[O+r]-I[O+t])+(I[O+s]-I[O+n])*(I[O+s]-I[O+n])),me=Math.sqrt((I[O+r]+I[O+t])*(I[O+r]+I[O+t])+(I[O+s]+I[O+n])*(I[O+s]+I[O+n]))/2,ze=.1*Math.log(1+me)/(1+Math.sqrt(_e)),Ne=I[O+i]+I[O+t]*(ze/P.slowDown),I[O+i]=Ne,je=I[O+e]+I[O+n]*(ze/P.slowDown),I[O+e]=je);else for(O=0;O<ee;O+=R)I[O+c]!==1&&(_e=I[O+a]*Math.sqrt((I[O+r]-I[O+t])*(I[O+r]-I[O+t])+(I[O+s]-I[O+n])*(I[O+s]-I[O+n])),me=Math.sqrt((I[O+r]+I[O+t])*(I[O+r]+I[O+t])+(I[O+s]+I[O+n])*(I[O+s]+I[O+n]))/2,ze=I[O+o]*Math.log(1+me)/(1+Math.sqrt(_e)),I[O+o]=Math.min(1,Math.sqrt(ze*(Math.pow(I[O+t],2)+Math.pow(I[O+n],2))/(1+Math.sqrt(_e)))),Ne=I[O+i]+I[O+t]*(ze/P.slowDown),I[O+i]=Ne,je=I[O+e]+I[O+n]*(ze/P.slowDown),I[O+e]=je);return{}},A_}var la={},FT;function t7(){if(FT)return la;FT=1;var i=10,e=3;return la.assign=function(t){t=t||{};var n=Array.prototype.slice.call(arguments).slice(1),r,s,a;for(r=0,a=n.length;r<a;r++)if(n[r])for(s in n[r])t[s]=n[r][s];return t},la.validateSettings=function(t){return"linLogMode"in t&&typeof t.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&typeof t.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&typeof t.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&typeof t.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in t&&!(typeof t.scalingRatio=="number"&&t.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},la.graphToByteArrays=function(t,n){var r=t.order,s=t.size,a={},o,l=new Float32Array(r*i),c=new Float32Array(s*e);return o=0,t.forEachNode(function(h,d){a[h]=o,l[o]=d.x,l[o+1]=d.y,l[o+2]=0,l[o+3]=0,l[o+4]=0,l[o+5]=0,l[o+6]=1,l[o+7]=1,l[o+8]=d.size||1,l[o+9]=d.fixed?1:0,o+=i}),o=0,t.forEachEdge(function(h,d,p,m,v,x,_){var g=a[p],b=a[m],E=n(h,d,p,m,v,x,_);l[g+6]+=E,l[b+6]+=E,c[o]=g,c[o+1]=b,c[o+2]=E,o+=e}),{nodes:l,edges:c}},la.assignLayoutChanges=function(t,n,r){var s=0;t.updateEachNodeAttributes(function(a,o){return o.x=n[s],o.y=n[s+1],s+=i,r?r(a,o):o})},la.readGraphPositions=function(t,n){var r=0;t.forEachNode(function(s,a){n[r]=a.x,n[r+1]=a.y,r+=i})},la.collectLayoutChanges=function(t,n,r){for(var s=t.nodes(),a={},o=0,l=0,c=n.length;o<c;o+=i){if(r){var h=Object.assign({},t.getNodeAttributes(s[l]));h.x=n[o],h.y=n[o+1],h=r(s[l],h),a[s[l]]={x:h.x,y:h.y}}else a[s[l]]={x:n[o],y:n[o+1]};l++}return a},la.createWorker=function(n){var r=window.URL||window.webkitURL,s=n.toString(),a=r.createObjectURL(new Blob(["("+s+").call(this);"],{type:"text/javascript"})),o=new Worker(a);return r.revokeObjectURL(a),o},la}var C_,BT;function n7(){return BT||(BT=1,C_={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),C_}var R_,kT;function i7(){if(kT)return R_;kT=1;var i=Ta(),e=d0().createEdgeWeightGetter,t=e7(),n=t7(),r=n7();function s(l,c,h){if(!i(c))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof h=="number"&&(h={iterations:h});var d=h.iterations;if(typeof d!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(d<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var p=e("getEdgeWeight"in h?h.getEdgeWeight:"weight").fromEntry,m=typeof h.outputReducer=="function"?h.outputReducer:null,v=n.assign({},r,h.settings),x=n.validateSettings(v);if(x)throw new Error("graphology-layout-forceatlas2: "+x.message);var _=n.graphToByteArrays(c,p),g;for(g=0;g<d;g++)t(v,_.nodes,_.edges);if(l){n.assignLayoutChanges(c,_.nodes,m);return}return n.collectLayoutChanges(c,_.nodes)}function a(l){var c=typeof l=="number"?l:l.order;return{barnesHutOptimize:c>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(c)}}var o=s.bind(null,!1);return o.assign=s.bind(null,!0),o.inferSettings=a,R_=o,R_}var r7=i7();const s7=po(r7);function a7(i,e,t){var n,r=1;i==null&&(i=0),e==null&&(e=0),t==null&&(t=0);function s(){var a,o=n.length,l,c=0,h=0,d=0;for(a=0;a<o;++a)l=n[a],c+=l.x||0,h+=l.y||0,d+=l.z||0;for(c=(c/o-i)*r,h=(h/o-e)*r,d=(d/o-t)*r,a=0;a<o;++a)l=n[a],c&&(l.x-=c),h&&(l.y-=h),d&&(l.z-=d)}return s.initialize=function(a){n=a},s.x=function(a){return arguments.length?(i=+a,s):i},s.y=function(a){return arguments.length?(e=+a,s):e},s.z=function(a){return arguments.length?(t=+a,s):t},s.strength=function(a){return arguments.length?(r=+a,s):r},s}function o7(i){const e=+this._x.call(null,i);return cD(this.cover(e),e,i)}function cD(i,e,t){if(isNaN(e))return i;var n,r=i._root,s={data:t},a=i._x0,o=i._x1,l,c,h,d,p;if(!r)return i._root=s,i;for(;r.length;)if((h=e>=(l=(a+o)/2))?a=l:o=l,n=r,!(r=r[d=+h]))return n[d]=s,i;if(c=+i._x.call(null,r.data),e===c)return s.next=r,n?n[d]=s:i._root=s,i;do n=n?n[d]=new Array(2):i._root=new Array(2),(h=e>=(l=(a+o)/2))?a=l:o=l;while((d=+h)==(p=+(c>=l)));return n[p]=r,n[d]=s,i}function l7(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e);let n=1/0,r=-1/0;for(let s=0,a;s<e;++s)isNaN(a=+this._x.call(null,i[s]))||(t[s]=a,a<n&&(n=a),a>r&&(r=a));if(n>r)return this;this.cover(n).cover(r);for(let s=0;s<e;++s)cD(this,t[s],i[s]);return this}function c7(i){if(isNaN(i=+i))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(i))+1;else{for(var n=t-e||1,r=this._root,s,a;e>i||i>=t;)switch(a=+(i<e),s=new Array(2),s[a]=r,r=s,n*=2,a){case 0:t=e+n;break;case 1:e=t-n;break}this._root&&this._root.length&&(this._root=r)}return this._x0=e,this._x1=t,this}function u7(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function h7(i){return arguments.length?this.cover(+i[0][0]).cover(+i[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function va(i,e,t){this.node=i,this.x0=e,this.x1=t}function f7(i,e){var t,n=this._x0,r,s,a=this._x1,o=[],l=this._root,c,h;for(l&&o.push(new va(l,n,a)),e==null?e=1/0:(n=i-e,a=i+e);c=o.pop();)if(!(!(l=c.node)||(r=c.x0)>a||(s=c.x1)<n))if(l.length){var d=(r+s)/2;o.push(new va(l[1],d,s),new va(l[0],r,d)),(h=+(i>=d))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-h],o[o.length-1-h]=c)}else{var p=Math.abs(i-+this._x.call(null,l.data));p<e&&(e=p,n=i-p,a=i+p,t=l.data)}return t}function d7(i){if(isNaN(l=+this._x.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,o=this._x1,l,c,h,d,p;if(!t)return this;if(t.length)for(;;){if((h=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[d=+h]))return this;if(!t.length)break;e[d+1&1]&&(n=e,p=d)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[d]=s:delete e[d],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(n?n[p]=t:this._root=t),this):(this._root=s,this)}function p7(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function m7(){return this._root}function g7(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function v7(i){var e=[],t,n=this._root,r,s,a;for(n&&e.push(new va(n,this._x0,this._x1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.x1)&&n.length){var o=(s+a)/2;(r=n[1])&&e.push(new va(r,o,a)),(r=n[0])&&e.push(new va(r,s,o))}return this}function y7(i){var e=[],t=[],n;for(this._root&&e.push(new va(this._root,this._x0,this._x1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,o=n.x1,l=(a+o)/2;(s=r[0])&&e.push(new va(s,a,l)),(s=r[1])&&e.push(new va(s,l,o))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.x1);return this}function _7(i){return i[0]}function x7(i){return arguments.length?(this._x=i,this):this._x}function rb(i,e){var t=new sb(e??_7,NaN,NaN);return i==null?t:t.addAll(i)}function sb(i,e,t){this._x=i,this._x0=e,this._x1=t,this._root=void 0}function GT(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var ir=rb.prototype=sb.prototype;ir.copy=function(){var i=new sb(this._x,this._x0,this._x1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=GT(e),i;for(t=[{source:e,target:i._root=new Array(2)}];e=t.pop();)for(var r=0;r<2;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(2)}):e.target[r]=GT(n));return i};ir.add=o7;ir.addAll=l7;ir.cover=c7;ir.data=u7;ir.extent=h7;ir.find=f7;ir.remove=d7;ir.removeAll=p7;ir.root=m7;ir.size=g7;ir.visit=v7;ir.visitAfter=y7;ir.x=x7;function b7(i){const e=+this._x.call(null,i),t=+this._y.call(null,i);return uD(this.cover(e,t),e,t,i)}function uD(i,e,t,n){if(isNaN(e)||isNaN(t))return i;var r,s=i._root,a={data:n},o=i._x0,l=i._y0,c=i._x1,h=i._y1,d,p,m,v,x,_,g,b;if(!s)return i._root=a,i;for(;s.length;)if((x=e>=(d=(o+c)/2))?o=d:c=d,(_=t>=(p=(l+h)/2))?l=p:h=p,r=s,!(s=s[g=_<<1|x]))return r[g]=a,i;if(m=+i._x.call(null,s.data),v=+i._y.call(null,s.data),e===m&&t===v)return a.next=s,r?r[g]=a:i._root=a,i;do r=r?r[g]=new Array(4):i._root=new Array(4),(x=e>=(d=(o+c)/2))?o=d:c=d,(_=t>=(p=(l+h)/2))?l=p:h=p;while((g=_<<1|x)===(b=(v>=p)<<1|m>=d));return r[b]=s,r[g]=a,i}function S7(i){var e,t,n=i.length,r,s,a=new Array(n),o=new Array(n),l=1/0,c=1/0,h=-1/0,d=-1/0;for(t=0;t<n;++t)isNaN(r=+this._x.call(null,e=i[t]))||isNaN(s=+this._y.call(null,e))||(a[t]=r,o[t]=s,r<l&&(l=r),r>h&&(h=r),s<c&&(c=s),s>d&&(d=s));if(l>h||c>d)return this;for(this.cover(l,c).cover(h,d),t=0;t<n;++t)uD(this,a[t],o[t],i[t]);return this}function E7(i,e){if(isNaN(i=+i)||isNaN(e=+e))return this;var t=this._x0,n=this._y0,r=this._x1,s=this._y1;if(isNaN(t))r=(t=Math.floor(i))+1,s=(n=Math.floor(e))+1;else{for(var a=r-t||1,o=this._root,l,c;t>i||i>=r||n>e||e>=s;)switch(c=(e<n)<<1|i<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:r=t+a,s=n+a;break;case 1:t=r-a,s=n+a;break;case 2:r=t+a,n=s-a;break;case 3:t=r-a,n=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=n,this._x1=r,this._y1=s,this}function M7(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function w7(i){return arguments.length?this.cover(+i[0][0],+i[0][1]).cover(+i[1][0],+i[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function zi(i,e,t,n,r){this.node=i,this.x0=e,this.y0=t,this.x1=n,this.y1=r}function T7(i,e,t){var n,r=this._x0,s=this._y0,a,o,l,c,h=this._x1,d=this._y1,p=[],m=this._root,v,x;for(m&&p.push(new zi(m,r,s,h,d)),t==null?t=1/0:(r=i-t,s=e-t,h=i+t,d=e+t,t*=t);v=p.pop();)if(!(!(m=v.node)||(a=v.x0)>h||(o=v.y0)>d||(l=v.x1)<r||(c=v.y1)<s))if(m.length){var _=(a+l)/2,g=(o+c)/2;p.push(new zi(m[3],_,g,l,c),new zi(m[2],a,g,_,c),new zi(m[1],_,o,l,g),new zi(m[0],a,o,_,g)),(x=(e>=g)<<1|i>=_)&&(v=p[p.length-1],p[p.length-1]=p[p.length-1-x],p[p.length-1-x]=v)}else{var b=i-+this._x.call(null,m.data),E=e-+this._y.call(null,m.data),S=b*b+E*E;if(S<t){var w=Math.sqrt(t=S);r=i-w,s=e-w,h=i+w,d=e+w,n=m.data}}return n}function A7(i){if(isNaN(h=+this._x.call(null,i))||isNaN(d=+this._y.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,o=this._y0,l=this._x1,c=this._y1,h,d,p,m,v,x,_,g;if(!t)return this;if(t.length)for(;;){if((v=h>=(p=(a+l)/2))?a=p:l=p,(x=d>=(m=(o+c)/2))?o=m:c=m,e=t,!(t=t[_=x<<1|v]))return this;if(!t.length)break;(e[_+1&3]||e[_+2&3]||e[_+3&3])&&(n=e,g=_)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[_]=s:delete e[_],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[g]=t:this._root=t),this):(this._root=s,this)}function C7(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function R7(){return this._root}function D7(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function U7(i){var e=[],t,n=this._root,r,s,a,o,l;for(n&&e.push(new zi(n,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.y0,o=t.x1,l=t.y1)&&n.length){var c=(s+o)/2,h=(a+l)/2;(r=n[3])&&e.push(new zi(r,c,h,o,l)),(r=n[2])&&e.push(new zi(r,s,h,c,l)),(r=n[1])&&e.push(new zi(r,c,a,o,h)),(r=n[0])&&e.push(new zi(r,s,a,c,h))}return this}function O7(i){var e=[],t=[],n;for(this._root&&e.push(new zi(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,o=n.y0,l=n.x1,c=n.y1,h=(a+l)/2,d=(o+c)/2;(s=r[0])&&e.push(new zi(s,a,o,h,d)),(s=r[1])&&e.push(new zi(s,h,o,l,d)),(s=r[2])&&e.push(new zi(s,a,d,h,c)),(s=r[3])&&e.push(new zi(s,h,d,l,c))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.x1,n.y1);return this}function L7(i){return i[0]}function I7(i){return arguments.length?(this._x=i,this):this._x}function N7(i){return i[1]}function P7(i){return arguments.length?(this._y=i,this):this._y}function ab(i,e,t){var n=new ob(e??L7,t??N7,NaN,NaN,NaN,NaN);return i==null?n:n.addAll(i)}function ob(i,e,t,n,r,s){this._x=i,this._y=e,this._x0=t,this._y0=n,this._x1=r,this._y1=s,this._root=void 0}function HT(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var Gi=ab.prototype=ob.prototype;Gi.copy=function(){var i=new ob(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=HT(e),i;for(t=[{source:e,target:i._root=new Array(4)}];e=t.pop();)for(var r=0;r<4;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(4)}):e.target[r]=HT(n));return i};Gi.add=b7;Gi.addAll=S7;Gi.cover=E7;Gi.data=M7;Gi.extent=w7;Gi.find=T7;Gi.remove=A7;Gi.removeAll=C7;Gi.root=R7;Gi.size=D7;Gi.visit=U7;Gi.visitAfter=O7;Gi.x=I7;Gi.y=P7;function z7(i){const e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return hD(this.cover(e,t,n),e,t,n,i)}function hD(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,a=i._root,o={data:r},l=i._x0,c=i._y0,h=i._z0,d=i._x1,p=i._y1,m=i._z1,v,x,_,g,b,E,S,w,T,R,U;if(!a)return i._root=o,i;for(;a.length;)if((S=e>=(v=(l+d)/2))?l=v:d=v,(w=t>=(x=(c+p)/2))?c=x:p=x,(T=n>=(_=(h+m)/2))?h=_:m=_,s=a,!(a=a[R=T<<2|w<<1|S]))return s[R]=o,i;if(g=+i._x.call(null,a.data),b=+i._y.call(null,a.data),E=+i._z.call(null,a.data),e===g&&t===b&&n===E)return o.next=a,s?s[R]=o:i._root=o,i;do s=s?s[R]=new Array(8):i._root=new Array(8),(S=e>=(v=(l+d)/2))?l=v:d=v,(w=t>=(x=(c+p)/2))?c=x:p=x,(T=n>=(_=(h+m)/2))?h=_:m=_;while((R=T<<2|w<<1|S)===(U=(E>=_)<<2|(b>=x)<<1|g>=v));return s[U]=a,s[R]=o,i}function F7(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=0,p,m,v,x;d<e;++d)isNaN(m=+this._x.call(null,p=i[d]))||isNaN(v=+this._y.call(null,p))||isNaN(x=+this._z.call(null,p))||(t[d]=m,n[d]=v,r[d]=x,m<s&&(s=m),m>l&&(l=m),v<a&&(a=v),v>c&&(c=v),x<o&&(o=x),x>h&&(h=x));if(s>l||a>c||o>h)return this;this.cover(s,a,o).cover(l,c,h);for(let d=0;d<e;++d)hD(this,t[d],n[d],r[d],i[d]);return this}function B7(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(n))a=(n=Math.floor(i))+1,o=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=a-n||1,h=this._root,d,p;n>i||i>=a||r>e||e>=o||s>t||t>=l;)switch(p=(t<s)<<2|(e<r)<<1|i<n,d=new Array(8),d[p]=h,h=d,c*=2,p){case 0:a=n+c,o=r+c,l=s+c;break;case 1:n=a-c,o=r+c,l=s+c;break;case 2:a=n+c,r=o-c,l=s+c;break;case 3:n=a-c,r=o-c,l=s+c;break;case 4:a=n+c,o=r+c,s=l-c;break;case 5:n=a-c,o=r+c,s=l-c;break;case 6:a=n+c,r=o-c,s=l-c;break;case 7:n=a-c,r=o-c,s=l-c;break}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this}function k7(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function G7(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function hn(i,e,t,n,r,s,a){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=a}function H7(i,e,t,n){var r,s=this._x0,a=this._y0,o=this._z0,l,c,h,d,p,m,v=this._x1,x=this._y1,_=this._z1,g=[],b=this._root,E,S;for(b&&g.push(new hn(b,s,a,o,v,x,_)),n==null?n=1/0:(s=i-n,a=e-n,o=t-n,v=i+n,x=e+n,_=t+n,n*=n);E=g.pop();)if(!(!(b=E.node)||(l=E.x0)>v||(c=E.y0)>x||(h=E.z0)>_||(d=E.x1)<s||(p=E.y1)<a||(m=E.z1)<o))if(b.length){var w=(l+d)/2,T=(c+p)/2,R=(h+m)/2;g.push(new hn(b[7],w,T,R,d,p,m),new hn(b[6],l,T,R,w,p,m),new hn(b[5],w,c,R,d,T,m),new hn(b[4],l,c,R,w,T,m),new hn(b[3],w,T,h,d,p,R),new hn(b[2],l,T,h,w,p,R),new hn(b[1],w,c,h,d,T,R),new hn(b[0],l,c,h,w,T,R)),(S=(t>=R)<<2|(e>=T)<<1|i>=w)&&(E=g[g.length-1],g[g.length-1]=g[g.length-1-S],g[g.length-1-S]=E)}else{var U=i-+this._x.call(null,b.data),A=e-+this._y.call(null,b.data),D=t-+this._z.call(null,b.data),L=U*U+A*A+D*D;if(L<n){var P=Math.sqrt(n=L);s=i-P,a=e-P,o=t-P,v=i+P,x=e+P,_=t+P,r=b.data}}return r}const V7=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function W7(i,e,t,n){const r=[],s=i-n,a=e-n,o=t-n,l=i+n,c=e+n,h=t+n;return this.visit((d,p,m,v,x,_,g)=>{if(!d.length)do{const b=d.data;V7(i,e,t,this._x(b),this._y(b),this._z(b))<=n&&r.push(b)}while(d=d.next);return p>l||m>c||v>h||x<s||_<a||g<o}),r}function X7(i){if(isNaN(p=+this._x.call(null,i))||isNaN(m=+this._y.call(null,i))||isNaN(v=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,o=this._y0,l=this._z0,c=this._x1,h=this._y1,d=this._z1,p,m,v,x,_,g,b,E,S,w,T;if(!t)return this;if(t.length)for(;;){if((b=p>=(x=(a+c)/2))?a=x:c=x,(E=m>=(_=(o+h)/2))?o=_:h=_,(S=v>=(g=(l+d)/2))?l=g:d=g,e=t,!(t=t[w=S<<2|E<<1|b]))return this;if(!t.length)break;(e[w+1&7]||e[w+2&7]||e[w+3&7]||e[w+4&7]||e[w+5&7]||e[w+6&7]||e[w+7&7])&&(n=e,T=w)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[w]=s:delete e[w],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[T]=t:this._root=t),this):(this._root=s,this)}function j7(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function q7(){return this._root}function Y7(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function Z7(i){var e=[],t,n=this._root,r,s,a,o,l,c,h;for(n&&e.push(new hn(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,h=t.z1)&&n.length){var d=(s+l)/2,p=(a+c)/2,m=(o+h)/2;(r=n[7])&&e.push(new hn(r,d,p,m,l,c,h)),(r=n[6])&&e.push(new hn(r,s,p,m,d,c,h)),(r=n[5])&&e.push(new hn(r,d,a,m,l,p,h)),(r=n[4])&&e.push(new hn(r,s,a,m,d,p,h)),(r=n[3])&&e.push(new hn(r,d,p,o,l,c,m)),(r=n[2])&&e.push(new hn(r,s,p,o,d,c,m)),(r=n[1])&&e.push(new hn(r,d,a,o,l,p,m)),(r=n[0])&&e.push(new hn(r,s,a,o,d,p,m))}return this}function K7(i){var e=[],t=[],n;for(this._root&&e.push(new hn(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,o=n.y0,l=n.z0,c=n.x1,h=n.y1,d=n.z1,p=(a+c)/2,m=(o+h)/2,v=(l+d)/2;(s=r[0])&&e.push(new hn(s,a,o,l,p,m,v)),(s=r[1])&&e.push(new hn(s,p,o,l,c,m,v)),(s=r[2])&&e.push(new hn(s,a,m,l,p,h,v)),(s=r[3])&&e.push(new hn(s,p,m,l,c,h,v)),(s=r[4])&&e.push(new hn(s,a,o,v,p,m,d)),(s=r[5])&&e.push(new hn(s,p,o,v,c,m,d)),(s=r[6])&&e.push(new hn(s,a,m,v,p,h,d)),(s=r[7])&&e.push(new hn(s,p,m,v,c,h,d))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function J7(i){return i[0]}function Q7(i){return arguments.length?(this._x=i,this):this._x}function $7(i){return i[1]}function e9(i){return arguments.length?(this._y=i,this):this._y}function t9(i){return i[2]}function n9(i){return arguments.length?(this._z=i,this):this._z}function lb(i,e,t,n){var r=new cb(e??J7,t??$7,n??t9,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function cb(i,e,t,n,r,s,a,o,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function VT(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var _i=lb.prototype=cb.prototype;_i.copy=function(){var i=new cb(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=VT(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=VT(n));return i};_i.add=z7;_i.addAll=F7;_i.cover=B7;_i.data=k7;_i.extent=G7;_i.find=H7;_i.findAllWithinRadius=W7;_i.remove=X7;_i.removeAll=j7;_i.root=q7;_i.size=Y7;_i.visit=Z7;_i.visitAfter=K7;_i.x=Q7;_i.y=e9;_i.z=n9;function Rn(i){return function(){return i}}function Pr(i){return(i()-.5)*1e-6}function D_(i){return i.x+i.vx}function WT(i){return i.y+i.vy}function i9(i){return i.z+i.vz}function fD(i){var e,t,n,r,s=1,a=1;typeof i!="function"&&(i=Rn(i==null?1:+i));function o(){for(var h,d=e.length,p,m,v,x,_,g,b,E=0;E<a;++E)for(p=(t===1?rb(e,D_):t===2?ab(e,D_,WT):t===3?lb(e,D_,WT,i9):null).visitAfter(l),h=0;h<d;++h)m=e[h],g=n[m.index],b=g*g,v=m.x+m.vx,t>1&&(x=m.y+m.vy),t>2&&(_=m.z+m.vz),p.visit(S);function S(w,T,R,U,A,D,L){var P=[T,R,U,A,D,L],I=P[0],V=P[1],H=P[2],z=P[t],O=P[t+1],B=P[t+2],G=w.data,X=w.r,k=g+X;if(G){if(G.index>m.index){var Y=v-G.x-G.vx,Q=t>1?x-G.y-G.vy:0,te=t>2?_-G.z-G.vz:0,ee=Y*Y+Q*Q+te*te;ee<k*k&&(Y===0&&(Y=Pr(r),ee+=Y*Y),t>1&&Q===0&&(Q=Pr(r),ee+=Q*Q),t>2&&te===0&&(te=Pr(r),ee+=te*te),ee=(k-(ee=Math.sqrt(ee)))/ee*s,m.vx+=(Y*=ee)*(k=(X*=X)/(b+X)),t>1&&(m.vy+=(Q*=ee)*k),t>2&&(m.vz+=(te*=ee)*k),G.vx-=Y*(k=1-k),t>1&&(G.vy-=Q*k),t>2&&(G.vz-=te*k))}return}return I>v+k||z<v-k||t>1&&(V>x+k||O<x-k)||t>2&&(H>_+k||B<_-k)}}function l(h){if(h.data)return h.r=n[h.data.index];for(var d=h.r=0;d<Math.pow(2,t);++d)h[d]&&h[d].r>h.r&&(h.r=h[d].r)}function c(){if(e){var h,d=e.length,p;for(n=new Array(d),h=0;h<d;++h)p=e[h],n[p.index]=+i(p,h,e)}}return o.initialize=function(h,...d){e=h,r=d.find(p=>typeof p=="function")||Math.random,t=d.find(p=>[1,2,3].includes(p))||2,c()},o.iterations=function(h){return arguments.length?(a=+h,o):a},o.strength=function(h){return arguments.length?(s=+h,o):s},o.radius=function(h){return arguments.length?(i=typeof h=="function"?h:Rn(+h),c(),o):i},o}function r9(i){return i.index}function XT(i,e){var t=i.get(e);if(!t)throw new Error("node not found: "+e);return t}function dD(i){var e=r9,t=p,n,r=Rn(30),s,a,o,l,c,h,d=1;i==null&&(i=[]);function p(g){return 1/Math.min(l[g.source.index],l[g.target.index])}function m(g){for(var b=0,E=i.length;b<d;++b)for(var S=0,w,T,R,U=0,A=0,D=0,L,P;S<E;++S)w=i[S],T=w.source,R=w.target,U=R.x+R.vx-T.x-T.vx||Pr(h),o>1&&(A=R.y+R.vy-T.y-T.vy||Pr(h)),o>2&&(D=R.z+R.vz-T.z-T.vz||Pr(h)),L=Math.sqrt(U*U+A*A+D*D),L=(L-s[S])/L*g*n[S],U*=L,A*=L,D*=L,R.vx-=U*(P=c[S]),o>1&&(R.vy-=A*P),o>2&&(R.vz-=D*P),T.vx+=U*(P=1-P),o>1&&(T.vy+=A*P),o>2&&(T.vz+=D*P)}function v(){if(a){var g,b=a.length,E=i.length,S=new Map(a.map((T,R)=>[e(T,R,a),T])),w;for(g=0,l=new Array(b);g<E;++g)w=i[g],w.index=g,typeof w.source!="object"&&(w.source=XT(S,w.source)),typeof w.target!="object"&&(w.target=XT(S,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(g=0,c=new Array(E);g<E;++g)w=i[g],c[g]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);n=new Array(E),x(),s=new Array(E),_()}}function x(){if(a)for(var g=0,b=i.length;g<b;++g)n[g]=+t(i[g],g,i)}function _(){if(a)for(var g=0,b=i.length;g<b;++g)s[g]=+r(i[g],g,i)}return m.initialize=function(g,...b){a=g,h=b.find(E=>typeof E=="function")||Math.random,o=b.find(E=>[1,2,3].includes(E))||2,v()},m.links=function(g){return arguments.length?(i=g,v(),m):i},m.id=function(g){return arguments.length?(e=g,m):e},m.iterations=function(g){return arguments.length?(d=+g,m):d},m.strength=function(g){return arguments.length?(t=typeof g=="function"?g:Rn(+g),x(),m):t},m.distance=function(g){return arguments.length?(r=typeof g=="function"?g:Rn(+g),_(),m):r},m}var s9={value:()=>{}};function pD(){for(var i=0,e=arguments.length,t={},n;i<e;++i){if(!(n=arguments[i]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new pm(t)}function pm(i){this._=i}function a9(i,e){return i.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}pm.prototype=pD.prototype={constructor:pm,on:function(i,e){var t=this._,n=a9(i+"",t),r,s=-1,a=n.length;if(arguments.length<2){for(;++s<a;)if((r=(i=n[s]).type)&&(r=o9(t[r],i.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(i=n[s]).type)t[r]=jT(t[r],i.name,e);else if(e==null)for(r in t)t[r]=jT(t[r],i.name,null);return this},copy:function(){var i={},e=this._;for(var t in e)i[t]=e[t].slice();return new pm(i)},call:function(i,e){if((r=arguments.length-2)>0)for(var t=new Array(r),n=0,r,s;n<r;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(i))throw new Error("unknown type: "+i);for(s=this._[i],n=0,r=s.length;n<r;++n)s[n].value.apply(e,t)},apply:function(i,e,t){if(!this._.hasOwnProperty(i))throw new Error("unknown type: "+i);for(var n=this._[i],r=0,s=n.length;r<s;++r)n[r].value.apply(e,t)}};function o9(i,e){for(var t=0,n=i.length,r;t<n;++t)if((r=i[t]).name===e)return r.value}function jT(i,e,t){for(var n=0,r=i.length;n<r;++n)if(i[n].name===e){i[n]=s9,i=i.slice(0,n).concat(i.slice(n+1));break}return t!=null&&i.push({name:e,value:t}),i}var bu=0,ef=0,Xh=0,mD=1e3,Eg,tf,Mg=0,Ol=0,E0=0,qf=typeof performance=="object"&&performance.now?performance:Date,gD=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(i){setTimeout(i,17)};function vD(){return Ol||(gD(l9),Ol=qf.now()+E0)}function l9(){Ol=0}function Ox(){this._call=this._time=this._next=null}Ox.prototype=yD.prototype={constructor:Ox,restart:function(i,e,t){if(typeof i!="function")throw new TypeError("callback is not a function");t=(t==null?vD():+t)+(e==null?0:+e),!this._next&&tf!==this&&(tf?tf._next=this:Eg=this,tf=this),this._call=i,this._time=t,Lx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lx())}};function yD(i,e,t){var n=new Ox;return n.restart(i,e,t),n}function c9(){vD(),++bu;for(var i=Eg,e;i;)(e=Ol-i._time)>=0&&i._call.call(void 0,e),i=i._next;--bu}function qT(){Ol=(Mg=qf.now())+E0,bu=ef=0;try{c9()}finally{bu=0,h9(),Ol=0}}function u9(){var i=qf.now(),e=i-Mg;e>mD&&(E0-=e,Mg=i)}function h9(){for(var i,e=Eg,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),i=e,e=e._next):(t=e._next,e._next=null,e=i?i._next=t:Eg=t);tf=i,Lx(n)}function Lx(i){if(!bu){ef&&(ef=clearTimeout(ef));var e=i-Ol;e>24?(i<1/0&&(ef=setTimeout(qT,i-qf.now()-E0)),Xh&&(Xh=clearInterval(Xh))):(Xh||(Mg=qf.now(),Xh=setInterval(u9,mD)),bu=1,gD(qT))}}const f9=1664525,d9=1013904223,YT=4294967296;function p9(){let i=1;return()=>(i=(f9*i+d9)%YT)/YT}var ZT=3;function U_(i){return i.x}function KT(i){return i.y}function m9(i){return i.z}var g9=10,v9=Math.PI*(3-Math.sqrt(5)),y9=Math.PI*20/(9+Math.sqrt(221));function _D(i,e){e=e||2;var t=Math.min(ZT,Math.max(1,Math.round(e))),n,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,l=.6,c=new Map,h=yD(m),d=pD("tick","end"),p=p9();i==null&&(i=[]);function m(){v(),d.call("tick",n),r<s&&(h.stop(),d.call("end",n))}function v(g){var b,E=i.length,S;g===void 0&&(g=1);for(var w=0;w<g;++w)for(r+=(o-r)*a,c.forEach(function(T){T(r)}),b=0;b<E;++b)S=i[b],S.fx==null?S.x+=S.vx*=l:(S.x=S.fx,S.vx=0),t>1&&(S.fy==null?S.y+=S.vy*=l:(S.y=S.fy,S.vy=0)),t>2&&(S.fz==null?S.z+=S.vz*=l:(S.z=S.fz,S.vz=0));return n}function x(){for(var g=0,b=i.length,E;g<b;++g){if(E=i[g],E.index=g,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),E.fz!=null&&(E.z=E.fz),isNaN(E.x)||t>1&&isNaN(E.y)||t>2&&isNaN(E.z)){var S=g9*(t>2?Math.cbrt(.5+g):t>1?Math.sqrt(.5+g):g),w=g*v9,T=g*y9;t===1?E.x=S:t===2?(E.x=S*Math.cos(w),E.y=S*Math.sin(w)):(E.x=S*Math.sin(w)*Math.cos(T),E.y=S*Math.cos(w),E.z=S*Math.sin(w)*Math.sin(T))}(isNaN(E.vx)||t>1&&isNaN(E.vy)||t>2&&isNaN(E.vz))&&(E.vx=0,t>1&&(E.vy=0),t>2&&(E.vz=0))}}function _(g){return g.initialize&&g.initialize(i,p,t),g}return x(),n={tick:v,restart:function(){return h.restart(m),n},stop:function(){return h.stop(),n},numDimensions:function(g){return arguments.length?(t=Math.min(ZT,Math.max(1,Math.round(g))),c.forEach(_),n):t},nodes:function(g){return arguments.length?(i=g,x(),c.forEach(_),n):i},alpha:function(g){return arguments.length?(r=+g,n):r},alphaMin:function(g){return arguments.length?(s=+g,n):s},alphaDecay:function(g){return arguments.length?(a=+g,n):+a},alphaTarget:function(g){return arguments.length?(o=+g,n):o},velocityDecay:function(g){return arguments.length?(l=1-g,n):1-l},randomSource:function(g){return arguments.length?(p=g,c.forEach(_),n):p},force:function(g,b){return arguments.length>1?(b==null?c.delete(g):c.set(g,_(b)),n):c.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),b=g.shift()||0,E=(t>1?g.shift():null)||0,S=(t>2?g.shift():null)||0,w=g.shift()||1/0,T=0,R=i.length,U,A,D,L,P,I;for(w*=w,T=0;T<R;++T)P=i[T],U=b-P.x,A=E-(P.y||0),D=S-(P.z||0),L=U*U+A*A+D*D,L<w&&(I=P,w=L);return I},on:function(g,b){return arguments.length>1?(d.on(g,b),n):d.on(g)}}}function xD(){var i,e,t,n,r,s=Rn(-30),a,o=1,l=1/0,c=.81;function h(v){var x,_=i.length,g=(e===1?rb(i,U_):e===2?ab(i,U_,KT):e===3?lb(i,U_,KT,m9):null).visitAfter(p);for(r=v,x=0;x<_;++x)t=i[x],g.visit(m)}function d(){if(i){var v,x=i.length,_;for(a=new Array(x),v=0;v<x;++v)_=i[v],a[_.index]=+s(_,v,i)}}function p(v){var x=0,_,g,b=0,E,S,w,T,R=v.length;if(R){for(E=S=w=T=0;T<R;++T)(_=v[T])&&(g=Math.abs(_.value))&&(x+=_.value,b+=g,E+=g*(_.x||0),S+=g*(_.y||0),w+=g*(_.z||0));x*=Math.sqrt(4/R),v.x=E/b,e>1&&(v.y=S/b),e>2&&(v.z=w/b)}else{_=v,_.x=_.data.x,e>1&&(_.y=_.data.y),e>2&&(_.z=_.data.z);do x+=a[_.data.index];while(_=_.next)}v.value=x}function m(v,x,_,g,b){if(!v.value)return!0;var E=[_,g,b][e-1],S=v.x-t.x,w=e>1?v.y-t.y:0,T=e>2?v.z-t.z:0,R=E-x,U=S*S+w*w+T*T;if(R*R/c<U)return U<l&&(S===0&&(S=Pr(n),U+=S*S),e>1&&w===0&&(w=Pr(n),U+=w*w),e>2&&T===0&&(T=Pr(n),U+=T*T),U<o&&(U=Math.sqrt(o*U)),t.vx+=S*v.value*r/U,e>1&&(t.vy+=w*v.value*r/U),e>2&&(t.vz+=T*v.value*r/U)),!0;if(v.length||U>=l)return;(v.data!==t||v.next)&&(S===0&&(S=Pr(n),U+=S*S),e>1&&w===0&&(w=Pr(n),U+=w*w),e>2&&T===0&&(T=Pr(n),U+=T*T),U<o&&(U=Math.sqrt(o*U)));do v.data!==t&&(R=a[v.data.index]*r/U,t.vx+=S*R,e>1&&(t.vy+=w*R),e>2&&(t.vz+=T*R));while(v=v.next)}return h.initialize=function(v,...x){i=v,n=x.find(_=>typeof _=="function")||Math.random,e=x.find(_=>[1,2,3].includes(_))||2,d()},h.strength=function(v){return arguments.length?(s=typeof v=="function"?v:Rn(+v),d(),h):s},h.distanceMin=function(v){return arguments.length?(o=v*v,h):Math.sqrt(o)},h.distanceMax=function(v){return arguments.length?(l=v*v,h):Math.sqrt(l)},h.theta=function(v){return arguments.length?(c=v*v,h):Math.sqrt(c)},h}function _9(i,e,t,n){var r,s,a=Rn(.1),o,l;typeof i!="function"&&(i=Rn(+i)),e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function c(d){for(var p=0,m=r.length;p<m;++p){var v=r[p],x=v.x-e||1e-6,_=(v.y||0)-t||1e-6,g=(v.z||0)-n||1e-6,b=Math.sqrt(x*x+_*_+g*g),E=(l[p]-b)*o[p]*d/b;v.vx+=x*E,s>1&&(v.vy+=_*E),s>2&&(v.vz+=g*E)}}function h(){if(r){var d,p=r.length;for(o=new Array(p),l=new Array(p),d=0;d<p;++d)l[d]=+i(r[d],d,r),o[d]=isNaN(l[d])?0:+a(r[d],d,r)}}return c.initialize=function(d,...p){r=d,s=p.find(m=>[1,2,3].includes(m))||2,h()},c.strength=function(d){return arguments.length?(a=typeof d=="function"?d:Rn(+d),h(),c):a},c.radius=function(d){return arguments.length?(i=typeof d=="function"?d:Rn(+d),h(),c):i},c.x=function(d){return arguments.length?(e=+d,c):e},c.y=function(d){return arguments.length?(t=+d,c):t},c.z=function(d){return arguments.length?(n=+d,c):n},c}function Ix(i){var e=Rn(.1),t,n,r;typeof i!="function"&&(i=Rn(i==null?0:+i));function s(o){for(var l=0,c=t.length,h;l<c;++l)h=t[l],h.vx+=(r[l]-h.x)*n[l]*o}function a(){if(t){var o,l=t.length;for(n=new Array(l),r=new Array(l),o=0;o<l;++o)n[o]=isNaN(r[o]=+i(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Rn(+o),a(),s):e},s.x=function(o){return arguments.length?(i=typeof o=="function"?o:Rn(+o),a(),s):i},s}function Nx(i){var e=Rn(.1),t,n,r;typeof i!="function"&&(i=Rn(i==null?0:+i));function s(o){for(var l=0,c=t.length,h;l<c;++l)h=t[l],h.vy+=(r[l]-h.y)*n[l]*o}function a(){if(t){var o,l=t.length;for(n=new Array(l),r=new Array(l),o=0;o<l;++o)n[o]=isNaN(r[o]=+i(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Rn(+o),a(),s):e},s.y=function(o){return arguments.length?(i=typeof o=="function"?o:Rn(+o),a(),s):i},s}function x9(i){var e=Rn(.1),t,n,r;typeof i!="function"&&(i=Rn(i==null?0:+i));function s(o){for(var l=0,c=t.length,h;l<c;++l)h=t[l],h.vz+=(r[l]-h.z)*n[l]*o}function a(){if(t){var o,l=t.length;for(n=new Array(l),r=new Array(l),o=0;o<l;++o)n[o]=isNaN(r[o]=+i(t[o],o,t))?0:+e(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Rn(+o),a(),s):e},s.z=function(o){return arguments.length?(i=typeof o=="function"?o:Rn(+o),a(),s):i},s}function b9(i){var e=0,t=i.children,n=t&&t.length;if(!n)e=1;else for(;--n>=0;)e+=t[n].value;i.value=e}function S9(){return this.eachAfter(b9)}function E9(i,e){let t=-1;for(const n of this)i.call(e,n,++t,this);return this}function M9(i,e){for(var t=this,n=[t],r,s,a=-1;t=n.pop();)if(i.call(e,t,++a,this),r=t.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function w9(i,e){for(var t=this,n=[t],r=[],s,a,o,l=-1;t=n.pop();)if(r.push(t),s=t.children)for(a=0,o=s.length;a<o;++a)n.push(s[a]);for(;t=r.pop();)i.call(e,t,++l,this);return this}function T9(i,e){let t=-1;for(const n of this)if(i.call(e,n,++t,this))return n}function A9(i){return this.eachAfter(function(e){for(var t=+i(e.data)||0,n=e.children,r=n&&n.length;--r>=0;)t+=n[r].value;e.value=t})}function C9(i){return this.eachBefore(function(e){e.children&&e.children.sort(i)})}function R9(i){for(var e=this,t=D9(e,i),n=[e];e!==t;)e=e.parent,n.push(e);for(var r=n.length;i!==t;)n.splice(r,0,i),i=i.parent;return n}function D9(i,e){if(i===e)return i;var t=i.ancestors(),n=e.ancestors(),r=null;for(i=t.pop(),e=n.pop();i===e;)r=i,i=t.pop(),e=n.pop();return r}function U9(){for(var i=this,e=[i];i=i.parent;)e.push(i);return e}function O9(){return Array.from(this)}function L9(){var i=[];return this.eachBefore(function(e){e.children||i.push(e)}),i}function I9(){var i=this,e=[];return i.each(function(t){t!==i&&e.push({source:t.parent,target:t})}),e}function*N9(){var i=this,e,t=[i],n,r,s;do for(e=t.reverse(),t=[];i=e.pop();)if(yield i,n=i.children)for(r=0,s=n.length;r<s;++r)t.push(n[r]);while(t.length)}function M0(i,e){i instanceof Map?(i=[void 0,i],e===void 0&&(e=F9)):e===void 0&&(e=z9);for(var t=new Su(i),n,r=[t],s,a,o,l;n=r.pop();)if((a=e(n.data))&&(l=(a=Array.from(a)).length))for(n.children=a,o=l-1;o>=0;--o)r.push(s=a[o]=new Su(a[o])),s.parent=n,s.depth=n.depth+1;return t.eachBefore(bD)}function P9(){return M0(this).eachBefore(B9)}function z9(i){return i.children}function F9(i){return Array.isArray(i)?i[1]:null}function B9(i){i.data.value!==void 0&&(i.value=i.data.value),i.data=i.data.data}function bD(i){var e=0;do i.height=e;while((i=i.parent)&&i.height<++e)}function Su(i){this.data=i,this.depth=this.height=0,this.parent=null}Su.prototype=M0.prototype={constructor:Su,count:S9,each:E9,eachAfter:w9,eachBefore:M9,find:T9,sum:A9,sort:C9,path:R9,ancestors:U9,descendants:O9,leaves:L9,links:I9,copy:P9,[Symbol.iterator]:N9};function O_(i){return i==null?null:SD(i)}function SD(i){if(typeof i!="function")throw new Error;return i}function jh(){return 0}function qh(i){return function(){return i}}function k9(i){i.x0=Math.round(i.x0),i.y0=Math.round(i.y0),i.x1=Math.round(i.x1),i.y1=Math.round(i.y1)}function G9(i,e,t,n,r){for(var s=i.children,a,o=-1,l=s.length,c=i.value&&(n-e)/i.value;++o<l;)a=s[o],a.y0=t,a.y1=r,a.x0=e,a.x1=e+=a.value*c}var H9={depth:-1},JT={},L_={};function V9(i){return i.id}function W9(i){return i.parentId}function X9(){var i=V9,e=W9,t;function n(r){var s=Array.from(r),a=i,o=e,l,c,h,d,p,m,v,x,_=new Map;if(t!=null){const g=s.map((S,w)=>j9(t(S,w,r))),b=g.map(QT),E=new Set(g).add("");for(const S of b)E.has(S)||(E.add(S),g.push(S),b.push(QT(S)),s.push(L_));a=(S,w)=>g[w],o=(S,w)=>b[w]}for(h=0,l=s.length;h<l;++h)c=s[h],m=s[h]=new Su(c),(v=a(c,h,r))!=null&&(v+="")&&(x=m.id=v,_.set(x,_.has(x)?JT:m)),(v=o(c,h,r))!=null&&(v+="")&&(m.parent=v);for(h=0;h<l;++h)if(m=s[h],v=m.parent){if(p=_.get(v),!p)throw new Error("missing: "+v);if(p===JT)throw new Error("ambiguous: "+v);p.children?p.children.push(m):p.children=[m],m.parent=p}else{if(d)throw new Error("multiple roots");d=m}if(!d)throw new Error("no root");if(t!=null){for(;d.data===L_&&d.children.length===1;)d=d.children[0],--l;for(let g=s.length-1;g>=0&&(m=s[g],m.data===L_);--g)m.data=null}if(d.parent=H9,d.eachBefore(function(g){g.depth=g.parent.depth+1,--l}).eachBefore(bD),d.parent=null,l>0)throw new Error("cycle");return d}return n.id=function(r){return arguments.length?(i=O_(r),n):i},n.parentId=function(r){return arguments.length?(e=O_(r),n):e},n.path=function(r){return arguments.length?(t=O_(r),n):t},n}function j9(i){i=`${i}`;let e=i.length;return Px(i,e-1)&&!Px(i,e-2)&&(i=i.slice(0,-1)),i[0]==="/"?i:`/${i}`}function QT(i){let e=i.length;if(e<2)return"";for(;--e>1&&!Px(i,e););return i.slice(0,e)}function Px(i,e){if(i[e]==="/"){let t=0;for(;e>0&&i[--e]==="\\";)++t;if((t&1)===0)return!0}return!1}function q9(i,e){return i.parent===e.parent?1:2}function I_(i){var e=i.children;return e?e[0]:i.t}function N_(i){var e=i.children;return e?e[e.length-1]:i.t}function Y9(i,e,t){var n=t/(e.i-i.i);e.c-=n,e.s+=t,i.c+=n,e.z+=t,e.m+=t}function Z9(i){for(var e=0,t=0,n=i.children,r=n.length,s;--r>=0;)s=n[r],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function K9(i,e,t){return i.a.parent===e.parent?i.a:t}function mm(i,e){this._=i,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=e}mm.prototype=Object.create(Su.prototype);function J9(i){for(var e=new mm(i,0),t,n=[e],r,s,a,o;t=n.pop();)if(s=t._.children)for(t.children=new Array(o=s.length),a=o-1;a>=0;--a)n.push(r=t.children[a]=new mm(s[a],a)),r.parent=t;return(e.parent=new mm(null,0)).children=[e],e}function Q9(){var i=q9,e=1,t=1,n=null;function r(c){var h=J9(c);if(h.eachAfter(s),h.parent.m=-h.z,h.eachBefore(a),n)c.eachBefore(l);else{var d=c,p=c,m=c;c.eachBefore(function(b){b.x<d.x&&(d=b),b.x>p.x&&(p=b),b.depth>m.depth&&(m=b)});var v=d===p?1:i(d,p)/2,x=v-d.x,_=e/(p.x+v+x),g=t/(m.depth||1);c.eachBefore(function(b){b.x=(b.x+x)*_,b.y=b.depth*g})}return c}function s(c){var h=c.children,d=c.parent.children,p=c.i?d[c.i-1]:null;if(h){Z9(c);var m=(h[0].z+h[h.length-1].z)/2;p?(c.z=p.z+i(c._,p._),c.m=c.z-m):c.z=m}else p&&(c.z=p.z+i(c._,p._));c.parent.A=o(c,p,c.parent.A||d[0])}function a(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function o(c,h,d){if(h){for(var p=c,m=c,v=h,x=p.parent.children[0],_=p.m,g=m.m,b=v.m,E=x.m,S;v=N_(v),p=I_(p),v&&p;)x=I_(x),m=N_(m),m.a=c,S=v.z+b-p.z-_+i(v._,p._),S>0&&(Y9(K9(v,c,d),c,S),_+=S,g+=S),b+=v.m,_+=p.m,E+=x.m,g+=m.m;v&&!N_(m)&&(m.t=v,m.m+=b-g),p&&!I_(x)&&(x.t=p,x.m+=_-E,d=c)}return d}function l(c){c.x*=e,c.y=c.depth*t}return r.separation=function(c){return arguments.length?(i=c,r):i},r.size=function(c){return arguments.length?(n=!1,e=+c[0],t=+c[1],r):n?null:[e,t]},r.nodeSize=function(c){return arguments.length?(n=!0,e=+c[0],t=+c[1],r):n?[e,t]:null},r}function $9(i,e,t,n,r){for(var s=i.children,a,o=-1,l=s.length,c=i.value&&(r-t)/i.value;++o<l;)a=s[o],a.x0=e,a.x1=n,a.y0=t,a.y1=t+=a.value*c}var eW=(1+Math.sqrt(5))/2;function tW(i,e,t,n,r,s){for(var a=[],o=e.children,l,c,h=0,d=0,p=o.length,m,v,x=e.value,_,g,b,E,S,w,T;h<p;){m=r-t,v=s-n;do _=o[d++].value;while(!_&&d<p);for(g=b=_,w=Math.max(v/m,m/v)/(x*i),T=_*_*w,S=Math.max(b/T,T/g);d<p;++d){if(_+=c=o[d].value,c<g&&(g=c),c>b&&(b=c),T=_*_*w,E=Math.max(b/T,T/g),E>S){_-=c;break}S=E}a.push(l={value:_,dice:m<v,children:o.slice(h,d)}),l.dice?G9(l,t,n,r,x?n+=v*_/x:s):$9(l,t,n,x?t+=m*_/x:r,s),x-=_,h=d}return a}const nW=(function i(e){function t(n,r,s,a,o){tW(e,n,r,s,a,o)}return t.ratio=function(n){return i((n=+n)>1?n:1)},t})(eW);function iW(){var i=nW,e=!1,t=1,n=1,r=[0],s=jh,a=jh,o=jh,l=jh,c=jh;function h(p){return p.x0=p.y0=0,p.x1=t,p.y1=n,p.eachBefore(d),r=[0],e&&p.eachBefore(k9),p}function d(p){var m=r[p.depth],v=p.x0+m,x=p.y0+m,_=p.x1-m,g=p.y1-m;_<v&&(v=_=(v+_)/2),g<x&&(x=g=(x+g)/2),p.x0=v,p.y0=x,p.x1=_,p.y1=g,p.children&&(m=r[p.depth+1]=s(p)/2,v+=c(p)-m,x+=a(p)-m,_-=o(p)-m,g-=l(p)-m,_<v&&(v=_=(v+_)/2),g<x&&(x=g=(x+g)/2),i(p,v,x,_,g))}return h.round=function(p){return arguments.length?(e=!!p,h):e},h.size=function(p){return arguments.length?(t=+p[0],n=+p[1],h):[t,n]},h.tile=function(p){return arguments.length?(i=SD(p),h):i},h.padding=function(p){return arguments.length?h.paddingInner(p).paddingOuter(p):h.paddingInner()},h.paddingInner=function(p){return arguments.length?(s=typeof p=="function"?p:qh(+p),h):s},h.paddingOuter=function(p){return arguments.length?h.paddingTop(p).paddingRight(p).paddingBottom(p).paddingLeft(p):h.paddingTop()},h.paddingTop=function(p){return arguments.length?(a=typeof p=="function"?p:qh(+p),h):a},h.paddingRight=function(p){return arguments.length?(o=typeof p=="function"?p:qh(+p),h):o},h.paddingBottom=function(p){return arguments.length?(l=typeof p=="function"?p:qh(+p),h):l},h.paddingLeft=function(p){return arguments.length?(c=typeof p=="function"?p:qh(+p),h):c},h}var P_,$T;function rW(){if($T)return P_;$T=1;var i=0,e=1,t=2,n=3;function r(a,o){return a+"§"+o}function s(){return .01*(.5-Math.random())}return P_=function(o,l){var c=o.margin,h=o.ratio,d=o.expansion,p=o.gridSize,m=o.speed,v,x,_,g,b,E,S=!0,w=l.length,T=w/n|0,R=new Float32Array(T),U=new Float32Array(T),A=1/0,D=1/0,L=-1/0,P=-1/0;for(v=0;v<w;v+=n)_=l[v+i],g=l[v+e],E=l[v+t]*h+c,A=Math.min(A,_-E),L=Math.max(L,_+E),D=Math.min(D,g-E),P=Math.max(P,g+E);var I=L-A,V=P-D,H=(A+L)/2,z=(D+P)/2;A=H-d*I/2,L=H+d*I/2,D=z-d*V/2,P=z+d*V/2;var O=new Array(p*p),B=O.length,G;for(G=0;G<B;G++)O[G]=[];var X,k,Y,Q,te,ee,ie,re,de,Ae;for(v=0;v<w;v+=n)for(_=l[v+i],g=l[v+e],E=l[v+t]*h+c,X=_-E,k=_+E,Y=g-E,Q=g+E,te=Math.floor(p*(X-A)/(L-A)),ee=Math.floor(p*(k-A)/(L-A)),ie=Math.floor(p*(Y-D)/(P-D)),re=Math.floor(p*(Q-D)/(P-D)),de=te;de<=ee;de++)for(Ae=ie;Ae<=re;Ae++)O[de*p+Ae].push(v);var Me,ve=new Set,fe,J,oe,se,$,pe,ye,xe,be,ue,He,W,F;for(G=0;G<B;G++)for(Me=O[G],v=0,b=Me.length;v<b;v++)for(fe=Me[v],oe=l[fe+i],$=l[fe+e],ye=l[fe+t],x=v+1;x<b;x++)J=Me[x],be=r(fe,J),!(B>1&&ve.has(be))&&(B>1&&ve.add(be),se=l[J+i],pe=l[J+e],xe=l[J+t],ue=se-oe,He=pe-$,W=Math.sqrt(ue*ue+He*He),F=W<ye*h+c+(xe*h+c),F&&(S=!1,J=J/n|0,W>0?(R[J]+=ue/W*(1+ye),U[J]+=He/W*(1+ye)):(R[J]+=I*s(),U[J]+=V*s())));for(v=0,x=0;v<w;v+=n,x++)l[v+i]+=R[x]*.1*m,l[v+e]+=U[x]*.1*m;return{converged:S}},P_}var ul={},eA;function sW(){if(eA)return ul;eA=1;var i=3;return ul.validateSettings=function(e){return"gridSize"in e&&typeof e.gridSize!="number"||e.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in e&&typeof e.margin!="number"||e.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in e&&typeof e.expansion!="number"||e.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in e&&typeof e.ratio!="number"||e.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in e&&typeof e.speed!="number"||e.speed<=0?{message:"the `speed` setting should be a positive number."}:null},ul.graphToByteArray=function(e,t){var n=e.order,r=new Float32Array(n*i),s=0;return e.forEachNode(function(a,o){typeof t=="function"&&(o=t(a,o)),r[s]=o.x,r[s+1]=o.y,r[s+2]=o.size||1,s+=i}),r},ul.assignLayoutChanges=function(e,t,n){var r=0;e.forEachNode(function(s){var a={x:t[r],y:t[r+1]};typeof n=="function"&&(a=n(s,a)),e.mergeNodeAttributes(s,a),r+=i})},ul.collectLayoutChanges=function(e,t,n){var r={},s=0;return e.forEachNode(function(a){var o={x:t[s],y:t[s+1]};typeof n=="function"&&(o=n(a,o)),r[a]=o,s+=i}),r},ul.createWorker=function(t){var n=window.URL||window.webkitURL,r=t.toString(),s=n.createObjectURL(new Blob(["("+r+").call(this);"],{type:"text/javascript"})),a=new Worker(s);return n.revokeObjectURL(s),a},ul}var z_,tA;function aW(){return tA||(tA=1,z_={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}),z_}var F_,nA;function oW(){if(nA)return F_;nA=1;var i=Ta(),e=rW(),t=sW(),n=aW(),r=500;function s(o,l,c){if(!i(l))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");typeof c=="number"?c={maxIterations:c}:c=c||{};var h=c.maxIterations||r;if(typeof h!="number"||h<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var d=Object.assign({},n,c.settings),p=t.validateSettings(d);if(p)throw new Error("graphology-layout-noverlap: "+p.message);var m=t.graphToByteArray(l,c.inputReducer),v=!1,x;for(x=0;x<h&&!v;x++)v=e(d,m).converged;if(o){t.assignLayoutChanges(l,m,c.outputReducer);return}return t.collectLayoutChanges(l,m,c.outputReducer)}var a=s.bind(null,!1);return a.assign=s.bind(null,!0),F_=a,F_}var lW=oW();const cW=po(lW);var B_={exports:{}};var iA;function uW(){return iA||(iA=1,(function(i){(function(){var e={}.hasOwnProperty;function t(){for(var s="",a=0;a<arguments.length;a++){var o=arguments[a];o&&(s=r(s,n(o)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return t.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var o in s)e.call(s,o)&&s[o]&&(a=r(a,o));return a}function r(s,a){return a?s?s+" "+a:s+a:s}i.exports?(t.default=t,i.exports=t):window.classNames=t})()})(B_)),B_.exports}uW();(function(){try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(`._canvas_670zp_1 {
|
|
4159
4084
|
position: absolute;
|
|
4160
4085
|
top: 0;
|
|
4161
4086
|
left: 0;
|