zigbee2mqtt-windfront 2.13.0 → 2.14.0
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-Ds4E5jmt.js → About-fqfJrqFI.js} +1 -1
- package/dist/assets/About-fqfJrqFI.js.br +0 -0
- package/dist/assets/{ActivityPage-z4HvbBIA.js → ActivityPage-D1xSFJw0.js} +1 -1
- package/dist/assets/ActivityPage-D1xSFJw0.js.br +0 -0
- package/dist/assets/{Bind-BVQS0LRq.js → Bind-B8SSw2ve.js} +1 -1
- package/dist/assets/Bind-B8SSw2ve.js.br +0 -0
- package/dist/assets/{BindRow-BqPe9jRt.js → BindRow-CN3tEA7v.js} +1 -1
- package/dist/assets/BindRow-CN3tEA7v.js.br +0 -0
- package/dist/assets/{BindingsPage-Dj1ao25d.js → BindingsPage-BK92x9Te.js} +1 -1
- package/dist/assets/BindingsPage-BK92x9Te.js.br +0 -0
- package/dist/assets/Bridge-CtNLXjl2.js +1 -0
- package/dist/assets/Bridge-CtNLXjl2.js.br +0 -0
- package/dist/assets/{CheckboxField-CuYpvZuF.js → CheckboxField-CzUa3ISp.js} +1 -1
- package/dist/assets/CheckboxField-CzUa3ISp.js.br +0 -0
- package/dist/assets/{ClusterSinglePicker-BSWFzqBE.js → ClusterSinglePicker-zyB3Jq--.js} +1 -1
- package/dist/assets/ClusterSinglePicker-zyB3Jq--.js.br +0 -0
- package/dist/assets/{Clusters-D_vIyhtD.js → Clusters-D8ft6qSV.js} +1 -1
- package/dist/assets/Clusters-D8ft6qSV.js.br +0 -0
- package/dist/assets/{ContributePage-B-DYlK4j.js → ContributePage-xC07Vlnj.js} +1 -1
- package/dist/assets/ContributePage-xC07Vlnj.js.br +0 -0
- package/dist/assets/Dashboard-k8SvabK0.js +1 -0
- package/dist/assets/Dashboard-k8SvabK0.js.br +0 -0
- package/dist/assets/{DashboardFeatureWrapper-FsZiU1sw.js → DashboardFeatureWrapper-BxYtaGVm.js} +1 -1
- package/dist/assets/DashboardFeatureWrapper-BxYtaGVm.js.br +0 -0
- package/dist/assets/{DebouncedInput-BQDPX7Sm.js → DebouncedInput-oq8bX0s-.js} +1 -1
- package/dist/assets/DebouncedInput-oq8bX0s-.js.br +3 -0
- package/dist/assets/{DevConsole-Cx8XCb78.js → DevConsole-BmuDNcGH.js} +1 -1
- package/dist/assets/DevConsole-BmuDNcGH.js.br +0 -0
- package/dist/assets/{DevConsole-DznCAH02.js → DevConsole-drRG0aFe.js} +1 -1
- package/dist/assets/DevConsole-drRG0aFe.js.br +0 -0
- package/dist/assets/{DeviceCard-CPph_TDG.js → DeviceCard-CbiojlW6.js} +1 -1
- package/dist/assets/DeviceCard-CbiojlW6.js.br +0 -0
- package/dist/assets/{DeviceImage-C318RT7U.js → DeviceImage-BuQphSNv.js} +1 -1
- package/dist/assets/DeviceImage-BuQphSNv.js.br +0 -0
- package/dist/assets/DeviceInfo-MwKFIkq0.js +27 -0
- package/dist/assets/DeviceInfo-MwKFIkq0.js.br +0 -0
- package/dist/assets/{DevicePage-C34abgvz.js → DevicePage-C7RJS1xk.js} +2 -2
- package/dist/assets/DevicePage-C7RJS1xk.js.br +0 -0
- package/dist/assets/{DevicePicker-BkIPjn9I.js → DevicePicker-B6FgDjrJ.js} +1 -1
- package/dist/assets/DevicePicker-B6FgDjrJ.js.br +0 -0
- package/dist/assets/{DeviceSettings-C6-5bmf7.js → DeviceSettings-SXz1m5ap.js} +1 -1
- package/dist/assets/DeviceSettings-SXz1m5ap.js.br +0 -0
- package/dist/assets/{DeviceSpecificSettings-BlsShCQQ.js → DeviceSpecificSettings-V4tdPjJl.js} +1 -1
- package/dist/assets/DeviceSpecificSettings-V4tdPjJl.js.br +0 -0
- package/dist/assets/{Devices-BcQDQSsT.js → Devices-CtpIK4Ws.js} +1 -1
- package/dist/assets/Devices-CtpIK4Ws.js.br +0 -0
- package/dist/assets/DevicesPage-D4EfGRjL.js +1 -0
- package/dist/assets/DevicesPage-D4EfGRjL.js.br +0 -0
- package/dist/assets/{DisplayValue-Bde1KGeh.js → DisplayValue-8WlGubxH.js} +1 -1
- package/dist/assets/DisplayValue-8WlGubxH.js.br +0 -0
- package/dist/assets/{Docs-B2ZgDo_q.js → Docs-sFq-lOLl.js} +1 -1
- package/dist/assets/Docs-sFq-lOLl.js.br +0 -0
- package/dist/assets/{Duration-JbjSfE2n.js → Duration-Dk-M8m22.js} +1 -1
- package/dist/assets/Duration-Dk-M8m22.js.br +0 -0
- package/dist/assets/{EndpointPicker-DCEjZv_Q.js → EndpointPicker-D4BSoZaj.js} +1 -1
- package/dist/assets/EndpointPicker-D4BSoZaj.js.br +0 -0
- package/dist/assets/{Exposes-BXCJVn_x.js → Exposes-bB94Rgbe.js} +1 -1
- package/dist/assets/Exposes-bB94Rgbe.js.br +0 -0
- package/dist/assets/{Exposes-D2lPvKwq.js → Exposes-gQ_6exxj.js} +1 -1
- package/dist/assets/Exposes-gQ_6exxj.js.br +0 -0
- package/dist/assets/{FeatureWrapper-Yn8oD_Xr.js → FeatureWrapper-CuGmNNoZ.js} +1 -1
- package/dist/assets/FeatureWrapper-CuGmNNoZ.js.br +0 -0
- package/dist/assets/{FrontendSettingsPage-CGQA2MuZ.js → FrontendSettingsPage-BIIt0B5P.js} +1 -1
- package/dist/assets/FrontendSettingsPage-BIIt0B5P.js.br +0 -0
- package/dist/assets/{GroupPage-DanGbJ6d.js → GroupPage-D4YaBv4i.js} +2 -2
- package/dist/assets/GroupPage-D4YaBv4i.js.br +0 -0
- package/dist/assets/{GroupSettings-Br0dJD8r.js → GroupSettings-BU-O0I-b.js} +1 -1
- package/dist/assets/GroupSettings-BU-O0I-b.js.br +0 -0
- package/dist/assets/{Groups-DtkO-kcX.js → Groups-Dp30C12q.js} +1 -1
- package/dist/assets/Groups-Dp30C12q.js.br +0 -0
- package/dist/assets/{GroupsPage-CMD_QGup.js → GroupsPage-XgAqzk9f.js} +1 -1
- package/dist/assets/GroupsPage-XgAqzk9f.js.br +0 -0
- package/dist/assets/{Health-BbcPcZA-.js → Health-BA6PJpPI.js} +1 -1
- package/dist/assets/Health-BA6PJpPI.js.br +0 -0
- package/dist/assets/{HomePage-Cl139PZ4.js → HomePage-VQUdO7So.js} +1 -1
- package/dist/assets/HomePage-VQUdO7So.js.br +0 -0
- package/dist/assets/{IndeterminateCheckbox-DW5TMSl4.js → IndeterminateCheckbox-BmOSk4cJ.js} +1 -1
- package/dist/assets/IndeterminateCheckbox-BmOSk4cJ.js.br +0 -0
- package/dist/assets/InfoAlert-BYb1Ijsc.js +1 -0
- package/dist/assets/InfoAlert-BYb1Ijsc.js.br +0 -0
- package/dist/assets/{InputField-DluRTnPF.js → InputField-DBG-IjF8.js} +1 -1
- package/dist/assets/InputField-DBG-IjF8.js.br +0 -0
- package/dist/assets/{Json-Dk8IlvF5.js → Json-Xr5KQjbb.js} +1 -1
- package/dist/assets/Json-Xr5KQjbb.js.br +0 -0
- package/dist/assets/{LastSeen-Dcqgpo_x.js → LastSeen-DuqkpiII.js} +1 -1
- package/dist/assets/LastSeen-DuqkpiII.js.br +1 -0
- package/dist/assets/{LogsPage-BYtMU4_m.js → LogsPage-HVCihoop.js} +1 -1
- package/dist/assets/LogsPage-HVCihoop.js.br +0 -0
- package/dist/assets/{Lqi-DiZrNrdx.js → Lqi-DzsgggAL.js} +1 -1
- package/dist/assets/Lqi-DzsgggAL.js.br +0 -0
- package/dist/assets/{NetworkPage-Cz9eaWaB.js → NetworkPage-v3sbC3LY.js} +2 -2
- package/dist/assets/NetworkPage-v3sbC3LY.js.br +0 -0
- package/dist/assets/{NumberField-B9niXzGd.js → NumberField-Cft7S9El.js} +1 -1
- package/dist/assets/NumberField-Cft7S9El.js.br +0 -0
- package/dist/assets/{OtaControlGroup-BGz_clAW.js → OtaControlGroup-DSxACZwU.js} +1 -1
- package/dist/assets/OtaControlGroup-DSxACZwU.js.br +0 -0
- package/dist/assets/{OtaPage-acKcWzpb.js → OtaPage-BaukyTFL.js} +1 -1
- package/dist/assets/OtaPage-BaukyTFL.js.br +0 -0
- package/dist/assets/{PowerSource-q8QGN6VM.js → PowerSource-C9PkIWWx.js} +1 -1
- package/dist/assets/PowerSource-C9PkIWWx.js.br +0 -0
- package/dist/assets/{RawNetworkData-1sfbKmIT.js → RawNetworkData-BrKJDfDC.js} +1 -1
- package/dist/assets/RawNetworkData-BrKJDfDC.js.br +0 -0
- package/dist/assets/{RawNetworkMap-B0qSKrAZ.js → RawNetworkMap-BPFMSW9F.js} +1 -1
- package/dist/assets/RawNetworkMap-BPFMSW9F.js.br +0 -0
- package/dist/assets/{RecallRemove-DTduKoA-.js → RecallRemove-DB4u8g49.js} +1 -1
- package/dist/assets/RecallRemove-DB4u8g49.js.br +0 -0
- package/dist/assets/RemoveDeviceModal-C-C4nIYP.js +1 -0
- package/dist/assets/RemoveDeviceModal-C-C4nIYP.js.br +0 -0
- package/dist/assets/{Reporting-BRC7k81D.js → Reporting-BrO129nK.js} +1 -1
- package/dist/assets/Reporting-BrO129nK.js.br +0 -0
- package/dist/assets/{ReportingPage-hiDwZUDm.js → ReportingPage-VQM1etxl.js} +1 -1
- package/dist/assets/ReportingPage-VQM1etxl.js.br +0 -0
- package/dist/assets/{ReportingRow-DrrvSIxH.js → ReportingRow-CHHj04Su.js} +1 -1
- package/dist/assets/ReportingRow-CHHj04Su.js.br +0 -0
- package/dist/assets/{Scene-DIFYbvkR.js → Scene-CWougPHR.js} +1 -1
- package/dist/assets/Scene-CWougPHR.js.br +0 -0
- package/dist/assets/{SelectField-DeTNGgWr.js → SelectField-JWPpuidh.js} +1 -1
- package/dist/assets/SelectField-JWPpuidh.js.br +0 -0
- package/dist/assets/{Settings-BEtuGRLL.js → Settings-D6AUIQUZ.js} +1 -1
- package/dist/assets/Settings-D6AUIQUZ.js.br +0 -0
- package/dist/assets/{SettingsList-B9ee47rK.js → SettingsList-BKLVWCQb.js} +1 -1
- package/dist/assets/SettingsList-BKLVWCQb.js.br +0 -0
- package/dist/assets/{SettingsPage-Csl4gGlo.js → SettingsPage-CE80kDSa.js} +2 -2
- package/dist/assets/SettingsPage-CE80kDSa.js.br +0 -0
- package/dist/assets/State-T57UIGbi.js +1 -0
- package/dist/assets/State-T57UIGbi.js.br +0 -0
- package/dist/assets/Table-D4Pe1SGt.js +1 -0
- package/dist/assets/Table-D4Pe1SGt.js.br +0 -0
- package/dist/assets/{TextareaField-BWAarzAH.js → TextareaField-DL3qwzHr.js} +1 -1
- package/dist/assets/TextareaField-DL3qwzHr.js.br +0 -0
- package/dist/assets/{TimeAgo-Cn8EU0M8.js → TimeAgo-D8Qg455l.js} +1 -1
- package/dist/assets/TimeAgo-D8Qg455l.js.br +0 -0
- package/dist/assets/{Tools-BPOsD6_L.js → Tools-Bs3ADVEx.js} +1 -1
- package/dist/assets/Tools-Bs3ADVEx.js.br +0 -0
- package/dist/assets/{TouchlinkPage-C8ICAcAw.js → TouchlinkPage-CqDuwnnO.js} +1 -1
- package/dist/assets/TouchlinkPage-CqDuwnnO.js.br +0 -0
- package/dist/assets/{VendorLink-CImg8YQo.js → VendorLink-BTghUeUV.js} +1 -1
- package/dist/assets/VendorLink-BTghUeUV.js.br +0 -0
- package/dist/assets/{_createCompounder-C3OKcadI.js → _createCompounder-KpkcgNnL.js} +1 -1
- package/dist/assets/_createCompounder-KpkcgNnL.js.br +0 -0
- package/dist/assets/floating-ui.dom-D02yrJtw.js +1 -0
- package/dist/assets/floating-ui.dom-D02yrJtw.js.br +0 -0
- package/dist/assets/floating-ui.react-BHMQGHCG.js +1 -0
- package/dist/assets/floating-ui.react-BHMQGHCG.js.br +0 -0
- package/dist/assets/index-B_eahVWI.js +1104 -0
- package/dist/assets/index-B_eahVWI.js.br +0 -0
- package/dist/assets/index-BtdcwP6l.css +1 -0
- package/dist/assets/index-BtdcwP6l.css.br +0 -0
- package/dist/assets/{isObjectLike-_sNiXEP6.js → isObjectLike-mS1hgzH9.js} +1 -1
- package/dist/assets/isObjectLike-mS1hgzH9.js.br +0 -0
- package/dist/assets/{jszip.min-CnFZnmmU.js → jszip.min-BWTg2zzb.js} +1 -1
- package/dist/assets/jszip.min-BWTg2zzb.js.br +0 -0
- package/dist/assets/{merge-Dc_L-YaK.js → merge-CkWezbly.js} +1 -1
- package/dist/assets/merge-CkWezbly.js.br +0 -0
- package/dist/assets/oui-DZhdJrax.js +1 -0
- package/dist/assets/oui-DZhdJrax.js.br +0 -0
- package/dist/assets/{react-select.esm-D1i3P0fQ.js → react-select.esm-BQis7zht.js} +1 -1
- package/dist/assets/react-select.esm-BQis7zht.js.br +0 -0
- package/dist/assets/snakeCase-CJzHmbbg.js +1 -0
- package/dist/assets/snakeCase-CJzHmbbg.js.br +0 -0
- package/dist/assets/{startCase-BeJgjsmJ.js → startCase-BlYkzI2K.js} +1 -1
- package/dist/assets/startCase-BlYkzI2K.js.br +0 -0
- package/dist/assets/{useColumnCount-BIOO86ok.js → useColumnCount-C5Hk15aM.js} +1 -1
- package/dist/assets/useColumnCount-C5Hk15aM.js.br +0 -0
- package/dist/assets/{useSearch-CKvEE-gg.js → useSearch-BuVIcQ48.js} +1 -1
- package/dist/assets/useSearch-BuVIcQ48.js.br +0 -0
- package/dist/assets/{useTable-hokZ-kgr.js → useTable-BSrHjfh7.js} +1 -1
- package/dist/assets/useTable-BSrHjfh7.js.br +0 -0
- package/dist/index.html +2 -2
- package/dist/index.html.br +0 -0
- package/dist/onboarding/assets/index-BdRPFV0I.css +1 -0
- package/dist/onboarding/assets/index-BdRPFV0I.css.br +0 -0
- package/dist/onboarding/assets/{index-D_6oghNx.js → index-zVqX9OsS.js} +16 -16
- package/dist/onboarding/assets/index-zVqX9OsS.js.br +0 -0
- package/dist/onboarding/index.html +2 -2
- package/dist/onboarding/index.html.br +0 -0
- package/package.json +14 -14
- package/dist/assets/About-Ds4E5jmt.js.br +0 -0
- package/dist/assets/ActivityPage-z4HvbBIA.js.br +0 -0
- package/dist/assets/Bind-BVQS0LRq.js.br +0 -0
- package/dist/assets/BindRow-BqPe9jRt.js.br +0 -0
- package/dist/assets/BindingsPage-Dj1ao25d.js.br +0 -0
- package/dist/assets/Bridge-pvypw6CK.js +0 -1
- package/dist/assets/Bridge-pvypw6CK.js.br +0 -0
- package/dist/assets/CheckboxField-CuYpvZuF.js.br +0 -0
- package/dist/assets/ClusterSinglePicker-BSWFzqBE.js.br +0 -0
- package/dist/assets/Clusters-D_vIyhtD.js.br +0 -0
- package/dist/assets/ContributePage-B-DYlK4j.js.br +0 -0
- package/dist/assets/Dashboard-DweF1rsG.js +0 -1
- package/dist/assets/Dashboard-DweF1rsG.js.br +0 -0
- package/dist/assets/DashboardFeatureWrapper-FsZiU1sw.js.br +0 -0
- package/dist/assets/DebouncedInput-BQDPX7Sm.js.br +0 -0
- package/dist/assets/DevConsole-Cx8XCb78.js.br +0 -0
- package/dist/assets/DevConsole-DznCAH02.js.br +0 -0
- package/dist/assets/DeviceCard-CPph_TDG.js.br +0 -0
- package/dist/assets/DeviceImage-C318RT7U.js.br +0 -0
- package/dist/assets/DeviceInfo-DOlqbufu.js +0 -27
- package/dist/assets/DeviceInfo-DOlqbufu.js.br +0 -0
- package/dist/assets/DevicePage-C34abgvz.js.br +0 -0
- package/dist/assets/DevicePicker-BkIPjn9I.js.br +0 -0
- package/dist/assets/DeviceSettings-C6-5bmf7.js.br +0 -0
- package/dist/assets/DeviceSpecificSettings-BlsShCQQ.js.br +0 -0
- package/dist/assets/Devices-BcQDQSsT.js.br +0 -0
- package/dist/assets/DevicesPage-y-E3vlO8.js +0 -1
- package/dist/assets/DevicesPage-y-E3vlO8.js.br +0 -0
- package/dist/assets/DisplayValue-Bde1KGeh.js.br +0 -0
- package/dist/assets/Docs-B2ZgDo_q.js.br +0 -0
- package/dist/assets/Duration-JbjSfE2n.js.br +0 -0
- package/dist/assets/EndpointPicker-DCEjZv_Q.js.br +0 -0
- package/dist/assets/Exposes-BXCJVn_x.js.br +0 -2
- package/dist/assets/Exposes-D2lPvKwq.js.br +0 -0
- package/dist/assets/FeatureWrapper-Yn8oD_Xr.js.br +0 -0
- package/dist/assets/FrontendSettingsPage-CGQA2MuZ.js.br +0 -0
- package/dist/assets/GroupPage-DanGbJ6d.js.br +0 -0
- package/dist/assets/GroupSettings-Br0dJD8r.js.br +0 -0
- package/dist/assets/Groups-DtkO-kcX.js.br +0 -0
- package/dist/assets/GroupsPage-CMD_QGup.js.br +0 -0
- package/dist/assets/Health-BbcPcZA-.js.br +0 -0
- package/dist/assets/HomePage-Cl139PZ4.js.br +0 -0
- package/dist/assets/IndeterminateCheckbox-DW5TMSl4.js.br +0 -0
- package/dist/assets/InfoAlert-SBQCV8TC.js +0 -1
- package/dist/assets/InfoAlert-SBQCV8TC.js.br +0 -0
- package/dist/assets/InputField-DluRTnPF.js.br +0 -0
- package/dist/assets/Json-Dk8IlvF5.js.br +0 -2
- package/dist/assets/LastSeen-Dcqgpo_x.js.br +0 -1
- package/dist/assets/LogsPage-BYtMU4_m.js.br +0 -0
- package/dist/assets/Lqi-DiZrNrdx.js.br +0 -0
- package/dist/assets/NetworkPage-Cz9eaWaB.js.br +0 -0
- package/dist/assets/NumberField-B9niXzGd.js.br +0 -0
- package/dist/assets/OtaControlGroup-BGz_clAW.js.br +0 -0
- package/dist/assets/OtaPage-acKcWzpb.js.br +0 -0
- package/dist/assets/PowerSource-q8QGN6VM.js.br +0 -0
- package/dist/assets/RawNetworkData-1sfbKmIT.js.br +0 -0
- package/dist/assets/RawNetworkMap-B0qSKrAZ.js.br +0 -0
- package/dist/assets/RecallRemove-DTduKoA-.js.br +0 -0
- package/dist/assets/RemoveDeviceModal-De1OAZRw.js +0 -1
- package/dist/assets/RemoveDeviceModal-De1OAZRw.js.br +0 -0
- package/dist/assets/Reporting-BRC7k81D.js.br +0 -0
- package/dist/assets/ReportingPage-hiDwZUDm.js.br +0 -0
- package/dist/assets/ReportingRow-DrrvSIxH.js.br +0 -0
- package/dist/assets/Scene-DIFYbvkR.js.br +0 -0
- package/dist/assets/SelectField-DeTNGgWr.js.br +0 -0
- package/dist/assets/Settings-BEtuGRLL.js.br +0 -0
- package/dist/assets/SettingsList-B9ee47rK.js.br +0 -0
- package/dist/assets/SettingsPage-Csl4gGlo.js.br +0 -0
- package/dist/assets/State-BdeLzFY1.js +0 -1
- package/dist/assets/State-BdeLzFY1.js.br +0 -0
- package/dist/assets/Table-BdgAksG_.js +0 -1
- package/dist/assets/Table-BdgAksG_.js.br +0 -0
- package/dist/assets/TextareaField-BWAarzAH.js.br +0 -0
- package/dist/assets/TimeAgo-Cn8EU0M8.js.br +0 -0
- package/dist/assets/Tools-BPOsD6_L.js.br +0 -0
- package/dist/assets/TouchlinkPage-C8ICAcAw.js.br +0 -0
- package/dist/assets/VendorLink-CImg8YQo.js.br +0 -0
- package/dist/assets/_createCompounder-C3OKcadI.js.br +0 -0
- package/dist/assets/floating-ui.dom-DbzrgdRQ.js +0 -1
- package/dist/assets/floating-ui.dom-DbzrgdRQ.js.br +0 -0
- package/dist/assets/floating-ui.react-C3wWHfVL.js +0 -1
- package/dist/assets/floating-ui.react-C3wWHfVL.js.br +0 -0
- package/dist/assets/index-DHfDbN_5.css +0 -1
- package/dist/assets/index-DHfDbN_5.css.br +0 -0
- package/dist/assets/index-gwEIVCDE.js +0 -1104
- package/dist/assets/index-gwEIVCDE.js.br +0 -0
- package/dist/assets/isObjectLike-_sNiXEP6.js.br +0 -4
- package/dist/assets/jszip.min-CnFZnmmU.js.br +0 -0
- package/dist/assets/merge-Dc_L-YaK.js.br +0 -0
- package/dist/assets/oui-yLt1YL8J.js +0 -1
- package/dist/assets/oui-yLt1YL8J.js.br +0 -0
- package/dist/assets/react-select.esm-D1i3P0fQ.js.br +0 -0
- package/dist/assets/snakeCase-CL4tidbi.js +0 -1
- package/dist/assets/snakeCase-CL4tidbi.js.br +0 -0
- package/dist/assets/startCase-BeJgjsmJ.js.br +0 -0
- package/dist/assets/useColumnCount-BIOO86ok.js.br +0 -0
- package/dist/assets/useSearch-CKvEE-gg.js.br +0 -0
- package/dist/assets/useTable-hokZ-kgr.js.br +0 -0
- package/dist/onboarding/assets/index-D_6oghNx.js.br +0 -0
- package/dist/onboarding/assets/index-TksH0CIe.css +0 -1
- package/dist/onboarding/assets/index-TksH0CIe.css.br +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{da as ML,db as EL,aX as Vl,dc as TL,d7 as fu,dd as AL,r as q,j as de,de as CL,df as RL,dg as IL,I as KA,u as Vg,t as PL,F as Jn,ap as DL,B as Wr,dh as LL,di as UL,f as NL,dj as OL,dk as FL,dl as kL,dm as zL,dn as BL,dp as GL,az as du,bB as VL,dq as HL,cl as WL,a2 as jL,cX as iy,a as XL,m as Pw,aI as Dw}from"./index-gwEIVCDE.js";import{m as qL}from"./merge-Dc_L-YaK.js";import{g as $L}from"./index-CDoSh7QA.js";import{E as Tl,Z as gi,N as gm,c as _h}from"./index-Bs7zcW7e.js";import"./envs-CRUy-_iG.js";import"./isObjectLike-_sNiXEP6.js";import"./isObject--vsEa_js.js";const Hg="184",JA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},YL={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},QA=0,K_=1,eC=2,ZL=3,tC=0,pu=1,ff=2,bl=3,Po=0,Zi=1,Bn=2,Ws=0,Al=1,J_=2,Q_=3,ex=4,nC=5,KL=6,ya=100,iC=101,rC=102,sC=103,oC=104,aC=200,lC=201,cC=202,uC=203,Rm=204,Im=205,hC=206,fC=207,dC=208,pC=209,mC=210,gC=211,vC=212,yC=213,_C=214,Pm=0,Dm=1,Lm=2,Dl=3,Um=4,Nm=5,Om=6,Fm=7,sd=0,xC=1,bC=2,Zr=0,Kx=1,Jx=2,Qx=3,Wg=4,eb=5,tb=6,nb=7,tx="attached",SC="detached",jg=300,Xs=301,Ta=302,df=303,pf=304,Uu=306,If=1e3,hr=1001,Pf=1002,Hn=1003,ib=1004,JL=1004,lu=1005,QL=1005,gn=1006,mf=1007,eU=1007,Vs=1008,tU=1008,Xi=1009,rb=1010,sb=1011,_u=1012,Xg=1013,Jr=1014,Yi=1015,qs=1016,qg=1017,$g=1018,xu=1020,ob=35902,ab=35899,lb=1021,cb=1022,Oi=1023,$s=1026,_a=1027,Yg=1028,od=1029,Aa=1030,Zg=1031,nU=1032,Kg=1033,gf=33776,vf=33777,yf=33778,_f=33779,km=35840,zm=35841,Bm=35842,Gm=35843,Vm=36196,Hm=37492,Wm=37496,jm=37488,Xm=37489,Df=37490,qm=37491,$m=37808,Ym=37809,Zm=37810,Km=37811,Jm=37812,Qm=37813,eg=37814,tg=37815,ng=37816,ig=37817,rg=37818,sg=37819,og=37820,ag=37821,lg=36492,cg=36494,ug=36495,hg=36283,fg=36284,Lf=36285,dg=36286,wC=2200,MC=2201,EC=2202,Uf=2300,pg=2301,vm=2302,nx=2303,Sl=2400,wl=2401,Nf=2402,Jg=2500,ub=2501,iU=0,rU=1,sU=2,TC=3200,AC=3201,oU=3202,aU=3203,Do=0,CC=1,Eo="",Ni="srgb",bu="srgb-linear",Of="linear",hn="srgb",lU="",cU="rg",uU="ga",hU=0,yl=7680,fU=7681,dU=7682,pU=7683,mU=34055,gU=34056,vU=5386,yU=512,_U=513,xU=514,bU=515,SU=516,wU=517,MU=518,ix=519,RC=512,IC=513,PC=514,Qg=515,DC=516,LC=517,e0=518,UC=519,Ff=35044,EU=35048,TU=35040,AU=35045,CU=35049,RU=35041,IU=35046,PU=35050,DU=35042,LU="100",rx="300 es",Dr=2e3,Ll=2001,UU={COMPUTE:"compute",RENDER:"render"},NU={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},OU={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},FU={TEXTURE_COMPARE:"depthTextureCompare"};function kU(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const zU={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function cu(n,e){return new zU[n](e)}function NC(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function kf(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function OC(){const n=kf("canvas");return n.style.display="block",n}const Lw={};let Ca=null;function BU(n){Ca=n}function GU(){return Ca}function zf(...n){const e="THREE."+n.shift();Ca?Ca("log",e,...n):console.log(e,...n)}function FC(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ot(...n){n=FC(n);const e="THREE."+n.shift();if(Ca)Ca("warn",e,...n);else{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function bt(...n){n=FC(n);const e="THREE."+n.shift();if(Ca)Ca("error",e,...n);else{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function mg(...n){const e=n.join(" ");e in Lw||(Lw[e]=!0,ot(...n))}function VU(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const HU={[Pm]:Dm,[Lm]:Om,[Um]:Fm,[Dl]:Nm,[Dm]:Pm,[Om]:Lm,[Fm]:Um,[Nm]:Dl};let bs=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[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 i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}};const Di=["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 Uw=1234567;const Cl=Math.PI/180,Su=180/Math.PI;function Lr(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Di[n&255]+Di[n>>8&255]+Di[n>>16&255]+Di[n>>24&255]+"-"+Di[e&255]+Di[e>>8&255]+"-"+Di[e>>16&15|64]+Di[e>>24&255]+"-"+Di[t&63|128]+Di[t>>8&255]+"-"+Di[t>>16&255]+Di[t>>24&255]+Di[i&255]+Di[i>>8&255]+Di[i>>16&255]+Di[i>>24&255]).toLowerCase()}function Ct(n,e,t){return Math.max(e,Math.min(t,n))}function hb(n,e){return(n%e+e)%e}function WU(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function jU(n,e,t){return n!==e?(t-n)/(e-n):0}function xf(n,e,t){return(1-t)*n+t*e}function XU(n,e,t,i){return xf(n,e,1-Math.exp(-t*i))}function qU(n,e=1){return e-Math.abs(hb(n,e*2)-e)}function $U(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function YU(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function ZU(n,e){return n+Math.floor(Math.random()*(e-n+1))}function KU(n,e){return n+Math.random()*(e-n)}function JU(n){return n*(.5-Math.random())}function QU(n){n!==void 0&&(Uw=n);let e=Uw+=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 eN(n){return n*Cl}function tN(n){return n*Su}function nN(n){return(n&n-1)===0&&n!==0}function iN(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function rN(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function sN(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),f=o((e+i)/2),d=s((e-i)/2),p=o((e-i)/2),m=s((i-e)/2),g=o((i-e)/2);switch(r){case"XYX":n.set(a*f,l*d,l*p,a*c);break;case"YZY":n.set(l*p,a*f,l*d,a*c);break;case"ZXZ":n.set(l*d,l*p,a*f,a*c);break;case"XZX":n.set(a*f,l*g,l*m,a*c);break;case"YXY":n.set(l*m,a*f,l*g,a*c);break;case"ZYZ":n.set(l*g,l*m,a*f,a*c);break;default:ot("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function qi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Gt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const gg={DEG2RAD:Cl,RAD2DEG:Su,generateUUID:Lr,clamp:Ct,euclideanModulo:hb,mapLinear:WU,inverseLerp:jU,lerp:xf,damp:XU,pingpong:qU,smoothstep:$U,smootherstep:YU,randInt:ZU,randFloat:KU,randFloatSpread:JU,seededRandom:QU,degToRad:eN,radToDeg:tN,isPowerOfTwo:nN,ceilPowerOfTwo:iN,floorPowerOfTwo:rN,setQuaternionFromProperEuler:sN,normalize:Gt,denormalize:qi},C1=class C1{constructor(e=0,t=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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+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=Ct(this.x,e.x,t.x),this.y=Ct(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ct(this.x,e,t),this.y=Ct(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ct(i,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 i=this.dot(e)/t;return Math.acos(Ct(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};C1.prototype.isVector2=!0;let Ve=C1;class vi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],f=i[r+2],d=i[r+3],p=s[o+0],m=s[o+1],g=s[o+2],x=s[o+3];if(d!==x||l!==p||c!==m||f!==g){let _=l*p+c*m+f*g+d*x;_<0&&(p=-p,m=-m,g=-g,x=-x,_=-_);let y=1-a;if(_<.9995){const b=Math.acos(_),w=Math.sin(b);y=Math.sin(y*b)/w,a=Math.sin(a*b)/w,l=l*y+p*a,c=c*y+m*a,f=f*y+g*a,d=d*y+x*a}else{l=l*y+p*a,c=c*y+m*a,f=f*y+g*a,d=d*y+x*a;const b=1/Math.sqrt(l*l+c*c+f*f+d*d);l*=b,c*=b,f*=b,d*=b}}e[t]=l,e[t+1]=c,e[t+2]=f,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],f=i[r+3],d=s[o],p=s[o+1],m=s[o+2],g=s[o+3];return e[t]=a*g+f*d+l*m-c*p,e[t+1]=l*g+f*p+c*d-a*m,e[t+2]=c*g+f*m+a*p-l*d,e[t+3]=f*g-a*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,i,r){return this._x=e,this._y=t,this._z=i,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 i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),f=a(r/2),d=a(s/2),p=l(i/2),m=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=p*f*d+c*m*g,this._y=c*m*d-p*f*g,this._z=c*f*g+p*m*d,this._w=c*f*d-p*m*g;break;case"YXZ":this._x=p*f*d+c*m*g,this._y=c*m*d-p*f*g,this._z=c*f*g-p*m*d,this._w=c*f*d+p*m*g;break;case"ZXY":this._x=p*f*d-c*m*g,this._y=c*m*d+p*f*g,this._z=c*f*g+p*m*d,this._w=c*f*d-p*m*g;break;case"ZYX":this._x=p*f*d-c*m*g,this._y=c*m*d+p*f*g,this._z=c*f*g-p*m*d,this._w=c*f*d+p*m*g;break;case"YZX":this._x=p*f*d+c*m*g,this._y=c*m*d+p*f*g,this._z=c*f*g-p*m*d,this._w=c*f*d-p*m*g;break;case"XZY":this._x=p*f*d-c*m*g,this._y=c*m*d-p*f*g,this._z=c*f*g+p*m*d,this._w=c*f*d+p*m*g;break;default:ot("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],f=t[6],d=t[10],p=i+a+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(f-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(i>a&&i>d){const m=2*Math.sqrt(1+i-a-d);this._w=(f-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>d){const m=2*Math.sqrt(1+a-i-d);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+f)/m}else{const m=2*Math.sqrt(1+d-i-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+f)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ct(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);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 i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,f=t._w;return this._x=i*f+o*a+r*c-s*l,this._y=r*f+o*l+s*a-i*c,this._z=s*f+o*c+i*l-r*a,this._w=o*f-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(i=-i,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){const c=Math.acos(a),f=Math.sin(c);l=Math.sin(l*c)/f,t=Math.sin(t*c)/f,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);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}}const R1=class R1{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(Nw.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nw.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),f=2*(a*t-s*r),d=2*(s*i-o*t);return this.x=t+l*c+o*d-a*f,this.y=i+l*f+a*c-s*d,this.z=r+l*d+s*f-o*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,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+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=Ct(this.x,e.x,t.x),this.y=Ct(this.y,e.y,t.y),this.z=Ct(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ct(this.x,e,t),this.y=Ct(this.y,e,t),this.z=Ct(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ct(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ry.copy(this).projectOnVector(e),this.sub(ry)}reflect(e){return this.sub(ry.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 i=this.dot(e)/t;return Math.acos(Ct(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+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,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,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,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};R1.prototype.isVector3=!0;let $=R1;const ry=new $,Nw=new vi,I1=class I1{constructor(e,t,i,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const f=this.elements;return f[0]=e,f[1]=r,f[2]=a,f[3]=t,f[4]=s,f[5]=l,f[6]=i,f[7]=o,f[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],f=i[4],d=i[7],p=i[2],m=i[5],g=i[8],x=r[0],_=r[3],y=r[6],b=r[1],w=r[4],M=r[7],T=r[2],E=r[5],I=r[8];return s[0]=o*x+a*b+l*T,s[3]=o*_+a*w+l*E,s[6]=o*y+a*M+l*I,s[1]=c*x+f*b+d*T,s[4]=c*_+f*w+d*E,s[7]=c*y+f*M+d*I,s[2]=p*x+m*b+g*T,s[5]=p*_+m*w+g*E,s[8]=p*y+m*M+g*I,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],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8];return t*o*f-t*a*c-i*s*f+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8],d=f*o-a*c,p=a*l-f*s,m=c*s-o*l,g=t*d+i*p+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/g;return e[0]=d*x,e[1]=(r*c-f*i)*x,e[2]=(a*i-r*o)*x,e[3]=p*x,e[4]=(f*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(i*l-c*t)*x,e[8]=(o*t-i*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,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(sy.makeScale(e,t)),this}rotate(e){return this.premultiply(sy.makeRotation(-e)),this}translate(e,t){return this.premultiply(sy.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};I1.prototype.isMatrix3=!0;let Ut=I1;const sy=new Ut,Ow=new Ut().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Fw=new Ut().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function oN(){const n={enabled:!0,workingColorSpace:bu,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===hn&&(r.r=Co(r.r),r.g=Co(r.g),r.b=Co(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===hn&&(r.r=mu(r.r),r.g=mu(r.g),r.b=mu(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===Eo?Of: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,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].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 mg("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return mg("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[bu]:{primaries:e,whitePoint:i,transfer:Of,toXYZ:Ow,fromXYZ:Fw,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ni},outputColorSpaceConfig:{drawingBufferColorSpace:Ni}},[Ni]:{primaries:e,whitePoint:i,transfer:hn,toXYZ:Ow,fromXYZ:Fw,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ni}}}),n}const jt=oN();function Co(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function mu(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Tc;class kC{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Tc===void 0&&(Tc=kf("canvas")),Tc.width=e.width,Tc.height=e.height;const r=Tc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Tc}return i.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=kf("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Co(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Co(t[i]/255)*255):t[i]=Co(t[i]);return{data:t,width:e.width,height:e.height}}else return ot("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let aN=0;class xa{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:aN++}),this.uuid=Lr(),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):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,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 i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(oy(r[o].image)):s.push(oy(r[o]))}else s=oy(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function oy(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?kC.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ot("Texture: Unable to serialize Texture."),{})}let lN=0;const ay=new $;class An extends bs{constructor(e=An.DEFAULT_IMAGE,t=An.DEFAULT_MAPPING,i=hr,r=hr,s=gn,o=Vs,a=Oi,l=Xi,c=An.DEFAULT_ANISOTROPY,f=Eo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:lN++}),this.uuid=Lr(),this.name="",this.source=new xa(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ve(0,0),this.repeat=new Ve(1,1),this.center=new Ve(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,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,this.normalized=!1}get width(){return this.source.getSize(ay).x}get height(){return this.source.getSize(ay).y}get depth(){return this.source.getSize(ay).z}get image(){return this.source.data}set image(e){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.normalized=e.normalized,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 i=e[t];if(i===void 0){ot(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ot(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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,normalized:this.normalized,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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==jg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case hr:e.x=e.x<0?0:1;break;case Pf: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 If:e.y=e.y-Math.floor(e.y);break;case hr:e.y=e.y<0?0:1;break;case Pf: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++}}An.DEFAULT_IMAGE=null;An.DEFAULT_MAPPING=jg;An.DEFAULT_ANISOTROPY=1;const P1=class P1{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,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,i,r){return this.x=e,this.y=t,this.z=i,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,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[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,i,r,s;const l=e.elements,c=l[0],f=l[4],d=l[8],p=l[1],m=l[5],g=l[9],x=l[2],_=l[6],y=l[10];if(Math.abs(f-p)<.01&&Math.abs(d-x)<.01&&Math.abs(g-_)<.01){if(Math.abs(f+p)<.1&&Math.abs(d+x)<.1&&Math.abs(g+_)<.1&&Math.abs(c+m+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,M=(m+1)/2,T=(y+1)/2,E=(f+p)/4,I=(d+x)/4,A=(g+_)/4;return w>M&&w>T?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=E/i,s=I/i):M>T?M<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),i=E/r,s=A/r):T<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),i=I/s,r=A/s),this.set(i,r,s,t),this}let b=Math.sqrt((_-g)*(_-g)+(d-x)*(d-x)+(p-f)*(p-f));return Math.abs(b)<.001&&(b=1),this.x=(_-g)/b,this.y=(d-x)/b,this.z=(p-f)/b,this.w=Math.acos((c+m+y-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=Ct(this.x,e.x,t.x),this.y=Ct(this.y,e.y,t.y),this.z=Ct(this.z,e.z,t.z),this.w=Ct(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ct(this.x,e,t),this.y=Ct(this.y,e,t),this.z=Ct(this.z,e,t),this.w=Ct(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ct(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,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}};P1.prototype.isVector4=!0;let ln=P1;class fb extends bs{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new ln(0,0,e,t),this.scissorTest=!1,this.viewport=new ln(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new An(r),o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:gn,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 i=0;i<this.textures.length;i++)this.textures[i].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,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;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=i,this.textures[r].isData3DTexture!==!0&&(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,i=e.textures.length;t<i;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 xa(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.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ur extends fb{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class t0 extends An{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Hn,this.minFilter=Hn,this.wrapR=hr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class cN extends Ur{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new t0(null,e,t,i),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class n0 extends An{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Hn,this.minFilter=Hn,this.wrapR=hr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class uN extends Ur{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new n0(null,e,t,i),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}const Gg=class Gg{constructor(e,t,i,r,s,o,a,l,c,f,d,p,m,g,x,_){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,i,r,s,o,a,l,c,f,d,p,m,g,x,_)}set(e,t,i,r,s,o,a,l,c,f,d,p,m,g,x,_){const y=this.elements;return y[0]=e,y[4]=t,y[8]=i,y[12]=r,y[1]=s,y[5]=o,y[9]=a,y[13]=l,y[2]=c,y[6]=f,y[10]=d,y[14]=p,y[3]=m,y[7]=g,y[11]=x,y[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 Gg().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/Ac.setFromMatrixColumn(e,0).length(),s=1/Ac.setFromMatrixColumn(e,1).length(),o=1/Ac.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),f=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=o*f,m=o*d,g=a*f,x=a*d;t[0]=l*f,t[4]=-l*d,t[8]=c,t[1]=m+g*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=g+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*f,m=l*d,g=c*f,x=c*d;t[0]=p+x*a,t[4]=g*a-m,t[8]=o*c,t[1]=o*d,t[5]=o*f,t[9]=-a,t[2]=m*a-g,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*f,m=l*d,g=c*f,x=c*d;t[0]=p-x*a,t[4]=-o*d,t[8]=g+m*a,t[1]=m+g*a,t[5]=o*f,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*f,m=o*d,g=a*f,x=a*d;t[0]=l*f,t[4]=g*c-m,t[8]=p*c+x,t[1]=l*d,t[5]=x*c+p,t[9]=m*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,g=a*l,x=a*c;t[0]=l*f,t[4]=x-p*d,t[8]=g*d+m,t[1]=d,t[5]=o*f,t[9]=-a*f,t[2]=-c*f,t[6]=m*d+g,t[10]=p-x*d}else if(e.order==="XZY"){const p=o*l,m=o*c,g=a*l,x=a*c;t[0]=l*f,t[4]=-d,t[8]=c*f,t[1]=p*d+x,t[5]=o*f,t[9]=m*d-g,t[2]=g*d-m,t[6]=a*f,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(hN,e,fN)}lookAt(e,t,i){const r=this.elements;return Rr.subVectors(e,t),Rr.lengthSq()===0&&(Rr.z=1),Rr.normalize(),aa.crossVectors(i,Rr),aa.lengthSq()===0&&(Math.abs(i.z)===1?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),aa.crossVectors(i,Rr)),aa.normalize(),sp.crossVectors(Rr,aa),r[0]=aa.x,r[4]=sp.x,r[8]=Rr.x,r[1]=aa.y,r[5]=sp.y,r[9]=Rr.y,r[2]=aa.z,r[6]=sp.z,r[10]=Rr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],f=i[1],d=i[5],p=i[9],m=i[13],g=i[2],x=i[6],_=i[10],y=i[14],b=i[3],w=i[7],M=i[11],T=i[15],E=r[0],I=r[4],A=r[8],R=r[12],D=r[1],L=r[5],U=r[9],N=r[13],B=r[2],z=r[6],k=r[10],O=r[14],Y=r[3],X=r[7],K=r[11],G=r[15];return s[0]=o*E+a*D+l*B+c*Y,s[4]=o*I+a*L+l*z+c*X,s[8]=o*A+a*U+l*k+c*K,s[12]=o*R+a*N+l*O+c*G,s[1]=f*E+d*D+p*B+m*Y,s[5]=f*I+d*L+p*z+m*X,s[9]=f*A+d*U+p*k+m*K,s[13]=f*R+d*N+p*O+m*G,s[2]=g*E+x*D+_*B+y*Y,s[6]=g*I+x*L+_*z+y*X,s[10]=g*A+x*U+_*k+y*K,s[14]=g*R+x*N+_*O+y*G,s[3]=b*E+w*D+M*B+T*Y,s[7]=b*I+w*L+M*z+T*X,s[11]=b*A+w*U+M*k+T*K,s[15]=b*R+w*N+M*O+T*G,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],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],f=e[2],d=e[6],p=e[10],m=e[14],g=e[3],x=e[7],_=e[11],y=e[15],b=l*m-c*p,w=a*m-c*d,M=a*p-l*d,T=o*m-c*f,E=o*p-l*f,I=o*d-a*f;return t*(x*b-_*w+y*M)-i*(g*b-_*T+y*E)+r*(g*w-x*T+y*I)-s*(g*M-x*E+_*I)}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,i){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]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8],d=e[9],p=e[10],m=e[11],g=e[12],x=e[13],_=e[14],y=e[15],b=t*a-i*o,w=t*l-r*o,M=t*c-s*o,T=i*l-r*a,E=i*c-s*a,I=r*c-s*l,A=f*x-d*g,R=f*_-p*g,D=f*y-m*g,L=d*_-p*x,U=d*y-m*x,N=p*y-m*_,B=b*N-w*U+M*L+T*D-E*R+I*A;if(B===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/B;return e[0]=(a*N-l*U+c*L)*z,e[1]=(r*U-i*N-s*L)*z,e[2]=(x*I-_*E+y*T)*z,e[3]=(p*E-d*I-m*T)*z,e[4]=(l*D-o*N-c*R)*z,e[5]=(t*N-r*D+s*R)*z,e[6]=(_*M-g*I-y*w)*z,e[7]=(f*I-p*M+m*w)*z,e[8]=(o*U-a*D+c*A)*z,e[9]=(i*D-t*U-s*A)*z,e[10]=(g*E-x*M+y*b)*z,e[11]=(d*M-f*E-m*b)*z,e[12]=(a*R-o*L-l*A)*z,e[13]=(t*L-i*R+r*A)*z,e[14]=(x*w-g*T-_*b)*z,e[15]=(f*T-d*w+p*b)*z,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,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],i=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,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,f=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,f*a+i,f*l-r*o,0,c*l-r*a,f*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,f=o+o,d=a+a,p=s*c,m=s*f,g=s*d,x=o*f,_=o*d,y=a*d,b=l*c,w=l*f,M=l*d,T=i.x,E=i.y,I=i.z;return r[0]=(1-(x+y))*T,r[1]=(m+M)*T,r[2]=(g-w)*T,r[3]=0,r[4]=(m-M)*E,r[5]=(1-(p+y))*E,r[6]=(_+b)*E,r[7]=0,r[8]=(g+w)*I,r[9]=(_-b)*I,r[10]=(1-(p+x))*I,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let o=Ac.set(r[0],r[1],r[2]).length();const a=Ac.set(r[4],r[5],r[6]).length(),l=Ac.set(r[8],r[9],r[10]).length();s<0&&(o=-o),cs.copy(this);const c=1/o,f=1/a,d=1/l;return cs.elements[0]*=c,cs.elements[1]*=c,cs.elements[2]*=c,cs.elements[4]*=f,cs.elements[5]*=f,cs.elements[6]*=f,cs.elements[8]*=d,cs.elements[9]*=d,cs.elements[10]*=d,t.setFromRotationMatrix(cs),i.x=o,i.y=a,i.z=l,this}makePerspective(e,t,i,r,s,o,a=Dr,l=!1){const c=this.elements,f=2*s/(t-e),d=2*s/(i-r),p=(t+e)/(t-e),m=(i+r)/(i-r);let g,x;if(l)g=s/(o-s),x=o*s/(o-s);else if(a===Dr)g=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===Ll)g=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=f,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]=g,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Dr,l=!1){const c=this.elements,f=2/(t-e),d=2/(i-r),p=-(t+e)/(t-e),m=-(i+r)/(i-r);let g,x;if(l)g=1/(o-s),x=o/(o-s);else if(a===Dr)g=-2/(o-s),x=-(o+s)/(o-s);else if(a===Ll)g=-1/(o-s),x=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=f,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]=g,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Gg.prototype.isMatrix4=!0;let Rt=Gg;const Ac=new $,cs=new Rt,hN=new $(0,0,0),fN=new $(1,1,1),aa=new $,sp=new $,Rr=new $,kw=new Rt,zw=new vi;class Nr{constructor(e=0,t=0,i=0,r=Nr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,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,i,r=this._order){return this._x=e,this._y=t,this._z=i,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,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],f=r[9],d=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Ct(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ct(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ct(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ct(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(-o,c));break;case"YZX":this._z=Math.asin(Ct(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Ct(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,m),this._y=0);break;default:ot("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return kw.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kw,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return zw.setFromEuler(this),this.setFromQuaternion(zw,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}}Nr.DEFAULT_ORDER="XYZ";class wu{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 dN=0;const Bw=new $,Cc=new vi,fo=new Rt,op=new $,xh=new $,pN=new $,mN=new vi,Gw=new $(1,0,0),Vw=new $(0,1,0),Hw=new $(0,0,1),Ww={type:"added"},gN={type:"removed"},Rc={type:"childadded",child:null},ly={type:"childremoved",child:null};class nn extends bs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:dN++}),this.uuid=Lr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nn.DEFAULT_UP.clone();const e=new $,t=new Nr,i=new vi,r=new $(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Rt},normalMatrix:{value:new Ut}}),this.matrix=new Rt,this.matrixWorld=new Rt,this.matrixAutoUpdate=nn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new wu,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.static=!1,this.userData={},this.pivot=null}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 Cc.setFromAxisAngle(e,t),this.quaternion.multiply(Cc),this}rotateOnWorldAxis(e,t){return Cc.setFromAxisAngle(e,t),this.quaternion.premultiply(Cc),this}rotateX(e){return this.rotateOnAxis(Gw,e)}rotateY(e){return this.rotateOnAxis(Vw,e)}rotateZ(e){return this.rotateOnAxis(Hw,e)}translateOnAxis(e,t){return Bw.copy(e).applyQuaternion(this.quaternion),this.position.add(Bw.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Gw,e)}translateY(e){return this.translateOnAxis(Vw,e)}translateZ(e){return this.translateOnAxis(Hw,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(fo.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?op.copy(e):op.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),xh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fo.lookAt(xh,op,this.up):fo.lookAt(op,xh,this.up),this.quaternion.setFromRotationMatrix(fo),r&&(fo.extractRotation(r.matrixWorld),Cc.setFromRotationMatrix(fo),this.quaternion.premultiply(Cc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(bt("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(Ww),Rc.child=e,this.dispatchEvent(Rc),Rc.child=null):bt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(gN),ly.child=e,this.dispatchEvent(ly),ly.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),fo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),fo.multiply(e.parent.matrixWorld)),e.applyMatrix4(fo),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ww),Rc.child=e,this.dispatchEvent(Rc),Rc.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 i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xh,e,pN),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xh,mN,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 i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].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);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}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 i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.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),this.static!==!1&&(r.static=this.static),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.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),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(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),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(a,l){return a[l.uuid]===void 0&&(a[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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,f=l.length;c<f;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 a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),f=o(e.images),d=o(e.shapes),p=o(e.skeletons),m=o(e.animations),g=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),f.length>0&&(i.images=f),d.length>0&&(i.shapes=d),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const f=a[c];delete f.metadata,l.push(f)}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}nn.DEFAULT_UP=new $(0,1,0);nn.DEFAULT_MATRIX_AUTO_UPDATE=!0;nn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class uu extends nn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vN={type:"move"};class ym{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new uu,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 uu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new uu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $,this._grip.eventsEnabled=!1),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 i of e.hand.values())this._getHandJoint(t,i)}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,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const _=t.getJointPose(x,i),y=this._getHandJoint(c,x);_!==null&&(y.matrix.fromArray(_.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=_.radius),y.visible=_!==null}const f=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],p=f.position.distanceTo(d.position),m=.02,g=.005;c.inputState.pinching&&p>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),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,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vN)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new uu;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const zC={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},la={h:0,s:0,l:0},ap={h:0,s:0,l:0};function cy(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}let et=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===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,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ni){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,jt.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=jt.workingColorSpace){return this.r=e,this.g=t,this.b=i,jt.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=jt.workingColorSpace){if(e=hb(e,1),t=Ct(t,0,1),i=Ct(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=cy(o,s,e+1/3),this.g=cy(o,s,e),this.b=cy(o,s,e-1/3)}return jt.colorSpaceToWorking(this,r),this}setStyle(e,t=Ni){function i(s){s!==void 0&&parseFloat(s)<1&&ot("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(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(a))return i(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(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ot("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);ot("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ni){const i=zC[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ot("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=Co(e.r),this.g=Co(e.g),this.b=Co(e.b),this}copyLinearToSRGB(e){return this.r=mu(e.r),this.g=mu(e.g),this.b=mu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ni){return jt.workingToColorSpace(Li.copy(this),e),Math.round(Ct(Li.r*255,0,255))*65536+Math.round(Ct(Li.g*255,0,255))*256+Math.round(Ct(Li.b*255,0,255))}getHexString(e=Ni){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=jt.workingColorSpace){jt.workingToColorSpace(Li.copy(this),t);const i=Li.r,r=Li.g,s=Li.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const f=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=f<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=f,e}getRGB(e,t=jt.workingColorSpace){return jt.workingToColorSpace(Li.copy(this),t),e.r=Li.r,e.g=Li.g,e.b=Li.b,e}getStyle(e=Ni){jt.workingToColorSpace(Li.copy(this),e);const t=Li.r,i=Li.g,r=Li.b;return e!==Ni?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(la),this.setHSL(la.h+e,la.s+t,la.l+i)}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(la),e.getHSL(ap);const i=xf(la.h,ap.h,t),r=xf(la.s,ap.s,t),s=xf(la.l,ap.l,t);return this.setHSL(i,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,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+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 Li=new et;et.NAMES=zC;class i0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new et(e),this.density=t}clone(){return new i0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class r0{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new et(e),this.near=t,this.far=i}clone(){return new r0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class s0 extends nn{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 Nr,this.environmentIntensity=1,this.environmentRotation=new Nr,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}}const us=new $,po=new $,uy=new $,mo=new $,Ic=new $,Pc=new $,jw=new $,hy=new $,fy=new $,dy=new $,py=new ln,my=new ln,gy=new ln;class ur{constructor(e=new $,t=new $,i=new $){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),us.subVectors(e,t),r.cross(us);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){us.subVectors(r,t),po.subVectors(i,t),uy.subVectors(e,t);const o=us.dot(us),a=us.dot(po),l=us.dot(uy),c=po.dot(po),f=po.dot(uy),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const p=1/d,m=(c*l-a*f)*p,g=(o*f-a*l)*p;return s.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,mo)===null?!1:mo.x>=0&&mo.y>=0&&mo.x+mo.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,mo)===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,mo.x),l.addScaledVector(o,mo.y),l.addScaledVector(a,mo.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return py.setScalar(0),my.setScalar(0),gy.setScalar(0),py.fromBufferAttribute(e,t),my.fromBufferAttribute(e,i),gy.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(py,s.x),o.addScaledVector(my,s.y),o.addScaledVector(gy,s.z),o}static isFrontFacing(e,t,i,r){return us.subVectors(i,t),po.subVectors(e,t),us.cross(po).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),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 us.subVectors(this.c,this.b),po.subVectors(this.a,this.b),us.cross(po).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ur.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ur.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ur.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ur.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ur.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Ic.subVectors(r,i),Pc.subVectors(s,i),hy.subVectors(e,i);const l=Ic.dot(hy),c=Pc.dot(hy);if(l<=0&&c<=0)return t.copy(i);fy.subVectors(e,r);const f=Ic.dot(fy),d=Pc.dot(fy);if(f>=0&&d<=f)return t.copy(r);const p=l*d-f*c;if(p<=0&&l>=0&&f<=0)return o=l/(l-f),t.copy(i).addScaledVector(Ic,o);dy.subVectors(e,s);const m=Ic.dot(dy),g=Pc.dot(dy);if(g>=0&&m<=g)return t.copy(s);const x=m*c-l*g;if(x<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(Pc,a);const _=f*g-m*d;if(_<=0&&d-f>=0&&m-g>=0)return jw.subVectors(s,r),a=(d-f)/(d-f+(m-g)),t.copy(r).addScaledVector(jw,a);const y=1/(_+x+p);return o=x*y,a=p*y,t.copy(i).addScaledVector(Ic,o).addScaledVector(Pc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ai{constructor(e=new $(1/0,1/0,1/0),t=new $(-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,i=e.length;t<i;t+=3)this.expandByPoint(hs.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(hs.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=hs.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,hs):hs.fromBufferAttribute(s,o),hs.applyMatrix4(e.matrixWorld),this.expandByPoint(hs);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),lp.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),lp.copy(i.boundingBox)),lp.applyMatrix4(e.matrixWorld),this.union(lp)}const r=e.children;for(let s=0,o=r.length;s<o;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,hs),hs.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(bh),cp.subVectors(this.max,bh),Dc.subVectors(e.a,bh),Lc.subVectors(e.b,bh),Uc.subVectors(e.c,bh),ca.subVectors(Lc,Dc),ua.subVectors(Uc,Lc),tl.subVectors(Dc,Uc);let t=[0,-ca.z,ca.y,0,-ua.z,ua.y,0,-tl.z,tl.y,ca.z,0,-ca.x,ua.z,0,-ua.x,tl.z,0,-tl.x,-ca.y,ca.x,0,-ua.y,ua.x,0,-tl.y,tl.x,0];return!vy(t,Dc,Lc,Uc,cp)||(t=[1,0,0,0,1,0,0,0,1],!vy(t,Dc,Lc,Uc,cp))?!1:(up.crossVectors(ca,ua),t=[up.x,up.y,up.z],vy(t,Dc,Lc,Uc,cp))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hs).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:(go[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),go[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),go[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),go[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),go[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),go[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),go[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),go[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(go),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 go=[new $,new $,new $,new $,new $,new $,new $,new $],hs=new $,lp=new ai,Dc=new $,Lc=new $,Uc=new $,ca=new $,ua=new $,tl=new $,bh=new $,cp=new $,up=new $,nl=new $;function vy(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){nl.fromArray(n,s);const a=r.x*Math.abs(nl.x)+r.y*Math.abs(nl.y)+r.z*Math.abs(nl.z),l=e.dot(nl),c=t.dot(nl),f=i.dot(nl);if(Math.max(-Math.max(l,c,f),Math.min(l,c,f))>a)return!1}return!0}const To=yN();function yN(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,f=0;for(;(c&8388608)===0;)c<<=1,f-=8388608;c&=-8388609,f+=947912704,s[l]=c|f}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function lr(n){Math.abs(n)>65504&&ot("DataUtils.toHalfFloat(): Value out of range."),n=Ct(n,-65504,65504),To.floatView[0]=n;const e=To.uint32View[0],t=e>>23&511;return To.baseTable[t]+((e&8388607)>>To.shiftTable[t])}function nf(n){const e=n>>10;return To.uint32View[0]=To.mantissaTable[To.offsetTable[e]+(n&1023)]+To.exponentTable[e],To.floatView[0]}class _N{static toHalfFloat(e){return lr(e)}static fromHalfFloat(e){return nf(e)}}const Kn=new $,hp=new Ve;let xN=0;class cn extends bs{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xN++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ff,this.updateRanges=[],this.gpuType=Yi,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)hp.fromBufferAttribute(this,t),hp.applyMatrix3(e),this.setXY(t,hp.x,hp.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.applyMatrix3(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.applyMatrix4(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.applyNormalMatrix(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.transformDirection(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=qi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Gt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=qi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=qi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Gt(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=qi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Gt(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=qi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,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!==Ff&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class bN extends cn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class SN extends cn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class wN extends cn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class MN extends cn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class db extends cn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class EN extends cn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class pb extends cn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class TN extends cn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=nf(this.array[e*this.itemSize]);return this.normalized&&(t=qi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize]=lr(t),this}getY(e){let t=nf(this.array[e*this.itemSize+1]);return this.normalized&&(t=qi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+1]=lr(t),this}getZ(e){let t=nf(this.array[e*this.itemSize+2]);return this.normalized&&(t=qi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+2]=lr(t),this}getW(e){let t=nf(this.array[e*this.itemSize+3]);return this.normalized&&(t=qi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+3]=lr(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array)),this.array[e+0]=lr(t),this.array[e+1]=lr(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array)),this.array[e+0]=lr(t),this.array[e+1]=lr(i),this.array[e+2]=lr(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.array[e+0]=lr(t),this.array[e+1]=lr(i),this.array[e+2]=lr(r),this.array[e+3]=lr(s),this}}class dt extends cn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const AN=new ai,Sh=new $,yy=new $;let li=class{constructor(e=new $,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 i=this.center;t!==void 0?i.copy(t):AN.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.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 i=this.center.distanceToSquared(e);return t.copy(e),i>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;Sh.subVectors(e,this.center);const t=Sh.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Sh,r/i),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):(yy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Sh.copy(e.center).add(yy)),this.expandByPoint(Sh.copy(e.center).sub(yy))),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}},CN=0;const Vr=new Rt,_y=new nn,Nc=new $,Ir=new ai,wh=new ai,mi=new $;class Nt extends bs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CN++}),this.uuid=Lr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,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(kU(e)?pb:db)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}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 i=this.attributes.normal;if(i!==void 0){const s=new Ut().getNormalMatrix(e);i.applyNormalMatrix(s),i.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 Vr.makeRotationFromQuaternion(e),this.applyMatrix4(Vr),this}rotateX(e){return Vr.makeRotationX(e),this.applyMatrix4(Vr),this}rotateY(e){return Vr.makeRotationY(e),this.applyMatrix4(Vr),this}rotateZ(e){return Vr.makeRotationZ(e),this.applyMatrix4(Vr),this}translate(e,t,i){return Vr.makeTranslation(e,t,i),this.applyMatrix4(Vr),this}scale(e,t,i){return Vr.makeScale(e,t,i),this.applyMatrix4(Vr),this}lookAt(e){return _y.lookAt(e),_y.updateMatrix(),this.applyMatrix4(_y.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Nc).negate(),this.translate(Nc.x,Nc.y,Nc.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new dt(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ot("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 ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){bt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Ir.setFromBufferAttribute(s),this.morphTargetsRelative?(mi.addVectors(this.boundingBox.min,Ir.min),this.boundingBox.expandByPoint(mi),mi.addVectors(this.boundingBox.max,Ir.max),this.boundingBox.expandByPoint(mi)):(this.boundingBox.expandByPoint(Ir.min),this.boundingBox.expandByPoint(Ir.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&bt('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 li);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){bt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new $,1/0);return}if(e){const i=this.boundingSphere.center;if(Ir.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];wh.setFromBufferAttribute(a),this.morphTargetsRelative?(mi.addVectors(Ir.min,wh.min),Ir.expandByPoint(mi),mi.addVectors(Ir.max,wh.max),Ir.expandByPoint(mi)):(Ir.expandByPoint(wh.min),Ir.expandByPoint(wh.max))}Ir.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)mi.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(mi));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,f=a.count;c<f;c++)mi.fromBufferAttribute(a,c),l&&(Nc.fromBufferAttribute(e,c),mi.add(Nc)),r=Math.max(r,i.distanceToSquared(mi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&bt('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){bt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new cn(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let A=0;A<i.count;A++)a[A]=new $,l[A]=new $;const c=new $,f=new $,d=new $,p=new Ve,m=new Ve,g=new Ve,x=new $,_=new $;function y(A,R,D){c.fromBufferAttribute(i,A),f.fromBufferAttribute(i,R),d.fromBufferAttribute(i,D),p.fromBufferAttribute(s,A),m.fromBufferAttribute(s,R),g.fromBufferAttribute(s,D),f.sub(c),d.sub(c),m.sub(p),g.sub(p);const L=1/(m.x*g.y-g.x*m.y);isFinite(L)&&(x.copy(f).multiplyScalar(g.y).addScaledVector(d,-m.y).multiplyScalar(L),_.copy(d).multiplyScalar(m.x).addScaledVector(f,-g.x).multiplyScalar(L),a[A].add(x),a[R].add(x),a[D].add(x),l[A].add(_),l[R].add(_),l[D].add(_))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let A=0,R=b.length;A<R;++A){const D=b[A],L=D.start,U=D.count;for(let N=L,B=L+U;N<B;N+=3)y(e.getX(N+0),e.getX(N+1),e.getX(N+2))}const w=new $,M=new $,T=new $,E=new $;function I(A){T.fromBufferAttribute(r,A),E.copy(T);const R=a[A];w.copy(R),w.sub(T.multiplyScalar(T.dot(R))).normalize(),M.crossVectors(E,R);const L=M.dot(l[A])<0?-1:1;o.setXYZW(A,w.x,w.y,w.z,L)}for(let A=0,R=b.length;A<R;++A){const D=b[A],L=D.start,U=D.count;for(let N=L,B=L+U;N<B;N+=3)I(e.getX(N+0)),I(e.getX(N+1)),I(e.getX(N+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new cn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let p=0,m=i.count;p<m;p++)i.setXYZ(p,0,0,0);const r=new $,s=new $,o=new $,a=new $,l=new $,c=new $,f=new $,d=new $;if(e)for(let p=0,m=e.count;p<m;p+=3){const g=e.getX(p+0),x=e.getX(p+1),_=e.getX(p+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,_),f.subVectors(o,s),d.subVectors(r,s),f.cross(d),a.fromBufferAttribute(i,g),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,_),a.add(f),l.add(f),c.add(f),i.setXYZ(g,a.x,a.y,a.z),i.setXYZ(x,l.x,l.y,l.z),i.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),o.fromBufferAttribute(t,p+2),f.subVectors(o,s),d.subVectors(r,s),f.cross(d),i.setXYZ(p+0,f.x,f.y,f.z),i.setXYZ(p+1,f.x,f.y,f.z),i.setXYZ(p+2,f.x,f.y,f.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)mi.fromBufferAttribute(e,t),mi.normalize(),e.setXYZ(t,mi.x,mi.y,mi.z)}toNonIndexed(){function e(a,l){const c=a.array,f=a.itemSize,d=a.normalized,p=new c.constructor(l.length*f);let m=0,g=0;for(let x=0,_=l.length;x<_;x++){a.isInterleavedBufferAttribute?m=l[x]*a.data.stride+a.offset:m=l[x]*f;for(let y=0;y<f;y++)p[g++]=c[m++]}return new cn(p,f,d)}if(this.index===null)return ot("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Nt,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let f=0,d=c.length;f<d;f++){const p=c[f],m=e(p,i);l.push(m)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];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 i=this.attributes;for(const l in i){const c=i[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],f=[];for(let d=0,p=c.length;d<p;d++){const m=c[d];f.push(m.toJSON(e.data))}f.length>0&&(r[l]=f,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.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 i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const f=r[c];this.setAttribute(c,f.clone(t))}const s=e.morphAttributes;for(const c in s){const f=[],d=s[c];for(let p=0,m=d.length;p<m;p++)f.push(d[p].clone(t));this.morphAttributes[c]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,f=o.length;c<f;c++){const d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.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"})}}class o0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ff,this.updateRanges=[],this.version=0,this.uuid=Lr()}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,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+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=Lr()),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]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=Lr()),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 Wi=new $;class Ul{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,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,i=this.data.count;t<i;t++)Wi.fromBufferAttribute(this,t),Wi.applyMatrix4(e),this.setXYZ(t,Wi.x,Wi.y,Wi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Wi.fromBufferAttribute(this,t),Wi.applyNormalMatrix(e),this.setXYZ(t,Wi.x,Wi.y,Wi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Wi.fromBufferAttribute(this,t),Wi.transformDirection(e),this.setXYZ(t,Wi.x,Wi.y,Wi.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=qi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Gt(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Gt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Gt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Gt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Gt(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=qi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=qi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=qi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=qi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){zf("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new cn(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 Ul(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){zf("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*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}}}let RN=0;class Fi extends bs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:RN++}),this.uuid=Lr(),this.name="",this.type="Material",this.blending=Al,this.side=Po,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Rm,this.blendDst=Im,this.blendEquation=ya,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new et(0,0,0),this.blendAlpha=0,this.depthFunc=Dl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ix,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yl,this.stencilZFail=yl,this.stencilZPass=yl,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 i=e[t];if(i===void 0){ot(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ot(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Al&&(i.blending=this.blending),this.side!==Po&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Rm&&(i.blendSrc=this.blendSrc),this.blendDst!==Im&&(i.blendDst=this.blendDst),this.blendEquation!==ya&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Dl&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ix&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==yl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==yl&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}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 i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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.allowOverride=e.allowOverride,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 mb extends Fi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new et(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 Oc;const Mh=new $,Fc=new $,kc=new $,zc=new Ve,Eh=new Ve,BC=new Rt,fp=new $,Th=new $,dp=new $,Xw=new Ve,xy=new Ve,qw=new Ve;class GC extends nn{constructor(e=new mb){if(super(),this.isSprite=!0,this.type="Sprite",Oc===void 0){Oc=new Nt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new o0(t,5);Oc.setIndex([0,1,2,0,2,3]),Oc.setAttribute("position",new Ul(i,3,0,!1)),Oc.setAttribute("uv",new Ul(i,2,3,!1))}this.geometry=Oc,this.material=e,this.center=new Ve(.5,.5),this.count=1}raycast(e,t){e.camera===null&&bt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Fc.setFromMatrixScale(this.matrixWorld),BC.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),kc.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fc.multiplyScalar(-kc.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;pp(fp.set(-.5,-.5,0),kc,o,Fc,r,s),pp(Th.set(.5,-.5,0),kc,o,Fc,r,s),pp(dp.set(.5,.5,0),kc,o,Fc,r,s),Xw.set(0,0),xy.set(1,0),qw.set(1,1);let a=e.ray.intersectTriangle(fp,Th,dp,!1,Mh);if(a===null&&(pp(Th.set(-.5,.5,0),kc,o,Fc,r,s),xy.set(0,1),a=e.ray.intersectTriangle(fp,dp,Th,!1,Mh),a===null))return;const l=e.ray.origin.distanceTo(Mh);l<e.near||l>e.far||t.push({distance:l,point:Mh.clone(),uv:ur.getInterpolation(Mh,fp,Th,dp,Xw,xy,qw,new Ve),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 pp(n,e,t,i,r,s){zc.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Eh.x=s*zc.x-r*zc.y,Eh.y=r*zc.x+s*zc.y):Eh.copy(zc),n.copy(e),n.x+=Eh.x,n.y+=Eh.y,n.applyMatrix4(BC)}const mp=new $,$w=new $;class VC extends nn{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 i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=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:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const r=t.splice(i,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 i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){mp.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(mp);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){mp.setFromMatrixPosition(e.matrixWorld),$w.setFromMatrixPosition(this.matrixWorld);const i=mp.distanceTo($w)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)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 i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const vo=new $,by=new $,gp=new $,ha=new $,Sy=new $,vp=new $,wy=new $;class Nu{constructor(e=new $,t=new $(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,vo)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=vo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(vo.copy(this.origin).addScaledVector(this.direction,t),vo.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){by.copy(e).add(t).multiplyScalar(.5),gp.copy(t).sub(e).normalize(),ha.copy(this.origin).sub(by);const s=e.distanceTo(t)*.5,o=-this.direction.dot(gp),a=ha.dot(this.direction),l=-ha.dot(gp),c=ha.lengthSq(),f=Math.abs(1-o*o);let d,p,m,g;if(f>0)if(d=o*l-a,p=o*a-l,g=s*f,d>=0)if(p>=-g)if(p<=g){const x=1/f;d*=x,p*=x,m=d*(d+o*p+2*a)+p*(o*d+p+2*l)+c}else p=s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;else p=-s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;else p<=-g?(d=Math.max(0,-(-o*s+a)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c):p<=g?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(d=Math.max(0,-(o*s+a)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c);else p=o>0?-s:s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(by).addScaledVector(gp,p),m}intersectSphere(e,t){vo.subVectors(e.center,this.origin);const i=vo.dot(this.direction),r=vo.dot(vo)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,f=1/this.direction.y,d=1/this.direction.z,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),f>=0?(s=(e.min.y-p.y)*f,o=(e.max.y-p.y)*f):(s=(e.max.y-p.y)*f,o=(e.min.y-p.y)*f),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(a=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,vo)!==null}intersectTriangle(e,t,i,r,s){Sy.subVectors(t,e),vp.subVectors(i,e),wy.crossVectors(Sy,vp);let o=this.direction.dot(wy),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ha.subVectors(this.origin,e);const l=a*this.direction.dot(vp.crossVectors(ha,vp));if(l<0)return null;const c=a*this.direction.dot(Sy.cross(ha));if(c<0||l+c>o)return null;const f=-a*ha.dot(wy);return f<0?null:this.at(f/o,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 No extends Fi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(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 Nr,this.combine=sd,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 Yw=new Rt,il=new Nu,yp=new li,Zw=new $,_p=new $,xp=new $,bp=new $,My=new $,Sp=new $,Kw=new $,wp=new $;class wn extends nn{constructor(e=new Nt,t=new No){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,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){Sp.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const f=a[l],d=s[l];f!==0&&(My.fromBufferAttribute(d,e),o?Sp.addScaledVector(My,f):Sp.addScaledVector(My.sub(t),f))}t.add(Sp)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),yp.copy(i.boundingSphere),yp.applyMatrix4(s),il.copy(e.ray).recast(e.near),!(yp.containsPoint(il.origin)===!1&&(il.intersectSphere(yp,Zw)===null||il.origin.distanceToSquared(Zw)>(e.far-e.near)**2))&&(Yw.copy(s).invert(),il.copy(e.ray).applyMatrix4(Yw),!(i.boundingBox!==null&&il.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,il)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,f=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,x=p.length;g<x;g++){const _=p[g],y=o[_.materialIndex],b=Math.max(_.start,m.start),w=Math.min(a.count,Math.min(_.start+_.count,m.start+m.count));for(let M=b,T=w;M<T;M+=3){const E=a.getX(M),I=a.getX(M+1),A=a.getX(M+2);r=Mp(this,y,e,i,c,f,d,E,I,A),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const g=Math.max(0,m.start),x=Math.min(a.count,m.start+m.count);for(let _=g,y=x;_<y;_+=3){const b=a.getX(_),w=a.getX(_+1),M=a.getX(_+2);r=Mp(this,o,e,i,c,f,d,b,w,M),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let g=0,x=p.length;g<x;g++){const _=p[g],y=o[_.materialIndex],b=Math.max(_.start,m.start),w=Math.min(l.count,Math.min(_.start+_.count,m.start+m.count));for(let M=b,T=w;M<T;M+=3){const E=M,I=M+1,A=M+2;r=Mp(this,y,e,i,c,f,d,E,I,A),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const g=Math.max(0,m.start),x=Math.min(l.count,m.start+m.count);for(let _=g,y=x;_<y;_+=3){const b=_,w=_+1,M=_+2;r=Mp(this,o,e,i,c,f,d,b,w,M),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}}}function IN(n,e,t,i,r,s,o,a){let l;if(e.side===Zi?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Po,a),l===null)return null;wp.copy(a),wp.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(wp);return c<t.near||c>t.far?null:{distance:c,point:wp.clone(),object:n}}function Mp(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,_p),n.getVertexPosition(l,xp),n.getVertexPosition(c,bp);const f=IN(n,e,t,i,_p,xp,bp,Kw);if(f){const d=new $;ur.getBarycoord(Kw,_p,xp,bp,d),r&&(f.uv=ur.getInterpolatedAttribute(r,a,l,c,d,new Ve)),s&&(f.uv1=ur.getInterpolatedAttribute(s,a,l,c,d,new Ve)),o&&(f.normal=ur.getInterpolatedAttribute(o,a,l,c,d,new $),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new $,materialIndex:0};ur.getNormal(_p,xp,bp,p.normal),f.face=p,f.barycoord=d}return f}const Ah=new ln,Jw=new ln,Qw=new ln,PN=new ln,eM=new Rt,Ep=new $,Ey=new li,tM=new Rt,Ty=new Nu;class HC extends wn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=tx,this.bindMatrix=new Rt,this.bindMatrixInverse=new Rt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ai),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ep),this.boundingBox.expandByPoint(Ep)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new li),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ep),this.boundingSphere.expandByPoint(Ep)}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 i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ey.copy(this.boundingSphere),Ey.applyMatrix4(r),e.ray.intersectsSphere(Ey)!==!1&&(tM.copy(r).invert(),Ty.copy(e.ray).applyMatrix4(tM),!(this.boundingBox!==null&&Ty.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Ty)))}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 ln,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===tx?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===SC?this.bindMatrixInverse.copy(this.bindMatrix).invert():ot("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;Jw.fromBufferAttribute(r.attributes.skinIndex,e),Qw.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(Ah.copy(t),t.set(0,0,0,0)):(Ah.set(...t,1),t.set(0,0,0)),Ah.applyMatrix4(this.bindMatrix);for(let s=0;s<4;s++){const o=Qw.getComponent(s);if(o!==0){const a=Jw.getComponent(s);eM.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(PN.copy(Ah).applyMatrix4(eM),o)}}return t.isVector4&&(t.w=Ah.w),t.applyMatrix4(this.bindMatrixInverse)}}class gb extends nn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class xs extends An{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Hn,f=Hn,d,p){super(null,o,a,l,c,f,r,s,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const nM=new Rt,DN=new Rt;class a0{constructor(e=[],t=[]){this.uuid=Lr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=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){ot("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new Rt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new Rt;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:DN;nM.multiplyMatrices(a,t[s]),nM.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new a0(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 i=new xs(t,e,e,Oi,Yi);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;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 i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(ot("Skeleton: No bone found with UUID:",s),o=new gb),this.bones.push(o),this.boneInverses.push(new Rt().fromArray(e.boneInverses[i]))}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,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Nl extends cn{constructor(e,t,i,r=1){super(e,t,i),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 Bc=new Rt,iM=new Rt,Tp=[],rM=new ai,LN=new Rt,Ch=new wn,Rh=new li;class WC extends wn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Nl(new Float32Array(i*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,LN)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ai),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Bc),rM.copy(e.boundingBox).applyMatrix4(Bc),this.boundingBox.union(rM)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new li),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Bc),Rh.copy(e.boundingSphere).applyMatrix4(Bc),this.boundingSphere.union(Rh)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),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){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(Ch.geometry=this.geometry,Ch.material=this.material,Ch.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Rh.copy(this.boundingSphere),Rh.applyMatrix4(i),e.ray.intersectsSphere(Rh)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Bc),iM.multiplyMatrices(i,Bc),Ch.matrixWorld=iM,Ch.raycast(e,Tp);for(let o=0,a=Tp.length;o<a;o++){const l=Tp[o];l.instanceId=s,l.object=this,t.push(l)}Tp.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Nl(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new xs(new Float32Array(r*this.count),r,this.count,Yg,Yi));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;return s[l]=a,s.set(i,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ay=new $,UN=new $,NN=new Ut;class Mo{constructor(e=new $(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Ay.subVectors(i,t).cross(UN.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,i=!0){const r=e.delta(Ay),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||NN.getNormalMatrix(e),r=this.coplanarPoint(Ay).applyMatrix4(e),s=this.normal.applyMatrix3(i).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 rl=new li,ON=new Ve(.5,.5),Ap=new $;class Hl{constructor(e=new Mo,t=new Mo,i=new Mo,r=new Mo,s=new Mo,o=new Mo){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Dr,i=!1){const r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],f=s[4],d=s[5],p=s[6],m=s[7],g=s[8],x=s[9],_=s[10],y=s[11],b=s[12],w=s[13],M=s[14],T=s[15];if(r[0].setComponents(c-o,m-f,y-g,T-b).normalize(),r[1].setComponents(c+o,m+f,y+g,T+b).normalize(),r[2].setComponents(c+a,m+d,y+x,T+w).normalize(),r[3].setComponents(c-a,m-d,y-x,T-w).normalize(),i)r[4].setComponents(l,p,_,M).normalize(),r[5].setComponents(c-l,m-p,y-_,T-M).normalize();else if(r[4].setComponents(c-l,m-p,y-_,T-M).normalize(),t===Dr)r[5].setComponents(c+l,m+p,y+_,T+M).normalize();else if(t===Ll)r[5].setComponents(l,p,_,M).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(),rl.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),rl.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(rl)}intersectsSprite(e){rl.center.set(0,0,0);const t=ON.distanceTo(e.center);return rl.radius=.7071067811865476+t,rl.applyMatrix4(e.matrixWorld),this.intersectsSphere(rl)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ap.x=r.normal.x>0?e.max.x:e.min.x,Ap.y=r.normal.y>0?e.max.y:e.min.y,Ap.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ap)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Ps=new Rt,Ds=new Hl;class l0{constructor(){this.coordinateSystem=Dr}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.containsPoint(e))return!0}return!1}clone(){return new l0}}function Cy(n,e){return n-e}function FN(n,e){return n.z-e.z}function kN(n,e){return e.z-n.z}class zN{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,r){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=i,a.index=r}reset(){this.list.length=0,this.index=0}}const or=new Rt,BN=new et(1,1,1),sM=new Hl,GN=new l0,Cp=new ai,sl=new li,Ih=new $,oM=new $,VN=new $,Ry=new zN,Ui=new wn,Rp=[];function HN(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}function ol(n,e){if(n.constructor!==e.constructor){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)e[i]=n[i]}else{const t=Math.min(n.length,e.length);e.set(new n.constructor(n.buffer,0,t))}}class jC extends wn{constructor(e,t,i=t*2,r){super(new Nt,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=i,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,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),i=new xs(t,e,e,Oi,Yi);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new xs(t,e,e,od,Jr);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new xs(t,e,e,Oi,Yi);i.colorSpace=jt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,f=new a.constructor(i*l),d=new cn(f,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new cn(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 i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);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 ai);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,or),this.getBoundingBoxAt(s,Cp).applyMatrix4(or),e.union(Cp)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new li);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,or),this.getBoundingSphereAt(s,sl).applyMatrix4(or),e.union(sl)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Cy),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=i):(r=this._instanceInfo.length,this._instanceInfo.push(i));const s=this._matricesTexture;or.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(BN.toArray(o.image.data,r*4),o.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,i=-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 o=e.getIndex();if(o!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=i===-1?o.count:i),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(Cy),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 i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(r&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const f in i.attributes){const d=t.getAttribute(f),p=i.getAttribute(f);HN(d,p,l);const m=d.itemSize;for(let g=d.count,x=c;g<x;g++){const _=l+g;for(let y=0;y<m;y++)p.setComponent(_,y,0)}p.needsUpdate=!0,p.addUpdateRange(l*m,c*m)}if(r){const f=a.indexStart,d=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let p=0;p<o.count;p++)s.setX(f+p,l+o.getX(p));for(let p=o.count,m=d;p<m;p++)s.setX(f+p,l);s.needsUpdate=!0,s.addUpdateRange(f,a.reservedIndexCount)}return a.start=r?a.indexStart:a.vertexStart,a.count=r?a.indexCount:a.vertexCount,a.boundingBox=null,t.boundingBox!==null&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,t.boundingSphere!==null&&(a.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 i=this._instanceInfo;for(let r=0,s=i.length;r<s;r++)i[r].active&&i[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 i=this._geometryInfo,r=i.map((o,a)=>a).sort((o,a)=>i[o].vertexStart-i[a].vertexStart),s=this.geometry;for(let o=0,a=i.length;o<a;o++){const l=r[o],c=i[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:f,vertexStart:d,reservedIndexCount:p}=c,m=s.index,g=m.array,x=e-d;for(let _=f;_<f+p;_++)g[_]=g[_]+x;m.array.copyWithin(t,f,f+p),m.addUpdateRange(t,p),m.needsUpdate=!0,c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:f,reservedVertexCount:d}=c,p=s.attributes;for(const m in p){const g=p[m],{array:x,itemSize:_}=g;x.copyWithin(e*_,f*_,(f+d)*_),g.addUpdateRange(e*_,d*_),g.needsUpdate=!0}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new ai,o=i.index,a=i.attributes.position;for(let l=r.start,c=r.start+r.count;l<c;l++){let f=l;o&&(f=o.getX(f)),s.expandByPoint(Ih.fromBufferAttribute(a,f))}r.boundingBox=s}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new li;this.getBoundingBoxAt(e,Cp),Cp.getCenter(s.center);const o=i.index,a=i.attributes.position;let l=0;for(let c=r.start,f=r.start+r.count;c<f;c++){let d=c;o&&(d=o.getX(d)),Ih.fromBufferAttribute(a,d),l=Math.max(l,s.center.distanceToSquared(Ih))}s.radius=Math.sqrt(l),r.boundingSphere=s}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const i=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),i.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),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):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 i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(Cy);t[t.length-1]===i.length-1;)i.pop(),t.pop();if(e<i.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);ol(this._multiDrawCounts,r),ol(this._multiDrawStarts,s),this._multiDrawCounts=r,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),ol(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),ol(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),ol(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...i.map(a=>a.vertexStart+a.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(...i.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 Nt,this._initializeGeometry(s));const o=this.geometry;s.index&&ol(s.index.array,o.index.array);for(const a in s.attributes)ol(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const i=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Ui.material=this.material,Ui.geometry.index=o.index,Ui.geometry.attributes=o.attributes,Ui.geometry.boundingBox===null&&(Ui.geometry.boundingBox=new ai),Ui.geometry.boundingSphere===null&&(Ui.geometry.boundingSphere=new li);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,f=r[c];Ui.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(a,Ui.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Ui.geometry.boundingBox),this.getBoundingSphereAt(c,Ui.geometry.boundingSphere),Ui.raycast(e,Rp);for(let d=0,p=Rp.length;d<p;d++){const m=Rp[d];m.object=this,m.batchId=a,t.push(m)}Rp.length=0}Ui.material=null,Ui.geometry.index=null,Ui.geometry.attributes={},Ui.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,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex();let a=o===null?1:o.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,a=r.attributes.position.count>65535?4:2);const c=this._instanceInfo,f=this._multiDrawStarts,d=this._multiDrawCounts,p=this._geometryInfo,m=this.perObjectFrustumCulled,g=this._indirectTexture,x=g.image.data,_=i.isArrayCamera?GN:sM;m&&!i.isArrayCamera&&(or.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sM.setFromProjectionMatrix(or,i.coordinateSystem,i.reversedDepth));let y=0;if(this.sortObjects){or.copy(this.matrixWorld).invert(),Ih.setFromMatrixPosition(i.matrixWorld).applyMatrix4(or),oM.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(or);for(let M=0,T=c.length;M<T;M++)if(c[M].visible&&c[M].active){const E=c[M].geometryIndex;this.getMatrixAt(M,or),this.getBoundingSphereAt(E,sl).applyMatrix4(or);let I=!1;if(m&&(I=!_.intersectsSphere(sl,i)),!I){const A=p[E],R=VN.subVectors(sl.center,Ih).dot(oM);Ry.push(A.start,A.count,R,M)}}const b=Ry.list,w=this.customSort;w===null?b.sort(s.transparent?kN:FN):w.call(this,b,i);for(let M=0,T=b.length;M<T;M++){const E=b[M];f[y]=E.start*a*l,d[y]=E.count*l,x[y]=E.index,y++}Ry.reset()}else for(let b=0,w=c.length;b<w;b++)if(c[b].visible&&c[b].active){const M=c[b].geometryIndex;let T=!1;if(m&&(this.getMatrixAt(b,or),this.getBoundingSphereAt(M,sl).applyMatrix4(or),T=!_.intersectsSphere(sl,i)),!T){const E=p[M];f[y]=E.start*a*l,d[y]=E.count*l,x[y]=b,y++}}g.needsUpdate=!0,this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class Ki extends Fi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new et(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 vg=new $,yg=new $,aM=new Rt,Ph=new Nu,Ip=new li,Iy=new $,lM=new $;let Ra=class extends nn{constructor(e=new Nt,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,i=[0];for(let r=1,s=t.count;r<s;r++)vg.fromBufferAttribute(t,r-1),yg.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=vg.distanceTo(yg);e.setAttribute("lineDistance",new dt(i,1))}else ot("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ip.copy(i.boundingSphere),Ip.applyMatrix4(r),Ip.radius+=s,e.ray.intersectsSphere(Ip)===!1)return;aM.copy(r).invert(),Ph.copy(e.ray).applyMatrix4(aM);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,f=i.index,p=i.attributes.position;if(f!==null){const m=Math.max(0,o.start),g=Math.min(f.count,o.start+o.count);for(let x=m,_=g-1;x<_;x+=c){const y=f.getX(x),b=f.getX(x+1),w=Pp(this,e,Ph,l,y,b,x);w&&t.push(w)}if(this.isLineLoop){const x=f.getX(g-1),_=f.getX(m),y=Pp(this,e,Ph,l,x,_,g-1);y&&t.push(y)}}else{const m=Math.max(0,o.start),g=Math.min(p.count,o.start+o.count);for(let x=m,_=g-1;x<_;x+=c){const y=Pp(this,e,Ph,l,x,x+1,x);y&&t.push(y)}if(this.isLineLoop){const x=Pp(this,e,Ph,l,g-1,m,g-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function Pp(n,e,t,i,r,s,o){const a=n.geometry.attributes.position;if(vg.fromBufferAttribute(a,r),yg.fromBufferAttribute(a,s),t.distanceSqToSegment(vg,yg,Iy,lM)>i)return;Iy.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Iy);if(!(c<e.near||c>e.far))return{distance:c,point:lM.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const cM=new $,uM=new $;class Zs extends Ra{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,i=[];for(let r=0,s=t.count;r<s;r+=2)cM.fromBufferAttribute(t,r),uM.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+cM.distanceTo(uM);e.setAttribute("lineDistance",new dt(i,1))}else ot("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class XC extends Ra{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class vb extends Fi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new et(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 hM=new Rt,sx=new Nu,Dp=new li,Lp=new $;class qC extends nn{constructor(e=new Nt,t=new vb){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 i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Dp.copy(i.boundingSphere),Dp.applyMatrix4(r),Dp.radius+=s,e.ray.intersectsSphere(Dp)===!1)return;hM.copy(r).invert(),sx.copy(e.ray).applyMatrix4(hM);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,d=i.attributes.position;if(c!==null){const p=Math.max(0,o.start),m=Math.min(c.count,o.start+o.count);for(let g=p,x=m;g<x;g++){const _=c.getX(g);Lp.fromBufferAttribute(d,_),fM(Lp,_,l,r,e,t,this)}}else{const p=Math.max(0,o.start),m=Math.min(d.count,o.start+o.count);for(let g=p,x=m;g<x;g++)Lp.fromBufferAttribute(d,g),fM(Lp,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function fM(n,e,t,i,r,s,o){const a=sx.distanceSqToPoint(n);if(a<t){const l=new $;sx.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class $C extends An{constructor(e,t,i,r,s=gn,o=gn,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const f=this;function d(){f.needsUpdate=!0,f._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),this._requestVideoFrameCallbackId=0),super.dispose()}}class WN extends $C{constructor(e,t,i,r,s,o,a,l){super({},e,t,i,r,s,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class jN extends An{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Hn,this.minFilter=Hn,this.generateMipmaps=!1,this.needsUpdate=!0}}class c0 extends An{constructor(e,t,i,r,s,o,a,l,c,f,d,p){super(null,o,a,l,c,f,r,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class XN extends c0{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=hr,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class qN extends c0{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Xs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ad extends An{constructor(e=[],t=Xs,i,r,s,o,a,l,c,f){super(e,t,i,r,s,o,a,l,c,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $N extends An{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class YN extends An{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const f=e?e.parentNode:null;f!==null&&"requestPaint"in f&&(f.onpaint=()=>{this.needsUpdate=!0},f.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class Ol extends An{constructor(e,t,i=Jr,r,s,o,a=Hn,l=Hn,c,f=$s,d=1){if(f!==$s&&f!==_a)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,o,a,l,f,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xa(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 YC extends Ol{constructor(e,t=Jr,i=Xs,r,s,o=Hn,a=Hn,l,c=$s){const f={width:e,height:e,depth:1},d=[f,f,f,f,f,f];super(e,e,t,i,r,s,o,a,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class yb extends An{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Pa extends Nt{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],f=[],d=[];let p=0,m=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new dt(c,3)),this.setAttribute("normal",new dt(f,3)),this.setAttribute("uv",new dt(d,2));function g(x,_,y,b,w,M,T,E,I,A,R){const D=M/I,L=T/A,U=M/2,N=T/2,B=E/2,z=I+1,k=A+1;let O=0,Y=0;const X=new $;for(let K=0;K<k;K++){const G=K*L-N;for(let J=0;J<z;J++){const H=J*D-U;X[x]=H*b,X[_]=G*w,X[y]=B,c.push(X.x,X.y,X.z),X[x]=0,X[_]=0,X[y]=E>0?1:-1,f.push(X.x,X.y,X.z),d.push(J/I),d.push(1-K/A),O+=1}}for(let K=0;K<A;K++)for(let G=0;G<I;G++){const J=p+G+z*K,H=p+G+z*(K+1),ee=p+(G+1)+z*(K+1),ne=p+(G+1)+z*K;l.push(J,H,ne),l.push(H,ee,ne),Y+=6}a.addGroup(m,Y,R),m+=Y,p+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pa(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class u0 extends Nt{constructor(e=1,t=1,i=4,r=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:r,heightSegments:s},t=Math.max(0,t),i=Math.max(1,Math.floor(i)),r=Math.max(3,Math.floor(r)),s=Math.max(1,Math.floor(s));const o=[],a=[],l=[],c=[],f=t/2,d=Math.PI/2*e,p=t,m=2*d+p,g=i*2+s,x=r+1,_=new $,y=new $;for(let b=0;b<=g;b++){let w=0,M=0,T=0,E=0;if(b<=i){const R=b/i,D=R*Math.PI/2;M=-f-e*Math.cos(D),T=e*Math.sin(D),E=-e*Math.cos(D),w=R*d}else if(b<=i+s){const R=(b-i)/s;M=-f+R*t,T=e,E=0,w=d+R*p}else{const R=(b-i-s)/i,D=R*Math.PI/2;M=f+e*Math.sin(D),T=e*Math.cos(D),E=e*Math.sin(D),w=d+p+R*d}const I=Math.max(0,Math.min(1,w/m));let A=0;b===0?A=.5/r:b===g&&(A=-.5/r);for(let R=0;R<=r;R++){const D=R/r,L=D*Math.PI*2,U=Math.sin(L),N=Math.cos(L);y.x=-T*N,y.y=M,y.z=T*U,a.push(y.x,y.y,y.z),_.set(-T*N,E,T*U),_.normalize(),l.push(_.x,_.y,_.z),c.push(D+A,I)}if(b>0){const R=(b-1)*x;for(let D=0;D<r;D++){const L=R+D,U=R+D+1,N=b*x+D,B=b*x+D+1;o.push(L,U,N),o.push(U,B,N)}}}this.setIndex(o),this.setAttribute("position",new dt(a,3)),this.setAttribute("normal",new dt(l,3)),this.setAttribute("uv",new dt(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new u0(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class h0 extends Nt{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new $,f=new Ve;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const m=i+d/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),o.push(c.x,c.y,c.z),a.push(0,0,1),f.x=(o[p]/e+1)/2,f.y=(o[p+1]/e+1)/2,l.push(f.x,f.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new dt(o,3)),this.setAttribute("normal",new dt(a,3)),this.setAttribute("uv",new dt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new h0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ou extends Nt{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const f=[],d=[],p=[],m=[];let g=0;const x=[],_=i/2;let y=0;b(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(f),this.setAttribute("position",new dt(d,3)),this.setAttribute("normal",new dt(p,3)),this.setAttribute("uv",new dt(m,2));function b(){const M=new $,T=new $;let E=0;const I=(t-e)/i;for(let A=0;A<=s;A++){const R=[],D=A/s,L=D*(t-e)+e;for(let U=0;U<=r;U++){const N=U/r,B=N*l+a,z=Math.sin(B),k=Math.cos(B);T.x=L*z,T.y=-D*i+_,T.z=L*k,d.push(T.x,T.y,T.z),M.set(z,I,k).normalize(),p.push(M.x,M.y,M.z),m.push(N,1-D),R.push(g++)}x.push(R)}for(let A=0;A<r;A++)for(let R=0;R<s;R++){const D=x[R][A],L=x[R+1][A],U=x[R+1][A+1],N=x[R][A+1];(e>0||R!==0)&&(f.push(D,L,N),E+=3),(t>0||R!==s-1)&&(f.push(L,U,N),E+=3)}c.addGroup(y,E,0),y+=E}function w(M){const T=g,E=new Ve,I=new $;let A=0;const R=M===!0?e:t,D=M===!0?1:-1;for(let U=1;U<=r;U++)d.push(0,_*D,0),p.push(0,D,0),m.push(.5,.5),g++;const L=g;for(let U=0;U<=r;U++){const B=U/r*l+a,z=Math.cos(B),k=Math.sin(B);I.x=R*k,I.y=_*D,I.z=R*z,d.push(I.x,I.y,I.z),p.push(0,D,0),E.x=z*.5+.5,E.y=k*.5*D+.5,m.push(E.x,E.y),g++}for(let U=0;U<r;U++){const N=T+U,B=L+U;M===!0?f.push(B,B+1,N):f.push(B+1,B,N),A+=3}c.addGroup(y,A,M===!0?1:2),y+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ou(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ld extends Ou{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new ld(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Da extends Nt{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),f(),this.setAttribute("position",new dt(s,3)),this.setAttribute("normal",new dt(s.slice(),3)),this.setAttribute("uv",new dt(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(b){const w=new $,M=new $,T=new $;for(let E=0;E<t.length;E+=3)m(t[E+0],w),m(t[E+1],M),m(t[E+2],T),l(w,M,T,b)}function l(b,w,M,T){const E=T+1,I=[];for(let A=0;A<=E;A++){I[A]=[];const R=b.clone().lerp(M,A/E),D=w.clone().lerp(M,A/E),L=E-A;for(let U=0;U<=L;U++)U===0&&A===E?I[A][U]=R:I[A][U]=R.clone().lerp(D,U/L)}for(let A=0;A<E;A++)for(let R=0;R<2*(E-A)-1;R++){const D=Math.floor(R/2);R%2===0?(p(I[A][D+1]),p(I[A+1][D]),p(I[A][D])):(p(I[A][D+1]),p(I[A+1][D+1]),p(I[A+1][D]))}}function c(b){const w=new $;for(let M=0;M<s.length;M+=3)w.x=s[M+0],w.y=s[M+1],w.z=s[M+2],w.normalize().multiplyScalar(b),s[M+0]=w.x,s[M+1]=w.y,s[M+2]=w.z}function f(){const b=new $;for(let w=0;w<s.length;w+=3){b.x=s[w+0],b.y=s[w+1],b.z=s[w+2];const M=_(b)/2/Math.PI+.5,T=y(b)/Math.PI+.5;o.push(M,1-T)}g(),d()}function d(){for(let b=0;b<o.length;b+=6){const w=o[b+0],M=o[b+2],T=o[b+4],E=Math.max(w,M,T),I=Math.min(w,M,T);E>.9&&I<.1&&(w<.2&&(o[b+0]+=1),M<.2&&(o[b+2]+=1),T<.2&&(o[b+4]+=1))}}function p(b){s.push(b.x,b.y,b.z)}function m(b,w){const M=b*3;w.x=e[M+0],w.y=e[M+1],w.z=e[M+2]}function g(){const b=new $,w=new $,M=new $,T=new $,E=new Ve,I=new Ve,A=new Ve;for(let R=0,D=0;R<s.length;R+=9,D+=6){b.set(s[R+0],s[R+1],s[R+2]),w.set(s[R+3],s[R+4],s[R+5]),M.set(s[R+6],s[R+7],s[R+8]),E.set(o[D+0],o[D+1]),I.set(o[D+2],o[D+3]),A.set(o[D+4],o[D+5]),T.copy(b).add(w).add(M).divideScalar(3);const L=_(T);x(E,D+0,b,L),x(I,D+2,w,L),x(A,D+4,M,L)}}function x(b,w,M,T){T<0&&b.x===1&&(o[w]=b.x-1),M.x===0&&M.z===0&&(o[w]=T/2/Math.PI+.5)}function _(b){return Math.atan2(b.z,-b.x)}function y(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 Da(e.vertices,e.indices,e.radius,e.detail)}}class f0 extends Da{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,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,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[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,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new f0(e.radius,e.detail)}}const Up=new $,Np=new $,Py=new $,Op=new ur;class ZC extends Nt{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(Cl*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],f=["a","b","c"],d=new Array(3),p={},m=[];for(let g=0;g<l;g+=3){o?(c[0]=o.getX(g),c[1]=o.getX(g+1),c[2]=o.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:x,b:_,c:y}=Op;if(x.fromBufferAttribute(a,c[0]),_.fromBufferAttribute(a,c[1]),y.fromBufferAttribute(a,c[2]),Op.getNormal(Py),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(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let b=0;b<3;b++){const w=(b+1)%3,M=d[b],T=d[w],E=Op[f[b]],I=Op[f[w]],A=`${M}_${T}`,R=`${T}_${M}`;R in p&&p[R]?(Py.dot(p[R].normal)<=s&&(m.push(E.x,E.y,E.z),m.push(I.x,I.y,I.z)),p[R]=null):A in p||(p[A]={index0:c[b],index1:c[w],normal:Py.clone()})}}for(const g in p)if(p[g]){const{index0:x,index1:_}=p[g];Up.fromBufferAttribute(a,x),Np.fromBufferAttribute(a,_),m.push(Up.x,Up.y,Up.z),m.push(Np.x,Np.y,Np.z)}this.setAttribute("position",new dt(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ss{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ot("Curve: .getPoint() not implemented.")}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const f=i[r],p=i[r+1]-f,m=(o-f)/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 o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Ve:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){const i=new $,r=[],s=[],o=[],a=new $,l=new Rt;for(let m=0;m<=e;m++){const g=m/e;r[m]=this.getTangentAt(g,new $)}s[0]=new $,o[0]=new $;let c=Number.MAX_VALUE;const f=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);f<=c&&(c=f,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),p<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(Ct(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,g))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(Ct(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],m*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:o}}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 d0 extends Ss{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Ve){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const f=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=l-this.aX,m=c-this.aY;l=p*f-m*d+this.aX,c=p*d+m*f+this.aY}return i.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 KC extends d0{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function _b(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,f,d){let p=(o-s)/c-(a-s)/(c+f)+(a-o)/f,m=(a-o)/f-(l-o)/(f+d)+(l-a)/d;p*=f,m*=f,r(o,a,p,m)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const dM=new $,pM=new $,Dy=new _b,Ly=new _b,Uy=new _b;class p0 extends Ss{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new $){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,f;this.closed||a>0?c=r[(a-1)%s]:(pM.subVectors(r[0],r[1]).add(r[0]),c=pM);const d=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?f=r[(a+2)%s]:(dM.subVectors(r[s-1],r[s-2]).add(r[s-1]),f=dM),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(d),m),x=Math.pow(d.distanceToSquared(p),m),_=Math.pow(p.distanceToSquared(f),m);x<1e-4&&(x=1),g<1e-4&&(g=x),_<1e-4&&(_=x),Dy.initNonuniformCatmullRom(c.x,d.x,p.x,f.x,g,x,_),Ly.initNonuniformCatmullRom(c.y,d.y,p.y,f.y,g,x,_),Uy.initNonuniformCatmullRom(c.z,d.z,p.z,f.z,g,x,_)}else this.curveType==="catmullrom"&&(Dy.initCatmullRom(c.x,d.x,p.x,f.x,this.tension),Ly.initCatmullRom(c.y,d.y,p.y,f.y,this.tension),Uy.initCatmullRom(c.z,d.z,p.z,f.z,this.tension));return i.set(Dy.calc(l),Ly.calc(l),Uy.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;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,i=this.points.length;t<i;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,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new $().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function mM(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function ZN(n,e){const t=1-n;return t*t*e}function KN(n,e){return 2*(1-n)*n*e}function JN(n,e){return n*n*e}function bf(n,e,t,i){return ZN(n,e)+KN(n,t)+JN(n,i)}function QN(n,e){const t=1-n;return t*t*t*e}function eO(n,e){const t=1-n;return 3*t*t*n*e}function tO(n,e){return 3*(1-n)*n*n*e}function nO(n,e){return n*n*n*e}function Sf(n,e,t,i,r){return QN(n,e)+eO(n,t)+tO(n,i)+nO(n,r)}class xb extends Ss{constructor(e=new Ve,t=new Ve,i=new Ve,r=new Ve){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Ve){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Sf(e,r.x,s.x,o.x,a.x),Sf(e,r.y,s.y,o.y,a.y)),i}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 JC extends Ss{constructor(e=new $,t=new $,i=new $,r=new $){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new $){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Sf(e,r.x,s.x,o.x,a.x),Sf(e,r.y,s.y,o.y,a.y),Sf(e,r.z,s.z,o.z,a.z)),i}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 bb extends Ss{constructor(e=new Ve,t=new Ve){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Ve){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Ve){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 Sb extends Ss{constructor(e=new $,t=new $){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new $){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new $){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 wb extends Ss{constructor(e=new Ve,t=new Ve,i=new Ve){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Ve){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(bf(e,r.x,s.x,o.x),bf(e,r.y,s.y,o.y)),i}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 m0 extends Ss{constructor(e=new $,t=new $,i=new $){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new $){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(bf(e,r.x,s.x,o.x),bf(e,r.y,s.y,o.y),bf(e,r.z,s.z,o.z)),i}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 Mb extends Ss{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Ve){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],f=r[o>r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(mM(a,l.x,c.x,f.x,d.x),mM(a,l.y,c.y,f.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Ve().fromArray(r))}return this}}var _g=Object.freeze({__proto__:null,ArcCurve:KC,CatmullRomCurve3:p0,CubicBezierCurve:xb,CubicBezierCurve3:JC,EllipseCurve:d0,LineCurve:bb,LineCurve3:Sb,QuadraticBezierCurve:wb,QuadraticBezierCurve3:m0,SplineCurve:Mb});class QC extends Ss{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 i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new _g[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.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 i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const f=l[c];i&&i.equals(f)||(t.push(f),i=f)}}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,i=e.curves.length;t<i;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,i=this.curves.length;t<i;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,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new _g[r.type]().fromJSON(r))}return this}}class xg extends QC{constructor(e){super(),this.type="Path",this.currentPoint=new Ve,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new bb(this.currentPoint.clone(),new Ve(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new wb(this.currentPoint.clone(),new Ve(e,t),new Ve(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new xb(this.currentPoint.clone(),new Ve(e,t),new Ve(i,r),new Ve(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Mb(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+c,t+f,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new d0(e,t,i,r,s,o,a,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 f=c.getPoint(1);return this.currentPoint.copy(f),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 Ma extends xg{constructor(e){super(e),this.uuid=Lr(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;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,i=this.holes.length;t<i;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,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new xg().fromJSON(r))}return this}}function iO(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=eR(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(i&&(s=lO(n,e,s,t)),n.length>80*t){a=n[0],l=n[1];let f=a,d=l;for(let p=t;p<r;p+=t){const m=n[p],g=n[p+1];m<a&&(a=m),g<l&&(l=g),m>f&&(f=m),g>d&&(d=g)}c=Math.max(f-a,d-l),c=c!==0?32767/c:0}return Bf(s,o,t,a,l,c,0),o}function eR(n,e,t,i,r){let s;if(r===_O(n,e,t,i)>0)for(let o=e;o<t;o+=i)s=gM(o/i|0,n[o],n[o+1],s);else for(let o=t-i;o>=e;o-=i)s=gM(o/i|0,n[o],n[o+1],s);return s&&Mu(s,s.next)&&(Vf(s),s=s.next),s}function Fl(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Mu(t,t.next)||Dn(t.prev,t,t.next)===0)){if(Vf(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Bf(n,e,t,i,r,s,o){if(!n)return;!o&&s&&dO(n,i,r,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?sO(n,i,r,s):rO(n)){e.push(l.i,n.i,c.i),Vf(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=oO(Fl(n),e),Bf(n,e,t,i,r,s,2)):o===2&&aO(n,e,t,i,r,s):Bf(Fl(n),e,t,i,r,s,1);break}}}function rO(n){const e=n.prev,t=n,i=n.next;if(Dn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,f=Math.min(r,s,o),d=Math.min(a,l,c),p=Math.max(r,s,o),m=Math.max(a,l,c);let g=i.next;for(;g!==e;){if(g.x>=f&&g.x<=p&&g.y>=d&&g.y<=m&&rf(r,a,s,l,o,c,g.x,g.y)&&Dn(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function sO(n,e,t,i){const r=n.prev,s=n,o=n.next;if(Dn(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,f=r.y,d=s.y,p=o.y,m=Math.min(a,l,c),g=Math.min(f,d,p),x=Math.max(a,l,c),_=Math.max(f,d,p),y=ox(m,g,e,t,i),b=ox(x,_,e,t,i);let w=n.prevZ,M=n.nextZ;for(;w&&w.z>=y&&M&&M.z<=b;){if(w.x>=m&&w.x<=x&&w.y>=g&&w.y<=_&&w!==r&&w!==o&&rf(a,f,l,d,c,p,w.x,w.y)&&Dn(w.prev,w,w.next)>=0||(w=w.prevZ,M.x>=m&&M.x<=x&&M.y>=g&&M.y<=_&&M!==r&&M!==o&&rf(a,f,l,d,c,p,M.x,M.y)&&Dn(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;w&&w.z>=y;){if(w.x>=m&&w.x<=x&&w.y>=g&&w.y<=_&&w!==r&&w!==o&&rf(a,f,l,d,c,p,w.x,w.y)&&Dn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=b;){if(M.x>=m&&M.x<=x&&M.y>=g&&M.y<=_&&M!==r&&M!==o&&rf(a,f,l,d,c,p,M.x,M.y)&&Dn(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function oO(n,e){let t=n;do{const i=t.prev,r=t.next.next;!Mu(i,r)&&nR(i,t,t.next,r)&&Gf(i,r)&&Gf(r,i)&&(e.push(i.i,t.i,r.i),Vf(t),Vf(t.next),t=n=r),t=t.next}while(t!==n);return Fl(t)}function aO(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&gO(o,a)){let l=iR(o,a);o=Fl(o,o.next),l=Fl(l,l.next),Bf(o,e,t,i,r,s,0),Bf(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function lO(n,e,t,i){const r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=eR(n,a,l,i,!1);c===c.next&&(c.steiner=!0),r.push(mO(c))}r.sort(cO);for(let s=0;s<r.length;s++)t=uO(r[s],t);return t}function cO(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const i=(n.next.y-n.y)/(n.next.x-n.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=i-r}return t}function uO(n,e){const t=hO(n,e);if(!t)return e;const i=iR(t,n);return Fl(i,i.next),Fl(t,t.next)}function hO(n,e){let t=e;const i=n.x,r=n.y;let s=-1/0,o;if(Mu(n,t))return t;do{if(Mu(n,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<=i&&d>s&&(s=d,o=t.x<t.next.x?t:t.next,d===i))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let f=1/0;t=o;do{if(i>=t.x&&t.x>=l&&i!==t.x&&tR(r<c?i:s,r,l,c,r<c?s:i,r,t.x,t.y)){const d=Math.abs(r-t.y)/(i-t.x);Gf(t,n)&&(d<f||d===f&&(t.x>o.x||t.x===o.x&&fO(o,t)))&&(o=t,f=d)}t=t.next}while(t!==a);return o}function fO(n,e){return Dn(n.prev,n,e.prev)<0&&Dn(e.next,n,n.next)<0}function dO(n,e,t,i){let r=n;do r.z===0&&(r.z=ox(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,pO(r)}function pO(n){let e,t=1;do{let i=n,r;n=null;let s=null;for(e=0;i;){e++;let o=i,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;i=o}s.nextZ=null,t*=2}while(e>1);return n}function ox(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function mO(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function tR(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function rf(n,e,t,i,r,s,o,a){return!(n===o&&e===a)&&tR(n,e,t,i,r,s,o,a)}function gO(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!vO(n,e)&&(Gf(n,e)&&Gf(e,n)&&yO(n,e)&&(Dn(n.prev,n,e.prev)||Dn(n,e.prev,e))||Mu(n,e)&&Dn(n.prev,n,n.next)>0&&Dn(e.prev,e,e.next)>0)}function Dn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Mu(n,e){return n.x===e.x&&n.y===e.y}function nR(n,e,t,i){const r=kp(Dn(n,e,t)),s=kp(Dn(n,e,i)),o=kp(Dn(t,i,n)),a=kp(Dn(t,i,e));return!!(r!==s&&o!==a||r===0&&Fp(n,t,e)||s===0&&Fp(n,i,e)||o===0&&Fp(t,n,i)||a===0&&Fp(t,e,i))}function Fp(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function kp(n){return n>0?1:n<0?-1:0}function vO(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&nR(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Gf(n,e){return Dn(n.prev,n,n.next)<0?Dn(n,e,n.next)>=0&&Dn(n,n.prev,e)>=0:Dn(n,e,n.prev)<0||Dn(n,n.next,e)<0}function yO(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.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&&(i=!i),t=t.next;while(t!==n);return i}function iR(n,e){const t=ax(n.i,n.x,n.y),i=ax(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function gM(n,e,t,i){const r=ax(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Vf(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function ax(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _O(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class xO{static triangulate(e,t,i=2){return iO(e,t,i)}}class ys{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return ys.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];vM(e),yM(i,e);let o=e.length;t.forEach(vM);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,yM(i,t[l]);const a=xO.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function vM(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function yM(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class g0 extends Nt{constructor(e=new Ma([new Ve(.5,.5),new Ve(-.5,.5),new Ve(-.5,-.5),new Ve(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new dt(r,3)),this.setAttribute("uv",new dt(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,f=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,g=t.bevelSize!==void 0?t.bevelSize:m-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,_=t.bevelSegments!==void 0?t.bevelSegments:3;const y=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:bO;let w,M=!1,T,E,I,A;if(y){w=y.getSpacedPoints(f),M=!0,p=!1;const oe=y.isCatmullRomCurve3?y.closed:!1;T=y.computeFrenetFrames(f,oe),E=new $,I=new $,A=new $}p||(_=0,m=0,g=0,x=0);const R=a.extractPoints(c);let D=R.shape;const L=R.holes;if(!ys.isClockWise(D)){D=D.reverse();for(let oe=0,ae=L.length;oe<ae;oe++){const Q=L[oe];ys.isClockWise(Q)&&(L[oe]=Q.reverse())}}function N(oe){const Q=10000000000000001e-36;let Ee=oe[0];for(let ge=1;ge<=oe.length;ge++){const Oe=ge%oe.length,Z=oe[Oe],ce=Z.x-Ee.x,ke=Z.y-Ee.y,De=ce*ce+ke*ke,pe=Math.max(Math.abs(Z.x),Math.abs(Z.y),Math.abs(Ee.x),Math.abs(Ee.y)),ze=Q*pe*pe;if(De<=ze){oe.splice(Oe,1),ge--;continue}Ee=Z}}N(D),L.forEach(N);const B=L.length,z=D;for(let oe=0;oe<B;oe++){const ae=L[oe];D=D.concat(ae)}function k(oe,ae,Q){return ae||bt("ExtrudeGeometry: vec does not exist"),oe.clone().addScaledVector(ae,Q)}const O=D.length;function Y(oe,ae,Q){let Ee,ge,Oe;const Z=oe.x-ae.x,ce=oe.y-ae.y,ke=Q.x-oe.x,De=Q.y-oe.y,pe=Z*Z+ce*ce,ze=Z*De-ce*ke;if(Math.abs(ze)>Number.EPSILON){const W=Math.sqrt(pe),F=Math.sqrt(ke*ke+De*De),re=ae.x-ce/W,me=ae.y+Z/W,Te=Q.x-De/F,Be=Q.y+ke/F,He=((Te-re)*De-(Be-me)*ke)/(Z*De-ce*ke);Ee=re+Z*He-oe.x,ge=me+ce*He-oe.y;const be=Ee*Ee+ge*ge;if(be<=2)return new Ve(Ee,ge);Oe=Math.sqrt(be/2)}else{let W=!1;Z>Number.EPSILON?ke>Number.EPSILON&&(W=!0):Z<-Number.EPSILON?ke<-Number.EPSILON&&(W=!0):Math.sign(ce)===Math.sign(De)&&(W=!0),W?(Ee=-ce,ge=Z,Oe=Math.sqrt(pe)):(Ee=Z,ge=ce,Oe=Math.sqrt(pe/2))}return new Ve(Ee/Oe,ge/Oe)}const X=[];for(let oe=0,ae=z.length,Q=ae-1,Ee=oe+1;oe<ae;oe++,Q++,Ee++)Q===ae&&(Q=0),Ee===ae&&(Ee=0),X[oe]=Y(z[oe],z[Q],z[Ee]);const K=[];let G,J=X.concat();for(let oe=0,ae=B;oe<ae;oe++){const Q=L[oe];G=[];for(let Ee=0,ge=Q.length,Oe=ge-1,Z=Ee+1;Ee<ge;Ee++,Oe++,Z++)Oe===ge&&(Oe=0),Z===ge&&(Z=0),G[Ee]=Y(Q[Ee],Q[Oe],Q[Z]);K.push(G),J=J.concat(G)}let H;if(_===0)H=ys.triangulateShape(z,L);else{const oe=[],ae=[];for(let Q=0;Q<_;Q++){const Ee=Q/_,ge=m*Math.cos(Ee*Math.PI/2),Oe=g*Math.sin(Ee*Math.PI/2)+x;for(let Z=0,ce=z.length;Z<ce;Z++){const ke=k(z[Z],X[Z],Oe);ye(ke.x,ke.y,-ge),Ee===0&&oe.push(ke)}for(let Z=0,ce=B;Z<ce;Z++){const ke=L[Z];G=K[Z];const De=[];for(let pe=0,ze=ke.length;pe<ze;pe++){const W=k(ke[pe],G[pe],Oe);ye(W.x,W.y,-ge),Ee===0&&De.push(W)}Ee===0&&ae.push(De)}}H=ys.triangulateShape(oe,ae)}const ee=H.length,ne=g+x;for(let oe=0;oe<O;oe++){const ae=p?k(D[oe],J[oe],ne):D[oe];M?(I.copy(T.normals[0]).multiplyScalar(ae.x),E.copy(T.binormals[0]).multiplyScalar(ae.y),A.copy(w[0]).add(I).add(E),ye(A.x,A.y,A.z)):ye(ae.x,ae.y,0)}for(let oe=1;oe<=f;oe++)for(let ae=0;ae<O;ae++){const Q=p?k(D[ae],J[ae],ne):D[ae];M?(I.copy(T.normals[oe]).multiplyScalar(Q.x),E.copy(T.binormals[oe]).multiplyScalar(Q.y),A.copy(w[oe]).add(I).add(E),ye(A.x,A.y,A.z)):ye(Q.x,Q.y,d/f*oe)}for(let oe=_-1;oe>=0;oe--){const ae=oe/_,Q=m*Math.cos(ae*Math.PI/2),Ee=g*Math.sin(ae*Math.PI/2)+x;for(let ge=0,Oe=z.length;ge<Oe;ge++){const Z=k(z[ge],X[ge],Ee);ye(Z.x,Z.y,d+Q)}for(let ge=0,Oe=L.length;ge<Oe;ge++){const Z=L[ge];G=K[ge];for(let ce=0,ke=Z.length;ce<ke;ce++){const De=k(Z[ce],G[ce],Ee);M?ye(De.x,De.y+w[f-1].y,w[f-1].x+Q):ye(De.x,De.y,d+Q)}}}te(),se();function te(){const oe=r.length/3;if(p){let ae=0,Q=O*ae;for(let Ee=0;Ee<ee;Ee++){const ge=H[Ee];Se(ge[2]+Q,ge[1]+Q,ge[0]+Q)}ae=f+_*2,Q=O*ae;for(let Ee=0;Ee<ee;Ee++){const ge=H[Ee];Se(ge[0]+Q,ge[1]+Q,ge[2]+Q)}}else{for(let ae=0;ae<ee;ae++){const Q=H[ae];Se(Q[2],Q[1],Q[0])}for(let ae=0;ae<ee;ae++){const Q=H[ae];Se(Q[0]+O*f,Q[1]+O*f,Q[2]+O*f)}}i.addGroup(oe,r.length/3-oe,0)}function se(){const oe=r.length/3;let ae=0;ie(z,ae),ae+=z.length;for(let Q=0,Ee=L.length;Q<Ee;Q++){const ge=L[Q];ie(ge,ae),ae+=ge.length}i.addGroup(oe,r.length/3-oe,1)}function ie(oe,ae){let Q=oe.length;for(;--Q>=0;){const Ee=Q;let ge=Q-1;ge<0&&(ge=oe.length-1);for(let Oe=0,Z=f+_*2;Oe<Z;Oe++){const ce=O*Oe,ke=O*(Oe+1),De=ae+Ee+ce,pe=ae+ge+ce,ze=ae+ge+ke,W=ae+Ee+ke;fe(De,pe,ze,W)}}}function ye(oe,ae,Q){l.push(oe),l.push(ae),l.push(Q)}function Se(oe,ae,Q){ue(oe),ue(ae),ue(Q);const Ee=r.length/3,ge=b.generateTopUV(i,r,Ee-3,Ee-2,Ee-1);Le(ge[0]),Le(ge[1]),Le(ge[2])}function fe(oe,ae,Q,Ee){ue(oe),ue(ae),ue(Ee),ue(ae),ue(Q),ue(Ee);const ge=r.length/3,Oe=b.generateSideWallUV(i,r,ge-6,ge-3,ge-2,ge-1);Le(Oe[0]),Le(Oe[1]),Le(Oe[3]),Le(Oe[1]),Le(Oe[2]),Le(Oe[3])}function ue(oe){r.push(l[oe*3+0]),r.push(l[oe*3+1]),r.push(l[oe*3+2])}function Le(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,i=this.parameters.options;return SO(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new _g[r.type]().fromJSON(r)),new g0(i,e.options)}}const bO={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],f=e[r*3+1];return[new Ve(s,o),new Ve(a,l),new Ve(c,f)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],f=e[i*3+1],d=e[i*3+2],p=e[r*3],m=e[r*3+1],g=e[r*3+2],x=e[s*3],_=e[s*3+1],y=e[s*3+2];return Math.abs(a-f)<Math.abs(o-c)?[new Ve(o,1-l),new Ve(c,1-d),new Ve(p,1-g),new Ve(x,1-y)]:[new Ve(a,1-l),new Ve(f,1-d),new Ve(m,1-g),new Ve(_,1-y)]}};function SO(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class v0 extends Da{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,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 v0(e.radius,e.detail)}}class y0 extends Nt{constructor(e=[new Ve(0,-.5),new Ve(.5,0),new Ve(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Ct(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],f=1/t,d=new $,p=new Ve,m=new $,g=new $,x=new $;let _=0,y=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:_=e[b+1].x-e[b].x,y=e[b+1].y-e[b].y,m.x=y*1,m.y=-_,m.z=y*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,y=e[b+1].y-e[b].y,m.x=y*1,m.y=-_,m.z=y*0,g.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(g)}for(let b=0;b<=t;b++){const w=i+b*f*r,M=Math.sin(w),T=Math.cos(w);for(let E=0;E<=e.length-1;E++){d.x=e[E].x*M,d.y=e[E].y,d.z=e[E].x*T,o.push(d.x,d.y,d.z),p.x=b/t,p.y=E/(e.length-1),a.push(p.x,p.y);const I=l[3*E+0]*M,A=l[3*E+1],R=l[3*E+0]*T;c.push(I,A,R)}}for(let b=0;b<t;b++)for(let w=0;w<e.length-1;w++){const M=w+b*e.length,T=M,E=M+e.length,I=M+e.length+1,A=M+1;s.push(T,E,A),s.push(I,A,E)}this.setIndex(s),this.setAttribute("position",new dt(o,3)),this.setAttribute("uv",new dt(a,2)),this.setAttribute("normal",new dt(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new y0(e.points,e.segments,e.phiStart,e.phiLength)}}class cd extends Da{constructor(e=1,t=0){const i=[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(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new cd(e.radius,e.detail)}}class Oo extends Nt{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,f=l+1,d=e/a,p=t/l,m=[],g=[],x=[],_=[];for(let y=0;y<f;y++){const b=y*p-o;for(let w=0;w<c;w++){const M=w*d-s;g.push(M,-b,0),x.push(0,0,1),_.push(w/a),_.push(1-y/l)}}for(let y=0;y<l;y++)for(let b=0;b<a;b++){const w=b+c*y,M=b+c*(y+1),T=b+1+c*(y+1),E=b+1+c*y;m.push(w,M,E),m.push(M,T,E)}this.setIndex(m),this.setAttribute("position",new dt(g,3)),this.setAttribute("normal",new dt(x,3)),this.setAttribute("uv",new dt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Oo(e.width,e.height,e.widthSegments,e.heightSegments)}}class ud extends Nt{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],f=[];let d=e;const p=(t-e)/r,m=new $,g=new Ve;for(let x=0;x<=r;x++){for(let _=0;_<=i;_++){const y=s+_/i*o;m.x=d*Math.cos(y),m.y=d*Math.sin(y),l.push(m.x,m.y,m.z),c.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,f.push(g.x,g.y)}d+=p}for(let x=0;x<r;x++){const _=x*(i+1);for(let y=0;y<i;y++){const b=y+_,w=b,M=b+i+1,T=b+i+2,E=b+1;a.push(w,M,E),a.push(M,T,E)}}this.setIndex(a),this.setAttribute("position",new dt(l,3)),this.setAttribute("normal",new dt(c,3)),this.setAttribute("uv",new dt(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ud(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class _0 extends Nt{constructor(e=new Ma([new Ve(0,.5),new Ve(-.5,-.5),new Ve(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let f=0;f<e.length;f++)c(e[f]),this.addGroup(a,l,f),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new dt(r,3)),this.setAttribute("normal",new dt(s,3)),this.setAttribute("uv",new dt(o,2));function c(f){const d=r.length/3,p=f.extractPoints(t);let m=p.shape;const g=p.holes;ys.isClockWise(m)===!1&&(m=m.reverse());for(let _=0,y=g.length;_<y;_++){const b=g[_];ys.isClockWise(b)===!0&&(g[_]=b.reverse())}const x=ys.triangulateShape(m,g);for(let _=0,y=g.length;_<y;_++){const b=g[_];m=m.concat(b)}for(let _=0,y=m.length;_<y;_++){const b=m[_];r.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let _=0,y=x.length;_<y;_++){const b=x[_],w=b[0]+d,M=b[1]+d,T=b[2]+d;i.push(w,M,T),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 wO(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new _0(i,e.curveSegments)}}function wO(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Fu extends Nt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const f=[],d=new $,p=new $,m=[],g=[],x=[],_=[];for(let y=0;y<=i;y++){const b=[],w=y/i;let M=0;y===0&&o===0?M=.5/t:y===i&&l===Math.PI&&(M=-.5/t);for(let T=0;T<=t;T++){const E=T/t;d.x=-e*Math.cos(r+E*s)*Math.sin(o+w*a),d.y=e*Math.cos(o+w*a),d.z=e*Math.sin(r+E*s)*Math.sin(o+w*a),g.push(d.x,d.y,d.z),p.copy(d).normalize(),x.push(p.x,p.y,p.z),_.push(E+M,1-w),b.push(c++)}f.push(b)}for(let y=0;y<i;y++)for(let b=0;b<t;b++){const w=f[y][b+1],M=f[y][b],T=f[y+1][b],E=f[y+1][b+1];(y!==0||o>0)&&m.push(w,M,E),(y!==i-1||l<Math.PI)&&m.push(M,T,E)}this.setIndex(m),this.setAttribute("position",new dt(g,3)),this.setAttribute("normal",new dt(x,3)),this.setAttribute("uv",new dt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class x0 extends Da{constructor(e=1,t=0){const i=[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(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new x0(e.radius,e.detail)}}class b0 extends Nt{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2,o=0,a=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s,thetaStart:o,thetaLength:a},i=Math.floor(i),r=Math.floor(r);const l=[],c=[],f=[],d=[],p=new $,m=new $,g=new $;for(let x=0;x<=i;x++){const _=o+x/i*a;for(let y=0;y<=r;y++){const b=y/r*s;m.x=(e+t*Math.cos(_))*Math.cos(b),m.y=(e+t*Math.cos(_))*Math.sin(b),m.z=t*Math.sin(_),c.push(m.x,m.y,m.z),p.x=e*Math.cos(b),p.y=e*Math.sin(b),g.subVectors(m,p).normalize(),f.push(g.x,g.y,g.z),d.push(y/r),d.push(x/i)}}for(let x=1;x<=i;x++)for(let _=1;_<=r;_++){const y=(r+1)*x+_-1,b=(r+1)*(x-1)+_-1,w=(r+1)*(x-1)+_,M=(r+1)*x+_;l.push(y,b,M),l.push(b,w,M)}this.setIndex(l),this.setAttribute("position",new dt(c,3)),this.setAttribute("normal",new dt(f,3)),this.setAttribute("uv",new dt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new b0(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class S0 extends Nt{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],f=[],d=new $,p=new $,m=new $,g=new $,x=new $,_=new $,y=new $;for(let w=0;w<=i;++w){const M=w/i*s*Math.PI*2;b(M,s,o,e,m),b(M+.01,s,o,e,g),_.subVectors(g,m),y.addVectors(g,m),x.crossVectors(_,y),y.crossVectors(x,_),x.normalize(),y.normalize();for(let T=0;T<=r;++T){const E=T/r*Math.PI*2,I=-t*Math.cos(E),A=t*Math.sin(E);d.x=m.x+(I*y.x+A*x.x),d.y=m.y+(I*y.y+A*x.y),d.z=m.z+(I*y.z+A*x.z),l.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),c.push(p.x,p.y,p.z),f.push(w/i),f.push(T/r)}}for(let w=1;w<=i;w++)for(let M=1;M<=r;M++){const T=(r+1)*(w-1)+(M-1),E=(r+1)*w+(M-1),I=(r+1)*w+M,A=(r+1)*(w-1)+M;a.push(T,E,A),a.push(E,I,A)}this.setIndex(a),this.setAttribute("position",new dt(l,3)),this.setAttribute("normal",new dt(c,3)),this.setAttribute("uv",new dt(f,2));function b(w,M,T,E,I){const A=Math.cos(w),R=Math.sin(w),D=T/M*w,L=Math.cos(D);I.x=E*(2+L)*.5*A,I.y=E*(2+L)*R*.5,I.z=E*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 Ia extends Nt{constructor(e=new m0(new $(-1,-1,0),new $(-1,1,0),new $(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new $,l=new $,c=new Ve;let f=new $;const d=[],p=[],m=[],g=[];x(),this.setIndex(g),this.setAttribute("position",new dt(d,3)),this.setAttribute("normal",new dt(p,3)),this.setAttribute("uv",new dt(m,2));function x(){for(let w=0;w<t;w++)_(w);_(s===!1?t:0),b(),y()}function _(w){f=e.getPointAt(w/t,f);const M=o.normals[w],T=o.binormals[w];for(let E=0;E<=r;E++){const I=E/r*Math.PI*2,A=Math.sin(I),R=-Math.cos(I);l.x=R*M.x+A*T.x,l.y=R*M.y+A*T.y,l.z=R*M.z+A*T.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=f.x+i*l.x,a.y=f.y+i*l.y,a.z=f.z+i*l.z,d.push(a.x,a.y,a.z)}}function y(){for(let w=1;w<=t;w++)for(let M=1;M<=r;M++){const T=(r+1)*(w-1)+(M-1),E=(r+1)*w+(M-1),I=(r+1)*w+M,A=(r+1)*(w-1)+M;g.push(T,E,A),g.push(E,I,A)}}function b(){for(let w=0;w<=t;w++)for(let M=0;M<=r;M++)c.x=w/t,c.y=M/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 Ia(new _g[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class rR extends Nt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new $,s=new $;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,f=l.length;c<f;++c){const d=l[c],p=d.start,m=d.count;for(let g=p,x=p+m;g<x;g+=3)for(let _=0;_<3;_++){const y=a.getX(g+_),b=a.getX(g+(_+1)%3);r.fromBufferAttribute(o,y),s.fromBufferAttribute(o,b),_M(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const f=3*a+c,d=3*a+(c+1)%3;r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,d),_M(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new dt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function _M(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var xM=Object.freeze({__proto__:null,BoxGeometry:Pa,CapsuleGeometry:u0,CircleGeometry:h0,ConeGeometry:ld,CylinderGeometry:Ou,DodecahedronGeometry:f0,EdgesGeometry:ZC,ExtrudeGeometry:g0,IcosahedronGeometry:v0,LatheGeometry:y0,OctahedronGeometry:cd,PlaneGeometry:Oo,PolyhedronGeometry:Da,RingGeometry:ud,ShapeGeometry:_0,SphereGeometry:Fu,TetrahedronGeometry:x0,TorusGeometry:b0,TorusKnotGeometry:S0,TubeGeometry:Ia,WireframeGeometry:rR});class sR extends Fi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new et(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}}function Eu(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(bM(r))r.isRenderTargetTexture?(ot("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(bM(r[0])){const s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function ji(n){const e={};for(let t=0;t<n.length;t++){const i=Eu(n[t]);for(const r in i)e[r]=i[r]}return e}function bM(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function MO(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function oR(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:jt.workingColorSpace}const Eb={clone:Eu,merge:ji};var EO=`void main() {
|
|
1
|
+
import{da as ML,db as EL,aX as Vl,dc as TL,d7 as fu,dd as AL,r as q,j as de,de as CL,df as RL,dg as IL,I as KA,u as Vg,t as PL,F as Jn,ap as DL,B as Wr,dh as LL,di as UL,f as NL,dj as OL,dk as FL,dl as kL,dm as zL,dn as BL,dp as GL,az as du,bB as VL,dq as HL,cl as WL,a2 as jL,cX as iy,a as XL,m as Pw,aI as Dw}from"./index-B_eahVWI.js";import{m as qL}from"./merge-CkWezbly.js";import{g as $L}from"./index-CDoSh7QA.js";import{E as Tl,Z as gi,N as gm,c as _h}from"./index-Bs7zcW7e.js";import"./envs-CRUy-_iG.js";import"./isObjectLike-mS1hgzH9.js";import"./isObject--vsEa_js.js";const Hg="184",JA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},YL={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},QA=0,K_=1,eC=2,ZL=3,tC=0,pu=1,ff=2,bl=3,Po=0,Zi=1,Bn=2,Ws=0,Al=1,J_=2,Q_=3,ex=4,nC=5,KL=6,ya=100,iC=101,rC=102,sC=103,oC=104,aC=200,lC=201,cC=202,uC=203,Rm=204,Im=205,hC=206,fC=207,dC=208,pC=209,mC=210,gC=211,vC=212,yC=213,_C=214,Pm=0,Dm=1,Lm=2,Dl=3,Um=4,Nm=5,Om=6,Fm=7,sd=0,xC=1,bC=2,Zr=0,Kx=1,Jx=2,Qx=3,Wg=4,eb=5,tb=6,nb=7,tx="attached",SC="detached",jg=300,Xs=301,Ta=302,df=303,pf=304,Uu=306,If=1e3,hr=1001,Pf=1002,Hn=1003,ib=1004,JL=1004,lu=1005,QL=1005,gn=1006,mf=1007,eU=1007,Vs=1008,tU=1008,Xi=1009,rb=1010,sb=1011,_u=1012,Xg=1013,Jr=1014,Yi=1015,qs=1016,qg=1017,$g=1018,xu=1020,ob=35902,ab=35899,lb=1021,cb=1022,Oi=1023,$s=1026,_a=1027,Yg=1028,od=1029,Aa=1030,Zg=1031,nU=1032,Kg=1033,gf=33776,vf=33777,yf=33778,_f=33779,km=35840,zm=35841,Bm=35842,Gm=35843,Vm=36196,Hm=37492,Wm=37496,jm=37488,Xm=37489,Df=37490,qm=37491,$m=37808,Ym=37809,Zm=37810,Km=37811,Jm=37812,Qm=37813,eg=37814,tg=37815,ng=37816,ig=37817,rg=37818,sg=37819,og=37820,ag=37821,lg=36492,cg=36494,ug=36495,hg=36283,fg=36284,Lf=36285,dg=36286,wC=2200,MC=2201,EC=2202,Uf=2300,pg=2301,vm=2302,nx=2303,Sl=2400,wl=2401,Nf=2402,Jg=2500,ub=2501,iU=0,rU=1,sU=2,TC=3200,AC=3201,oU=3202,aU=3203,Do=0,CC=1,Eo="",Ni="srgb",bu="srgb-linear",Of="linear",hn="srgb",lU="",cU="rg",uU="ga",hU=0,yl=7680,fU=7681,dU=7682,pU=7683,mU=34055,gU=34056,vU=5386,yU=512,_U=513,xU=514,bU=515,SU=516,wU=517,MU=518,ix=519,RC=512,IC=513,PC=514,Qg=515,DC=516,LC=517,e0=518,UC=519,Ff=35044,EU=35048,TU=35040,AU=35045,CU=35049,RU=35041,IU=35046,PU=35050,DU=35042,LU="100",rx="300 es",Dr=2e3,Ll=2001,UU={COMPUTE:"compute",RENDER:"render"},NU={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},OU={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},FU={TEXTURE_COMPARE:"depthTextureCompare"};function kU(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const zU={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function cu(n,e){return new zU[n](e)}function NC(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function kf(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function OC(){const n=kf("canvas");return n.style.display="block",n}const Lw={};let Ca=null;function BU(n){Ca=n}function GU(){return Ca}function zf(...n){const e="THREE."+n.shift();Ca?Ca("log",e,...n):console.log(e,...n)}function FC(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ot(...n){n=FC(n);const e="THREE."+n.shift();if(Ca)Ca("warn",e,...n);else{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function bt(...n){n=FC(n);const e="THREE."+n.shift();if(Ca)Ca("error",e,...n);else{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function mg(...n){const e=n.join(" ");e in Lw||(Lw[e]=!0,ot(...n))}function VU(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const HU={[Pm]:Dm,[Lm]:Om,[Um]:Fm,[Dl]:Nm,[Dm]:Pm,[Om]:Lm,[Fm]:Um,[Nm]:Dl};let bs=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[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 i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}};const Di=["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 Uw=1234567;const Cl=Math.PI/180,Su=180/Math.PI;function Lr(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Di[n&255]+Di[n>>8&255]+Di[n>>16&255]+Di[n>>24&255]+"-"+Di[e&255]+Di[e>>8&255]+"-"+Di[e>>16&15|64]+Di[e>>24&255]+"-"+Di[t&63|128]+Di[t>>8&255]+"-"+Di[t>>16&255]+Di[t>>24&255]+Di[i&255]+Di[i>>8&255]+Di[i>>16&255]+Di[i>>24&255]).toLowerCase()}function Ct(n,e,t){return Math.max(e,Math.min(t,n))}function hb(n,e){return(n%e+e)%e}function WU(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function jU(n,e,t){return n!==e?(t-n)/(e-n):0}function xf(n,e,t){return(1-t)*n+t*e}function XU(n,e,t,i){return xf(n,e,1-Math.exp(-t*i))}function qU(n,e=1){return e-Math.abs(hb(n,e*2)-e)}function $U(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function YU(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function ZU(n,e){return n+Math.floor(Math.random()*(e-n+1))}function KU(n,e){return n+Math.random()*(e-n)}function JU(n){return n*(.5-Math.random())}function QU(n){n!==void 0&&(Uw=n);let e=Uw+=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 eN(n){return n*Cl}function tN(n){return n*Su}function nN(n){return(n&n-1)===0&&n!==0}function iN(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function rN(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function sN(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),f=o((e+i)/2),d=s((e-i)/2),p=o((e-i)/2),m=s((i-e)/2),g=o((i-e)/2);switch(r){case"XYX":n.set(a*f,l*d,l*p,a*c);break;case"YZY":n.set(l*p,a*f,l*d,a*c);break;case"ZXZ":n.set(l*d,l*p,a*f,a*c);break;case"XZX":n.set(a*f,l*g,l*m,a*c);break;case"YXY":n.set(l*m,a*f,l*g,a*c);break;case"ZYZ":n.set(l*g,l*m,a*f,a*c);break;default:ot("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function qi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Gt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const gg={DEG2RAD:Cl,RAD2DEG:Su,generateUUID:Lr,clamp:Ct,euclideanModulo:hb,mapLinear:WU,inverseLerp:jU,lerp:xf,damp:XU,pingpong:qU,smoothstep:$U,smootherstep:YU,randInt:ZU,randFloat:KU,randFloatSpread:JU,seededRandom:QU,degToRad:eN,radToDeg:tN,isPowerOfTwo:nN,ceilPowerOfTwo:iN,floorPowerOfTwo:rN,setQuaternionFromProperEuler:sN,normalize:Gt,denormalize:qi},C1=class C1{constructor(e=0,t=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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+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=Ct(this.x,e.x,t.x),this.y=Ct(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ct(this.x,e,t),this.y=Ct(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ct(i,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 i=this.dot(e)/t;return Math.acos(Ct(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};C1.prototype.isVector2=!0;let Ve=C1;class vi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],f=i[r+2],d=i[r+3],p=s[o+0],m=s[o+1],g=s[o+2],x=s[o+3];if(d!==x||l!==p||c!==m||f!==g){let _=l*p+c*m+f*g+d*x;_<0&&(p=-p,m=-m,g=-g,x=-x,_=-_);let y=1-a;if(_<.9995){const b=Math.acos(_),w=Math.sin(b);y=Math.sin(y*b)/w,a=Math.sin(a*b)/w,l=l*y+p*a,c=c*y+m*a,f=f*y+g*a,d=d*y+x*a}else{l=l*y+p*a,c=c*y+m*a,f=f*y+g*a,d=d*y+x*a;const b=1/Math.sqrt(l*l+c*c+f*f+d*d);l*=b,c*=b,f*=b,d*=b}}e[t]=l,e[t+1]=c,e[t+2]=f,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],f=i[r+3],d=s[o],p=s[o+1],m=s[o+2],g=s[o+3];return e[t]=a*g+f*d+l*m-c*p,e[t+1]=l*g+f*p+c*d-a*m,e[t+2]=c*g+f*m+a*p-l*d,e[t+3]=f*g-a*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,i,r){return this._x=e,this._y=t,this._z=i,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 i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),f=a(r/2),d=a(s/2),p=l(i/2),m=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=p*f*d+c*m*g,this._y=c*m*d-p*f*g,this._z=c*f*g+p*m*d,this._w=c*f*d-p*m*g;break;case"YXZ":this._x=p*f*d+c*m*g,this._y=c*m*d-p*f*g,this._z=c*f*g-p*m*d,this._w=c*f*d+p*m*g;break;case"ZXY":this._x=p*f*d-c*m*g,this._y=c*m*d+p*f*g,this._z=c*f*g+p*m*d,this._w=c*f*d-p*m*g;break;case"ZYX":this._x=p*f*d-c*m*g,this._y=c*m*d+p*f*g,this._z=c*f*g-p*m*d,this._w=c*f*d+p*m*g;break;case"YZX":this._x=p*f*d+c*m*g,this._y=c*m*d+p*f*g,this._z=c*f*g-p*m*d,this._w=c*f*d-p*m*g;break;case"XZY":this._x=p*f*d-c*m*g,this._y=c*m*d-p*f*g,this._z=c*f*g+p*m*d,this._w=c*f*d+p*m*g;break;default:ot("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],f=t[6],d=t[10],p=i+a+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(f-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(i>a&&i>d){const m=2*Math.sqrt(1+i-a-d);this._w=(f-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>d){const m=2*Math.sqrt(1+a-i-d);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+f)/m}else{const m=2*Math.sqrt(1+d-i-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+f)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ct(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);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 i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,f=t._w;return this._x=i*f+o*a+r*c-s*l,this._y=r*f+o*l+s*a-i*c,this._z=s*f+o*c+i*l-r*a,this._w=o*f-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(i=-i,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){const c=Math.acos(a),f=Math.sin(c);l=Math.sin(l*c)/f,t=Math.sin(t*c)/f,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);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}}const R1=class R1{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(Nw.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nw.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),f=2*(a*t-s*r),d=2*(s*i-o*t);return this.x=t+l*c+o*d-a*f,this.y=i+l*f+a*c-s*d,this.z=r+l*d+s*f-o*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,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+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=Ct(this.x,e.x,t.x),this.y=Ct(this.y,e.y,t.y),this.z=Ct(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ct(this.x,e,t),this.y=Ct(this.y,e,t),this.z=Ct(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ct(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ry.copy(this).projectOnVector(e),this.sub(ry)}reflect(e){return this.sub(ry.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 i=this.dot(e)/t;return Math.acos(Ct(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+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,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,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,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};R1.prototype.isVector3=!0;let $=R1;const ry=new $,Nw=new vi,I1=class I1{constructor(e,t,i,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const f=this.elements;return f[0]=e,f[1]=r,f[2]=a,f[3]=t,f[4]=s,f[5]=l,f[6]=i,f[7]=o,f[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],f=i[4],d=i[7],p=i[2],m=i[5],g=i[8],x=r[0],_=r[3],y=r[6],b=r[1],w=r[4],M=r[7],T=r[2],E=r[5],I=r[8];return s[0]=o*x+a*b+l*T,s[3]=o*_+a*w+l*E,s[6]=o*y+a*M+l*I,s[1]=c*x+f*b+d*T,s[4]=c*_+f*w+d*E,s[7]=c*y+f*M+d*I,s[2]=p*x+m*b+g*T,s[5]=p*_+m*w+g*E,s[8]=p*y+m*M+g*I,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],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8];return t*o*f-t*a*c-i*s*f+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8],d=f*o-a*c,p=a*l-f*s,m=c*s-o*l,g=t*d+i*p+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/g;return e[0]=d*x,e[1]=(r*c-f*i)*x,e[2]=(a*i-r*o)*x,e[3]=p*x,e[4]=(f*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(i*l-c*t)*x,e[8]=(o*t-i*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,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(sy.makeScale(e,t)),this}rotate(e){return this.premultiply(sy.makeRotation(-e)),this}translate(e,t){return this.premultiply(sy.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};I1.prototype.isMatrix3=!0;let Ut=I1;const sy=new Ut,Ow=new Ut().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Fw=new Ut().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function oN(){const n={enabled:!0,workingColorSpace:bu,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===hn&&(r.r=Co(r.r),r.g=Co(r.g),r.b=Co(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===hn&&(r.r=mu(r.r),r.g=mu(r.g),r.b=mu(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===Eo?Of: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,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].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 mg("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return mg("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[bu]:{primaries:e,whitePoint:i,transfer:Of,toXYZ:Ow,fromXYZ:Fw,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ni},outputColorSpaceConfig:{drawingBufferColorSpace:Ni}},[Ni]:{primaries:e,whitePoint:i,transfer:hn,toXYZ:Ow,fromXYZ:Fw,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ni}}}),n}const jt=oN();function Co(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function mu(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Tc;class kC{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Tc===void 0&&(Tc=kf("canvas")),Tc.width=e.width,Tc.height=e.height;const r=Tc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Tc}return i.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=kf("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Co(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Co(t[i]/255)*255):t[i]=Co(t[i]);return{data:t,width:e.width,height:e.height}}else return ot("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let aN=0;class xa{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:aN++}),this.uuid=Lr(),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):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,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 i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(oy(r[o].image)):s.push(oy(r[o]))}else s=oy(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function oy(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?kC.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ot("Texture: Unable to serialize Texture."),{})}let lN=0;const ay=new $;class An extends bs{constructor(e=An.DEFAULT_IMAGE,t=An.DEFAULT_MAPPING,i=hr,r=hr,s=gn,o=Vs,a=Oi,l=Xi,c=An.DEFAULT_ANISOTROPY,f=Eo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:lN++}),this.uuid=Lr(),this.name="",this.source=new xa(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ve(0,0),this.repeat=new Ve(1,1),this.center=new Ve(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,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,this.normalized=!1}get width(){return this.source.getSize(ay).x}get height(){return this.source.getSize(ay).y}get depth(){return this.source.getSize(ay).z}get image(){return this.source.data}set image(e){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.normalized=e.normalized,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 i=e[t];if(i===void 0){ot(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ot(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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,normalized:this.normalized,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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==jg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case hr:e.x=e.x<0?0:1;break;case Pf: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 If:e.y=e.y-Math.floor(e.y);break;case hr:e.y=e.y<0?0:1;break;case Pf: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++}}An.DEFAULT_IMAGE=null;An.DEFAULT_MAPPING=jg;An.DEFAULT_ANISOTROPY=1;const P1=class P1{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,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,i,r){return this.x=e,this.y=t,this.z=i,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,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[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,i,r,s;const l=e.elements,c=l[0],f=l[4],d=l[8],p=l[1],m=l[5],g=l[9],x=l[2],_=l[6],y=l[10];if(Math.abs(f-p)<.01&&Math.abs(d-x)<.01&&Math.abs(g-_)<.01){if(Math.abs(f+p)<.1&&Math.abs(d+x)<.1&&Math.abs(g+_)<.1&&Math.abs(c+m+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,M=(m+1)/2,T=(y+1)/2,E=(f+p)/4,I=(d+x)/4,A=(g+_)/4;return w>M&&w>T?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=E/i,s=I/i):M>T?M<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),i=E/r,s=A/r):T<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),i=I/s,r=A/s),this.set(i,r,s,t),this}let b=Math.sqrt((_-g)*(_-g)+(d-x)*(d-x)+(p-f)*(p-f));return Math.abs(b)<.001&&(b=1),this.x=(_-g)/b,this.y=(d-x)/b,this.z=(p-f)/b,this.w=Math.acos((c+m+y-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=Ct(this.x,e.x,t.x),this.y=Ct(this.y,e.y,t.y),this.z=Ct(this.z,e.z,t.z),this.w=Ct(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ct(this.x,e,t),this.y=Ct(this.y,e,t),this.z=Ct(this.z,e,t),this.w=Ct(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ct(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,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}};P1.prototype.isVector4=!0;let ln=P1;class fb extends bs{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new ln(0,0,e,t),this.scissorTest=!1,this.viewport=new ln(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new An(r),o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:gn,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 i=0;i<this.textures.length;i++)this.textures[i].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,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;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=i,this.textures[r].isData3DTexture!==!0&&(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,i=e.textures.length;t<i;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 xa(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.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ur extends fb{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class t0 extends An{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Hn,this.minFilter=Hn,this.wrapR=hr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class cN extends Ur{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new t0(null,e,t,i),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class n0 extends An{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Hn,this.minFilter=Hn,this.wrapR=hr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class uN extends Ur{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new n0(null,e,t,i),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}const Gg=class Gg{constructor(e,t,i,r,s,o,a,l,c,f,d,p,m,g,x,_){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,i,r,s,o,a,l,c,f,d,p,m,g,x,_)}set(e,t,i,r,s,o,a,l,c,f,d,p,m,g,x,_){const y=this.elements;return y[0]=e,y[4]=t,y[8]=i,y[12]=r,y[1]=s,y[5]=o,y[9]=a,y[13]=l,y[2]=c,y[6]=f,y[10]=d,y[14]=p,y[3]=m,y[7]=g,y[11]=x,y[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 Gg().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/Ac.setFromMatrixColumn(e,0).length(),s=1/Ac.setFromMatrixColumn(e,1).length(),o=1/Ac.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),f=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=o*f,m=o*d,g=a*f,x=a*d;t[0]=l*f,t[4]=-l*d,t[8]=c,t[1]=m+g*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=g+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*f,m=l*d,g=c*f,x=c*d;t[0]=p+x*a,t[4]=g*a-m,t[8]=o*c,t[1]=o*d,t[5]=o*f,t[9]=-a,t[2]=m*a-g,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*f,m=l*d,g=c*f,x=c*d;t[0]=p-x*a,t[4]=-o*d,t[8]=g+m*a,t[1]=m+g*a,t[5]=o*f,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*f,m=o*d,g=a*f,x=a*d;t[0]=l*f,t[4]=g*c-m,t[8]=p*c+x,t[1]=l*d,t[5]=x*c+p,t[9]=m*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,g=a*l,x=a*c;t[0]=l*f,t[4]=x-p*d,t[8]=g*d+m,t[1]=d,t[5]=o*f,t[9]=-a*f,t[2]=-c*f,t[6]=m*d+g,t[10]=p-x*d}else if(e.order==="XZY"){const p=o*l,m=o*c,g=a*l,x=a*c;t[0]=l*f,t[4]=-d,t[8]=c*f,t[1]=p*d+x,t[5]=o*f,t[9]=m*d-g,t[2]=g*d-m,t[6]=a*f,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(hN,e,fN)}lookAt(e,t,i){const r=this.elements;return Rr.subVectors(e,t),Rr.lengthSq()===0&&(Rr.z=1),Rr.normalize(),aa.crossVectors(i,Rr),aa.lengthSq()===0&&(Math.abs(i.z)===1?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),aa.crossVectors(i,Rr)),aa.normalize(),sp.crossVectors(Rr,aa),r[0]=aa.x,r[4]=sp.x,r[8]=Rr.x,r[1]=aa.y,r[5]=sp.y,r[9]=Rr.y,r[2]=aa.z,r[6]=sp.z,r[10]=Rr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],f=i[1],d=i[5],p=i[9],m=i[13],g=i[2],x=i[6],_=i[10],y=i[14],b=i[3],w=i[7],M=i[11],T=i[15],E=r[0],I=r[4],A=r[8],R=r[12],D=r[1],L=r[5],U=r[9],N=r[13],B=r[2],z=r[6],k=r[10],O=r[14],Y=r[3],X=r[7],K=r[11],G=r[15];return s[0]=o*E+a*D+l*B+c*Y,s[4]=o*I+a*L+l*z+c*X,s[8]=o*A+a*U+l*k+c*K,s[12]=o*R+a*N+l*O+c*G,s[1]=f*E+d*D+p*B+m*Y,s[5]=f*I+d*L+p*z+m*X,s[9]=f*A+d*U+p*k+m*K,s[13]=f*R+d*N+p*O+m*G,s[2]=g*E+x*D+_*B+y*Y,s[6]=g*I+x*L+_*z+y*X,s[10]=g*A+x*U+_*k+y*K,s[14]=g*R+x*N+_*O+y*G,s[3]=b*E+w*D+M*B+T*Y,s[7]=b*I+w*L+M*z+T*X,s[11]=b*A+w*U+M*k+T*K,s[15]=b*R+w*N+M*O+T*G,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],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],f=e[2],d=e[6],p=e[10],m=e[14],g=e[3],x=e[7],_=e[11],y=e[15],b=l*m-c*p,w=a*m-c*d,M=a*p-l*d,T=o*m-c*f,E=o*p-l*f,I=o*d-a*f;return t*(x*b-_*w+y*M)-i*(g*b-_*T+y*E)+r*(g*w-x*T+y*I)-s*(g*M-x*E+_*I)}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,i){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]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8],d=e[9],p=e[10],m=e[11],g=e[12],x=e[13],_=e[14],y=e[15],b=t*a-i*o,w=t*l-r*o,M=t*c-s*o,T=i*l-r*a,E=i*c-s*a,I=r*c-s*l,A=f*x-d*g,R=f*_-p*g,D=f*y-m*g,L=d*_-p*x,U=d*y-m*x,N=p*y-m*_,B=b*N-w*U+M*L+T*D-E*R+I*A;if(B===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/B;return e[0]=(a*N-l*U+c*L)*z,e[1]=(r*U-i*N-s*L)*z,e[2]=(x*I-_*E+y*T)*z,e[3]=(p*E-d*I-m*T)*z,e[4]=(l*D-o*N-c*R)*z,e[5]=(t*N-r*D+s*R)*z,e[6]=(_*M-g*I-y*w)*z,e[7]=(f*I-p*M+m*w)*z,e[8]=(o*U-a*D+c*A)*z,e[9]=(i*D-t*U-s*A)*z,e[10]=(g*E-x*M+y*b)*z,e[11]=(d*M-f*E-m*b)*z,e[12]=(a*R-o*L-l*A)*z,e[13]=(t*L-i*R+r*A)*z,e[14]=(x*w-g*T-_*b)*z,e[15]=(f*T-d*w+p*b)*z,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,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],i=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,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,f=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,f*a+i,f*l-r*o,0,c*l-r*a,f*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,f=o+o,d=a+a,p=s*c,m=s*f,g=s*d,x=o*f,_=o*d,y=a*d,b=l*c,w=l*f,M=l*d,T=i.x,E=i.y,I=i.z;return r[0]=(1-(x+y))*T,r[1]=(m+M)*T,r[2]=(g-w)*T,r[3]=0,r[4]=(m-M)*E,r[5]=(1-(p+y))*E,r[6]=(_+b)*E,r[7]=0,r[8]=(g+w)*I,r[9]=(_-b)*I,r[10]=(1-(p+x))*I,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let o=Ac.set(r[0],r[1],r[2]).length();const a=Ac.set(r[4],r[5],r[6]).length(),l=Ac.set(r[8],r[9],r[10]).length();s<0&&(o=-o),cs.copy(this);const c=1/o,f=1/a,d=1/l;return cs.elements[0]*=c,cs.elements[1]*=c,cs.elements[2]*=c,cs.elements[4]*=f,cs.elements[5]*=f,cs.elements[6]*=f,cs.elements[8]*=d,cs.elements[9]*=d,cs.elements[10]*=d,t.setFromRotationMatrix(cs),i.x=o,i.y=a,i.z=l,this}makePerspective(e,t,i,r,s,o,a=Dr,l=!1){const c=this.elements,f=2*s/(t-e),d=2*s/(i-r),p=(t+e)/(t-e),m=(i+r)/(i-r);let g,x;if(l)g=s/(o-s),x=o*s/(o-s);else if(a===Dr)g=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===Ll)g=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=f,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]=g,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Dr,l=!1){const c=this.elements,f=2/(t-e),d=2/(i-r),p=-(t+e)/(t-e),m=-(i+r)/(i-r);let g,x;if(l)g=1/(o-s),x=o/(o-s);else if(a===Dr)g=-2/(o-s),x=-(o+s)/(o-s);else if(a===Ll)g=-1/(o-s),x=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=f,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]=g,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Gg.prototype.isMatrix4=!0;let Rt=Gg;const Ac=new $,cs=new Rt,hN=new $(0,0,0),fN=new $(1,1,1),aa=new $,sp=new $,Rr=new $,kw=new Rt,zw=new vi;class Nr{constructor(e=0,t=0,i=0,r=Nr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,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,i,r=this._order){return this._x=e,this._y=t,this._z=i,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,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],f=r[9],d=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Ct(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ct(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ct(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ct(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(-o,c));break;case"YZX":this._z=Math.asin(Ct(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Ct(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,m),this._y=0);break;default:ot("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return kw.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kw,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return zw.setFromEuler(this),this.setFromQuaternion(zw,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}}Nr.DEFAULT_ORDER="XYZ";class wu{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 dN=0;const Bw=new $,Cc=new vi,fo=new Rt,op=new $,xh=new $,pN=new $,mN=new vi,Gw=new $(1,0,0),Vw=new $(0,1,0),Hw=new $(0,0,1),Ww={type:"added"},gN={type:"removed"},Rc={type:"childadded",child:null},ly={type:"childremoved",child:null};class nn extends bs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:dN++}),this.uuid=Lr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nn.DEFAULT_UP.clone();const e=new $,t=new Nr,i=new vi,r=new $(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Rt},normalMatrix:{value:new Ut}}),this.matrix=new Rt,this.matrixWorld=new Rt,this.matrixAutoUpdate=nn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new wu,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.static=!1,this.userData={},this.pivot=null}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 Cc.setFromAxisAngle(e,t),this.quaternion.multiply(Cc),this}rotateOnWorldAxis(e,t){return Cc.setFromAxisAngle(e,t),this.quaternion.premultiply(Cc),this}rotateX(e){return this.rotateOnAxis(Gw,e)}rotateY(e){return this.rotateOnAxis(Vw,e)}rotateZ(e){return this.rotateOnAxis(Hw,e)}translateOnAxis(e,t){return Bw.copy(e).applyQuaternion(this.quaternion),this.position.add(Bw.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Gw,e)}translateY(e){return this.translateOnAxis(Vw,e)}translateZ(e){return this.translateOnAxis(Hw,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(fo.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?op.copy(e):op.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),xh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fo.lookAt(xh,op,this.up):fo.lookAt(op,xh,this.up),this.quaternion.setFromRotationMatrix(fo),r&&(fo.extractRotation(r.matrixWorld),Cc.setFromRotationMatrix(fo),this.quaternion.premultiply(Cc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(bt("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(Ww),Rc.child=e,this.dispatchEvent(Rc),Rc.child=null):bt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(gN),ly.child=e,this.dispatchEvent(ly),ly.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),fo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),fo.multiply(e.parent.matrixWorld)),e.applyMatrix4(fo),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ww),Rc.child=e,this.dispatchEvent(Rc),Rc.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 i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xh,e,pN),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xh,mN,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 i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].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);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}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 i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.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),this.static!==!1&&(r.static=this.static),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.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),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(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),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(a,l){return a[l.uuid]===void 0&&(a[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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,f=l.length;c<f;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 a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),f=o(e.images),d=o(e.shapes),p=o(e.skeletons),m=o(e.animations),g=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),f.length>0&&(i.images=f),d.length>0&&(i.shapes=d),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const f=a[c];delete f.metadata,l.push(f)}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}nn.DEFAULT_UP=new $(0,1,0);nn.DEFAULT_MATRIX_AUTO_UPDATE=!0;nn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class uu extends nn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vN={type:"move"};class ym{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new uu,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 uu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new uu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $,this._grip.eventsEnabled=!1),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 i of e.hand.values())this._getHandJoint(t,i)}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,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const _=t.getJointPose(x,i),y=this._getHandJoint(c,x);_!==null&&(y.matrix.fromArray(_.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=_.radius),y.visible=_!==null}const f=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],p=f.position.distanceTo(d.position),m=.02,g=.005;c.inputState.pinching&&p>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),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,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vN)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new uu;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const zC={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},la={h:0,s:0,l:0},ap={h:0,s:0,l:0};function cy(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}let et=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===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,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ni){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,jt.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=jt.workingColorSpace){return this.r=e,this.g=t,this.b=i,jt.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=jt.workingColorSpace){if(e=hb(e,1),t=Ct(t,0,1),i=Ct(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=cy(o,s,e+1/3),this.g=cy(o,s,e),this.b=cy(o,s,e-1/3)}return jt.colorSpaceToWorking(this,r),this}setStyle(e,t=Ni){function i(s){s!==void 0&&parseFloat(s)<1&&ot("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(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(a))return i(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(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ot("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);ot("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ni){const i=zC[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ot("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=Co(e.r),this.g=Co(e.g),this.b=Co(e.b),this}copyLinearToSRGB(e){return this.r=mu(e.r),this.g=mu(e.g),this.b=mu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ni){return jt.workingToColorSpace(Li.copy(this),e),Math.round(Ct(Li.r*255,0,255))*65536+Math.round(Ct(Li.g*255,0,255))*256+Math.round(Ct(Li.b*255,0,255))}getHexString(e=Ni){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=jt.workingColorSpace){jt.workingToColorSpace(Li.copy(this),t);const i=Li.r,r=Li.g,s=Li.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const f=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=f<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=f,e}getRGB(e,t=jt.workingColorSpace){return jt.workingToColorSpace(Li.copy(this),t),e.r=Li.r,e.g=Li.g,e.b=Li.b,e}getStyle(e=Ni){jt.workingToColorSpace(Li.copy(this),e);const t=Li.r,i=Li.g,r=Li.b;return e!==Ni?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(la),this.setHSL(la.h+e,la.s+t,la.l+i)}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(la),e.getHSL(ap);const i=xf(la.h,ap.h,t),r=xf(la.s,ap.s,t),s=xf(la.l,ap.l,t);return this.setHSL(i,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,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+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 Li=new et;et.NAMES=zC;class i0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new et(e),this.density=t}clone(){return new i0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class r0{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new et(e),this.near=t,this.far=i}clone(){return new r0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class s0 extends nn{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 Nr,this.environmentIntensity=1,this.environmentRotation=new Nr,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}}const us=new $,po=new $,uy=new $,mo=new $,Ic=new $,Pc=new $,jw=new $,hy=new $,fy=new $,dy=new $,py=new ln,my=new ln,gy=new ln;class ur{constructor(e=new $,t=new $,i=new $){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),us.subVectors(e,t),r.cross(us);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){us.subVectors(r,t),po.subVectors(i,t),uy.subVectors(e,t);const o=us.dot(us),a=us.dot(po),l=us.dot(uy),c=po.dot(po),f=po.dot(uy),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const p=1/d,m=(c*l-a*f)*p,g=(o*f-a*l)*p;return s.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,mo)===null?!1:mo.x>=0&&mo.y>=0&&mo.x+mo.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,mo)===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,mo.x),l.addScaledVector(o,mo.y),l.addScaledVector(a,mo.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return py.setScalar(0),my.setScalar(0),gy.setScalar(0),py.fromBufferAttribute(e,t),my.fromBufferAttribute(e,i),gy.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(py,s.x),o.addScaledVector(my,s.y),o.addScaledVector(gy,s.z),o}static isFrontFacing(e,t,i,r){return us.subVectors(i,t),po.subVectors(e,t),us.cross(po).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),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 us.subVectors(this.c,this.b),po.subVectors(this.a,this.b),us.cross(po).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ur.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ur.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ur.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ur.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ur.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Ic.subVectors(r,i),Pc.subVectors(s,i),hy.subVectors(e,i);const l=Ic.dot(hy),c=Pc.dot(hy);if(l<=0&&c<=0)return t.copy(i);fy.subVectors(e,r);const f=Ic.dot(fy),d=Pc.dot(fy);if(f>=0&&d<=f)return t.copy(r);const p=l*d-f*c;if(p<=0&&l>=0&&f<=0)return o=l/(l-f),t.copy(i).addScaledVector(Ic,o);dy.subVectors(e,s);const m=Ic.dot(dy),g=Pc.dot(dy);if(g>=0&&m<=g)return t.copy(s);const x=m*c-l*g;if(x<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(Pc,a);const _=f*g-m*d;if(_<=0&&d-f>=0&&m-g>=0)return jw.subVectors(s,r),a=(d-f)/(d-f+(m-g)),t.copy(r).addScaledVector(jw,a);const y=1/(_+x+p);return o=x*y,a=p*y,t.copy(i).addScaledVector(Ic,o).addScaledVector(Pc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ai{constructor(e=new $(1/0,1/0,1/0),t=new $(-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,i=e.length;t<i;t+=3)this.expandByPoint(hs.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(hs.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=hs.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,hs):hs.fromBufferAttribute(s,o),hs.applyMatrix4(e.matrixWorld),this.expandByPoint(hs);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),lp.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),lp.copy(i.boundingBox)),lp.applyMatrix4(e.matrixWorld),this.union(lp)}const r=e.children;for(let s=0,o=r.length;s<o;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,hs),hs.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(bh),cp.subVectors(this.max,bh),Dc.subVectors(e.a,bh),Lc.subVectors(e.b,bh),Uc.subVectors(e.c,bh),ca.subVectors(Lc,Dc),ua.subVectors(Uc,Lc),tl.subVectors(Dc,Uc);let t=[0,-ca.z,ca.y,0,-ua.z,ua.y,0,-tl.z,tl.y,ca.z,0,-ca.x,ua.z,0,-ua.x,tl.z,0,-tl.x,-ca.y,ca.x,0,-ua.y,ua.x,0,-tl.y,tl.x,0];return!vy(t,Dc,Lc,Uc,cp)||(t=[1,0,0,0,1,0,0,0,1],!vy(t,Dc,Lc,Uc,cp))?!1:(up.crossVectors(ca,ua),t=[up.x,up.y,up.z],vy(t,Dc,Lc,Uc,cp))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hs).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:(go[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),go[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),go[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),go[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),go[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),go[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),go[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),go[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(go),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 go=[new $,new $,new $,new $,new $,new $,new $,new $],hs=new $,lp=new ai,Dc=new $,Lc=new $,Uc=new $,ca=new $,ua=new $,tl=new $,bh=new $,cp=new $,up=new $,nl=new $;function vy(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){nl.fromArray(n,s);const a=r.x*Math.abs(nl.x)+r.y*Math.abs(nl.y)+r.z*Math.abs(nl.z),l=e.dot(nl),c=t.dot(nl),f=i.dot(nl);if(Math.max(-Math.max(l,c,f),Math.min(l,c,f))>a)return!1}return!0}const To=yN();function yN(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,f=0;for(;(c&8388608)===0;)c<<=1,f-=8388608;c&=-8388609,f+=947912704,s[l]=c|f}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function lr(n){Math.abs(n)>65504&&ot("DataUtils.toHalfFloat(): Value out of range."),n=Ct(n,-65504,65504),To.floatView[0]=n;const e=To.uint32View[0],t=e>>23&511;return To.baseTable[t]+((e&8388607)>>To.shiftTable[t])}function nf(n){const e=n>>10;return To.uint32View[0]=To.mantissaTable[To.offsetTable[e]+(n&1023)]+To.exponentTable[e],To.floatView[0]}class _N{static toHalfFloat(e){return lr(e)}static fromHalfFloat(e){return nf(e)}}const Kn=new $,hp=new Ve;let xN=0;class cn extends bs{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xN++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ff,this.updateRanges=[],this.gpuType=Yi,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)hp.fromBufferAttribute(this,t),hp.applyMatrix3(e),this.setXY(t,hp.x,hp.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.applyMatrix3(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.applyMatrix4(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.applyNormalMatrix(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Kn.fromBufferAttribute(this,t),Kn.transformDirection(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=qi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Gt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=qi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=qi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Gt(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=qi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Gt(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=qi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,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!==Ff&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class bN extends cn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class SN extends cn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class wN extends cn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class MN extends cn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class db extends cn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class EN extends cn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class pb extends cn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class TN extends cn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=nf(this.array[e*this.itemSize]);return this.normalized&&(t=qi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize]=lr(t),this}getY(e){let t=nf(this.array[e*this.itemSize+1]);return this.normalized&&(t=qi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+1]=lr(t),this}getZ(e){let t=nf(this.array[e*this.itemSize+2]);return this.normalized&&(t=qi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+2]=lr(t),this}getW(e){let t=nf(this.array[e*this.itemSize+3]);return this.normalized&&(t=qi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Gt(t,this.array)),this.array[e*this.itemSize+3]=lr(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array)),this.array[e+0]=lr(t),this.array[e+1]=lr(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array)),this.array[e+0]=lr(t),this.array[e+1]=lr(i),this.array[e+2]=lr(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.array[e+0]=lr(t),this.array[e+1]=lr(i),this.array[e+2]=lr(r),this.array[e+3]=lr(s),this}}class dt extends cn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const AN=new ai,Sh=new $,yy=new $;let li=class{constructor(e=new $,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 i=this.center;t!==void 0?i.copy(t):AN.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.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 i=this.center.distanceToSquared(e);return t.copy(e),i>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;Sh.subVectors(e,this.center);const t=Sh.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Sh,r/i),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):(yy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Sh.copy(e.center).add(yy)),this.expandByPoint(Sh.copy(e.center).sub(yy))),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}},CN=0;const Vr=new Rt,_y=new nn,Nc=new $,Ir=new ai,wh=new ai,mi=new $;class Nt extends bs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CN++}),this.uuid=Lr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,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(kU(e)?pb:db)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}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 i=this.attributes.normal;if(i!==void 0){const s=new Ut().getNormalMatrix(e);i.applyNormalMatrix(s),i.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 Vr.makeRotationFromQuaternion(e),this.applyMatrix4(Vr),this}rotateX(e){return Vr.makeRotationX(e),this.applyMatrix4(Vr),this}rotateY(e){return Vr.makeRotationY(e),this.applyMatrix4(Vr),this}rotateZ(e){return Vr.makeRotationZ(e),this.applyMatrix4(Vr),this}translate(e,t,i){return Vr.makeTranslation(e,t,i),this.applyMatrix4(Vr),this}scale(e,t,i){return Vr.makeScale(e,t,i),this.applyMatrix4(Vr),this}lookAt(e){return _y.lookAt(e),_y.updateMatrix(),this.applyMatrix4(_y.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Nc).negate(),this.translate(Nc.x,Nc.y,Nc.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new dt(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ot("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 ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){bt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Ir.setFromBufferAttribute(s),this.morphTargetsRelative?(mi.addVectors(this.boundingBox.min,Ir.min),this.boundingBox.expandByPoint(mi),mi.addVectors(this.boundingBox.max,Ir.max),this.boundingBox.expandByPoint(mi)):(this.boundingBox.expandByPoint(Ir.min),this.boundingBox.expandByPoint(Ir.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&bt('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 li);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){bt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new $,1/0);return}if(e){const i=this.boundingSphere.center;if(Ir.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];wh.setFromBufferAttribute(a),this.morphTargetsRelative?(mi.addVectors(Ir.min,wh.min),Ir.expandByPoint(mi),mi.addVectors(Ir.max,wh.max),Ir.expandByPoint(mi)):(Ir.expandByPoint(wh.min),Ir.expandByPoint(wh.max))}Ir.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)mi.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(mi));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,f=a.count;c<f;c++)mi.fromBufferAttribute(a,c),l&&(Nc.fromBufferAttribute(e,c),mi.add(Nc)),r=Math.max(r,i.distanceToSquared(mi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&bt('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){bt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new cn(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let A=0;A<i.count;A++)a[A]=new $,l[A]=new $;const c=new $,f=new $,d=new $,p=new Ve,m=new Ve,g=new Ve,x=new $,_=new $;function y(A,R,D){c.fromBufferAttribute(i,A),f.fromBufferAttribute(i,R),d.fromBufferAttribute(i,D),p.fromBufferAttribute(s,A),m.fromBufferAttribute(s,R),g.fromBufferAttribute(s,D),f.sub(c),d.sub(c),m.sub(p),g.sub(p);const L=1/(m.x*g.y-g.x*m.y);isFinite(L)&&(x.copy(f).multiplyScalar(g.y).addScaledVector(d,-m.y).multiplyScalar(L),_.copy(d).multiplyScalar(m.x).addScaledVector(f,-g.x).multiplyScalar(L),a[A].add(x),a[R].add(x),a[D].add(x),l[A].add(_),l[R].add(_),l[D].add(_))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let A=0,R=b.length;A<R;++A){const D=b[A],L=D.start,U=D.count;for(let N=L,B=L+U;N<B;N+=3)y(e.getX(N+0),e.getX(N+1),e.getX(N+2))}const w=new $,M=new $,T=new $,E=new $;function I(A){T.fromBufferAttribute(r,A),E.copy(T);const R=a[A];w.copy(R),w.sub(T.multiplyScalar(T.dot(R))).normalize(),M.crossVectors(E,R);const L=M.dot(l[A])<0?-1:1;o.setXYZW(A,w.x,w.y,w.z,L)}for(let A=0,R=b.length;A<R;++A){const D=b[A],L=D.start,U=D.count;for(let N=L,B=L+U;N<B;N+=3)I(e.getX(N+0)),I(e.getX(N+1)),I(e.getX(N+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new cn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let p=0,m=i.count;p<m;p++)i.setXYZ(p,0,0,0);const r=new $,s=new $,o=new $,a=new $,l=new $,c=new $,f=new $,d=new $;if(e)for(let p=0,m=e.count;p<m;p+=3){const g=e.getX(p+0),x=e.getX(p+1),_=e.getX(p+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,_),f.subVectors(o,s),d.subVectors(r,s),f.cross(d),a.fromBufferAttribute(i,g),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,_),a.add(f),l.add(f),c.add(f),i.setXYZ(g,a.x,a.y,a.z),i.setXYZ(x,l.x,l.y,l.z),i.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),o.fromBufferAttribute(t,p+2),f.subVectors(o,s),d.subVectors(r,s),f.cross(d),i.setXYZ(p+0,f.x,f.y,f.z),i.setXYZ(p+1,f.x,f.y,f.z),i.setXYZ(p+2,f.x,f.y,f.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)mi.fromBufferAttribute(e,t),mi.normalize(),e.setXYZ(t,mi.x,mi.y,mi.z)}toNonIndexed(){function e(a,l){const c=a.array,f=a.itemSize,d=a.normalized,p=new c.constructor(l.length*f);let m=0,g=0;for(let x=0,_=l.length;x<_;x++){a.isInterleavedBufferAttribute?m=l[x]*a.data.stride+a.offset:m=l[x]*f;for(let y=0;y<f;y++)p[g++]=c[m++]}return new cn(p,f,d)}if(this.index===null)return ot("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Nt,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let f=0,d=c.length;f<d;f++){const p=c[f],m=e(p,i);l.push(m)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];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 i=this.attributes;for(const l in i){const c=i[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],f=[];for(let d=0,p=c.length;d<p;d++){const m=c[d];f.push(m.toJSON(e.data))}f.length>0&&(r[l]=f,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.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 i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const f=r[c];this.setAttribute(c,f.clone(t))}const s=e.morphAttributes;for(const c in s){const f=[],d=s[c];for(let p=0,m=d.length;p<m;p++)f.push(d[p].clone(t));this.morphAttributes[c]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,f=o.length;c<f;c++){const d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.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"})}}class o0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ff,this.updateRanges=[],this.version=0,this.uuid=Lr()}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,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+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=Lr()),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]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=Lr()),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 Wi=new $;class Ul{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,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,i=this.data.count;t<i;t++)Wi.fromBufferAttribute(this,t),Wi.applyMatrix4(e),this.setXYZ(t,Wi.x,Wi.y,Wi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Wi.fromBufferAttribute(this,t),Wi.applyNormalMatrix(e),this.setXYZ(t,Wi.x,Wi.y,Wi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Wi.fromBufferAttribute(this,t),Wi.transformDirection(e),this.setXYZ(t,Wi.x,Wi.y,Wi.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=qi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Gt(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Gt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Gt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Gt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Gt(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=qi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=qi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=qi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=qi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Gt(t,this.array),i=Gt(i,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){zf("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new cn(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 Ul(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){zf("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*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}}}let RN=0;class Fi extends bs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:RN++}),this.uuid=Lr(),this.name="",this.type="Material",this.blending=Al,this.side=Po,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Rm,this.blendDst=Im,this.blendEquation=ya,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new et(0,0,0),this.blendAlpha=0,this.depthFunc=Dl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ix,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yl,this.stencilZFail=yl,this.stencilZPass=yl,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 i=e[t];if(i===void 0){ot(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ot(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Al&&(i.blending=this.blending),this.side!==Po&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Rm&&(i.blendSrc=this.blendSrc),this.blendDst!==Im&&(i.blendDst=this.blendDst),this.blendEquation!==ya&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Dl&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ix&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==yl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==yl&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}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 i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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.allowOverride=e.allowOverride,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 mb extends Fi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new et(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 Oc;const Mh=new $,Fc=new $,kc=new $,zc=new Ve,Eh=new Ve,BC=new Rt,fp=new $,Th=new $,dp=new $,Xw=new Ve,xy=new Ve,qw=new Ve;class GC extends nn{constructor(e=new mb){if(super(),this.isSprite=!0,this.type="Sprite",Oc===void 0){Oc=new Nt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new o0(t,5);Oc.setIndex([0,1,2,0,2,3]),Oc.setAttribute("position",new Ul(i,3,0,!1)),Oc.setAttribute("uv",new Ul(i,2,3,!1))}this.geometry=Oc,this.material=e,this.center=new Ve(.5,.5),this.count=1}raycast(e,t){e.camera===null&&bt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Fc.setFromMatrixScale(this.matrixWorld),BC.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),kc.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fc.multiplyScalar(-kc.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;pp(fp.set(-.5,-.5,0),kc,o,Fc,r,s),pp(Th.set(.5,-.5,0),kc,o,Fc,r,s),pp(dp.set(.5,.5,0),kc,o,Fc,r,s),Xw.set(0,0),xy.set(1,0),qw.set(1,1);let a=e.ray.intersectTriangle(fp,Th,dp,!1,Mh);if(a===null&&(pp(Th.set(-.5,.5,0),kc,o,Fc,r,s),xy.set(0,1),a=e.ray.intersectTriangle(fp,dp,Th,!1,Mh),a===null))return;const l=e.ray.origin.distanceTo(Mh);l<e.near||l>e.far||t.push({distance:l,point:Mh.clone(),uv:ur.getInterpolation(Mh,fp,Th,dp,Xw,xy,qw,new Ve),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 pp(n,e,t,i,r,s){zc.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Eh.x=s*zc.x-r*zc.y,Eh.y=r*zc.x+s*zc.y):Eh.copy(zc),n.copy(e),n.x+=Eh.x,n.y+=Eh.y,n.applyMatrix4(BC)}const mp=new $,$w=new $;class VC extends nn{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 i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=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:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const r=t.splice(i,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 i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){mp.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(mp);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){mp.setFromMatrixPosition(e.matrixWorld),$w.setFromMatrixPosition(this.matrixWorld);const i=mp.distanceTo($w)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)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 i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const vo=new $,by=new $,gp=new $,ha=new $,Sy=new $,vp=new $,wy=new $;class Nu{constructor(e=new $,t=new $(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,vo)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=vo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(vo.copy(this.origin).addScaledVector(this.direction,t),vo.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){by.copy(e).add(t).multiplyScalar(.5),gp.copy(t).sub(e).normalize(),ha.copy(this.origin).sub(by);const s=e.distanceTo(t)*.5,o=-this.direction.dot(gp),a=ha.dot(this.direction),l=-ha.dot(gp),c=ha.lengthSq(),f=Math.abs(1-o*o);let d,p,m,g;if(f>0)if(d=o*l-a,p=o*a-l,g=s*f,d>=0)if(p>=-g)if(p<=g){const x=1/f;d*=x,p*=x,m=d*(d+o*p+2*a)+p*(o*d+p+2*l)+c}else p=s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;else p=-s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;else p<=-g?(d=Math.max(0,-(-o*s+a)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c):p<=g?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(d=Math.max(0,-(o*s+a)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c);else p=o>0?-s:s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(by).addScaledVector(gp,p),m}intersectSphere(e,t){vo.subVectors(e.center,this.origin);const i=vo.dot(this.direction),r=vo.dot(vo)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,f=1/this.direction.y,d=1/this.direction.z,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),f>=0?(s=(e.min.y-p.y)*f,o=(e.max.y-p.y)*f):(s=(e.max.y-p.y)*f,o=(e.min.y-p.y)*f),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(a=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,vo)!==null}intersectTriangle(e,t,i,r,s){Sy.subVectors(t,e),vp.subVectors(i,e),wy.crossVectors(Sy,vp);let o=this.direction.dot(wy),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ha.subVectors(this.origin,e);const l=a*this.direction.dot(vp.crossVectors(ha,vp));if(l<0)return null;const c=a*this.direction.dot(Sy.cross(ha));if(c<0||l+c>o)return null;const f=-a*ha.dot(wy);return f<0?null:this.at(f/o,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 No extends Fi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(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 Nr,this.combine=sd,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 Yw=new Rt,il=new Nu,yp=new li,Zw=new $,_p=new $,xp=new $,bp=new $,My=new $,Sp=new $,Kw=new $,wp=new $;class wn extends nn{constructor(e=new Nt,t=new No){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,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){Sp.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const f=a[l],d=s[l];f!==0&&(My.fromBufferAttribute(d,e),o?Sp.addScaledVector(My,f):Sp.addScaledVector(My.sub(t),f))}t.add(Sp)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),yp.copy(i.boundingSphere),yp.applyMatrix4(s),il.copy(e.ray).recast(e.near),!(yp.containsPoint(il.origin)===!1&&(il.intersectSphere(yp,Zw)===null||il.origin.distanceToSquared(Zw)>(e.far-e.near)**2))&&(Yw.copy(s).invert(),il.copy(e.ray).applyMatrix4(Yw),!(i.boundingBox!==null&&il.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,il)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,f=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,x=p.length;g<x;g++){const _=p[g],y=o[_.materialIndex],b=Math.max(_.start,m.start),w=Math.min(a.count,Math.min(_.start+_.count,m.start+m.count));for(let M=b,T=w;M<T;M+=3){const E=a.getX(M),I=a.getX(M+1),A=a.getX(M+2);r=Mp(this,y,e,i,c,f,d,E,I,A),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const g=Math.max(0,m.start),x=Math.min(a.count,m.start+m.count);for(let _=g,y=x;_<y;_+=3){const b=a.getX(_),w=a.getX(_+1),M=a.getX(_+2);r=Mp(this,o,e,i,c,f,d,b,w,M),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let g=0,x=p.length;g<x;g++){const _=p[g],y=o[_.materialIndex],b=Math.max(_.start,m.start),w=Math.min(l.count,Math.min(_.start+_.count,m.start+m.count));for(let M=b,T=w;M<T;M+=3){const E=M,I=M+1,A=M+2;r=Mp(this,y,e,i,c,f,d,E,I,A),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const g=Math.max(0,m.start),x=Math.min(l.count,m.start+m.count);for(let _=g,y=x;_<y;_+=3){const b=_,w=_+1,M=_+2;r=Mp(this,o,e,i,c,f,d,b,w,M),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}}}function IN(n,e,t,i,r,s,o,a){let l;if(e.side===Zi?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Po,a),l===null)return null;wp.copy(a),wp.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(wp);return c<t.near||c>t.far?null:{distance:c,point:wp.clone(),object:n}}function Mp(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,_p),n.getVertexPosition(l,xp),n.getVertexPosition(c,bp);const f=IN(n,e,t,i,_p,xp,bp,Kw);if(f){const d=new $;ur.getBarycoord(Kw,_p,xp,bp,d),r&&(f.uv=ur.getInterpolatedAttribute(r,a,l,c,d,new Ve)),s&&(f.uv1=ur.getInterpolatedAttribute(s,a,l,c,d,new Ve)),o&&(f.normal=ur.getInterpolatedAttribute(o,a,l,c,d,new $),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new $,materialIndex:0};ur.getNormal(_p,xp,bp,p.normal),f.face=p,f.barycoord=d}return f}const Ah=new ln,Jw=new ln,Qw=new ln,PN=new ln,eM=new Rt,Ep=new $,Ey=new li,tM=new Rt,Ty=new Nu;class HC extends wn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=tx,this.bindMatrix=new Rt,this.bindMatrixInverse=new Rt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ai),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ep),this.boundingBox.expandByPoint(Ep)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new li),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ep),this.boundingSphere.expandByPoint(Ep)}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 i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ey.copy(this.boundingSphere),Ey.applyMatrix4(r),e.ray.intersectsSphere(Ey)!==!1&&(tM.copy(r).invert(),Ty.copy(e.ray).applyMatrix4(tM),!(this.boundingBox!==null&&Ty.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Ty)))}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 ln,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===tx?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===SC?this.bindMatrixInverse.copy(this.bindMatrix).invert():ot("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;Jw.fromBufferAttribute(r.attributes.skinIndex,e),Qw.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(Ah.copy(t),t.set(0,0,0,0)):(Ah.set(...t,1),t.set(0,0,0)),Ah.applyMatrix4(this.bindMatrix);for(let s=0;s<4;s++){const o=Qw.getComponent(s);if(o!==0){const a=Jw.getComponent(s);eM.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(PN.copy(Ah).applyMatrix4(eM),o)}}return t.isVector4&&(t.w=Ah.w),t.applyMatrix4(this.bindMatrixInverse)}}class gb extends nn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class xs extends An{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Hn,f=Hn,d,p){super(null,o,a,l,c,f,r,s,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const nM=new Rt,DN=new Rt;class a0{constructor(e=[],t=[]){this.uuid=Lr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=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){ot("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new Rt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new Rt;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:DN;nM.multiplyMatrices(a,t[s]),nM.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new a0(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 i=new xs(t,e,e,Oi,Yi);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;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 i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(ot("Skeleton: No bone found with UUID:",s),o=new gb),this.bones.push(o),this.boneInverses.push(new Rt().fromArray(e.boneInverses[i]))}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,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Nl extends cn{constructor(e,t,i,r=1){super(e,t,i),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 Bc=new Rt,iM=new Rt,Tp=[],rM=new ai,LN=new Rt,Ch=new wn,Rh=new li;class WC extends wn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Nl(new Float32Array(i*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,LN)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ai),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Bc),rM.copy(e.boundingBox).applyMatrix4(Bc),this.boundingBox.union(rM)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new li),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Bc),Rh.copy(e.boundingSphere).applyMatrix4(Bc),this.boundingSphere.union(Rh)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),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){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(Ch.geometry=this.geometry,Ch.material=this.material,Ch.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Rh.copy(this.boundingSphere),Rh.applyMatrix4(i),e.ray.intersectsSphere(Rh)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Bc),iM.multiplyMatrices(i,Bc),Ch.matrixWorld=iM,Ch.raycast(e,Tp);for(let o=0,a=Tp.length;o<a;o++){const l=Tp[o];l.instanceId=s,l.object=this,t.push(l)}Tp.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Nl(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new xs(new Float32Array(r*this.count),r,this.count,Yg,Yi));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;return s[l]=a,s.set(i,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ay=new $,UN=new $,NN=new Ut;class Mo{constructor(e=new $(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Ay.subVectors(i,t).cross(UN.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,i=!0){const r=e.delta(Ay),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||NN.getNormalMatrix(e),r=this.coplanarPoint(Ay).applyMatrix4(e),s=this.normal.applyMatrix3(i).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 rl=new li,ON=new Ve(.5,.5),Ap=new $;class Hl{constructor(e=new Mo,t=new Mo,i=new Mo,r=new Mo,s=new Mo,o=new Mo){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Dr,i=!1){const r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],f=s[4],d=s[5],p=s[6],m=s[7],g=s[8],x=s[9],_=s[10],y=s[11],b=s[12],w=s[13],M=s[14],T=s[15];if(r[0].setComponents(c-o,m-f,y-g,T-b).normalize(),r[1].setComponents(c+o,m+f,y+g,T+b).normalize(),r[2].setComponents(c+a,m+d,y+x,T+w).normalize(),r[3].setComponents(c-a,m-d,y-x,T-w).normalize(),i)r[4].setComponents(l,p,_,M).normalize(),r[5].setComponents(c-l,m-p,y-_,T-M).normalize();else if(r[4].setComponents(c-l,m-p,y-_,T-M).normalize(),t===Dr)r[5].setComponents(c+l,m+p,y+_,T+M).normalize();else if(t===Ll)r[5].setComponents(l,p,_,M).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(),rl.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),rl.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(rl)}intersectsSprite(e){rl.center.set(0,0,0);const t=ON.distanceTo(e.center);return rl.radius=.7071067811865476+t,rl.applyMatrix4(e.matrixWorld),this.intersectsSphere(rl)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ap.x=r.normal.x>0?e.max.x:e.min.x,Ap.y=r.normal.y>0?e.max.y:e.min.y,Ap.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ap)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Ps=new Rt,Ds=new Hl;class l0{constructor(){this.coordinateSystem=Dr}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const r=t.cameras[i];if(Ps.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ds.setFromProjectionMatrix(Ps,r.coordinateSystem,r.reversedDepth),Ds.containsPoint(e))return!0}return!1}clone(){return new l0}}function Cy(n,e){return n-e}function FN(n,e){return n.z-e.z}function kN(n,e){return e.z-n.z}class zN{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,r){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=i,a.index=r}reset(){this.list.length=0,this.index=0}}const or=new Rt,BN=new et(1,1,1),sM=new Hl,GN=new l0,Cp=new ai,sl=new li,Ih=new $,oM=new $,VN=new $,Ry=new zN,Ui=new wn,Rp=[];function HN(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}function ol(n,e){if(n.constructor!==e.constructor){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)e[i]=n[i]}else{const t=Math.min(n.length,e.length);e.set(new n.constructor(n.buffer,0,t))}}class jC extends wn{constructor(e,t,i=t*2,r){super(new Nt,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=i,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,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),i=new xs(t,e,e,Oi,Yi);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new xs(t,e,e,od,Jr);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new xs(t,e,e,Oi,Yi);i.colorSpace=jt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,f=new a.constructor(i*l),d=new cn(f,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new cn(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 i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);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 ai);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,or),this.getBoundingBoxAt(s,Cp).applyMatrix4(or),e.union(Cp)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new li);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,or),this.getBoundingSphereAt(s,sl).applyMatrix4(or),e.union(sl)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Cy),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=i):(r=this._instanceInfo.length,this._instanceInfo.push(i));const s=this._matricesTexture;or.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(BN.toArray(o.image.data,r*4),o.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,i=-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 o=e.getIndex();if(o!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=i===-1?o.count:i),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(Cy),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 i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(r&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const f in i.attributes){const d=t.getAttribute(f),p=i.getAttribute(f);HN(d,p,l);const m=d.itemSize;for(let g=d.count,x=c;g<x;g++){const _=l+g;for(let y=0;y<m;y++)p.setComponent(_,y,0)}p.needsUpdate=!0,p.addUpdateRange(l*m,c*m)}if(r){const f=a.indexStart,d=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let p=0;p<o.count;p++)s.setX(f+p,l+o.getX(p));for(let p=o.count,m=d;p<m;p++)s.setX(f+p,l);s.needsUpdate=!0,s.addUpdateRange(f,a.reservedIndexCount)}return a.start=r?a.indexStart:a.vertexStart,a.count=r?a.indexCount:a.vertexCount,a.boundingBox=null,t.boundingBox!==null&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,t.boundingSphere!==null&&(a.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 i=this._instanceInfo;for(let r=0,s=i.length;r<s;r++)i[r].active&&i[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 i=this._geometryInfo,r=i.map((o,a)=>a).sort((o,a)=>i[o].vertexStart-i[a].vertexStart),s=this.geometry;for(let o=0,a=i.length;o<a;o++){const l=r[o],c=i[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:f,vertexStart:d,reservedIndexCount:p}=c,m=s.index,g=m.array,x=e-d;for(let _=f;_<f+p;_++)g[_]=g[_]+x;m.array.copyWithin(t,f,f+p),m.addUpdateRange(t,p),m.needsUpdate=!0,c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:f,reservedVertexCount:d}=c,p=s.attributes;for(const m in p){const g=p[m],{array:x,itemSize:_}=g;x.copyWithin(e*_,f*_,(f+d)*_),g.addUpdateRange(e*_,d*_),g.needsUpdate=!0}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new ai,o=i.index,a=i.attributes.position;for(let l=r.start,c=r.start+r.count;l<c;l++){let f=l;o&&(f=o.getX(f)),s.expandByPoint(Ih.fromBufferAttribute(a,f))}r.boundingBox=s}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new li;this.getBoundingBoxAt(e,Cp),Cp.getCenter(s.center);const o=i.index,a=i.attributes.position;let l=0;for(let c=r.start,f=r.start+r.count;c<f;c++){let d=c;o&&(d=o.getX(d)),Ih.fromBufferAttribute(a,d),l=Math.max(l,s.center.distanceToSquared(Ih))}s.radius=Math.sqrt(l),r.boundingSphere=s}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const i=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),i.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),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):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 i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(Cy);t[t.length-1]===i.length-1;)i.pop(),t.pop();if(e<i.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);ol(this._multiDrawCounts,r),ol(this._multiDrawStarts,s),this._multiDrawCounts=r,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),ol(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),ol(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),ol(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...i.map(a=>a.vertexStart+a.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(...i.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 Nt,this._initializeGeometry(s));const o=this.geometry;s.index&&ol(s.index.array,o.index.array);for(const a in s.attributes)ol(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const i=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Ui.material=this.material,Ui.geometry.index=o.index,Ui.geometry.attributes=o.attributes,Ui.geometry.boundingBox===null&&(Ui.geometry.boundingBox=new ai),Ui.geometry.boundingSphere===null&&(Ui.geometry.boundingSphere=new li);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,f=r[c];Ui.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(a,Ui.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Ui.geometry.boundingBox),this.getBoundingSphereAt(c,Ui.geometry.boundingSphere),Ui.raycast(e,Rp);for(let d=0,p=Rp.length;d<p;d++){const m=Rp[d];m.object=this,m.batchId=a,t.push(m)}Rp.length=0}Ui.material=null,Ui.geometry.index=null,Ui.geometry.attributes={},Ui.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,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex();let a=o===null?1:o.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,a=r.attributes.position.count>65535?4:2);const c=this._instanceInfo,f=this._multiDrawStarts,d=this._multiDrawCounts,p=this._geometryInfo,m=this.perObjectFrustumCulled,g=this._indirectTexture,x=g.image.data,_=i.isArrayCamera?GN:sM;m&&!i.isArrayCamera&&(or.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sM.setFromProjectionMatrix(or,i.coordinateSystem,i.reversedDepth));let y=0;if(this.sortObjects){or.copy(this.matrixWorld).invert(),Ih.setFromMatrixPosition(i.matrixWorld).applyMatrix4(or),oM.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(or);for(let M=0,T=c.length;M<T;M++)if(c[M].visible&&c[M].active){const E=c[M].geometryIndex;this.getMatrixAt(M,or),this.getBoundingSphereAt(E,sl).applyMatrix4(or);let I=!1;if(m&&(I=!_.intersectsSphere(sl,i)),!I){const A=p[E],R=VN.subVectors(sl.center,Ih).dot(oM);Ry.push(A.start,A.count,R,M)}}const b=Ry.list,w=this.customSort;w===null?b.sort(s.transparent?kN:FN):w.call(this,b,i);for(let M=0,T=b.length;M<T;M++){const E=b[M];f[y]=E.start*a*l,d[y]=E.count*l,x[y]=E.index,y++}Ry.reset()}else for(let b=0,w=c.length;b<w;b++)if(c[b].visible&&c[b].active){const M=c[b].geometryIndex;let T=!1;if(m&&(this.getMatrixAt(b,or),this.getBoundingSphereAt(M,sl).applyMatrix4(or),T=!_.intersectsSphere(sl,i)),!T){const E=p[M];f[y]=E.start*a*l,d[y]=E.count*l,x[y]=b,y++}}g.needsUpdate=!0,this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class Ki extends Fi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new et(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 vg=new $,yg=new $,aM=new Rt,Ph=new Nu,Ip=new li,Iy=new $,lM=new $;let Ra=class extends nn{constructor(e=new Nt,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,i=[0];for(let r=1,s=t.count;r<s;r++)vg.fromBufferAttribute(t,r-1),yg.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=vg.distanceTo(yg);e.setAttribute("lineDistance",new dt(i,1))}else ot("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ip.copy(i.boundingSphere),Ip.applyMatrix4(r),Ip.radius+=s,e.ray.intersectsSphere(Ip)===!1)return;aM.copy(r).invert(),Ph.copy(e.ray).applyMatrix4(aM);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,f=i.index,p=i.attributes.position;if(f!==null){const m=Math.max(0,o.start),g=Math.min(f.count,o.start+o.count);for(let x=m,_=g-1;x<_;x+=c){const y=f.getX(x),b=f.getX(x+1),w=Pp(this,e,Ph,l,y,b,x);w&&t.push(w)}if(this.isLineLoop){const x=f.getX(g-1),_=f.getX(m),y=Pp(this,e,Ph,l,x,_,g-1);y&&t.push(y)}}else{const m=Math.max(0,o.start),g=Math.min(p.count,o.start+o.count);for(let x=m,_=g-1;x<_;x+=c){const y=Pp(this,e,Ph,l,x,x+1,x);y&&t.push(y)}if(this.isLineLoop){const x=Pp(this,e,Ph,l,g-1,m,g-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function Pp(n,e,t,i,r,s,o){const a=n.geometry.attributes.position;if(vg.fromBufferAttribute(a,r),yg.fromBufferAttribute(a,s),t.distanceSqToSegment(vg,yg,Iy,lM)>i)return;Iy.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Iy);if(!(c<e.near||c>e.far))return{distance:c,point:lM.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const cM=new $,uM=new $;class Zs extends Ra{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,i=[];for(let r=0,s=t.count;r<s;r+=2)cM.fromBufferAttribute(t,r),uM.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+cM.distanceTo(uM);e.setAttribute("lineDistance",new dt(i,1))}else ot("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class XC extends Ra{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class vb extends Fi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new et(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 hM=new Rt,sx=new Nu,Dp=new li,Lp=new $;class qC extends nn{constructor(e=new Nt,t=new vb){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 i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Dp.copy(i.boundingSphere),Dp.applyMatrix4(r),Dp.radius+=s,e.ray.intersectsSphere(Dp)===!1)return;hM.copy(r).invert(),sx.copy(e.ray).applyMatrix4(hM);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,d=i.attributes.position;if(c!==null){const p=Math.max(0,o.start),m=Math.min(c.count,o.start+o.count);for(let g=p,x=m;g<x;g++){const _=c.getX(g);Lp.fromBufferAttribute(d,_),fM(Lp,_,l,r,e,t,this)}}else{const p=Math.max(0,o.start),m=Math.min(d.count,o.start+o.count);for(let g=p,x=m;g<x;g++)Lp.fromBufferAttribute(d,g),fM(Lp,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function fM(n,e,t,i,r,s,o){const a=sx.distanceSqToPoint(n);if(a<t){const l=new $;sx.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class $C extends An{constructor(e,t,i,r,s=gn,o=gn,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const f=this;function d(){f.needsUpdate=!0,f._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),this._requestVideoFrameCallbackId=0),super.dispose()}}class WN extends $C{constructor(e,t,i,r,s,o,a,l){super({},e,t,i,r,s,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class jN extends An{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Hn,this.minFilter=Hn,this.generateMipmaps=!1,this.needsUpdate=!0}}class c0 extends An{constructor(e,t,i,r,s,o,a,l,c,f,d,p){super(null,o,a,l,c,f,r,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class XN extends c0{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=hr,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class qN extends c0{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Xs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ad extends An{constructor(e=[],t=Xs,i,r,s,o,a,l,c,f){super(e,t,i,r,s,o,a,l,c,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $N extends An{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class YN extends An{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const f=e?e.parentNode:null;f!==null&&"requestPaint"in f&&(f.onpaint=()=>{this.needsUpdate=!0},f.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class Ol extends An{constructor(e,t,i=Jr,r,s,o,a=Hn,l=Hn,c,f=$s,d=1){if(f!==$s&&f!==_a)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,o,a,l,f,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xa(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 YC extends Ol{constructor(e,t=Jr,i=Xs,r,s,o=Hn,a=Hn,l,c=$s){const f={width:e,height:e,depth:1},d=[f,f,f,f,f,f];super(e,e,t,i,r,s,o,a,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class yb extends An{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Pa extends Nt{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],f=[],d=[];let p=0,m=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new dt(c,3)),this.setAttribute("normal",new dt(f,3)),this.setAttribute("uv",new dt(d,2));function g(x,_,y,b,w,M,T,E,I,A,R){const D=M/I,L=T/A,U=M/2,N=T/2,B=E/2,z=I+1,k=A+1;let O=0,Y=0;const X=new $;for(let K=0;K<k;K++){const G=K*L-N;for(let J=0;J<z;J++){const H=J*D-U;X[x]=H*b,X[_]=G*w,X[y]=B,c.push(X.x,X.y,X.z),X[x]=0,X[_]=0,X[y]=E>0?1:-1,f.push(X.x,X.y,X.z),d.push(J/I),d.push(1-K/A),O+=1}}for(let K=0;K<A;K++)for(let G=0;G<I;G++){const J=p+G+z*K,H=p+G+z*(K+1),ee=p+(G+1)+z*(K+1),ne=p+(G+1)+z*K;l.push(J,H,ne),l.push(H,ee,ne),Y+=6}a.addGroup(m,Y,R),m+=Y,p+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pa(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class u0 extends Nt{constructor(e=1,t=1,i=4,r=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:r,heightSegments:s},t=Math.max(0,t),i=Math.max(1,Math.floor(i)),r=Math.max(3,Math.floor(r)),s=Math.max(1,Math.floor(s));const o=[],a=[],l=[],c=[],f=t/2,d=Math.PI/2*e,p=t,m=2*d+p,g=i*2+s,x=r+1,_=new $,y=new $;for(let b=0;b<=g;b++){let w=0,M=0,T=0,E=0;if(b<=i){const R=b/i,D=R*Math.PI/2;M=-f-e*Math.cos(D),T=e*Math.sin(D),E=-e*Math.cos(D),w=R*d}else if(b<=i+s){const R=(b-i)/s;M=-f+R*t,T=e,E=0,w=d+R*p}else{const R=(b-i-s)/i,D=R*Math.PI/2;M=f+e*Math.sin(D),T=e*Math.cos(D),E=e*Math.sin(D),w=d+p+R*d}const I=Math.max(0,Math.min(1,w/m));let A=0;b===0?A=.5/r:b===g&&(A=-.5/r);for(let R=0;R<=r;R++){const D=R/r,L=D*Math.PI*2,U=Math.sin(L),N=Math.cos(L);y.x=-T*N,y.y=M,y.z=T*U,a.push(y.x,y.y,y.z),_.set(-T*N,E,T*U),_.normalize(),l.push(_.x,_.y,_.z),c.push(D+A,I)}if(b>0){const R=(b-1)*x;for(let D=0;D<r;D++){const L=R+D,U=R+D+1,N=b*x+D,B=b*x+D+1;o.push(L,U,N),o.push(U,B,N)}}}this.setIndex(o),this.setAttribute("position",new dt(a,3)),this.setAttribute("normal",new dt(l,3)),this.setAttribute("uv",new dt(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new u0(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class h0 extends Nt{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new $,f=new Ve;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const m=i+d/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),o.push(c.x,c.y,c.z),a.push(0,0,1),f.x=(o[p]/e+1)/2,f.y=(o[p+1]/e+1)/2,l.push(f.x,f.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new dt(o,3)),this.setAttribute("normal",new dt(a,3)),this.setAttribute("uv",new dt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new h0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ou extends Nt{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const f=[],d=[],p=[],m=[];let g=0;const x=[],_=i/2;let y=0;b(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(f),this.setAttribute("position",new dt(d,3)),this.setAttribute("normal",new dt(p,3)),this.setAttribute("uv",new dt(m,2));function b(){const M=new $,T=new $;let E=0;const I=(t-e)/i;for(let A=0;A<=s;A++){const R=[],D=A/s,L=D*(t-e)+e;for(let U=0;U<=r;U++){const N=U/r,B=N*l+a,z=Math.sin(B),k=Math.cos(B);T.x=L*z,T.y=-D*i+_,T.z=L*k,d.push(T.x,T.y,T.z),M.set(z,I,k).normalize(),p.push(M.x,M.y,M.z),m.push(N,1-D),R.push(g++)}x.push(R)}for(let A=0;A<r;A++)for(let R=0;R<s;R++){const D=x[R][A],L=x[R+1][A],U=x[R+1][A+1],N=x[R][A+1];(e>0||R!==0)&&(f.push(D,L,N),E+=3),(t>0||R!==s-1)&&(f.push(L,U,N),E+=3)}c.addGroup(y,E,0),y+=E}function w(M){const T=g,E=new Ve,I=new $;let A=0;const R=M===!0?e:t,D=M===!0?1:-1;for(let U=1;U<=r;U++)d.push(0,_*D,0),p.push(0,D,0),m.push(.5,.5),g++;const L=g;for(let U=0;U<=r;U++){const B=U/r*l+a,z=Math.cos(B),k=Math.sin(B);I.x=R*k,I.y=_*D,I.z=R*z,d.push(I.x,I.y,I.z),p.push(0,D,0),E.x=z*.5+.5,E.y=k*.5*D+.5,m.push(E.x,E.y),g++}for(let U=0;U<r;U++){const N=T+U,B=L+U;M===!0?f.push(B,B+1,N):f.push(B+1,B,N),A+=3}c.addGroup(y,A,M===!0?1:2),y+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ou(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ld extends Ou{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new ld(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Da extends Nt{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),f(),this.setAttribute("position",new dt(s,3)),this.setAttribute("normal",new dt(s.slice(),3)),this.setAttribute("uv",new dt(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(b){const w=new $,M=new $,T=new $;for(let E=0;E<t.length;E+=3)m(t[E+0],w),m(t[E+1],M),m(t[E+2],T),l(w,M,T,b)}function l(b,w,M,T){const E=T+1,I=[];for(let A=0;A<=E;A++){I[A]=[];const R=b.clone().lerp(M,A/E),D=w.clone().lerp(M,A/E),L=E-A;for(let U=0;U<=L;U++)U===0&&A===E?I[A][U]=R:I[A][U]=R.clone().lerp(D,U/L)}for(let A=0;A<E;A++)for(let R=0;R<2*(E-A)-1;R++){const D=Math.floor(R/2);R%2===0?(p(I[A][D+1]),p(I[A+1][D]),p(I[A][D])):(p(I[A][D+1]),p(I[A+1][D+1]),p(I[A+1][D]))}}function c(b){const w=new $;for(let M=0;M<s.length;M+=3)w.x=s[M+0],w.y=s[M+1],w.z=s[M+2],w.normalize().multiplyScalar(b),s[M+0]=w.x,s[M+1]=w.y,s[M+2]=w.z}function f(){const b=new $;for(let w=0;w<s.length;w+=3){b.x=s[w+0],b.y=s[w+1],b.z=s[w+2];const M=_(b)/2/Math.PI+.5,T=y(b)/Math.PI+.5;o.push(M,1-T)}g(),d()}function d(){for(let b=0;b<o.length;b+=6){const w=o[b+0],M=o[b+2],T=o[b+4],E=Math.max(w,M,T),I=Math.min(w,M,T);E>.9&&I<.1&&(w<.2&&(o[b+0]+=1),M<.2&&(o[b+2]+=1),T<.2&&(o[b+4]+=1))}}function p(b){s.push(b.x,b.y,b.z)}function m(b,w){const M=b*3;w.x=e[M+0],w.y=e[M+1],w.z=e[M+2]}function g(){const b=new $,w=new $,M=new $,T=new $,E=new Ve,I=new Ve,A=new Ve;for(let R=0,D=0;R<s.length;R+=9,D+=6){b.set(s[R+0],s[R+1],s[R+2]),w.set(s[R+3],s[R+4],s[R+5]),M.set(s[R+6],s[R+7],s[R+8]),E.set(o[D+0],o[D+1]),I.set(o[D+2],o[D+3]),A.set(o[D+4],o[D+5]),T.copy(b).add(w).add(M).divideScalar(3);const L=_(T);x(E,D+0,b,L),x(I,D+2,w,L),x(A,D+4,M,L)}}function x(b,w,M,T){T<0&&b.x===1&&(o[w]=b.x-1),M.x===0&&M.z===0&&(o[w]=T/2/Math.PI+.5)}function _(b){return Math.atan2(b.z,-b.x)}function y(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 Da(e.vertices,e.indices,e.radius,e.detail)}}class f0 extends Da{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,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,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[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,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new f0(e.radius,e.detail)}}const Up=new $,Np=new $,Py=new $,Op=new ur;class ZC extends Nt{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(Cl*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],f=["a","b","c"],d=new Array(3),p={},m=[];for(let g=0;g<l;g+=3){o?(c[0]=o.getX(g),c[1]=o.getX(g+1),c[2]=o.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:x,b:_,c:y}=Op;if(x.fromBufferAttribute(a,c[0]),_.fromBufferAttribute(a,c[1]),y.fromBufferAttribute(a,c[2]),Op.getNormal(Py),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(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let b=0;b<3;b++){const w=(b+1)%3,M=d[b],T=d[w],E=Op[f[b]],I=Op[f[w]],A=`${M}_${T}`,R=`${T}_${M}`;R in p&&p[R]?(Py.dot(p[R].normal)<=s&&(m.push(E.x,E.y,E.z),m.push(I.x,I.y,I.z)),p[R]=null):A in p||(p[A]={index0:c[b],index1:c[w],normal:Py.clone()})}}for(const g in p)if(p[g]){const{index0:x,index1:_}=p[g];Up.fromBufferAttribute(a,x),Np.fromBufferAttribute(a,_),m.push(Up.x,Up.y,Up.z),m.push(Np.x,Np.y,Np.z)}this.setAttribute("position",new dt(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ss{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ot("Curve: .getPoint() not implemented.")}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const f=i[r],p=i[r+1]-f,m=(o-f)/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 o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Ve:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){const i=new $,r=[],s=[],o=[],a=new $,l=new Rt;for(let m=0;m<=e;m++){const g=m/e;r[m]=this.getTangentAt(g,new $)}s[0]=new $,o[0]=new $;let c=Number.MAX_VALUE;const f=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);f<=c&&(c=f,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),p<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(Ct(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,g))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(Ct(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],m*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:o}}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 d0 extends Ss{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Ve){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const f=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=l-this.aX,m=c-this.aY;l=p*f-m*d+this.aX,c=p*d+m*f+this.aY}return i.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 KC extends d0{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function _b(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,f,d){let p=(o-s)/c-(a-s)/(c+f)+(a-o)/f,m=(a-o)/f-(l-o)/(f+d)+(l-a)/d;p*=f,m*=f,r(o,a,p,m)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const dM=new $,pM=new $,Dy=new _b,Ly=new _b,Uy=new _b;class p0 extends Ss{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new $){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,f;this.closed||a>0?c=r[(a-1)%s]:(pM.subVectors(r[0],r[1]).add(r[0]),c=pM);const d=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?f=r[(a+2)%s]:(dM.subVectors(r[s-1],r[s-2]).add(r[s-1]),f=dM),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(d),m),x=Math.pow(d.distanceToSquared(p),m),_=Math.pow(p.distanceToSquared(f),m);x<1e-4&&(x=1),g<1e-4&&(g=x),_<1e-4&&(_=x),Dy.initNonuniformCatmullRom(c.x,d.x,p.x,f.x,g,x,_),Ly.initNonuniformCatmullRom(c.y,d.y,p.y,f.y,g,x,_),Uy.initNonuniformCatmullRom(c.z,d.z,p.z,f.z,g,x,_)}else this.curveType==="catmullrom"&&(Dy.initCatmullRom(c.x,d.x,p.x,f.x,this.tension),Ly.initCatmullRom(c.y,d.y,p.y,f.y,this.tension),Uy.initCatmullRom(c.z,d.z,p.z,f.z,this.tension));return i.set(Dy.calc(l),Ly.calc(l),Uy.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;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,i=this.points.length;t<i;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,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new $().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function mM(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function ZN(n,e){const t=1-n;return t*t*e}function KN(n,e){return 2*(1-n)*n*e}function JN(n,e){return n*n*e}function bf(n,e,t,i){return ZN(n,e)+KN(n,t)+JN(n,i)}function QN(n,e){const t=1-n;return t*t*t*e}function eO(n,e){const t=1-n;return 3*t*t*n*e}function tO(n,e){return 3*(1-n)*n*n*e}function nO(n,e){return n*n*n*e}function Sf(n,e,t,i,r){return QN(n,e)+eO(n,t)+tO(n,i)+nO(n,r)}class xb extends Ss{constructor(e=new Ve,t=new Ve,i=new Ve,r=new Ve){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Ve){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Sf(e,r.x,s.x,o.x,a.x),Sf(e,r.y,s.y,o.y,a.y)),i}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 JC extends Ss{constructor(e=new $,t=new $,i=new $,r=new $){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new $){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Sf(e,r.x,s.x,o.x,a.x),Sf(e,r.y,s.y,o.y,a.y),Sf(e,r.z,s.z,o.z,a.z)),i}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 bb extends Ss{constructor(e=new Ve,t=new Ve){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Ve){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Ve){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 Sb extends Ss{constructor(e=new $,t=new $){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new $){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new $){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 wb extends Ss{constructor(e=new Ve,t=new Ve,i=new Ve){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Ve){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(bf(e,r.x,s.x,o.x),bf(e,r.y,s.y,o.y)),i}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 m0 extends Ss{constructor(e=new $,t=new $,i=new $){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new $){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(bf(e,r.x,s.x,o.x),bf(e,r.y,s.y,o.y),bf(e,r.z,s.z,o.z)),i}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 Mb extends Ss{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Ve){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],f=r[o>r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(mM(a,l.x,c.x,f.x,d.x),mM(a,l.y,c.y,f.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Ve().fromArray(r))}return this}}var _g=Object.freeze({__proto__:null,ArcCurve:KC,CatmullRomCurve3:p0,CubicBezierCurve:xb,CubicBezierCurve3:JC,EllipseCurve:d0,LineCurve:bb,LineCurve3:Sb,QuadraticBezierCurve:wb,QuadraticBezierCurve3:m0,SplineCurve:Mb});class QC extends Ss{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 i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new _g[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.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 i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const f=l[c];i&&i.equals(f)||(t.push(f),i=f)}}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,i=e.curves.length;t<i;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,i=this.curves.length;t<i;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,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new _g[r.type]().fromJSON(r))}return this}}class xg extends QC{constructor(e){super(),this.type="Path",this.currentPoint=new Ve,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new bb(this.currentPoint.clone(),new Ve(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new wb(this.currentPoint.clone(),new Ve(e,t),new Ve(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new xb(this.currentPoint.clone(),new Ve(e,t),new Ve(i,r),new Ve(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Mb(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+c,t+f,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new d0(e,t,i,r,s,o,a,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 f=c.getPoint(1);return this.currentPoint.copy(f),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 Ma extends xg{constructor(e){super(e),this.uuid=Lr(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;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,i=this.holes.length;t<i;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,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new xg().fromJSON(r))}return this}}function iO(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=eR(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(i&&(s=lO(n,e,s,t)),n.length>80*t){a=n[0],l=n[1];let f=a,d=l;for(let p=t;p<r;p+=t){const m=n[p],g=n[p+1];m<a&&(a=m),g<l&&(l=g),m>f&&(f=m),g>d&&(d=g)}c=Math.max(f-a,d-l),c=c!==0?32767/c:0}return Bf(s,o,t,a,l,c,0),o}function eR(n,e,t,i,r){let s;if(r===_O(n,e,t,i)>0)for(let o=e;o<t;o+=i)s=gM(o/i|0,n[o],n[o+1],s);else for(let o=t-i;o>=e;o-=i)s=gM(o/i|0,n[o],n[o+1],s);return s&&Mu(s,s.next)&&(Vf(s),s=s.next),s}function Fl(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Mu(t,t.next)||Dn(t.prev,t,t.next)===0)){if(Vf(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Bf(n,e,t,i,r,s,o){if(!n)return;!o&&s&&dO(n,i,r,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?sO(n,i,r,s):rO(n)){e.push(l.i,n.i,c.i),Vf(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=oO(Fl(n),e),Bf(n,e,t,i,r,s,2)):o===2&&aO(n,e,t,i,r,s):Bf(Fl(n),e,t,i,r,s,1);break}}}function rO(n){const e=n.prev,t=n,i=n.next;if(Dn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,f=Math.min(r,s,o),d=Math.min(a,l,c),p=Math.max(r,s,o),m=Math.max(a,l,c);let g=i.next;for(;g!==e;){if(g.x>=f&&g.x<=p&&g.y>=d&&g.y<=m&&rf(r,a,s,l,o,c,g.x,g.y)&&Dn(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function sO(n,e,t,i){const r=n.prev,s=n,o=n.next;if(Dn(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,f=r.y,d=s.y,p=o.y,m=Math.min(a,l,c),g=Math.min(f,d,p),x=Math.max(a,l,c),_=Math.max(f,d,p),y=ox(m,g,e,t,i),b=ox(x,_,e,t,i);let w=n.prevZ,M=n.nextZ;for(;w&&w.z>=y&&M&&M.z<=b;){if(w.x>=m&&w.x<=x&&w.y>=g&&w.y<=_&&w!==r&&w!==o&&rf(a,f,l,d,c,p,w.x,w.y)&&Dn(w.prev,w,w.next)>=0||(w=w.prevZ,M.x>=m&&M.x<=x&&M.y>=g&&M.y<=_&&M!==r&&M!==o&&rf(a,f,l,d,c,p,M.x,M.y)&&Dn(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;w&&w.z>=y;){if(w.x>=m&&w.x<=x&&w.y>=g&&w.y<=_&&w!==r&&w!==o&&rf(a,f,l,d,c,p,w.x,w.y)&&Dn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=b;){if(M.x>=m&&M.x<=x&&M.y>=g&&M.y<=_&&M!==r&&M!==o&&rf(a,f,l,d,c,p,M.x,M.y)&&Dn(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function oO(n,e){let t=n;do{const i=t.prev,r=t.next.next;!Mu(i,r)&&nR(i,t,t.next,r)&&Gf(i,r)&&Gf(r,i)&&(e.push(i.i,t.i,r.i),Vf(t),Vf(t.next),t=n=r),t=t.next}while(t!==n);return Fl(t)}function aO(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&gO(o,a)){let l=iR(o,a);o=Fl(o,o.next),l=Fl(l,l.next),Bf(o,e,t,i,r,s,0),Bf(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function lO(n,e,t,i){const r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=eR(n,a,l,i,!1);c===c.next&&(c.steiner=!0),r.push(mO(c))}r.sort(cO);for(let s=0;s<r.length;s++)t=uO(r[s],t);return t}function cO(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const i=(n.next.y-n.y)/(n.next.x-n.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=i-r}return t}function uO(n,e){const t=hO(n,e);if(!t)return e;const i=iR(t,n);return Fl(i,i.next),Fl(t,t.next)}function hO(n,e){let t=e;const i=n.x,r=n.y;let s=-1/0,o;if(Mu(n,t))return t;do{if(Mu(n,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<=i&&d>s&&(s=d,o=t.x<t.next.x?t:t.next,d===i))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let f=1/0;t=o;do{if(i>=t.x&&t.x>=l&&i!==t.x&&tR(r<c?i:s,r,l,c,r<c?s:i,r,t.x,t.y)){const d=Math.abs(r-t.y)/(i-t.x);Gf(t,n)&&(d<f||d===f&&(t.x>o.x||t.x===o.x&&fO(o,t)))&&(o=t,f=d)}t=t.next}while(t!==a);return o}function fO(n,e){return Dn(n.prev,n,e.prev)<0&&Dn(e.next,n,n.next)<0}function dO(n,e,t,i){let r=n;do r.z===0&&(r.z=ox(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,pO(r)}function pO(n){let e,t=1;do{let i=n,r;n=null;let s=null;for(e=0;i;){e++;let o=i,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;i=o}s.nextZ=null,t*=2}while(e>1);return n}function ox(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function mO(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function tR(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function rf(n,e,t,i,r,s,o,a){return!(n===o&&e===a)&&tR(n,e,t,i,r,s,o,a)}function gO(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!vO(n,e)&&(Gf(n,e)&&Gf(e,n)&&yO(n,e)&&(Dn(n.prev,n,e.prev)||Dn(n,e.prev,e))||Mu(n,e)&&Dn(n.prev,n,n.next)>0&&Dn(e.prev,e,e.next)>0)}function Dn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Mu(n,e){return n.x===e.x&&n.y===e.y}function nR(n,e,t,i){const r=kp(Dn(n,e,t)),s=kp(Dn(n,e,i)),o=kp(Dn(t,i,n)),a=kp(Dn(t,i,e));return!!(r!==s&&o!==a||r===0&&Fp(n,t,e)||s===0&&Fp(n,i,e)||o===0&&Fp(t,n,i)||a===0&&Fp(t,e,i))}function Fp(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function kp(n){return n>0?1:n<0?-1:0}function vO(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&nR(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Gf(n,e){return Dn(n.prev,n,n.next)<0?Dn(n,e,n.next)>=0&&Dn(n,n.prev,e)>=0:Dn(n,e,n.prev)<0||Dn(n,n.next,e)<0}function yO(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.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&&(i=!i),t=t.next;while(t!==n);return i}function iR(n,e){const t=ax(n.i,n.x,n.y),i=ax(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function gM(n,e,t,i){const r=ax(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Vf(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function ax(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _O(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class xO{static triangulate(e,t,i=2){return iO(e,t,i)}}class ys{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return ys.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];vM(e),yM(i,e);let o=e.length;t.forEach(vM);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,yM(i,t[l]);const a=xO.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function vM(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function yM(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class g0 extends Nt{constructor(e=new Ma([new Ve(.5,.5),new Ve(-.5,.5),new Ve(-.5,-.5),new Ve(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new dt(r,3)),this.setAttribute("uv",new dt(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,f=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,g=t.bevelSize!==void 0?t.bevelSize:m-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,_=t.bevelSegments!==void 0?t.bevelSegments:3;const y=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:bO;let w,M=!1,T,E,I,A;if(y){w=y.getSpacedPoints(f),M=!0,p=!1;const oe=y.isCatmullRomCurve3?y.closed:!1;T=y.computeFrenetFrames(f,oe),E=new $,I=new $,A=new $}p||(_=0,m=0,g=0,x=0);const R=a.extractPoints(c);let D=R.shape;const L=R.holes;if(!ys.isClockWise(D)){D=D.reverse();for(let oe=0,ae=L.length;oe<ae;oe++){const Q=L[oe];ys.isClockWise(Q)&&(L[oe]=Q.reverse())}}function N(oe){const Q=10000000000000001e-36;let Ee=oe[0];for(let ge=1;ge<=oe.length;ge++){const Oe=ge%oe.length,Z=oe[Oe],ce=Z.x-Ee.x,ke=Z.y-Ee.y,De=ce*ce+ke*ke,pe=Math.max(Math.abs(Z.x),Math.abs(Z.y),Math.abs(Ee.x),Math.abs(Ee.y)),ze=Q*pe*pe;if(De<=ze){oe.splice(Oe,1),ge--;continue}Ee=Z}}N(D),L.forEach(N);const B=L.length,z=D;for(let oe=0;oe<B;oe++){const ae=L[oe];D=D.concat(ae)}function k(oe,ae,Q){return ae||bt("ExtrudeGeometry: vec does not exist"),oe.clone().addScaledVector(ae,Q)}const O=D.length;function Y(oe,ae,Q){let Ee,ge,Oe;const Z=oe.x-ae.x,ce=oe.y-ae.y,ke=Q.x-oe.x,De=Q.y-oe.y,pe=Z*Z+ce*ce,ze=Z*De-ce*ke;if(Math.abs(ze)>Number.EPSILON){const W=Math.sqrt(pe),F=Math.sqrt(ke*ke+De*De),re=ae.x-ce/W,me=ae.y+Z/W,Te=Q.x-De/F,Be=Q.y+ke/F,He=((Te-re)*De-(Be-me)*ke)/(Z*De-ce*ke);Ee=re+Z*He-oe.x,ge=me+ce*He-oe.y;const be=Ee*Ee+ge*ge;if(be<=2)return new Ve(Ee,ge);Oe=Math.sqrt(be/2)}else{let W=!1;Z>Number.EPSILON?ke>Number.EPSILON&&(W=!0):Z<-Number.EPSILON?ke<-Number.EPSILON&&(W=!0):Math.sign(ce)===Math.sign(De)&&(W=!0),W?(Ee=-ce,ge=Z,Oe=Math.sqrt(pe)):(Ee=Z,ge=ce,Oe=Math.sqrt(pe/2))}return new Ve(Ee/Oe,ge/Oe)}const X=[];for(let oe=0,ae=z.length,Q=ae-1,Ee=oe+1;oe<ae;oe++,Q++,Ee++)Q===ae&&(Q=0),Ee===ae&&(Ee=0),X[oe]=Y(z[oe],z[Q],z[Ee]);const K=[];let G,J=X.concat();for(let oe=0,ae=B;oe<ae;oe++){const Q=L[oe];G=[];for(let Ee=0,ge=Q.length,Oe=ge-1,Z=Ee+1;Ee<ge;Ee++,Oe++,Z++)Oe===ge&&(Oe=0),Z===ge&&(Z=0),G[Ee]=Y(Q[Ee],Q[Oe],Q[Z]);K.push(G),J=J.concat(G)}let H;if(_===0)H=ys.triangulateShape(z,L);else{const oe=[],ae=[];for(let Q=0;Q<_;Q++){const Ee=Q/_,ge=m*Math.cos(Ee*Math.PI/2),Oe=g*Math.sin(Ee*Math.PI/2)+x;for(let Z=0,ce=z.length;Z<ce;Z++){const ke=k(z[Z],X[Z],Oe);ye(ke.x,ke.y,-ge),Ee===0&&oe.push(ke)}for(let Z=0,ce=B;Z<ce;Z++){const ke=L[Z];G=K[Z];const De=[];for(let pe=0,ze=ke.length;pe<ze;pe++){const W=k(ke[pe],G[pe],Oe);ye(W.x,W.y,-ge),Ee===0&&De.push(W)}Ee===0&&ae.push(De)}}H=ys.triangulateShape(oe,ae)}const ee=H.length,ne=g+x;for(let oe=0;oe<O;oe++){const ae=p?k(D[oe],J[oe],ne):D[oe];M?(I.copy(T.normals[0]).multiplyScalar(ae.x),E.copy(T.binormals[0]).multiplyScalar(ae.y),A.copy(w[0]).add(I).add(E),ye(A.x,A.y,A.z)):ye(ae.x,ae.y,0)}for(let oe=1;oe<=f;oe++)for(let ae=0;ae<O;ae++){const Q=p?k(D[ae],J[ae],ne):D[ae];M?(I.copy(T.normals[oe]).multiplyScalar(Q.x),E.copy(T.binormals[oe]).multiplyScalar(Q.y),A.copy(w[oe]).add(I).add(E),ye(A.x,A.y,A.z)):ye(Q.x,Q.y,d/f*oe)}for(let oe=_-1;oe>=0;oe--){const ae=oe/_,Q=m*Math.cos(ae*Math.PI/2),Ee=g*Math.sin(ae*Math.PI/2)+x;for(let ge=0,Oe=z.length;ge<Oe;ge++){const Z=k(z[ge],X[ge],Ee);ye(Z.x,Z.y,d+Q)}for(let ge=0,Oe=L.length;ge<Oe;ge++){const Z=L[ge];G=K[ge];for(let ce=0,ke=Z.length;ce<ke;ce++){const De=k(Z[ce],G[ce],Ee);M?ye(De.x,De.y+w[f-1].y,w[f-1].x+Q):ye(De.x,De.y,d+Q)}}}te(),se();function te(){const oe=r.length/3;if(p){let ae=0,Q=O*ae;for(let Ee=0;Ee<ee;Ee++){const ge=H[Ee];Se(ge[2]+Q,ge[1]+Q,ge[0]+Q)}ae=f+_*2,Q=O*ae;for(let Ee=0;Ee<ee;Ee++){const ge=H[Ee];Se(ge[0]+Q,ge[1]+Q,ge[2]+Q)}}else{for(let ae=0;ae<ee;ae++){const Q=H[ae];Se(Q[2],Q[1],Q[0])}for(let ae=0;ae<ee;ae++){const Q=H[ae];Se(Q[0]+O*f,Q[1]+O*f,Q[2]+O*f)}}i.addGroup(oe,r.length/3-oe,0)}function se(){const oe=r.length/3;let ae=0;ie(z,ae),ae+=z.length;for(let Q=0,Ee=L.length;Q<Ee;Q++){const ge=L[Q];ie(ge,ae),ae+=ge.length}i.addGroup(oe,r.length/3-oe,1)}function ie(oe,ae){let Q=oe.length;for(;--Q>=0;){const Ee=Q;let ge=Q-1;ge<0&&(ge=oe.length-1);for(let Oe=0,Z=f+_*2;Oe<Z;Oe++){const ce=O*Oe,ke=O*(Oe+1),De=ae+Ee+ce,pe=ae+ge+ce,ze=ae+ge+ke,W=ae+Ee+ke;fe(De,pe,ze,W)}}}function ye(oe,ae,Q){l.push(oe),l.push(ae),l.push(Q)}function Se(oe,ae,Q){ue(oe),ue(ae),ue(Q);const Ee=r.length/3,ge=b.generateTopUV(i,r,Ee-3,Ee-2,Ee-1);Le(ge[0]),Le(ge[1]),Le(ge[2])}function fe(oe,ae,Q,Ee){ue(oe),ue(ae),ue(Ee),ue(ae),ue(Q),ue(Ee);const ge=r.length/3,Oe=b.generateSideWallUV(i,r,ge-6,ge-3,ge-2,ge-1);Le(Oe[0]),Le(Oe[1]),Le(Oe[3]),Le(Oe[1]),Le(Oe[2]),Le(Oe[3])}function ue(oe){r.push(l[oe*3+0]),r.push(l[oe*3+1]),r.push(l[oe*3+2])}function Le(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,i=this.parameters.options;return SO(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new _g[r.type]().fromJSON(r)),new g0(i,e.options)}}const bO={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],f=e[r*3+1];return[new Ve(s,o),new Ve(a,l),new Ve(c,f)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],f=e[i*3+1],d=e[i*3+2],p=e[r*3],m=e[r*3+1],g=e[r*3+2],x=e[s*3],_=e[s*3+1],y=e[s*3+2];return Math.abs(a-f)<Math.abs(o-c)?[new Ve(o,1-l),new Ve(c,1-d),new Ve(p,1-g),new Ve(x,1-y)]:[new Ve(a,1-l),new Ve(f,1-d),new Ve(m,1-g),new Ve(_,1-y)]}};function SO(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class v0 extends Da{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,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 v0(e.radius,e.detail)}}class y0 extends Nt{constructor(e=[new Ve(0,-.5),new Ve(.5,0),new Ve(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Ct(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],f=1/t,d=new $,p=new Ve,m=new $,g=new $,x=new $;let _=0,y=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:_=e[b+1].x-e[b].x,y=e[b+1].y-e[b].y,m.x=y*1,m.y=-_,m.z=y*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,y=e[b+1].y-e[b].y,m.x=y*1,m.y=-_,m.z=y*0,g.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(g)}for(let b=0;b<=t;b++){const w=i+b*f*r,M=Math.sin(w),T=Math.cos(w);for(let E=0;E<=e.length-1;E++){d.x=e[E].x*M,d.y=e[E].y,d.z=e[E].x*T,o.push(d.x,d.y,d.z),p.x=b/t,p.y=E/(e.length-1),a.push(p.x,p.y);const I=l[3*E+0]*M,A=l[3*E+1],R=l[3*E+0]*T;c.push(I,A,R)}}for(let b=0;b<t;b++)for(let w=0;w<e.length-1;w++){const M=w+b*e.length,T=M,E=M+e.length,I=M+e.length+1,A=M+1;s.push(T,E,A),s.push(I,A,E)}this.setIndex(s),this.setAttribute("position",new dt(o,3)),this.setAttribute("uv",new dt(a,2)),this.setAttribute("normal",new dt(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new y0(e.points,e.segments,e.phiStart,e.phiLength)}}class cd extends Da{constructor(e=1,t=0){const i=[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(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new cd(e.radius,e.detail)}}class Oo extends Nt{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,f=l+1,d=e/a,p=t/l,m=[],g=[],x=[],_=[];for(let y=0;y<f;y++){const b=y*p-o;for(let w=0;w<c;w++){const M=w*d-s;g.push(M,-b,0),x.push(0,0,1),_.push(w/a),_.push(1-y/l)}}for(let y=0;y<l;y++)for(let b=0;b<a;b++){const w=b+c*y,M=b+c*(y+1),T=b+1+c*(y+1),E=b+1+c*y;m.push(w,M,E),m.push(M,T,E)}this.setIndex(m),this.setAttribute("position",new dt(g,3)),this.setAttribute("normal",new dt(x,3)),this.setAttribute("uv",new dt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Oo(e.width,e.height,e.widthSegments,e.heightSegments)}}class ud extends Nt{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],f=[];let d=e;const p=(t-e)/r,m=new $,g=new Ve;for(let x=0;x<=r;x++){for(let _=0;_<=i;_++){const y=s+_/i*o;m.x=d*Math.cos(y),m.y=d*Math.sin(y),l.push(m.x,m.y,m.z),c.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,f.push(g.x,g.y)}d+=p}for(let x=0;x<r;x++){const _=x*(i+1);for(let y=0;y<i;y++){const b=y+_,w=b,M=b+i+1,T=b+i+2,E=b+1;a.push(w,M,E),a.push(M,T,E)}}this.setIndex(a),this.setAttribute("position",new dt(l,3)),this.setAttribute("normal",new dt(c,3)),this.setAttribute("uv",new dt(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ud(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class _0 extends Nt{constructor(e=new Ma([new Ve(0,.5),new Ve(-.5,-.5),new Ve(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let f=0;f<e.length;f++)c(e[f]),this.addGroup(a,l,f),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new dt(r,3)),this.setAttribute("normal",new dt(s,3)),this.setAttribute("uv",new dt(o,2));function c(f){const d=r.length/3,p=f.extractPoints(t);let m=p.shape;const g=p.holes;ys.isClockWise(m)===!1&&(m=m.reverse());for(let _=0,y=g.length;_<y;_++){const b=g[_];ys.isClockWise(b)===!0&&(g[_]=b.reverse())}const x=ys.triangulateShape(m,g);for(let _=0,y=g.length;_<y;_++){const b=g[_];m=m.concat(b)}for(let _=0,y=m.length;_<y;_++){const b=m[_];r.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let _=0,y=x.length;_<y;_++){const b=x[_],w=b[0]+d,M=b[1]+d,T=b[2]+d;i.push(w,M,T),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 wO(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new _0(i,e.curveSegments)}}function wO(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Fu extends Nt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const f=[],d=new $,p=new $,m=[],g=[],x=[],_=[];for(let y=0;y<=i;y++){const b=[],w=y/i;let M=0;y===0&&o===0?M=.5/t:y===i&&l===Math.PI&&(M=-.5/t);for(let T=0;T<=t;T++){const E=T/t;d.x=-e*Math.cos(r+E*s)*Math.sin(o+w*a),d.y=e*Math.cos(o+w*a),d.z=e*Math.sin(r+E*s)*Math.sin(o+w*a),g.push(d.x,d.y,d.z),p.copy(d).normalize(),x.push(p.x,p.y,p.z),_.push(E+M,1-w),b.push(c++)}f.push(b)}for(let y=0;y<i;y++)for(let b=0;b<t;b++){const w=f[y][b+1],M=f[y][b],T=f[y+1][b],E=f[y+1][b+1];(y!==0||o>0)&&m.push(w,M,E),(y!==i-1||l<Math.PI)&&m.push(M,T,E)}this.setIndex(m),this.setAttribute("position",new dt(g,3)),this.setAttribute("normal",new dt(x,3)),this.setAttribute("uv",new dt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class x0 extends Da{constructor(e=1,t=0){const i=[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(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new x0(e.radius,e.detail)}}class b0 extends Nt{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2,o=0,a=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s,thetaStart:o,thetaLength:a},i=Math.floor(i),r=Math.floor(r);const l=[],c=[],f=[],d=[],p=new $,m=new $,g=new $;for(let x=0;x<=i;x++){const _=o+x/i*a;for(let y=0;y<=r;y++){const b=y/r*s;m.x=(e+t*Math.cos(_))*Math.cos(b),m.y=(e+t*Math.cos(_))*Math.sin(b),m.z=t*Math.sin(_),c.push(m.x,m.y,m.z),p.x=e*Math.cos(b),p.y=e*Math.sin(b),g.subVectors(m,p).normalize(),f.push(g.x,g.y,g.z),d.push(y/r),d.push(x/i)}}for(let x=1;x<=i;x++)for(let _=1;_<=r;_++){const y=(r+1)*x+_-1,b=(r+1)*(x-1)+_-1,w=(r+1)*(x-1)+_,M=(r+1)*x+_;l.push(y,b,M),l.push(b,w,M)}this.setIndex(l),this.setAttribute("position",new dt(c,3)),this.setAttribute("normal",new dt(f,3)),this.setAttribute("uv",new dt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new b0(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class S0 extends Nt{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],f=[],d=new $,p=new $,m=new $,g=new $,x=new $,_=new $,y=new $;for(let w=0;w<=i;++w){const M=w/i*s*Math.PI*2;b(M,s,o,e,m),b(M+.01,s,o,e,g),_.subVectors(g,m),y.addVectors(g,m),x.crossVectors(_,y),y.crossVectors(x,_),x.normalize(),y.normalize();for(let T=0;T<=r;++T){const E=T/r*Math.PI*2,I=-t*Math.cos(E),A=t*Math.sin(E);d.x=m.x+(I*y.x+A*x.x),d.y=m.y+(I*y.y+A*x.y),d.z=m.z+(I*y.z+A*x.z),l.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),c.push(p.x,p.y,p.z),f.push(w/i),f.push(T/r)}}for(let w=1;w<=i;w++)for(let M=1;M<=r;M++){const T=(r+1)*(w-1)+(M-1),E=(r+1)*w+(M-1),I=(r+1)*w+M,A=(r+1)*(w-1)+M;a.push(T,E,A),a.push(E,I,A)}this.setIndex(a),this.setAttribute("position",new dt(l,3)),this.setAttribute("normal",new dt(c,3)),this.setAttribute("uv",new dt(f,2));function b(w,M,T,E,I){const A=Math.cos(w),R=Math.sin(w),D=T/M*w,L=Math.cos(D);I.x=E*(2+L)*.5*A,I.y=E*(2+L)*R*.5,I.z=E*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 Ia extends Nt{constructor(e=new m0(new $(-1,-1,0),new $(-1,1,0),new $(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new $,l=new $,c=new Ve;let f=new $;const d=[],p=[],m=[],g=[];x(),this.setIndex(g),this.setAttribute("position",new dt(d,3)),this.setAttribute("normal",new dt(p,3)),this.setAttribute("uv",new dt(m,2));function x(){for(let w=0;w<t;w++)_(w);_(s===!1?t:0),b(),y()}function _(w){f=e.getPointAt(w/t,f);const M=o.normals[w],T=o.binormals[w];for(let E=0;E<=r;E++){const I=E/r*Math.PI*2,A=Math.sin(I),R=-Math.cos(I);l.x=R*M.x+A*T.x,l.y=R*M.y+A*T.y,l.z=R*M.z+A*T.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=f.x+i*l.x,a.y=f.y+i*l.y,a.z=f.z+i*l.z,d.push(a.x,a.y,a.z)}}function y(){for(let w=1;w<=t;w++)for(let M=1;M<=r;M++){const T=(r+1)*(w-1)+(M-1),E=(r+1)*w+(M-1),I=(r+1)*w+M,A=(r+1)*(w-1)+M;g.push(T,E,A),g.push(E,I,A)}}function b(){for(let w=0;w<=t;w++)for(let M=0;M<=r;M++)c.x=w/t,c.y=M/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 Ia(new _g[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class rR extends Nt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new $,s=new $;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,f=l.length;c<f;++c){const d=l[c],p=d.start,m=d.count;for(let g=p,x=p+m;g<x;g+=3)for(let _=0;_<3;_++){const y=a.getX(g+_),b=a.getX(g+(_+1)%3);r.fromBufferAttribute(o,y),s.fromBufferAttribute(o,b),_M(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const f=3*a+c,d=3*a+(c+1)%3;r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,d),_M(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new dt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function _M(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var xM=Object.freeze({__proto__:null,BoxGeometry:Pa,CapsuleGeometry:u0,CircleGeometry:h0,ConeGeometry:ld,CylinderGeometry:Ou,DodecahedronGeometry:f0,EdgesGeometry:ZC,ExtrudeGeometry:g0,IcosahedronGeometry:v0,LatheGeometry:y0,OctahedronGeometry:cd,PlaneGeometry:Oo,PolyhedronGeometry:Da,RingGeometry:ud,ShapeGeometry:_0,SphereGeometry:Fu,TetrahedronGeometry:x0,TorusGeometry:b0,TorusKnotGeometry:S0,TubeGeometry:Ia,WireframeGeometry:rR});class sR extends Fi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new et(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}}function Eu(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(bM(r))r.isRenderTargetTexture?(ot("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(bM(r[0])){const s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function ji(n){const e={};for(let t=0;t<n.length;t++){const i=Eu(n[t]);for(const r in i)e[r]=i[r]}return e}function bM(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function MO(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function oR(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:jt.workingColorSpace}const Eb={clone:Eu,merge:ji};var EO=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
3
|
}`,TO=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|