@realsee/five 5.0.0-alpha.14 → 5.0.0-alpha.142
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/README.md +21 -11
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/{images/icons.png → icons.png} +0 -0
- package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1413 -0
- package/docs/assets/{images/widgets.png → widgets.png} +0 -0
- package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
- package/docs/classes/five.AnimationFrameLoop.html +15 -0
- package/docs/classes/five.BVH.html +10 -0
- package/docs/classes/five.BVHIntersect.html +1 -0
- package/docs/classes/five.BVHNode.html +7 -0
- package/docs/classes/five.BVHVector3.html +1 -0
- package/docs/classes/five.Camera.html +11 -0
- package/docs/classes/five.Five.html +310 -0
- package/docs/classes/five.InternalWebGLRenderer.html +1 -0
- package/docs/classes/five.IntersectMesh.html +1 -0
- package/docs/classes/five.LegacyPanoCircleMesh.html +5 -0
- package/docs/classes/five.Model.html +87 -0
- package/docs/classes/five.NetworkSubscribe.html +50 -0
- package/docs/classes/five.PBMContainer.html +17 -0
- package/docs/classes/five.PBMGroup.html +19 -0
- package/docs/classes/five.PBMMaterial.html +19 -0
- package/docs/classes/five.PBMMesh.html +7 -0
- package/docs/classes/five.PanoCircleMesh.html +7 -0
- package/docs/classes/five.Scene.html +3 -0
- package/docs/classes/five.Subscribe.html +56 -0
- package/docs/classes/five.Tile3D.html +34 -0
- package/docs/classes/five.Tile3DModel.html +15 -0
- package/docs/classes/five.TileBoundingSphere.html +1 -0
- package/docs/classes/five.TileCacheNode.html +1 -0
- package/docs/classes/five.TileCullingVolume.html +1 -0
- package/docs/classes/five.TileOrientedBoundingBox.html +1 -0
- package/docs/classes/five.TilePlane.html +1 -0
- package/docs/classes/five.TileRequestScheduler.html +16 -0
- package/docs/classes/five.Tileset3D.html +11 -0
- package/docs/classes/five.Tileset3DTraverser.html +1 -0
- package/docs/classes/five.TilesetCache.html +1 -0
- package/docs/classes/five.Work.html +30 -0
- package/docs/classes/five.XRButton.html +1 -0
- package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
- package/docs/classes/gltf_loader.GLTFObject.html +7 -0
- package/docs/classes/line.Line.html +1 -0
- package/docs/classes/line.LineGeometry.html +1 -0
- package/docs/classes/line.LineMaterial.html +1 -0
- package/docs/classes/line.LineSegmentsGeometry.html +1 -0
- package/docs/classes/line.THREE_Line2.html +1 -0
- package/docs/classes/line.THREE_LineSegments2.html +1 -0
- package/docs/classes/react.Store.html +29 -0
- package/docs/classes/server.BVH.html +10 -0
- package/docs/classes/server.BVHIntersect.html +1 -0
- package/docs/classes/server.BVHNode.html +7 -0
- package/docs/classes/server.BVHVector3.html +1 -0
- package/docs/classes/server.Model.html +63 -0
- package/docs/classes/server.PBMGroup.html +9 -0
- package/docs/classes/server.PBMMesh.html +7 -0
- package/docs/classes/sticker.Sticker.html +32 -0
- package/docs/index.html +166 -422
- package/docs/interfaces/five.AddableObject.html +1 -0
- package/docs/interfaces/five.AnimationFrame.html +1 -0
- package/docs/interfaces/five.CameraPose.html +1 -0
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
- package/docs/interfaces/five.EventCallback.html +399 -0
- package/docs/interfaces/five.FiveInitArgs.html +107 -0
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +15 -0
- package/docs/interfaces/five.ImageOptions.html +18 -0
- package/docs/interfaces/five.ImageURLMappings.html +1 -0
- package/docs/interfaces/five.ImageURLOptions.html +17 -0
- package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
- package/docs/interfaces/five.Intersection.html +7 -0
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +15 -0
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/five.ModelEventCallback.html +22 -0
- package/docs/interfaces/five.MovePanoOptions.html +42 -0
- package/docs/interfaces/five.PBMPanoPicture.html +7 -0
- package/docs/interfaces/five.PBMParameters.html +19 -0
- package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +33 -0
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/five.Pose.html +37 -0
- package/docs/interfaces/five.Scissor.html +14 -0
- package/docs/interfaces/five.State.html +21 -0
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
- package/docs/interfaces/five.TextureOptions.html +20 -0
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +3 -0
- package/docs/interfaces/five.TileBoundingVolume.html +19 -0
- package/docs/interfaces/five.TileContent.html +1 -0
- package/docs/interfaces/five.Tileset3dOptions.html +1 -0
- package/docs/interfaces/five.TilesetJSON.html +1 -0
- package/docs/interfaces/five.TilesetJSONNode.html +1 -0
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -0
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +29 -0
- package/docs/interfaces/five.WorkCubeImage.html +13 -0
- package/docs/interfaces/five.WorkImage.html +21 -0
- package/docs/interfaces/five.WorkInitial.html +13 -0
- package/docs/interfaces/five.WorkModel.html +11 -0
- package/docs/interfaces/five.WorkModelTiles.html +3 -0
- package/docs/interfaces/five.WorkObserver.html +25 -0
- package/docs/interfaces/five.WorkTile.html +1 -0
- package/docs/interfaces/five.WorkVideo.html +9 -0
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +29 -0
- package/docs/interfaces/gltf_loader.GLTF.html +7 -0
- package/docs/interfaces/react.FiveActionReactCallbacks.html +62 -0
- package/docs/interfaces/react.FiveInjectionTypes.html +191 -0
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
- package/docs/interfaces/server.Intersection.html +7 -0
- package/docs/interfaces/server.ModelEventCallback.html +18 -0
- package/docs/interfaces/sticker.IntersectionLike.html +8 -0
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +62 -0
- package/docs/modules/five.SubscribeMixinType.html +1 -0
- package/docs/modules/five.html +496 -0
- package/docs/modules/gltf_loader.html +1 -0
- package/docs/modules/line.html +1 -0
- package/docs/modules/react.html +130 -1374
- package/docs/modules/server.html +18 -0
- package/docs/modules/sticker.html +1 -0
- package/docs/modules/vue.html +112 -0
- package/docs/modules.html +1 -120
- package/exporters/staticify.js +210 -0
- package/{index.d.ts → five/index.d.ts} +1211 -331
- package/five/index.js +372 -0
- package/gltf-loader/index.d.ts +76 -0
- package/gltf-loader/index.js +260 -0
- package/line/index.d.ts +69 -0
- package/line/index.js +260 -0
- package/package.json +25 -17
- package/react/index.d.ts +86 -24
- package/react/index.js +260 -1
- package/resource/{basis_transcoder.js → basis/basis_transcoder.js} +0 -0
- package/resource/{basis_transcoder.wasm → basis/basis_transcoder.wasm} +0 -0
- package/resource/gltf/draco_decoder.js +31 -0
- package/resource/gltf/draco_decoder.wasm +0 -0
- package/resource/gltf/draco_wasm_wrapper.js +119 -0
- package/scripts/five-staticify.js +26 -0
- package/server/index.d.ts +197 -26
- package/server/index.js +367 -1
- package/sticker/index.d.ts +71 -0
- package/sticker/index.js +260 -0
- package/templates/quick-start/README.md +1 -1
- package/templates/quick-start/package.json +1 -1
- package/templates/react-component/lib/index.tsx +3 -3
- package/umd/five-gltf-loader.js +2 -0
- package/umd/five-gltf-loader.js.LICENSE.txt +14 -0
- package/umd/five-line.js +2 -0
- package/umd/five-line.js.LICENSE.txt +14 -0
- package/umd/five-react.js +2 -0
- package/umd/five-react.js.LICENSE.txt +14 -0
- package/umd/five-sticker.js +2 -0
- package/umd/five-sticker.js.LICENSE.txt +14 -0
- package/umd/five-vue.js +1 -0
- package/umd/five.js +2 -0
- package/umd/five.js.LICENSE.txt +116 -0
- package/vue/index.d.ts +433 -0
- package/vue/index.js +260 -0
- package/bundles/five.js +0 -2
- package/bundles/five.js.LICENSE.txt +0 -160
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/index.five.html +0 -2498
- package/docs/classes/index.fivecamera.html +0 -311
- package/docs/classes/index.fivehashcubetexture.html +0 -240
- package/docs/classes/index.fiveline.html +0 -342
- package/docs/classes/index.fivelinegeometry.html +0 -500
- package/docs/classes/index.fivelinematerial.html +0 -276
- package/docs/classes/index.fivelinesegmentsgeometry.html +0 -447
- package/docs/classes/index.fivescene.html +0 -186
- package/docs/classes/index.internalwebglrenderer.html +0 -200
- package/docs/classes/index.model.html +0 -883
- package/docs/classes/index.pbmgroup.html +0 -415
- package/docs/classes/index.pbmmaterial.html +0 -521
- package/docs/classes/index.pbmmesh.html +0 -242
- package/docs/classes/index.subscribe.html +0 -556
- package/docs/classes/react.store.html +0 -584
- package/docs/interfaces/index.depthpanoramacontrollercustominitargs.html +0 -408
- package/docs/interfaces/index.eventcallback.html +0 -2452
- package/docs/interfaces/index.fiveinitargs.html +0 -695
- package/docs/interfaces/index.floorplancontrollercustominitargs.html +0 -283
- package/docs/interfaces/index.imageoptions.html +0 -320
- package/docs/interfaces/index.intersection.html +0 -215
- package/docs/interfaces/index.intersectmeshinterface.html +0 -176
- package/docs/interfaces/index.modelcontrollercustominitargs.html +0 -354
- package/docs/interfaces/index.modeleventcallback.html +0 -316
- package/docs/interfaces/index.movepanooptions.html +0 -457
- package/docs/interfaces/index.panocirclemeshinterface.html +0 -349
- package/docs/interfaces/index.panoramacontrollercustominitargs.html +0 -433
- package/docs/interfaces/index.panoramalikecontrollercustominitargs.html +0 -352
- package/docs/interfaces/index.pbmparameters.html +0 -462
- package/docs/interfaces/index.pose.html +0 -258
- package/docs/interfaces/index.scissor.html +0 -240
- package/docs/interfaces/index.state.html +0 -288
- package/docs/interfaces/index.subscribemixintype.emit.html +0 -180
- package/docs/interfaces/index.subscribemixintype.haslistener.html +0 -171
- package/docs/interfaces/index.subscribemixintype.off.html +0 -198
- package/docs/interfaces/index.subscribemixintype.on.html +0 -213
- package/docs/interfaces/index.subscribemixintype.once.html +0 -210
- package/docs/interfaces/index.topviewcontrollercustominitargs.html +0 -214
- package/docs/interfaces/index.vrpanoramacontrollercustominitargs.html +0 -420
- package/docs/interfaces/react.fiveactionreactcallbacks.html +0 -559
- package/docs/interfaces/react.fiveinjectiontypes.html +0 -1473
- package/docs/interfaces/react.injectfivetoprops.html +0 -259
- package/docs/modules/index.html +0 -3027
- package/docs/modules/index.subscribemixintype.html +0 -143
- package/five.js.LICENSE.txt +0 -160
- package/index.js +0 -1
- package/scripts/export-five-resource/chfs.exe +0 -0
- package/scripts/export-five-resource/fileify.js +0 -192
- package/scripts/export-five-resource/format-work.js +0 -71
- package/scripts/export-five-resource/staticify.js +0 -327
- package/scripts/transcode-model/BufferGeometryUtils.js +0 -832
- package/scripts/transcode-model/LoaderSupport.js +0 -1545
- package/scripts/transcode-model/MTLLoader.js +0 -602
- package/scripts/transcode-model/OBJLoader2.js +0 -1470
- package/scripts/transcode-model/obj2pbm.js +0 -65
package/five/index.js
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @realsee/five
|
|
3
|
+
*
|
|
4
|
+
* Generated: 2022-08-03
|
|
5
|
+
* Version: 5.0.0-alpha.142
|
|
6
|
+
*
|
|
7
|
+
* Terms:
|
|
8
|
+
* Realsee SDK License Agreement
|
|
9
|
+
*
|
|
10
|
+
* Update: July 28, 2021
|
|
11
|
+
*
|
|
12
|
+
* THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK)
|
|
13
|
+
* LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN
|
|
14
|
+
* RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee
|
|
15
|
+
* Software Development Kit(s) for the software and related explanatory materials
|
|
16
|
+
* (the "SDK") and includes any upgrades, modified versions, updates, additions,
|
|
17
|
+
* and copies of the SDK licensed to You by Realsee.
|
|
18
|
+
* BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE
|
|
19
|
+
* THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE
|
|
20
|
+
* AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO
|
|
21
|
+
* THE TERMS AND CONDITIONS STATED BELOW.
|
|
22
|
+
* This Agreement applies to Your use of the SDK in the country in which You
|
|
23
|
+
* legally install it (“Territory”) and is subject to the laws of such Territory
|
|
24
|
+
* and further subject to Section 12 below. Different terms, conditions, and
|
|
25
|
+
* limitations may apply to the use of the SDK in any additional countries.
|
|
26
|
+
* 1. DEFINITIONS.
|
|
27
|
+
* “Agreement” means this Realsee SDK License Agreement.
|
|
28
|
+
* “Developer”, “You” and “Your” means the person(s) or entity acquiring or using
|
|
29
|
+
* the SDK or otherwise exercising rights under the terms of this Agreement.
|
|
30
|
+
* “Documentation” means the technical or other specifications or documentation
|
|
31
|
+
* that Realsee may provide to You for use in connection with the SDK.
|
|
32
|
+
* “Integrated Product” means any software, website, or on-line service developed
|
|
33
|
+
* by You based on or using the SDK (collectively, the “Integrated Product”).
|
|
34
|
+
* “Intellectual Property” means any patents, patent rights, trademarks, service
|
|
35
|
+
* marks, registered and unregistered designs, applications for any of the
|
|
36
|
+
* foregoing, copyright, and any other similar protected rights in any country and
|
|
37
|
+
* to the extent recognised by any relevant jurisdiction as intellectual property,
|
|
38
|
+
* trade secrets, know-how and confidential information. Realsee reserves all
|
|
39
|
+
* rights not expressly granted to You.
|
|
40
|
+
* “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated
|
|
41
|
+
* and validly existing under the laws of Hong Kong].
|
|
42
|
+
* “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided
|
|
43
|
+
* hereunder, includes all development tools (including any compiler and debugger),
|
|
44
|
+
* application programming interfaces (“APIs”), libraries, binary utilities, header
|
|
45
|
+
* files, Documentation, content, data, code samples, and other materials provided
|
|
46
|
+
* to You in connection with this Agreement, whether delivered through a download,
|
|
47
|
+
* or any other media or form, and is licensed, not sold, to You by Realsee for use
|
|
48
|
+
* only under the terms of this Agreement. The terms of this Agreement will govern
|
|
49
|
+
* any updates provided by Realsee that replace and/or supplement the original SDK
|
|
50
|
+
* delivered to You, unless such update is accompanied by a separate license, in
|
|
51
|
+
* which case the terms of such license will govern.
|
|
52
|
+
* 2. LICENSED USES AND RESTRICTIONS.
|
|
53
|
+
* 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to
|
|
54
|
+
* You during the term, a limited, non-exclusive, revocable, non-sublicensable,
|
|
55
|
+
* non-transferable license to install and use the SDK within the Territory only
|
|
56
|
+
* for the purpose of internal development.
|
|
57
|
+
* 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall
|
|
58
|
+
* ensure that Your affiliates, employees, agents, representatives, officers,
|
|
59
|
+
* representatives, and subcontractors do not (directly or indirectly):
|
|
60
|
+
* 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source
|
|
61
|
+
* code of, those components of the SDK provided in object code form, or any part
|
|
62
|
+
* thereof;
|
|
63
|
+
* 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights
|
|
64
|
+
* notice on any part of the SDK;
|
|
65
|
+
* 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website
|
|
66
|
+
* or server for use by any third party except You, redistribute, or sublicense the
|
|
67
|
+
* SDK (or any part thereof), or operate the SDK (or any part thereof) in the
|
|
68
|
+
* capacity of a service bureau or other hosted services provider, in whole or in
|
|
69
|
+
* part, nor may You enable others to do so;
|
|
70
|
+
* 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
|
|
71
|
+
* 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner
|
|
72
|
+
* that is inconsistent with the terms of this Agreement, or to engage in any
|
|
73
|
+
* illegal activity;
|
|
74
|
+
* 2.2.6 use the SDK (or any part thereof) in any manner that may damage the
|
|
75
|
+
* operation of Realsee’s products or services; or
|
|
76
|
+
* 2.2.7 use the SDK or any information contained therein or otherwise provided by
|
|
77
|
+
* Realsee for the purpose of developing, or having developed, any product
|
|
78
|
+
* competitive with any Realsee product or service, as determined by Realsee in its
|
|
79
|
+
* sole discretion;
|
|
80
|
+
* 2.2.8 include any portion of the SDK in Your Developer products.
|
|
81
|
+
* 2.3 Realsee has the right to impose reasonable conditions such as a reasonable
|
|
82
|
+
* fee for use of the SDK in Integrated Product in the future.
|
|
83
|
+
* 2.4 You may make a limited number of copies of the SDK to be used by Your
|
|
84
|
+
* employees or consultants as provided herein, and not for general business
|
|
85
|
+
* purposes, and such employees or consultants shall be subject to the obligations
|
|
86
|
+
* and restrictions in this Agreement.
|
|
87
|
+
* 2.5 All licenses not expressly granted in this Agreement are reserved and no
|
|
88
|
+
* other licenses, immunity, or rights, express or implied, are granted by Realsee,
|
|
89
|
+
* by implication, estoppel, or otherwise.
|
|
90
|
+
* 3. CONFIDENTIALITY.
|
|
91
|
+
* The SDK and all source code, Documentation, specifications, engineering details,
|
|
92
|
+
* and related information pertaining to the SDK, whether in oral, written,
|
|
93
|
+
* graphic, or electronic form, are and shall remain the confidential and
|
|
94
|
+
* proprietary information of Realsee or its licensors (collectively, the
|
|
95
|
+
* “Confidential Information”). You shall (i) disclose Confidential Information to
|
|
96
|
+
* only those directors and employees (collectively, “Affiliates”) whose duties
|
|
97
|
+
* justify their need to know such information and who have been clearly informed
|
|
98
|
+
* of their obligation to maintain the confidential, proprietary, and/or trade
|
|
99
|
+
* secret status of such Confidential Information; and (ii) use Confidential
|
|
100
|
+
* Information solely in accordance with the license granted hereunder. In any
|
|
101
|
+
* event, You and Your Affiliates shall treat Confidential Information as strictly
|
|
102
|
+
* confidential and shall use the same care to prevent disclosure of such
|
|
103
|
+
* information as You use with respect to Your own similar confidential and/or
|
|
104
|
+
* proprietary information, which shall not be less than the care a reasonable
|
|
105
|
+
* person would use under similar circumstances. All Confidential Information, and
|
|
106
|
+
* any copies thereof, shall be returned promptly to Realsee upon request. You
|
|
107
|
+
* shall ensure that Your Affiliates comply with the provisions of this Section 3,
|
|
108
|
+
* and You shall be liable for any breach of this Section 3 resulting from the act
|
|
109
|
+
* or omission of any of Your Affiliates. You shall not disclose Confidential
|
|
110
|
+
* Information to any third party, including, without limitation, any of Your
|
|
111
|
+
* subcontractors.
|
|
112
|
+
* 4. PROPRIETARY RIGHTS.
|
|
113
|
+
* 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of
|
|
114
|
+
* all right, title, and interest in, to, and under the SDK, including, without
|
|
115
|
+
* limitation, all patents, copyrights, trade secrets, trademarks and other
|
|
116
|
+
* intellectual property and other proprietary rights therein, and reserve all
|
|
117
|
+
* rights not expressly granted to You.
|
|
118
|
+
* 4.2 The items contained in the SDK are the intellectual property of Realsee and
|
|
119
|
+
* its licensors and are protected by PRC copyright and patent law, international
|
|
120
|
+
* treaty provisions and applicable laws of the country in which it is being used.
|
|
121
|
+
* You agree to protect all copyright and other ownership interests of Realsee
|
|
122
|
+
* and/or its licensors in all items in the SDK supplied under this License
|
|
123
|
+
* Agreement. You agree that all copies of the items in the SDK, reproduced for any
|
|
124
|
+
* reason by You, contain the same copyright notices, and other proprietary notices
|
|
125
|
+
* as appropriate, as appear on or in the original items delivered by Realsee in
|
|
126
|
+
* the SDK. Realsee and/or its licensors retain title and ownership of the items in
|
|
127
|
+
* the SDK, the media on which it is loaded, and all subsequent copies, regardless
|
|
128
|
+
* of the form or media in or on which the original and other copies may exist.
|
|
129
|
+
* Except as stated above, this Agreement does not grant You any rights to patents,
|
|
130
|
+
* copyrights, trade secrets, trademarks or any other rights in respect to the
|
|
131
|
+
* items in the SDK.
|
|
132
|
+
* 5. TERM AND TERMINATION.
|
|
133
|
+
* 5.1 This Agreement is effective until terminated. Realsee has the right to
|
|
134
|
+
* terminate this Agreement immediately, without judicial intervention, if You fail
|
|
135
|
+
* to comply with any term herein. Upon any such termination You must remove all
|
|
136
|
+
* full and partial copies of the items in the SDK from Your computer and
|
|
137
|
+
* discontinue the use of the items in the SDK.
|
|
138
|
+
* 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have
|
|
139
|
+
* breached any provision of the Agreement; or (B) Realsee is required to do so by
|
|
140
|
+
* law; or (C) Realsee decides to no longer provide the SDK or certain parts of the
|
|
141
|
+
* SDK to users in the country in which You are resident or from which You use the
|
|
142
|
+
* service, or the provision of the SDK or certain SDK services to You by Realsee
|
|
143
|
+
* is, in Realsee's sole discretion, no longer legally or commercially viable.
|
|
144
|
+
* 5.3 When the Agreement comes to an end, all of the legal rights, obligations and
|
|
145
|
+
* liabilities that You and Realsee have benefited from, been subject to (or which
|
|
146
|
+
* have accrued over time whilst the Agreement has been in force) or which are
|
|
147
|
+
* expressed to continue indefinitely, shall be unaffected by this cessation, and
|
|
148
|
+
* the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such
|
|
149
|
+
* rights, obligations and liabilities indefinitely.
|
|
150
|
+
* 6. DISCLAIMER OF WARRANTY.
|
|
151
|
+
* YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE
|
|
152
|
+
* LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE
|
|
153
|
+
* ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS
|
|
154
|
+
* WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE
|
|
155
|
+
* MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK,
|
|
156
|
+
* WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY
|
|
157
|
+
* PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR
|
|
158
|
+
* RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING
|
|
159
|
+
* OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT
|
|
160
|
+
* CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL
|
|
161
|
+
* WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
|
|
162
|
+
* CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
163
|
+
* OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK
|
|
164
|
+
* OR ANY SERVICES RELATED TO THE SDK.
|
|
165
|
+
* REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE
|
|
166
|
+
* AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS
|
|
167
|
+
* THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
|
|
168
|
+
* 7. LIMITATION OF LIABILITY.
|
|
169
|
+
* TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS
|
|
170
|
+
* LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR
|
|
171
|
+
* CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE,
|
|
172
|
+
* LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR
|
|
173
|
+
* INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME,
|
|
174
|
+
* OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF
|
|
175
|
+
* PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER
|
|
176
|
+
* COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY
|
|
177
|
+
* TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY
|
|
178
|
+
* SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART
|
|
179
|
+
* THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT,
|
|
180
|
+
* OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
181
|
+
* DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES
|
|
182
|
+
* EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN
|
|
183
|
+
* IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS
|
|
184
|
+
* CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS
|
|
185
|
+
* OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT
|
|
186
|
+
* OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
|
|
187
|
+
* 8. INDEMNIFICATION.
|
|
188
|
+
* To the extent permitted by applicable law, You agree to indemnify, defend and
|
|
189
|
+
* hold harmless Realsee, its affiliates and each of their directors, officers,
|
|
190
|
+
* employees, independent contractors, and agents (each a “Realsee Indemnified
|
|
191
|
+
* Party”) from any and all claims, losses, liabilities, damages, expenses, and
|
|
192
|
+
* costs (including without limitation attorneys’ fees and court costs) incurred by
|
|
193
|
+
* a Realsee Indemnified Party as a result of: (i) Your non-compliance with any
|
|
194
|
+
* terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or
|
|
195
|
+
* (iii) Your use of any Integrated Product, including any claim that Integrated
|
|
196
|
+
* Product infringes the copyright, trademark, trade secret or other intellectual
|
|
197
|
+
* property right of a third party.
|
|
198
|
+
* 9. ACKNOWLEDGEMENTS.
|
|
199
|
+
* Portions of the SDK may utilize or include third party software and other
|
|
200
|
+
* copyrighted material. Acknowledgments, licensing terms, and disclaimers for such
|
|
201
|
+
* material are contained in Documentation for the SDK or may otherwise accompany
|
|
202
|
+
* such material, and Your use of such materials governed by their respective
|
|
203
|
+
* terms. In the event of conflict between the terms of this Agreement and an
|
|
204
|
+
* applicable open source or third party agreement, the open source or third party
|
|
205
|
+
* agreement will control solely with respect to the open source software or third
|
|
206
|
+
* party software. Moreover, You shall not subject any items (including not limited
|
|
207
|
+
* to source code, object code, and any software) included in the SDK to any open
|
|
208
|
+
* source license.
|
|
209
|
+
* 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
|
|
210
|
+
* You acknowledge that Realsee is currently developing or may develop technologies
|
|
211
|
+
* and products in the future that have or may have design and/or functionality
|
|
212
|
+
* similar to Integrated Product that You may develop based on Your license herein.
|
|
213
|
+
* Nothing in this Agreement shall impair, limit or curtail Realsee's right to
|
|
214
|
+
* continue with its development, maintenance and/or distribution of Realsee's
|
|
215
|
+
* technology or products.
|
|
216
|
+
* 11. GENERAL.
|
|
217
|
+
* 11.1 Export Control. You may not use or otherwise export or re-export the SDK
|
|
218
|
+
* (or any part thereof) except as authorized by United States law and the laws of
|
|
219
|
+
* the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In
|
|
220
|
+
* particular, but without limitation, the SDK may not be exported or re-exported
|
|
221
|
+
* (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury
|
|
222
|
+
* Department's list of Specially Designated Nationals or the U.S. Department of
|
|
223
|
+
* Commerce Denied Person's List or Entity List. By using the SDK (or any part
|
|
224
|
+
* thereof), You represent and warrant that You are not located in any such country
|
|
225
|
+
* or on any such list.
|
|
226
|
+
* 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall
|
|
227
|
+
* be governed by and construed in accordance with the laws of People’s Republic of
|
|
228
|
+
* China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau),
|
|
229
|
+
* without reference to its conflict of laws principles. Any dispute, controversy
|
|
230
|
+
* or claim arising from or in connection with this Agreement, or the breach,
|
|
231
|
+
* termination or invalidity thereof, shall be submitted to China International
|
|
232
|
+
* Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing
|
|
233
|
+
* which shall be conducted in accordance with the CIETAC's arbitration rules in
|
|
234
|
+
* effect at the time of applying for arbitration. The arbitral award is final and
|
|
235
|
+
* binding upon both parties.
|
|
236
|
+
* 11.3 Severability. If any provision of this Agreement is held by a court of
|
|
237
|
+
* competent jurisdiction to be unenforceable for any reason, the remaining
|
|
238
|
+
* provisions hereof will be unaffected and remain in full force and effect.
|
|
239
|
+
* 11.4. Modifications. Realsee reserves the right, from time to time, with or
|
|
240
|
+
* without notice to You, to make revisions to this Agreement in our sole and
|
|
241
|
+
* absolute discretion. The most current version of this Agreement will supersede
|
|
242
|
+
* all previous versions and shall be made available on the website where the SDK
|
|
243
|
+
* is made available, or by such other means as Realsee may determine in its
|
|
244
|
+
* discretion. Any modified versions of this Agreement hereto shall take effect
|
|
245
|
+
* from the time that it is made available. You shall be responsible for regularly
|
|
246
|
+
* checking for notice of any such modifications. You agree that Your continued use
|
|
247
|
+
* of the SDK constitutes Your agreement to the modified Agreement.
|
|
248
|
+
* 11.5 Relationship of the Parties. This Agreement will not be construed as
|
|
249
|
+
* creating an agency, partnership, joint venture, fiduciary duty, or any other
|
|
250
|
+
* form of legal association between You and Realsee, and You will not represent to
|
|
251
|
+
* the contrary, whether expressly, by implication, appearance, or otherwise.
|
|
252
|
+
* 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire
|
|
253
|
+
* agreement between You and Realsee with respect to the use of the SDK licensed
|
|
254
|
+
* hereunder and supersedes all prior understandings regarding such subject matter.
|
|
255
|
+
* No amendment to or modification of this Agreement will be binding unless in
|
|
256
|
+
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
257
|
+
* Agreement and all related documents shall be drafted in English.
|
|
258
|
+
*/
|
|
259
|
+
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("tslib"),i=require("protobufjs/minimal");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var r=n(e),o=n(i),a=Number(r.REVISION);if(a<115||a>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');
|
|
261
|
+
/**
|
|
262
|
+
* @license
|
|
263
|
+
* The 'jsrsasign'(RSA-Sign JavaScript Library) License
|
|
264
|
+
*
|
|
265
|
+
* Copyright (c) 2010-2021 Kenji Urushima
|
|
266
|
+
*
|
|
267
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
268
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
269
|
+
* in the Software without restriction, including without limitation the rights
|
|
270
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
271
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
272
|
+
* furnished to do so, subject to the following conditions:
|
|
273
|
+
*
|
|
274
|
+
* The above copyright notice and this permission notice shall be included in
|
|
275
|
+
* all copies or substantial portions of the Software.
|
|
276
|
+
*
|
|
277
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
278
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
279
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
280
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
281
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
282
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
283
|
+
* THE SOFTWARE.
|
|
284
|
+
*
|
|
285
|
+
* LICENSE: MIT License
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* @license
|
|
289
|
+
* RSA and ECC in JavaScript
|
|
290
|
+
*
|
|
291
|
+
* Copyright (c) 2003-2005 Tom Wu All Rights Reserved.
|
|
292
|
+
*
|
|
293
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
294
|
+
* a copy of this software and associated documentation files (the
|
|
295
|
+
* "Software"), to deal in the Software without restriction, including
|
|
296
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
297
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
298
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
299
|
+
* the following conditions:
|
|
300
|
+
*
|
|
301
|
+
* The above copyright notice and this permission notice shall be
|
|
302
|
+
* included in all copies or substantial portions of the Software.
|
|
303
|
+
*
|
|
304
|
+
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
|
305
|
+
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
|
306
|
+
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
307
|
+
*
|
|
308
|
+
* IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
|
309
|
+
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
|
|
310
|
+
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
|
|
311
|
+
* THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
|
|
312
|
+
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
313
|
+
*
|
|
314
|
+
* In addition, the following condition applies:
|
|
315
|
+
*
|
|
316
|
+
* All redistributions must retain an intact copy of this copyright notice
|
|
317
|
+
* and disclaimer.
|
|
318
|
+
*
|
|
319
|
+
* http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
320
|
+
* LICENSE: BSD License
|
|
321
|
+
* PART: ext/{base64,jsbn,jsbn2,prgn4,rng,rsa,rsa2}
|
|
322
|
+
*/
|
|
323
|
+
/**
|
|
324
|
+
* @license
|
|
325
|
+
* CryptoJS
|
|
326
|
+
*
|
|
327
|
+
* Copyright (c) 2009-2013 Jeff Mott
|
|
328
|
+
*
|
|
329
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
330
|
+
* a copy of this software and associated documentation files (the
|
|
331
|
+
* "Software"), to deal in the Software without restriction, including
|
|
332
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
333
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
334
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
335
|
+
* the following conditions:
|
|
336
|
+
*
|
|
337
|
+
* The above copyright notice and this permission notice shall be
|
|
338
|
+
* included in all copies or substantial portions of the Software.
|
|
339
|
+
*
|
|
340
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
341
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
342
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
343
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
344
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
345
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
346
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
347
|
+
*
|
|
348
|
+
* https://code.google.com/p/crypto-js/wiki/License
|
|
349
|
+
* PART: ext/cryptojs
|
|
350
|
+
*/var s,c={},l={},h=h||function(e,t){var i={},n=i.lib={},r=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var i=new e;return t&&i.mixIn(t),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,i=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<r;o++){var a=i[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(o=0;o<r;o+=4)t[n+o>>>2]=i[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var i=[],n=0;n<t;n+=4)i.push(4294967296*e.random()|0);return new o.init(i,t)}}),a=i.enc={},s=a.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n+=2)i[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(i,t/2)}},c=a.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(i,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i=this._data,n=i.words,r=i.sigBytes,a=this.blockSize,s=r/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,r);if(c){for(var h=0;h<c;h+=a)this._doProcessBlock(n,h);var u=n.splice(0,c);i.sigBytes-=l}return new o.init(u,l)},clone:function(){var e=r.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=h.extend({cfg:r.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new u.HMAC.init(e,i).finalize(t)}}});var u=i.algo={};return i}(Math);function u(e,t,i){null!=e&&("number"==typeof e?this.fromNumber(e,t,i):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function d(){return new u(null)}!function(e){for(var t=h,i=(r=t.lib).WordArray,n=r.Hasher,r=t.algo,o=[],a=[],s=function(e){return 4294967296*(e-(0|e))|0},c=2,l=0;64>l;){var u;e:{u=c;for(var d=e.sqrt(u),p=2;p<=d;p++)if(!(u%p)){u=!1;break e}u=!0}u&&(8>l&&(o[l]=s(e.pow(c,.5))),a[l]=s(e.pow(c,1/3)),l++),c++}var f=[];r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,n=i[0],r=i[1],o=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],d=0;64>d;d++){if(16>d)f[d]=0|e[t+d];else{var p=f[d-15],m=f[d-2];f[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[d-7]+((m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10)+f[d-16]}p=u+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&h)+a[d]+f[d],m=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&r^n&o^r&o),u=h,h=l,l=c,c=s+p|0,s=o,o=r,r=n,n=p+m|0}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+c|0,i[5]=i[5]+l|0,i[6]=i[6]+h|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(n/4294967296),i[15+(r+64>>>9<<4)]=n,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),h.lib.Cipher||function(e){var t=(f=h).lib,i=t.Base,n=t.WordArray,r=t.BufferedBlockAlgorithm,o=f.enc.Base64,a=f.algo.EvpKDF,s=t.Cipher=r.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,n){return("string"==typeof i?m:p).encrypt(e,t,i,n)},decrypt:function(t,i,n){return("string"==typeof i?m:p).decrypt(e,t,i,n)}}}});t.StreamCipher=s.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var c=f.mode={},l=function(e,t,i){var n=this._iv;n?this._iv=undefined:n=this._prevBlock;for(var r=0;r<i;r++)e[t+r]^=n[r]},u=(t.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();u.Encryptor=u.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;l.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),u.Decryptor=u.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,r=e.slice(t,t+n);i.decryptBlock(e,t),l.call(this,e,t,n),this._prevBlock=r}}),c=c.CBC=u,u=(f.pad={}).Pkcs7={pad:function(e,t){for(var i,r=(i=(i=4*t)-e.sigBytes%i)<<24|i<<16|i<<8|i,o=[],a=0;a<i;a+=4)o.push(r);i=n.create(o,i),e.concat(i)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=s.extend({cfg:s.cfg.extend({mode:c,padding:u}),reset:function(){s.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=t.createEncryptor;else i=t.createDecryptor,this._minBufferSize=1;this._mode=i.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var d=t.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(c=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?n.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var i=n.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:i})}},t.SerializableCipher=i.extend({cfg:i.extend({format:c}),encrypt:function(e,t,i,n){n=this.cfg.extend(n);var r=e.createEncryptor(i,n);return t=r.finalize(t),r=r.cfg,d.create({ciphertext:t,key:i,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,i,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(i,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,i,r){return r||(r=n.random(8)),e=a.create({keySize:t+i}).compute(e,r),i=n.create(e.words.slice(t),4*i),e.sigBytes=4*t,d.create({key:e,iv:i,salt:r})}},m=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:f}),encrypt:function(e,t,i,n){return i=(n=this.cfg.extend(n)).kdf.execute(i,e.keySize,e.ivSize),n.iv=i.iv,(e=p.encrypt.call(this,e,t,i.key,n)).mixIn(i),e},decrypt:function(e,t,i,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),i=n.kdf.execute(i,e.keySize,e.ivSize,t.salt),n.iv=i.iv,p.decrypt.call(this,e,t,i.key,n)}})}(),function(){for(var e=h,t=e.lib.BlockCipher,i=e.algo,n=[],r=[],o=[],a=[],s=[],c=[],l=[],u=[],d=[],p=[],f=[],m=0;256>m;m++)f[m]=128>m?m<<1:m<<1^283;var g=0,v=0;for(m=0;256>m;m++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;n[g]=y,r[y]=g;var A=f[g],x=f[A],b=f[x],w=257*f[y]^16843008*y;o[g]=w<<24|w>>>8,a[g]=w<<16|w>>>16,s[g]=w<<8|w>>>24,c[g]=w,w=16843009*b^65537*x^257*A^16843008*g,l[y]=w<<24|w>>>8,u[y]=w<<16|w>>>16,d[y]=w<<8|w>>>24,p[y]=w,g?(g=A^f[f[f[b^A]]],v^=f[f[v]]):g=v=1}var M=[0,1,2,4,8,16,32,64,128,27,54];i=i.AES=t.extend({_doReset:function(){for(var e=(i=this._key).words,t=i.sigBytes/4,i=4*((this._nRounds=t+6)+1),r=this._keySchedule=[],o=0;o<i;o++)if(o<t)r[o]=e[o];else{var a=r[o-1];o%t?6<t&&4==o%t&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a]):(a=n[(a=a<<8|a>>>24)>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a],a^=M[o/t|0]<<24),r[o]=r[o-t]^a}for(e=this._invKeySchedule=[],t=0;t<i;t++)o=i-t,a=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?a:l[n[a>>>24]]^u[n[a>>>16&255]]^d[n[a>>>8&255]]^p[n[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,s,c,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,l,u,d,p,r),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,n,r,o,a,s){for(var c=this._nRounds,l=e[t]^i[0],h=e[t+1]^i[1],u=e[t+2]^i[2],d=e[t+3]^i[3],p=4,f=1;f<c;f++){var m=n[l>>>24]^r[h>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],g=n[h>>>24]^r[u>>>16&255]^o[d>>>8&255]^a[255&l]^i[p++],v=n[u>>>24]^r[d>>>16&255]^o[l>>>8&255]^a[255&h]^i[p++];d=n[d>>>24]^r[l>>>16&255]^o[h>>>8&255]^a[255&u]^i[p++],l=m,h=g,u=v}m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++],g=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^i[p++],v=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^i[p++],d=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=v,e[t+3]=d},keySize:8});e.AES=t._createHelper(i)}(),
|
|
351
|
+
/*!
|
|
352
|
+
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
353
|
+
Code licensed under the BSD License:
|
|
354
|
+
http://developer.yahoo.com/yui/license.html
|
|
355
|
+
version: 2.9.0
|
|
356
|
+
*/
|
|
357
|
+
l.lang={extend:function(e,t,i){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),i){var r;for(r in i)e.prototype[r]=i[r];var o=function(){},a=["toString","valueOf"];try{/MSIE/.test("undefined"!=typeof navigator?navigator.userAgent:"node")&&(o=function(e,t){for(r=0;r<a.length;r+=1){var i=a[r],n=t[i];"function"==typeof n&&n!=Object.prototype[i]&&(e[i]=n)}})}catch(e){}o(e.prototype,i)}}},"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(u.prototype.am=function(e,t,i,n,r,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this[e],l=this[e++]>>15,h=s*c+l*a;r=((c=a*c+((32767&h)<<15)+i[n]+(1073741823&r))>>>30)+(h>>>15)+s*l+(r>>>30),i[n++]=1073741823&c}return r},s=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(u.prototype.am=function(e,t,i,n,r,o){for(;--o>=0;){var a=t*this[e++]+i[n]+r;r=Math.floor(a/67108864),i[n++]=67108863&a}return r},s=26):(u.prototype.am=function(e,t,i,n,r,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,h=s*c+l*a;r=((c=a*c+((16383&h)<<14)+i[n]+r)>>28)+(h>>14)+s*l,i[n++]=268435455&c}return r},s=28),u.prototype.DB=s,u.prototype.DM=(1<<s)-1,u.prototype.DV=1<<s;u.prototype.FV=Math.pow(2,52),u.prototype.F1=52-s,u.prototype.F2=2*s-52;var p,f,m=new Array;for(p="0".charCodeAt(0),f=0;f<=9;++f)m[p++]=f;for(p="a".charCodeAt(0),f=10;f<36;++f)m[p++]=f;for(p="A".charCodeAt(0),f=10;f<36;++f)m[p++]=f;function g(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function v(e,t){var i=m[e.charCodeAt(t)];return null==i?-1:i}function y(e){var t=d();return t.fromInt(e),t}function A(e){var t,i=1;return 0!=(t=e>>>16)&&(e=t,i+=16),0!=(t=e>>8)&&(e=t,i+=8),0!=(t=e>>4)&&(e=t,i+=4),0!=(t=e>>2)&&(e=t,i+=2),0!=(t=e>>1)&&(e=t,i+=1),i}function x(e){this.m=e}function b(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function w(e,t){return e&t}function M(e,t){return e|t}function E(e,t){return e^t}function S(e,t){return e&~t}function _(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function T(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function C(){}function I(e){return e}function P(e){this.r2=d(),this.q3=d(),u.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}x.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},x.prototype.revert=function(e){return e},x.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},x.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},x.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},b.prototype.convert=function(e){var t=d();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(u.ZERO)>0&&this.m.subTo(t,t),t},b.prototype.revert=function(e){var t=d();return e.copyTo(t),this.reduce(t),t},b.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=32767&e[t],n=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[i=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},b.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},b.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},u.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},u.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},u.prototype.fromString=function(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var n=e.length,r=!1,o=0;--n>=0;){var a=8==i?255&e[n]:v(e,n);a<0?"-"==e.charAt(n)&&(r=!0):(r=!1,0==o?this[this.t++]=a:o+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),r&&u.ZERO.subTo(this,this)},u.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},u.prototype.dlShiftTo=function(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s},u.prototype.drShiftTo=function(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s},u.prototype.lShiftTo=function(e,t){var i,n=e%this.DB,r=this.DB-n,o=(1<<r)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(i=this.t-1;i>=0;--i)t[i+a+1]=this[i]>>r|s,s=(this[i]&o)<<n;for(i=a-1;i>=0;--i)t[i]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},u.prototype.rShiftTo=function(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t)t.t=0;else{var n=e%this.DB,r=this.DB-n,o=(1<<n)-1;t[0]=this[i]>>n;for(var a=i+1;a<this.t;++a)t[a-i-1]|=(this[a]&o)<<r,t[a-i]=this[a]>>n;n>0&&(t[this.t-i-1]|=(this.s&o)<<r),t.t=this.t-i,t.clamp()}},u.prototype.subTo=function(e,t){for(var i=0,n=0,r=Math.min(e.t,this.t);i<r;)n+=this[i]-e[i],t[i++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;i<this.t;)n+=this[i],t[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<e.t;)n-=e[i],t[i++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[i++]=this.DV+n:n>0&&(t[i++]=n),t.t=i,t.clamp()},u.prototype.multiplyTo=function(e,t){var i=this.abs(),n=e.abs(),r=i.t;for(t.t=r+n.t;--r>=0;)t[r]=0;for(r=0;r<n.t;++r)t[r+i.t]=i.am(0,n[r],t,r,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&u.ZERO.subTo(t,t)},u.prototype.squareTo=function(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var n=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,n,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()},u.prototype.divRemTo=function(e,t,i){var n=e.abs();if(!(n.t<=0)){var r=this.abs();if(r.t<n.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=d());var o=d(),a=this.s,s=e.s,c=this.DB-A(n[n.t-1]);c>0?(n.lShiftTo(c,o),r.lShiftTo(c,i)):(n.copyTo(o),r.copyTo(i));var l=o.t,h=o[l-1];if(0!=h){var p=h*(1<<this.F1)+(l>1?o[l-2]>>this.F2:0),f=this.FV/p,m=(1<<this.F1)/p,g=1<<this.F2,v=i.t,y=v-l,x=null==t?d():t;for(o.dlShiftTo(y,x),i.compareTo(x)>=0&&(i[i.t++]=1,i.subTo(x,i)),u.ONE.dlShiftTo(l,x),x.subTo(o,o);o.t<l;)o[o.t++]=0;for(;--y>=0;){var b=i[--v]==h?this.DM:Math.floor(i[v]*f+(i[v-1]+g)*m);if((i[v]+=o.am(0,b,i,y,0,l))<b)for(o.dlShiftTo(y,x),i.subTo(x,i);i[v]<--b;)i.subTo(x,i)}null!=t&&(i.drShiftTo(l,t),a!=s&&u.ZERO.subTo(t,t)),i.t=l,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&u.ZERO.subTo(i,i)}}},u.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},u.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},u.prototype.exp=function(e,t){if(e>4294967295||e<1)return u.ONE;var i=d(),n=d(),r=t.convert(this),o=A(e)-1;for(r.copyTo(i);--o>=0;)if(t.sqrTo(i,n),(e&1<<o)>0)t.mulTo(n,r,i);else{var a=i;i=n,n=a}return t.revert(i)},u.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var i,n=(1<<t)-1,r=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(i=this[a]>>s)>0&&(r=!0,o=g(i));a>=0;)s<t?(i=(this[a]&(1<<s)-1)<<t-s,i|=this[--a]>>(s+=this.DB-t)):(i=this[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),i>0&&(r=!0),r&&(o+=g(i));return r?o:"0"},u.prototype.negate=function(){var e=d();return u.ZERO.subTo(this,e),e},u.prototype.abs=function(){return this.s<0?this.negate():this},u.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var i=this.t;if(0!=(t=i-e.t))return this.s<0?-t:t;for(;--i>=0;)if(0!=(t=this[i]-e[i]))return t;return 0},u.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)},u.prototype.mod=function(e){var t=d();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(u.ZERO)>0&&e.subTo(t,t),t},u.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new x(t):new b(t),this.exp(e,i)},u.ZERO=y(0),u.ONE=y(1),C.prototype.convert=I,C.prototype.revert=I,C.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},C.prototype.sqrTo=function(e,t){e.squareTo(t)},P.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=d();return e.copyTo(t),this.reduce(t),t},P.prototype.revert=function(e){return e},P.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},P.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},P.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var R=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],L=(1<<26)/R[R.length-1];u.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},u.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),n=y(i),r=d(),o=d(),a="";for(this.divRemTo(n,r,o);r.signum()>0;)a=(i+o.intValue()).toString(e).substr(1)+a,r.divRemTo(n,r,o);return o.intValue().toString(e)+a},u.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),n=Math.pow(t,i),r=!1,o=0,a=0,s=0;s<e.length;++s){var c=v(e,s);c<0?"-"==e.charAt(s)&&0==this.signum()&&(r=!0):(a=t*a+c,++o>=i&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),r&&u.ZERO.subTo(this,this)},u.prototype.fromNumber=function(e,t,i){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(u.ONE.shiftLeft(e-1),M,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(u.ONE.shiftLeft(e-1),this);else{var n=new Array,r=7&e;n.length=1+(e>>3),t.nextBytes(n),r>0?n[0]&=(1<<r)-1:n[0]=0,this.fromString(n,256)}},u.prototype.bitwiseTo=function(e,t,i){var n,r,o=Math.min(e.t,this.t);for(n=0;n<o;++n)i[n]=t(this[n],e[n]);if(e.t<this.t){for(r=e.s&this.DM,n=o;n<this.t;++n)i[n]=t(this[n],r);i.t=this.t}else{for(r=this.s&this.DM,n=o;n<e.t;++n)i[n]=t(r,e[n]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},u.prototype.changeBit=function(e,t){var i=u.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},u.prototype.addTo=function(e,t){for(var i=0,n=0,r=Math.min(e.t,this.t);i<r;)n+=this[i]+e[i],t[i++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;i<this.t;)n+=this[i],t[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<e.t;)n+=e[i],t[i++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[i++]=n:n<-1&&(t[i++]=this.DV+n),t.t=i,t.clamp()},u.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},u.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},u.prototype.multiplyLowerTo=function(e,t,i){var n,r=Math.min(this.t+e.t,t);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e[r],i,r,0,t-r);i.clamp()},u.prototype.multiplyUpperTo=function(e,t,i){--t;var n=i.t=this.t+e.t-t;for(i.s=0;--n>=0;)i[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)i[this.t+n-t]=this.am(t-n,e[n],i,0,0,this.t+n-t);i.clamp(),i.drShiftTo(1,i)},u.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(0==t)i=this[0]%e;else for(var n=this.t-1;n>=0;--n)i=(t*i+this[n])%e;return i},u.prototype.millerRabin=function(e){var t=this.subtract(u.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var n=t.shiftRight(i);(e=e+1>>1)>R.length&&(e=R.length);for(var r=d(),o=0;o<e;++o){r.fromInt(R[Math.floor(Math.random()*R.length)]);var a=r.modPow(n,this);if(0!=a.compareTo(u.ONE)&&0!=a.compareTo(t)){for(var s=1;s++<i&&0!=a.compareTo(t);)if(0==(a=a.modPowInt(2,this)).compareTo(u.ONE))return!1;if(0!=a.compareTo(t))return!1}}return!0},u.prototype.clone=
|
|
358
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
359
|
+
function(){var e=d();return this.copyTo(e),e},u.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},u.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},u.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},u.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},u.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,n=this.DB-e*this.DB%8,r=0;if(e-- >0)for(n<this.DB&&(i=this[e]>>n)!=(this.s&this.DM)>>n&&(t[r++]=i|this.s<<this.DB-n);e>=0;)n<8?(i=(this[e]&(1<<n)-1)<<8-n,i|=this[--e]>>(n+=this.DB-8)):(i=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&i)&&(i|=-256),0==r&&(128&this.s)!=(128&i)&&++r,(r>0||i!=this.s)&&(t[r++]=i);return t},u.prototype.equals=function(e){return 0==this.compareTo(e)},u.prototype.min=function(e){return this.compareTo(e)<0?this:e},u.prototype.max=function(e){return this.compareTo(e)>0?this:e},u.prototype.and=function(e){var t=d();return this.bitwiseTo(e,w,t),t},u.prototype.or=function(e){var t=d();return this.bitwiseTo(e,M,t),t},u.prototype.xor=function(e){var t=d();return this.bitwiseTo(e,E,t),t},u.prototype.andNot=function(e){var t=d();return this.bitwiseTo(e,S,t),t},u.prototype.not=function(){for(var e=d(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},u.prototype.shiftLeft=function(e){var t=d();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},u.prototype.shiftRight=function(e){var t=d();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},u.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+_(this[e]);return this.s<0?this.t*this.DB:-1},u.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=T(this[i]^t);return e},u.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},u.prototype.setBit=function(e){return this.changeBit(e,M)},u.prototype.clearBit=function(e){return this.changeBit(e,S)},u.prototype.flipBit=function(e){return this.changeBit(e,E)},u.prototype.add=function(e){var t=d();return this.addTo(e,t),t},u.prototype.subtract=function(e){var t=d();return this.subTo(e,t),t},u.prototype.multiply=function(e){var t=d();return this.multiplyTo(e,t),t},u.prototype.divide=function(e){var t=d();return this.divRemTo(e,t,null),t},u.prototype.remainder=function(e){var t=d();return this.divRemTo(e,null,t),t},u.prototype.divideAndRemainder=function(e){var t=d(),i=d();return this.divRemTo(e,t,i),new Array(t,i)},u.prototype.modPow=function(e,t){var i,n,r=e.bitLength(),o=y(1);if(r<=0)return o;i=r<18?1:r<48?3:r<144?4:r<768?5:6,n=r<8?new x(t):t.isEven()?new P(t):new b(t);var a=new Array,s=3,c=i-1,l=(1<<i)-1;if(a[1]=n.convert(this),i>1){var h=d();for(n.sqrTo(a[1],h);s<=l;)a[s]=d(),n.mulTo(h,a[s-2],a[s]),s+=2}var u,p,f=e.t-1,m=!0,g=d();for(r=A(e[f])-1;f>=0;){for(r>=c?u=e[f]>>r-c&l:(u=(e[f]&(1<<r+1)-1)<<c-r,f>0&&(u|=e[f-1]>>this.DB+r-c)),s=i;0==(1&u);)u>>=1,--s;if((r-=s)<0&&(r+=this.DB,--f),m)a[u].copyTo(o),m=!1;else{for(;s>1;)n.sqrTo(o,g),n.sqrTo(g,o),s-=2;s>0?n.sqrTo(o,g):(p=o,o=g,g=p),n.mulTo(g,a[u],o)}for(;f>=0&&0==(e[f]&1<<r);)n.sqrTo(o,g),p=o,o=g,g=p,--r<0&&(r=this.DB-1,--f)}return n.revert(o)},u.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return u.ZERO;for(var i=e.clone(),n=this.clone(),r=y(1),o=y(0),a=y(0),s=y(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(r.isEven()&&o.isEven()||(r.addTo(this,r),o.subTo(e,o)),r.rShiftTo(1,r)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&s.isEven()||(a.addTo(this,a),s.subTo(e,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);i.compareTo(n)>=0?(i.subTo(n,i),t&&r.subTo(a,r),o.subTo(s,o)):(n.subTo(i,n),t&&a.subTo(r,a),s.subTo(o,s))}return 0!=n.compareTo(u.ONE)?u.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},u.prototype.pow=function(e){return this.exp(e,new C)},u.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var n=t;t=i,i=n}var r=t.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return t;for(r<o&&(o=r),o>0&&(t.rShiftTo(o,t),i.rShiftTo(o,i));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=i.getLowestSetBit())>0&&i.rShiftTo(r,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i},u.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=R[R.length-1]){for(t=0;t<R.length;++t)if(i[0]==R[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<R.length;){for(var n=R[t],r=t+1;r<R.length&&n<L;)n*=R[r++];for(n=i.modInt(n);t<r;)if(n%R[t++]==0)return!1}return i.millerRabin(e)},u.prototype.square=function(){var e=d();return this.squareTo(e),e};
|
|
360
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
361
|
+
var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function D(e){var t,i,n="";for(t=0;t+3<=e.length;t+=3)i=parseInt(e.substring(t,t+3),16),n+=B.charAt(i>>6)+B.charAt(63&i);for(t+1==e.length?(i=parseInt(e.substring(t,t+1),16),n+=B.charAt(i<<2)):t+2==e.length&&(i=parseInt(e.substring(t,t+2),16),n+=B.charAt(i>>2)+B.charAt((3&i)<<4));(3&n.length)>0;)n+="=";return n}function O(e){var t,i,n,r="",o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t)(n=B.indexOf(e.charAt(t)))<0||(0==o?(r+=g(n>>2),i=3&n,o=1):1==o?(r+=g(i<<2|n>>4),i=15&n,o=2):2==o?(r+=g(i),r+=g(n>>2),i=3&n,o=3):(r+=g(i<<2|n>>4),r+=g(15&n),o=0));return 1==o&&(r+=g(i<<2)),r}
|
|
362
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function N(){this.i=0,this.j=0,this.S=new Array}N.prototype.init=function(e){var t,i,n;for(t=0;t<256;++t)this.S[t]=t;for(i=0,t=0;t<256;++t)i=i+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[i],this.S[i]=n;this.i=0,this.j=0},N.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var k,F,V;
|
|
363
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function z(){var e;e=(new Date).getTime(),F[V++]^=255&e,F[V++]^=e>>8&255,F[V++]^=e>>16&255,F[V++]^=e>>24&255,V>=256&&(V-=256)}if(null==F){var H;if(F=new Array,V=0,"undefined"!=typeof window&&(void 0!==window.crypto||void 0!==window.msCrypto)){var U=window.crypto||window.msCrypto;if(U.getRandomValues){var G=new Uint8Array(32);for(U.getRandomValues(G),H=0;H<32;++H)F[V++]=G[H]}else if("undefined"!=typeof navigator&&"Netscape"==navigator.appName&&navigator.appVersion<"5"){var j=window.crypto.random(32);for(H=0;H<j.length;++H)F[V++]=255&j.charCodeAt(H)}}for(;V<256;)H=Math.floor(65536*Math.random()),F[V++]=H>>>8,F[V++]=255&H;V=0,z()}function Q(){if(null==k){for(z(),(k=new N).init(F),V=0;V<F.length;++V)F[V]=0;V=0}return k.next()}function W(){}
|
|
364
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
365
|
+
function q(e,t){return new u(e,t)}function K(e,t,i){for(var n="",r=0;n.length<t;)n+=i(String.fromCharCode.apply(String,e.concat([(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r]))),r+=1;return n}function X(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function Y(e,t,i){for(var n="",r=0;n.length<t;)n+=i(e+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])),r+=1;return n}function Z(e){for(var t="",i=0;i<e.length;i++){var n=e[i].toString(16);1==n.length&&(n="0"+n),t+=n}return t}function J(e){return Z(function(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}(e))}function $(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function ee(e){return e.length%2==1&&(e="0"+e),function(e){return(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}(D(e))}function te(e){return O($(e))}function ie(e){return function(e){return e.replace(/%/g,"")}(function(e){for(var t=encodeURIComponent(e),i="",n=0;n<t.length;n++)"%"==t[n]?(i+=t.substr(n,3),n+=2):i=i+"%"+J(t[n]);return i}(e))}function ne(e){return decodeURIComponent(function(e){return e.replace(/(..)/g,"%$1")}(e))}function re(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function oe(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function ae(e){var t=function(e){return D(e)}(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function se(e,t){return"-----BEGIN "+t+"-----\r\n"+ae(e)+"\r\n-----END "+t+"-----\r\n"}function ce(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return function(e){return O(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function le(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?function(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),i=0;i<8;i++)t[i]=t[i].replace(/^0+/,""),""==t[i]&&(t[i]="0");var n=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===n)return e.slice(1,-1);var r="";for(i=0;i<n.length;i++)n[i].length>r.length&&(r=n[i]);return(e=e.replace(r,"::")).slice(1,-1)}(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function he(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),i=parseInt(e.substr(2),16);if(0==t&i<128)return String.fromCharCode(i);if(t<8){var n=128|63&i;return ne((192|(7&t)<<3|(192&i)>>6).toString(16)+n.toString(16))}n=128|(15&t)<<2|(192&i)>>6;var r=128|63&i;return ne((224|(240&t)>>4).toString(16)+n.toString(16)+r.toString(16))})).join("")}function ue(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function de(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}W.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=Q()},X.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},X.prototype.setPublic=function(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=q(e,16),this.e=parseInt(t,16)}},X.prototype.encrypt=function(e){var t=function(e,t){if(t<e.length+11)throw"Message too long for RSA";for(var i=new Array,n=e.length-1;n>=0&&t>0;){var r=e.charCodeAt(n--);r<128?i[--t]=r:r>127&&r<2048?(i[--t]=63&r|128,i[--t]=r>>6|192):(i[--t]=63&r|128,i[--t]=r>>6&63|128,i[--t]=r>>12|224)}i[--t]=0;for(var o=new W,a=new Array;t>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);i[--t]=a[0]}return i[--t]=2,i[--t]=0,new u(i)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var i=this.doPublic(t);if(null==i)return null;var n=i.toString(16);return 0==(1&n.length)?n:"0"+n},X.prototype.encryptOAEP=function(e,t,i){var n=function(e,t,i,n){var r=c.crypto.MessageDigest,o=c.crypto.Util,a=null;if(i||(i="sha1"),"string"==typeof i&&(a=r.getCanonicalAlgName(i),n=r.getHashLength(a),i=function(e){return re(o.hashHex(oe(e),a))}),e.length+2*n+2>t)throw"Message too long for RSA";var s,l="";for(s=0;s<t-e.length-2*n-2;s+=1)l+="\0";var h=i("")+l+""+e,d=new Array(n);(new W).nextBytes(d);var p=K(d,h.length,i),f=[];for(s=0;s<h.length;s+=1)f[s]=h.charCodeAt(s)^p.charCodeAt(s);var m=K(f,d.length,i),g=[0];for(s=0;s<d.length;s+=1)g[s+1]=d[s]^m.charCodeAt(s);return new u(g.concat(f))}(e,this.n.bitLength()+7>>3,t,i);if(null==n)return null;var r=this.doPublic(n);if(null==r)return null;var o=r.toString(16);return 0==(1&o.length)?o:"0"+o},X.prototype.type="RSA",X.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),i=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(i)<0;)t=t.add(this.p);return t.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},X.prototype.setPrivate=function(e,t,i){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=i;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=q(e,16),this.e=parseInt(t,16),this.d=q(i,16)}},X.prototype.setPrivateEx=function(e,t,i,n,r,o,a,s){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=q(e,16),this.e=parseInt(t,16),this.d=q(i,16),this.p=q(n,16),this.q=q(r,16),this.dmp1=q(o,16),this.dmq1=q(a,16),this.coeff=q(s,16)},X.prototype.generate=function(e,t){var i=new W,n=e>>1;this.e=parseInt(t,16);for(var r=new u(t,16);;){for(;this.p=new u(e-n,1,i),0!=this.p.subtract(u.ONE).gcd(r).compareTo(u.ONE)||!this.p.isProbablePrime(10););for(;this.q=new u(n,1,i),0!=this.q.subtract(u.ONE).gcd(r).compareTo(u.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var a=this.p.subtract(u.ONE),s=this.q.subtract(u.ONE),c=a.multiply(s);if(0==c.gcd(r).compareTo(u.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=r.modInverse(c),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(s),this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=!0},X.prototype.decrypt=function(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=q(e,16),i=this.doPrivate(t);return null==i?null:
|
|
366
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
367
|
+
function(e,t){for(var i=e.toByteArray(),n=0;n<i.length&&0==i[n];)++n;if(i.length-n!=t-1||2!=i[n])return null;for(++n;0!=i[n];)if(++n>=i.length)return null;for(var r="";++n<i.length;){var o=255&i[n];o<128?r+=String.fromCharCode(o):o>191&&o<224?(r+=String.fromCharCode((31&o)<<6|63&i[n+1]),++n):(r+=String.fromCharCode((15&o)<<12|(63&i[n+1])<<6|63&i[n+2]),n+=2)}return r}(i,this.n.bitLength()+7>>3)},X.prototype.decryptOAEP=function(e,t,i){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=q(e,16),r=this.doPrivate(n);return null==r?null:function(e,t,i,n){var r=c.crypto.MessageDigest,o=c.crypto.Util,a=null;for(i||(i="sha1"),"string"==typeof i&&(a=r.getCanonicalAlgName(i),n=r.getHashLength(a),i=function(e){return re(o.hashHex(oe(e),a))}),e=e.toByteArray(),s=0;s<e.length;s+=1)e[s]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*n+2)throw"Cipher too short";var s,l=e.substr(1,n),h=e.substr(n+1),u=Y(h,n,i),d=[];for(s=0;s<l.length;s+=1)d[s]=l.charCodeAt(s)^u.charCodeAt(s);var p=Y(String.fromCharCode.apply(String,d),e.length-n,i),f=[];for(s=0;s<h.length;s+=1)f[s]=h.charCodeAt(s)^p.charCodeAt(s);if((f=String.fromCharCode.apply(String,f)).substr(0,n)!==i(""))throw"Hash mismatch";var m=(f=f.substr(n)).indexOf("");if((-1!=m?f.substr(0,m).lastIndexOf("\0"):-1)+1!=m)throw"Malformed data";return f.substr(m+1)}(r,this.n.bitLength()+7>>3,t,i)},void 0!==c.lang&&c.lang||(c.lang={}),c.lang.String=function(){},c.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},c.lang.String.isHex=function(e){return ue(e)},c.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},c.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=$(e),c.lang.String.isBase64(e))},c.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},c.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},c.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},c.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var pe=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function fe(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==c.crypto&&c.crypto||(c.crypto={}),c.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:h.algo.MD5,sha1:h.algo.SHA1,sha224:h.algo.SHA224,sha256:h.algo.SHA256,sha384:h.algo.SHA384,sha512:h.algo.SHA512,ripemd160:h.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,i){var n=this.getDigestInfoHex(e,t),r=i/4;if(n.length+22>r)throw"key is too short for SigAlg: keylen="+i+","+t;for(var o="0001",a="00"+n,s="",c=r-o.length-a.length,l=0;l<c;l+=2)s+="ff";return o+s+a},this.hashString=function(e,t){return new c.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new c.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof X||e instanceof c.crypto.DSA||e instanceof c.crypto.ECDSA}},c.crypto.Util.md5=function(e){return new c.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},c.crypto.Util.ripemd160=function(e){return new c.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},c.crypto.Util.SECURERANDOMGEN=new W,c.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return c.crypto.Util.SECURERANDOMGEN.nextBytes(t),Z(t)},c.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new u(c.crypto.Util.getRandomHexOfNbytes(e),16)},c.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return c.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],Z(i)},c.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new u(c.crypto.Util.getRandomHexOfNbits(e),16)},c.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=c.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},c.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var i=e.compareTo(t);if(1==i)throw"biMin is greater than biMax";if(0==i)return e;var n=t.subtract(e);return c.crypto.Util.getRandomBigIntegerZeroToMax(n).add(e)},c.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=c.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=c.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=c.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=h.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(h.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=c.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},c.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},c.crypto.MessageDigest.getHashLength=function(e){var t=c.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},c.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},c.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=c.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var i=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==t){try{var n=c.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=h.algo.HMAC.create(n,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=h.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(h.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=oe(e)),void(this.pass=h.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=ie(e.utf8)),void 0!==e.rstr&&(t=oe(e.rstr)),void 0!==e.b64&&(t=O(e.b64)),void 0!==e.b64u&&(t=te(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=h.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=c.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},c.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var i="",n=t/4-e.length,r=0;r<n;r++)i+="0";return i+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new c.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var i=null;try{i=void 0===t?me.getKey(e):me.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===i.isPrivate)this.prvKey=i,this.state="SIGN";else{if(!0!==i.isPublic)throw"init failed.:"+i;this.pubKey=i,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==c.crypto.ECDSA&&(this.prvKey=new c.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof X&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof X&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof c.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof c.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==c.crypto.ECDSA&&(this.pubKey=new c.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof X&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof X&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==c.crypto.ECDSA&&this.pubKey instanceof c.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==c.crypto.DSA&&this.pubKey instanceof c.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=c.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=me.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},c.crypto.Cipher=function(e){},c.crypto.Cipher.encrypt=function(e,t,i){if(t instanceof X&&t.isPublic){var n=c.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===n)return t.encrypt(e);if("RSAOAEP"===n)return t.encryptOAEP(e,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return t.encryptOAEP(e,"sha"+r[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.encrypt: unsupported key or algorithm"},c.crypto.Cipher.decrypt=function(e,t,i){if(t instanceof X&&t.isPrivate){var n=c.crypto.Cipher.getAlgByKeyAndName(t,i);if("RSA"===n)return t.decrypt(e);if("RSAOAEP"===n)return t.decryptOAEP(e,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return t.decryptOAEP(e,"sha"+r[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.decrypt: unsupported key or algorithm"},c.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof X){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},c.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var me=function(){var e=function(e,i,n){return t(h.AES,e,i,n)},t=function(e,t,i,n){var r=h.enc.Hex.parse(t),o=h.enc.Hex.parse(i),a=h.enc.Hex.parse(n),s={};s.key=o,s.iv=a,s.ciphertext=r;var c=e.decrypt(s,o,{iv:a});return h.enc.Hex.stringify(c)},i=function(e,t,i){return n(h.AES,e,t,i)},n=function(e,t,i,n){var r=h.enc.Hex.parse(t),o=h.enc.Hex.parse(i),a=h.enc.Hex.parse(n),s=e.encrypt(r,o,{iv:a}),c=h.enc.Hex.parse(s.toString());return h.enc.Base64.stringify(c)},r={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,i,n){return t(h.TripleDES,e,i,n)},eproc:function(e,t,i){return n(h.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,i,n){return t(h.DES,e,i,n)},eproc:function(e,t,i){return n(h.DES,e,t,i)},keylen:8,ivlen:8}},o=function(e){var t={},i=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));i&&(t.cipher=i[1],t.ivsalt=i[2]);var n=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(t.type=n[1]);var r=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(r=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(r=e.indexOf("\n\n"),o=1);var a=e.indexOf("-----END");if(-1!=r&&-1!=a){var s=e.substring(r+2*o,a-o);s=s.replace(/\s+/g,""),t.data=s}return t},a=function(e,t,i){for(var n=i.substring(0,16),o=h.enc.Hex.parse(n),a=h.enc.Utf8.parse(t),s=r[e].keylen+r[e].ivlen,c="",l=null;;){var u=h.algo.MD5.create();if(null!=l&&u.update(l),u.update(a),u.update(o),l=u.finalize(),(c+=h.enc.Hex.stringify(l)).length>=2*s)break}var d={};return d.keyhex=c.substr(0,2*r[e].keylen),d.ivhex=c.substr(2*r[e].keylen,2*r[e].ivlen),d},s=function(e,t,i,n){var o=h.enc.Base64.parse(e),a=h.enc.Hex.stringify(o);return(0,r[t].proc)(a,i,n)};return{version:"1.0.0",parsePKCS5PEM:function(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return a(e,t,i)},decryptKeyB64:function(e,t,i,n){return s(e,t,i,n)},getDecryptedKeyHex:function(e,t){var i=o(e),n=i.cipher,r=i.ivsalt,c=i.data,l=a(n,t,r).keyhex;return s(c,n,l,r)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,n,o){var s="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===r[n])throw"KEYUTIL unsupported algorithm: "+n;void 0!==o&&null!=o||(o=function(e){var t=h.lib.WordArray.random(e);return h.enc.Hex.stringify(t)}(r[n].ivlen).toUpperCase());var c=function(e,t,i,n){return(0,r[t].eproc)(e,i,n)}(t,n,a(n,i,o).keyhex,o);s="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return s+="Proc-Type: 4,ENCRYPTED\r\n",s+="DEK-Info: "+n+","+o+"\r\n",s+="\r\n",s+=c.replace(/(.{64})/g,"$1\r\n"),s+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=ge,i=t.getChildIdx,n=t.getV,r={},o=i(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;r.ciphertext=n(e,o[1]);var a=i(e,o[0]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+a.length;if("2a864886f70d01050d"!=n(e,a[0]))throw"this only supports pkcs5PBES2";var s=i(e,a[1]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+s.length;var c=i(e,s[1]);if(2!=c.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length;if("2a864886f70d0307"!=n(e,c[0]))throw"this only supports TripleDES";r.encryptionSchemeAlg="TripleDES",r.encryptionSchemeIV=n(e,c[1]);var l=i(e,s[0]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length;if("2a864886f70d01050c"!=n(e,l[0]))throw"this only supports pkcs5PBKDF2";var h=i(e,l[1]);if(h.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length;r.pbkdf2Salt=n(e,h[0]);var u=n(e,h[1]);try{r.pbkdf2Iter=parseInt(u,16)}catch(e){throw"malformed format pbkdf2Iter: "+u}return r},getPBKDF2KeyHexFromParam:function(e,t){var i=h.enc.Hex.parse(e.pbkdf2Salt),n=e.pbkdf2Iter,r=h.PBKDF2(t,i,{keySize:6,iterations:n});return h.enc.Hex.stringify(r)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=ce(e,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(i),r=me.getPBKDF2KeyHexFromParam(n,t),o={};o.ciphertext=h.enc.Hex.parse(n.ciphertext);var a=h.enc.Hex.parse(r),s=h.enc.Hex.parse(n.encryptionSchemeIV),c=h.TripleDES.decrypt(o,a,{iv:s});return h.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function(e,t){var i=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(i)},parsePlainPrivatePKCS8Hex:function(e){var t=ge,i=t.getChildIdx,n=t.getV,r={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=i(e,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=i(e,o[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(r.algoid=n(e,a[0]),"06"==e.substr(a[1],2)&&(r.algparam=n(e,a[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return r.keyidx=t.getVidx(e,o[2]),r},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=ce(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new X;else if("2a8648ce380401"==i.algoid)t=new c.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw"unsupported private key algorithm";t=new c.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,i=ge.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===i)t=new X;else if("2a8648ce380401"===i)t=new c.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw"unsupported PKCS#8 public key hex";t=new c.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=ge,i=t.getChildIdx,n=t.getV,r={};if("30"!=e.substr(0,2))throw"malformed RSA key(code:001)";var o=i(e,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=e.substr(o[0],2))throw"malformed RSA key(code:003)";if(r.n=n(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return r.e=n(e,o[1]),r},parsePublicPKCS8Hex:function(e){var t=ge,i=t.getChildIdx,n=t.getV,r={algparam:null},o=i(e,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var a=o[0];if("30"!=e.substr(a,2))throw"malformed PKCS8 public key(code:001)";var s=i(e,a);if(2!=s.length)throw"malformed PKCS8 public key(code:002)";if("06"!=e.substr(s[0],2))throw"malformed PKCS8 public key(code:003)";if(r.algoid=n(e,s[0]),"06"==e.substr(s[1],2)?r.algparam=n(e,s[1]):"30"==e.substr(s[1],2)&&(r.algparam={},r.algparam.p=t.getVbyList(e,s[1],[0],"02"),r.algparam.q=t.getVbyList(e,s[1],[1],"02"),r.algparam.g=t.getVbyList(e,s[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return r.key=n(e,o[1]).substr(2),r}}}();me.getKey=function(e,t,i){var n=(y=ge).getChildIdx;y.getV;var r=y.getVbyList,o=c.crypto,a=o.ECDSA,s=o.DSA,l=X,h=ce,d=me;if(void 0!==l&&e instanceof l)return e;if(void 0!==a&&e instanceof a)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new a({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new a({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(I=new l).setPublic(e.n,e.e),I;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(I=new l).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),I;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(I=new l).setPrivate(e.n,e.e,e.d),I;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(I=new s).setPublic(e.p,e.q,e.g,e.y),I;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(I=new s).setPrivate(e.p,e.q,e.g,e.y,e.x),I;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(I=new l).setPublic(te(e.n),te(e.e)),I;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(I=new l).setPrivateEx(te(e.n),te(e.e),te(e.d),te(e.p),te(e.q),te(e.dp),te(e.dq),te(e.qi)),I;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(I=new l).setPrivate(te(e.n),te(e.e),te(e.d)),I;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var p=(C=new a({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+te(e.x)).slice(-p)+("0000000000"+te(e.y)).slice(-p);return C.setPublicKeyHex(f),C}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){p=(C=new a({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+te(e.x)).slice(-p)+("0000000000"+te(e.y)).slice(-p);var m=("0000000000"+te(e.d)).slice(-p);return C.setPublicKeyHex(f),C.setPrivateKeyHex(m),C}if("pkcs5prv"===i){var g,v=e,y=ge;if(9===(g=n(v,0)).length)(I=new l).readPKCS5PrvKeyHex(v);else if(6===g.length)(I=new s).readPKCS5PrvKeyHex(v);else{if(!(g.length>2&&"04"===v.substr(g[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(I=new a).readPKCS5PrvKeyHex(v)}return I}if("pkcs8prv"===i)return I=d.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return d._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return xe.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return xe.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var A=ce(e,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(A)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var x=h(e,"RSA PRIVATE KEY");return d.getKey(x,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=r(L=h(e,"DSA PRIVATE KEY"),0,[1],"02"),w=r(L,0,[2],"02"),M=r(L,0,[3],"02"),E=r(L,0,[4],"02"),S=r(L,0,[5],"02");return(I=new s).setPrivate(new u(b,16),new u(w,16),new u(M,16),new u(E,16),new u(S,16)),I}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){x=h(e,"EC PRIVATE KEY");return d.getKey(x,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return d.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var _=d.getDecryptedKeyHex(e,t),T=new X;return T.readPKCS5PrvKeyHex(_),T}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C,I=r(L=d.getDecryptedKeyHex(e,t),0,[1],"04"),P=r(L,0,[2,0],"06"),R=r(L,0,[3,0],"03").substr(2);if(void 0===c.crypto.OID.oidhex2name[P])throw"undefined OID(hex) in KJUR.crypto.OID: "+P;return(C=new a({curve:c.crypto.OID.oidhex2name[P]})).setPublicKeyHex(R),C.setPrivateKeyHex(I),C.isPublic=!1,C}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var L;b=r(L=d.getDecryptedKeyHex(e,t),0,[1],"02"),w=r(L,0,[2],"02"),M=r(L,0,[3],"02"),E=r(L,0,[4],"02"),S=r(L,0,[5],"02");return(I=new s).setPrivate(new u(b,16),new u(w,16),new u(M,16),new u(E,16),new u(S,16)),I}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return d.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},me.generateKeypair=function(e,t){if("RSA"==e){var i=t;(a=new X).generate(i,"10001"),a.isPrivate=!0,a.isPublic=!0;var n=new X,r=a.n.toString(16),o=a.e.toString(16);return n.setPublic(r,o),n.isPrivate=!1,n.isPublic=!0,(s={}).prvKeyObj=a,s.pubKeyObj=n,s}if("EC"==e){var a,s,l=t,h=new c.crypto.ECDSA({curve:l}).generateKeyPairHex();return(a=new c.crypto.ECDSA({curve:l})).setPublicKeyHex(h.ecpubhex),a.setPrivateKeyHex(h.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(n=new c.crypto.ECDSA({curve:l})).setPublicKeyHex(h.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(s={}).prvKeyObj=a,s.pubKeyObj=n,s}throw"unknown algorithm: "+e},me.getPEM=function(e,t,i,n,r,o){var a=c,s=a.asn1,l=s.DERObjectIdentifier,u=s.DERInteger,d=s.ASN1Util.newObject,p=s.x509.SubjectPublicKeyInfo,f=a.crypto,m=f.DSA,g=f.ECDSA,v=X;function y(e){return d({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function A(e){return d({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function x(e){return d({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==v&&e instanceof v||void 0!==m&&e instanceof m||void 0!==g&&e instanceof g)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return se(E=new p(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==v&&e instanceof v&&(void 0===i||null==i)&&1==e.isPrivate)return se(E=y(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==g&&e instanceof g&&(void 0===i||null==i)&&1==e.isPrivate){var b=new l({name:e.curveName}).getEncodedHex(),w=A(e).getEncodedHex(),M="";return M+=se(b,"EC PARAMETERS"),M+=se(w,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate)return se(E=x(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==v&&e instanceof v&&void 0!==i&&null!=i&&1==e.isPrivate){var E=y(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,i,n,o)}if("PKCS5PRV"==t&&void 0!==g&&e instanceof g&&void 0!==i&&null!=i&&1==e.isPrivate){E=A(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,i,n,o)}if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==i&&null!=i&&1==e.isPrivate){E=x(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,i,n,o)}var S=function(e,t){var i=_(e,t);return new d({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:i.pbkdf2Salt}},{int:i.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:i.encryptionSchemeIV}}]}]}]},{octstr:{hex:i.ciphertext}}]}).getEncodedHex()},_=function(e,t){var i=h.lib.WordArray.random(8),n=h.lib.WordArray.random(8),r=h.PBKDF2(t,i,{keySize:6,iterations:100}),o=h.enc.Hex.parse(e),a=h.TripleDES.encrypt(o,r,{iv:n})+"",s={};return s.ciphertext=a,s.pbkdf2Salt=h.enc.Hex.stringify(i),s.pbkdf2Iter=100,s.encryptionSchemeAlg="DES-EDE3-CBC",s.encryptionSchemeIV=h.enc.Hex.stringify(n),s};if("PKCS8PRV"==t&&null!=v&&e instanceof v&&1==e.isPrivate){var T=y(e).getEncodedHex();E=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:T}}]}).getEncodedHex();return void 0===i||null==i?se(E,"PRIVATE KEY"):se(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==g&&e instanceof g&&1==e.isPrivate){T=new d({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:T}}]}).getEncodedHex();return void 0===i||null==i?se(E,"PRIVATE KEY"):se(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==m&&e instanceof m&&1==e.isPrivate){T=new u({bigint:e.x}).getEncodedHex(),E=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:T}}]}).getEncodedHex();return void 0===i||null==i?se(E,"PRIVATE KEY"):se(w=S(E,i),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},me.getKeyFromCSRPEM=function(e){var t=ce(e,"CERTIFICATE REQUEST");return me.getKeyFromCSRHex(t)},me.getKeyFromCSRHex=function(e){var t=me.parseCSRHex(e);return me.getKey(t.p8pubkeyhex,null,"pkcs8pub")},me.parseCSRHex=function(e){var t=ge,i=t.getChildIdx,n=t.getTLV,r={},o=e;if("30"!=o.substr(0,2))throw"malformed CSR(code:001)";var a=i(o,0);if(a.length<1)throw"malformed CSR(code:002)";if("30"!=o.substr(a[0],2))throw"malformed CSR(code:003)";var s=i(o,a[0]);if(s.length<3)throw"malformed CSR(code:004)";return r.p8pubkeyhex=n(o,s[2]),r},me.getKeyID=function(e){var t=me,i=ge;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var n=ce(t.getPEM(e)),r=i.getIdxbyList(n,0,[1]),o=i.getV(n,r).substring(2);return c.crypto.Util.hashHex(o,"sha1")},me.getJWKFromKey=function(e){var t={};if(e instanceof X&&e.isPrivate)return t.kty="RSA",t.n=ee(e.n.toString(16)),t.e=ee(e.e.toString(16)),t.d=ee(e.d.toString(16)),t.p=ee(e.p.toString(16)),t.q=ee(e.q.toString(16)),t.dp=ee(e.dmp1.toString(16)),t.dq=ee(e.dmq1.toString(16)),t.qi=ee(e.coeff.toString(16)),t;if(e instanceof X&&e.isPublic)return t.kty="RSA",t.n=ee(e.n.toString(16)),t.e=ee(e.e.toString(16)),t;if(e instanceof c.crypto.ECDSA&&e.isPrivate){if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;var i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=ee(i.x),t.y=ee(i.y),t.d=ee(e.prvKeyHex),t}if(e instanceof c.crypto.ECDSA&&e.isPublic){var n;if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;i=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=ee(i.x),t.y=ee(i.y),t}throw"not supported key object"},void 0!==c.asn1&&c.asn1||(c.asn1={}),c.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var i=t.substr(1).length;i%2==1?i+=1:t.match(/^[0-7]/)||(i+=2);for(var n="",r=0;r<i;r++)n+="f";t=new u(n,16).xor(e).add(u.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return se(e,t)},this.newObject=function(e){var t=c.asn1,i=t.ASN1Object,n=t.DERBoolean,r=t.DERInteger,o=t.DERBitString,a=t.DEROctetString,s=t.DERNull,l=t.DERObjectIdentifier,h=t.DEREnumerated,u=t.DERUTF8String,d=t.DERNumericString,p=t.DERPrintableString,f=t.DERTeletexString,m=t.DERIA5String,g=t.DERUTCTime,v=t.DERGeneralizedTime,y=t.DERVisibleString,A=t.DERBMPString,x=t.DERSequence,b=t.DERSet,w=t.DERTaggedObject,M=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var E=Object.keys(e);if(1!=E.length)throw new Error("key of param shall be only one.");var S=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+S+":"))throw new Error("undefined key: "+S);if("bool"==S)return new n(e[S]);if("int"==S)return new r(e[S]);if("bitstr"==S)return new o(e[S]);if("octstr"==S)return new a(e[S]);if("null"==S)return new s(e[S]);if("oid"==S)return new l(e[S]);if("enum"==S)return new h(e[S]);if("utf8str"==S)return new u(e[S]);if("numstr"==S)return new d(e[S]);if("prnstr"==S)return new p(e[S]);if("telstr"==S)return new f(e[S]);if("ia5str"==S)return new m(e[S]);if("utctime"==S)return new g(e[S]);if("gentime"==S)return new v(e[S]);if("visstr"==S)return new y(e[S]);if("bmpstr"==S)return new A(e[S]);if("asn1"==S)return new i(e[S]);if("seq"==S){for(var _=e[S],T=[],C=0;C<_.length;C++){var I=M(_[C]);T.push(I)}return new x({array:T})}if("set"==S){for(_=e[S],T=[],C=0;C<_.length;C++){I=M(_[C]);T.push(I)}return new b({array:T})}if("tag"==S){var P=e[S];if("[object Array]"===Object.prototype.toString.call(P)&&3==P.length){var R=M(P[2]);return new w({tag:P[0],explicit:P[1],obj:R})}return new w(P)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},c.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),n=(t=Math.floor(i/40)+"."+i%40,""),r=2;r<e.length;r+=2){var o=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),"0"==o.substr(0,1))t=t+"."+new u(n,2).toString(10),n=""}return t},c.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",n=new u(e,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var o="",a=0;a<r;a++)o+="0";n=o+n;for(a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),i+=t(parseInt(s,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",r=e.split("."),o=40*parseInt(r[0])+parseInt(r[1]);n+=t(o),r.splice(0,2);for(var a=0;a<r.length;a++)n+=i(r[a]);return n},c.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var i=t.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+i).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},c.asn1.DERAbstractString=function(e){c.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=ie(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},l.lang.extend(c.asn1.DERAbstractString,c.asn1.ASN1Object),c.asn1.DERAbstractTime=function(e){c.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,i){var n=this.zeroPadding,r=this.localDateToUTC(e),o=String(r.getFullYear());"utc"==t&&(o=o.substr(2,2));var a=o+n(String(r.getMonth()+1),2)+n(String(r.getDate()),2)+n(String(r.getHours()),2)+n(String(r.getMinutes()),2)+n(String(r.getSeconds()),2);if(!0===i){var s=r.getMilliseconds();if(0!=s){var c=n(String(s),3);a=a+"."+(c=c.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=J(e)},this.setByDateValue=function(e,t,i,n,r,o){var a=new Date(Date.UTC(e,t-1,i,n,r,o,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},l.lang.extend(c.asn1.DERAbstractTime,c.asn1.ASN1Object),c.asn1.DERAbstractStructured=function(e){c.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},l.lang.extend(c.asn1.DERAbstractStructured,c.asn1.ASN1Object),c.asn1.DERBoolean=function(e){c.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},l.lang.extend(c.asn1.DERBoolean,c.asn1.ASN1Object),c.asn1.DERInteger=function(e){c.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new u(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},l.lang.extend(c.asn1.DERInteger,c.asn1.ASN1Object),c.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=c.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}c.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var i="0"+e;this.hTLV=null,this.isModified=!0,this.hV=i+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var i=0;i<=t;i++)e+="0";var n="";for(i=0;i<e.length-1;i+=8){var r=e.substr(i,8),o=parseInt(r,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+t+n},this.setByBooleanArray=function(e){for(var t="",i=0;i<e.length;i++)1==e[i]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},l.lang.extend(c.asn1.DERBitString,c.asn1.ASN1Object),c.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=c.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}c.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},l.lang.extend(c.asn1.DEROctetString,c.asn1.DERAbstractString),c.asn1.DERNull=function(){c.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},l.lang.extend(c.asn1.DERNull,c.asn1.ASN1Object),c.asn1.DERObjectIdentifier=function(e){c.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",n=parseInt(e,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var o="",a=0;a<r;a++)o+="0";for(n=o+n,a=0;a<n.length-1;a+=7){var s=n.substr(a,7);a!=n.length-7&&(s="1"+s),i+=t(parseInt(s,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var n="",r=e.split("."),o=40*parseInt(r[0],10)+parseInt(r[1],10);n+=t(o),r.splice(0,2);for(var a=0;a<r.length;a++)n+=i(r[a]);return n}catch(e){return null}}(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=c.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},l.lang.extend(c.asn1.DERObjectIdentifier,c.asn1.ASN1Object),c.asn1.DEREnumerated=function(e){c.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new u(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},l.lang.extend(c.asn1.DEREnumerated,c.asn1.ASN1Object),c.asn1.DERUTF8String=function(e){c.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},l.lang.extend(c.asn1.DERUTF8String,c.asn1.DERAbstractString),c.asn1.DERNumericString=function(e){c.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},l.lang.extend(c.asn1.DERNumericString,c.asn1.DERAbstractString),c.asn1.DERPrintableString=function(e){c.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},l.lang.extend(c.asn1.DERPrintableString,c.asn1.DERAbstractString),c.asn1.DERTeletexString=function(e){c.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},l.lang.extend(c.asn1.DERTeletexString,c.asn1.DERAbstractString),c.asn1.DERIA5String=function(e){c.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},l.lang.extend(c.asn1.DERIA5String,c.asn1.DERAbstractString),c.asn1.DERVisibleString=function(e){c.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},l.lang.extend(c.asn1.DERVisibleString,c.asn1.DERAbstractString),c.asn1.DERBMPString=function(e){c.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},l.lang.extend(c.asn1.DERBMPString,c.asn1.DERAbstractString),c.asn1.DERUTCTime=function(e){c.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=J(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=J(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},l.lang.extend(c.asn1.DERUTCTime,c.asn1.DERAbstractTime),c.asn1.DERGeneralizedTime=function(e){c.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=J(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=J(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},l.lang.extend(c.asn1.DERGeneralizedTime,c.asn1.DERAbstractTime),c.asn1.DERSequence=function(e){c.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},l.lang.extend(c.asn1.DERSequence,c.asn1.DERAbstractStructured),c.asn1.DERSet=function(e){c.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var i=this.asn1Array[t];e.push(i.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},l.lang.extend(c.asn1.DERSet,c.asn1.DERAbstractStructured),c.asn1.DERTaggedObject=function(e){c.asn1.DERTaggedObject.superclass.constructor.call(this);var t=c.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,i){this.hT=t,this.isExplicit=e,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},l.lang.extend(c.asn1.DERTaggedObject,c.asn1.ASN1Object);var ge=new function(){};function ve(e,t){for(var i="",n=t/4-e.length,r=0;r<n;r++)i+="0";return i+e}function ye(e,t,i){for(var n="",r=0;n.length<t;)n+=re(i(oe(e+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])))),r+=1;return n}function Ae(e){for(var t in c.crypto.Util.DIGESTINFOHEAD){var i=c.crypto.Util.DIGESTINFOHEAD[t],n=i.length;if(e.substring(0,n)==i)return[t,e.substring(n)]}return[]}function xe(e){var t,i=ge,n=i.getChildIdx,r=i.getV,o=i.getTLV,a=i.getVbyList,s=i.getVbyListEx,l=i.getTLVbyList,h=i.getTLVbyListEx,u=i.getIdxbyList,d=i.getIdxbyListEx,p=i.getVidx,f=i.getInt,m=i.oidname,g=i.hextooidstr,v=ce;try{t=c.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=l(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=l(e,0,[0]),i=f(t,0);if(i<0||2<i)throw new Error("malformed version field");return this.version=i+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return s(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var i in t)if(e===t[i])return i;return m(s(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=a(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=a(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return i.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return u(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return u(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return me.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),n=l(this.hex,0,[0],"30"),r=new c.crypto.Signature({alg:t});return r.init(e),r.updateHex(n),r.verify(i)},this.parseExt=function(e){var t,o,s;if(void 0===e){if(s=this.hex,3!==this.version)return-1;t=u(s,0,[0,7,0],"30"),o=n(s,t)}else{s=ce(e);var c=u(s,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=r(s,c))return void(this.aExtInfo=new Array);t=u(s,0,[0,3,0,1,0],"30"),o=n(s,t),this.hex=s}this.aExtInfo=new Array;for(var l=0;l<o.length;l++){var h={critical:!1},d=0;3===n(s,o[l]).length&&(h.critical=!0,d=1),h.oid=i.hextooidstr(a(s,o[l],[0],"06"));var f=u(s,o[l],[1+d]);h.vidx=p(s,f),this.aExtInfo.push(h)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=c.asn1.x509.OID.name2oid(e)),""!==i)for(var n=0;n<t.length;n++)if(t[n].oid===i)return t[n]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("basicConstraints");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"basicConstraints"};if(t&&(n.critical=!0),"3000"===e)return n;if("30030101ff"===e)return n.cA=!0,n;if("30060101ff02"===e.substr(0,12)){var a=r(e,10),s=parseInt(a,16);return n.cA=!0,n.pathLen=s,n}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("keyUsage");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"keyUsage"};return t&&(n.critical=!0),n.names=this.getExtKeyUsageString(e).split(","),n},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=o(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var i="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(i=i.slice(-8)),10==e.length&&(i=i.slice(-16)),""==(i=i.replace(/0+$/,""))&&(i="0"),i},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),i=new Array,n=0;n<t.length;n++)"1"==t.substr(n,1)&&i.push(xe.KEYUSAGE_NAME[n]);return i.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectKeyIdentifier");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"subjectKeyIdentifier"};t&&(n.critical=!0);var a=r(e,0);return n.kid={hex:a},n},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var a={extname:"authorityKeyIdentifier"};t&&(a.critical=!0);for(var s=n(e,0),c=0;c<s.length;c++){var l=e.substr(s[c],2);if("80"===l&&(a.kid={hex:r(e,s[c])}),"a1"===l){var h=o(e,s[c]),u=this.getGeneralNames(h);a.issuer=u[0].dn}"82"===l&&(a.sn={hex:r(e,s[c])})}return a},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var a={extname:"extKeyUsage",array:[]};t&&(a.critical=!0);for(var s=n(e,0),c=0;c<s.length;c++)a.array.push(m(r(e,s[c])));return a},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,i=o(this.hex,e.vidx);if(""===i)return t;for(var a=n(i,0),s=0;s<a.length;s++)t.push(m(r(i,a[s])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectAltName");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"subjectAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("issuerAltName");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var n={extname:"issuerAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getGeneralNames=function(e){for(var t=n(e,0),i=[],r=0;r<t.length;r++){var a=this.getGeneralName(o(e,t[r]));void 0!==a&&i.push(a)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=r(e,0),n=re(i);return"81"==t?{rfc822:n}:"82"==t?{dns:n}:"86"==t?{uri:n}:"87"==t?{ip:le(i)}:"a4"==t?{dn:this.getX500Name(i)}:void 0},this.getExtSubjectAltName2=function(){var e,t,i,a=this.getExtInfo("subjectAltName");if(void 0===a)return a;for(var s=new Array,c=o(this.hex,a.vidx),l=n(c,0),h=0;h<l.length;h++)i=c.substr(l[h],2),e=r(c,l[h]),"81"===i&&(t=ne(e),s.push(["MAIL",t])),"82"===i&&(t=ne(e),s.push(["DNS",t])),"84"===i&&(t=xe.hex2dn(e,0),s.push(["DN",t])),"86"===i&&(t=ne(e),s.push(["URI",t])),"87"===i&&(t=le(e),s.push(["IP",t]));return s},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("cRLDistributionPoints");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"cRLDistributionPoints",array:[]};t&&(r.critical=!0);for(var a=n(e,0),s=0;s<a.length;s++){var c=o(e,a[s]);r.array.push(this.getDistributionPoint(c))}return r},this.getDistributionPoint=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var a=e.substr(i[r],2),s=o(e,i[r]);"a0"==a&&(t.dpname=this.getDistributionPointName(s))}return t},this.getDistributionPointName=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var a=e.substr(i[r],2),s=o(e,i[r]);"a0"==a&&(t.full=this.getGeneralNames(s))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,i=n(this.hex,e.vidx),r=0;r<i.length;r++)try{var o=ne(a(this.hex,i[r],[0,0,0],"86"));t.push(o)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},i=n(this.hex,e.vidx),r=0;r<i.length;r++){var o=a(this.hex,i[r],[0],"06"),s=a(this.hex,i[r],[1],"86");"2b06010505073001"===o&&t.ocsp.push(ne(s)),"2b06010505073002"===o&&t.caissuer.push(ne(s))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityInfoAccess");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"authorityInfoAccess",array:[]};t&&(r.critical=!0);for(var c=n(e,0),l=0;l<c.length;l++){var h=s(e,c[l],[0],"06"),u=ne(a(e,c[l],[1],"86"));if("2b06010505073001"==h)r.array.push({ocsp:u});else{if("2b06010505073002"!=h)throw new Error("unknown method: "+h);r.array.push({caissuer:u})}}return r},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("certificatePolicies");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"certificatePolicies",array:[]};t&&(r.critical=!0);for(var a=n(e,0),s=0;s<a.length;s++){var c=o(e,a[s]),l=this.getPolicyInformation(c);r.array.push(l)}return r},this.getPolicyInformation=function(e){var t={},i=a(e,0,[0],"06");t.policyoid=m(i);var r=d(e,0,[1],"30");if(-1!=r){t.array=[];for(var s=n(e,r),c=0;c<s.length;c++){var l=o(e,s[c]),h=this.getPolicyQualifierInfo(l);t.array.push(h)}}return t},this.getPolicyQualifierInfo=function(e){var t={},i=a(e,0,[0],"06");if("2b06010505070201"===i){var n=s(e,0,[1],"16");t.cps=re(n)}else if("2b06010505070202"===i){var r=l(e,0,[1],"30");t.unotice=this.getUserNotice(r)}return t},this.getUserNotice=function(e){for(var t={},i=n(e,0),r=0;r<i.length;r++){var a=o(e,i[r]);"30"!=a.substr(0,2)&&(t.exptext=this.getDisplayText(a))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=re(r(e,0)),t},this.getExtCRLNumber=function(e,t){var i={extname:"cRLNumber"};if(t&&(i.critical=!0),"02"==e.substr(0,2))return i.num={hex:r(e,0)},i;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var i={extname:"cRLReason"};if(t&&(i.critical=!0),"0a"==e.substr(0,2))return i.code=parseInt(r(e,0),16),i;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var i={extname:"ocspNonce"};t&&(i.critical=!0);var n=r(e,0);return i.hex=n,i},this.getExtOcspNoCheck=function(e,t){var i={extname:"ocspNoCheck"};return t&&(i.critical=!0),i},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("adobeTimeStamp");if(void 0===i)return;e=o(this.hex,i.vidx),t=i.critical}var r={extname:"adobeTimeStamp"};t&&(r.critical=!0);var a=n(e,0);if(a.length>1){var s=o(e,a[1]),c=this.getGeneralName(s);null!=c.uri&&(r.uri=c.uri)}if(a.length>2){var l=o(e,a[2]);"0101ff"==l&&(r.reqauth=!0),"010100"==l&&(r.reqauth=!1)}return r},this.getX500NameRule=function(e){for(var t=null,i=[],n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.length;o++)i.push(r[o]);for(n=0;n<i.length;n++){var a=i[n],s=a.ds,l=a.value,h=a.type;if("prn"!=s&&"utf8"!=s&&"ia5"!=s)return"mixed";if("ia5"==s){if("CN"!=h)return"mixed";if(c.lang.String.isMail(l))continue;return"mixed"}if("C"==h){if("prn"==s)continue;return"mixed"}if(null==t)t=s;else if(t!==s)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],i=n(e,0),r=0;r<i.length;r++)t.push(this.getRDN(o(e,i[r])));return t},this.getRDN=function(e){for(var t=[],i=n(e,0),r=0;r<i.length;r++)t.push(this.getAttrTypeAndValue(o(e,i[r])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},i=n(e,0),r=a(e,i[0],[],"06"),o=a(e,i[1],[]),s=c.asn1.ASN1Util.oidHexToInt(r);return t.type=c.asn1.x509.OID.oid2atype(s),t.ds=this.HEX2STAG[e.substr(i[1],2)],"bmp"!=t.ds?t.value=ne(o):t.value=he(o),t},this.readCertPEM=function(e){this.readCertHex(v(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{u(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=se(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=d(this.hex,0,[0,"[3]"])&&(e=h(this.hex,0,[0,"[3]",0],"30")));for(var t=[],i=n(e,0),r=0;r<i.length;r++){var a=o(e,i[r]),s=this.getExtParam(a);null!=s&&t.push(s)}return t},this.getExtParam=function(e){var t=n(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var i=g(a(e,0,[0],"06")),r=!1;3==t&&"0101ff"==l(e,0,[1])&&(r=!0);var o=l(e,0,[t-1,0]),s=void 0;if("2.5.29.14"==i?s=this.getExtSubjectKeyIdentifier(o,r):"2.5.29.15"==i?s=this.getExtKeyUsage(o,r):"2.5.29.17"==i?s=this.getExtSubjectAltName(o,r):"2.5.29.18"==i?s=this.getExtIssuerAltName(o,r):"2.5.29.19"==i?s=this.getExtBasicConstraints(o,r):"2.5.29.31"==i?s=this.getExtCRLDistributionPoints(o,r):"2.5.29.32"==i?s=this.getExtCertificatePolicies(o,r):"2.5.29.35"==i?s=this.getExtAuthorityKeyIdentifier(o,r):"2.5.29.37"==i?s=this.getExtExtKeyUsage(o,r):"1.3.6.1.5.5.7.1.1"==i?s=this.getExtAuthorityInfoAccess(o,r):"2.5.29.20"==i?s=this.getExtCRLNumber(o,r):"2.5.29.21"==i?s=this.getExtCRLReason(o,r):"1.3.6.1.5.5.7.48.1.2"==i?s=this.getExtOcspNonce(o,r):"1.3.6.1.5.5.7.48.1.5"==i?s=this.getExtOcspNoCheck(o,r):"1.2.840.113583.1.1.9.1"==i&&(s=this.getExtAdobeTimeStamp(o,r)),null!=s)return s;var c={extname:i,extn:o};return r&&(c.critical=!0),c},this.findExt=function(e,t){for(var i=0;i<e.length;i++)if(e[i].extname==t)return e[i];return null},this.updateExtCDPFullURI=function(e,t){var i=this.findExt(e,"cRLDistributionPoints");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)if(null!=n[r].dpname&&null!=n[r].dpname.full)for(var o=n[r].dpname.full,a=0;a<o.length;a++){var s=o[r];null!=s.uri&&(s.uri=t)}},this.updateExtAIAOCSP=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)null!=n[r].ocsp&&(n[r].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var n=i.array,r=0;r<n.length;r++)null!=n[r].caissuer&&(n[r].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,i,n,r=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];if(t+=" policy oid: "+r.policyoid+"\n",void 0!==r.array)for(var o=0;o<r.array.length;o++){var a=r.array[o];void 0!==a.cps&&(t+=" cps: "+a.cps+"\n")}}return t},o=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];try{void 0!==r.dpname.full[0].uri&&(t+=" "+r.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==r.dname.full[0].dn.hex&&(t+=" "+xe.hex2dn(r.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},a=function(e){for(var t="",i=e.array,n=0;n<i.length;n++){var r=i[n];void 0!==r.caissuer&&(t+=" caissuer: "+r.caissuer+"\n"),void 0!==r.ocsp&&(t+=" ocsp: "+r.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+de(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+de(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var s=0;s<i.length;s++){var l=i[s],h=c.asn1.x509.OID.oid2name(l.oid);""===h&&(h=l.oid);var u="";if(!0===l.critical&&(u="CRITICAL"),e+=" "+h+" "+u+":\n","basicConstraints"===h){var d=this.getExtBasicConstraints();void 0===d.cA?e+=" {}\n":(e+=" cA=true",void 0!==d.pathLen&&(e+=", pathLen="+d.pathLen),e+="\n")}else if("keyUsage"===h)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===h)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===h){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(e+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"===h)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===h)e+=" "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===h)e+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===h)e+=a(this.getExtAuthorityInfoAccess());else"certificatePolicies"===h&&(e+=r(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):c.lang.String.isHex(e)&&this.readCertHex(e))}function be(e){return h.SHA256(e).toString()}ge.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var i=parseInt(e.substr(t+3,1));return 0==i?-1:0<i&&i<10?i+1:-2},ge.getL=function(e,t){var i=ge.getLblen(e,t);return i<1?"":e.substr(t+2,2*i)},ge.getVblen=function(e,t){var i;return""==(i=ge.getL(e,t))?-1:("8"===i.substr(0,1)?new u(i.substr(2),16):new u(i,16)).intValue()},ge.getVidx=function(e,t){var i=ge.getLblen(e,t);return i<0?i:t+2*(i+1)},ge.getV=function(e,t){var i=ge.getVidx(e,t),n=ge.getVblen(e,t);return e.substr(i,2*n)},ge.getTLV=function(e,t){return e.substr(t,2)+ge.getL(e,t)+ge.getV(e,t)},ge.getTLVblen=function(e,t){return 2+2*ge.getLblen(e,t)+2*ge.getVblen(e,t)},ge.getNextSiblingIdx=function(e,t){return ge.getVidx(e,t)+2*ge.getVblen(e,t)},ge.getChildIdx=function(e,t){var i,n,r,o=ge,a=[];i=o.getVidx(e,t),n=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,n-=2),r=0;for(var s=i;r<=n;){var c=o.getTLVblen(e,s);if((r+=c)<=n&&a.push(s),s+=c,r>=n)break}return a},ge.getNthChildIdx=function(e,t,i){return ge.getChildIdx(e,t)[i]},ge.getIdxbyList=function(e,t,i,n){var r,o,a=ge;return 0==i.length?void 0!==n&&e.substr(t,2)!==n?-1:t:(r=i.shift())>=(o=a.getChildIdx(e,t)).length?-1:a.getIdxbyList(e,o[r],i,n)},ge.getIdxbyListEx=function(e,t,i,n){var r,o,a=ge;if(0==i.length)return void 0!==n&&e.substr(t,2)!==n?-1:t;r=i.shift(),o=a.getChildIdx(e,t);for(var s=0,c=0;c<o.length;c++){var l=e.substr(o[c],2);if("number"==typeof r&&!a.isContextTag(l)&&s==r||"string"==typeof r&&a.isContextTag(l,r))return a.getIdxbyListEx(e,o[c],i,n);a.isContextTag(l)||s++}return-1},ge.getTLVbyList=function(e,t,i,n){var r=ge,o=r.getIdxbyList(e,t,i,n);return-1==o||o>=e.length?null:r.getTLV(e,o)},ge.getTLVbyListEx=function(e,t,i,n){var r=ge,o=r.getIdxbyListEx(e,t,i,n);return-1==o?null:r.getTLV(e,o)},ge.getVbyList=function(e,t,i,n,r){var o,a,s=ge;return-1==(o=s.getIdxbyList(e,t,i,n))||o>=e.length?null:(a=s.getV(e,o),!0===r&&(a=a.substr(2)),a)},ge.getVbyListEx=function(e,t,i,n,r){var o,a,s=ge;return-1==(o=s.getIdxbyListEx(e,t,i,n))?null:(a=s.getV(e,o),"03"==e.substr(o,2)&&!1!==r&&(a=a.substr(2)),a)},ge.getInt=function(e,t,i){null==i&&(i=-1);try{var n=e.substr(t,2);if("02"!=n&&"03"!=n)return i;var r=ge.getV(e,t);return"02"==n?parseInt(r,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16),n=e.substr(2),r=parseInt(n,16).toString(2);return"0"==r&&(r="00000000"),r=r.slice(0,0-i),parseInt(r,2)}catch(e){return-1}}(r)}catch(e){return i}},ge.getOID=function(e,t,i){null==i&&(i=null);try{return"06"!=e.substr(t,2)?i:function(e){if(!ue(e))return null;try{var t=[],i=e.substr(0,2),n=parseInt(i,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var r=e.substr(2),o=[],a=0;a<r.length/2;a++)o.push(parseInt(r.substr(2*a,2),16));var s=[],c="";for(a=0;a<o.length;a++)128&o[a]?c+=pe((127&o[a]).toString(2),7):(c+=pe((127&o[a]).toString(2),7),s.push(new String(parseInt(c,2))),c="");var l=t.join(".");return s.length>0&&(l=l+"."+s.join(".")),l}catch(e){return null}}(ge.getV(e,t))}catch(e){return i}},ge.getOIDName=function(e,t,i){null==i&&(i=null);try{var n=ge.getOID(e,t,i);if(n==i)return i;var r=c.asn1.x509.OID.oid2name(n);return""==r?n:r}catch(e){return i}},ge.getString=function(e,t,i){null==i&&(i=null);try{return re(ge.getV(e,t))}catch(e){return i}},ge.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},i=[],n=e.substr(0,2),r=parseInt(n,16);i[0]=new String(Math.floor(r/40)),i[1]=new String(r%40);for(var o=e.substr(2),a=[],s=0;s<o.length/2;s++)a.push(parseInt(o.substr(2*s,2),16));var c=[],l="";for(s=0;s<a.length;s++)128&a[s]?l+=t((127&a[s]).toString(2),7):(l+=t((127&a[s]).toString(2),7),c.push(new String(parseInt(l,2))),l="");var h=i.join(".");return c.length>0&&(h=h+"."+c.join(".")),h},ge.dump=function(e,t,i,n){var r=ge,o=r.getV,a=r.dump,s=r.getChildIdx,l=e;e instanceof c.asn1.ASN1Object&&(l=e.getEncodedHex());var h=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===i&&(i=0),void 0===n&&(n="");var u,d=t.ommit_long_octet;if("01"==(u=l.substr(i,2)))return"00"==(p=o(l,i))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==u)return n+"INTEGER "+h(p=o(l,i),d)+"\n";if("03"==u){var p=o(l,i);if(r.isASN1HEX(p.substr(2))){var f=n+"BITSTRING, encapsulates\n";return f+=a(p.substr(2),t,0,n+" ")}return n+"BITSTRING "+h(p,d)+"\n"}if("04"==u){p=o(l,i);if(r.isASN1HEX(p)){f=n+"OCTETSTRING, encapsulates\n";return f+=a(p,t,0,n+" ")}return n+"OCTETSTRING "+h(p,d)+"\n"}if("05"==u)return n+"NULL\n";if("06"==u){var m=o(l,i),g=c.asn1.ASN1Util.oidHexToInt(m),v=c.asn1.x509.OID.oid2name(g),y=g.replace(/\./g," ");return""!=v?n+"ObjectIdentifier "+v+" ("+y+")\n":n+"ObjectIdentifier ("+y+")\n"}if("0a"==u)return n+"ENUMERATED "+parseInt(o(l,i))+"\n";if("0c"==u)return n+"UTF8String '"+ne(o(l,i))+"'\n";if("13"==u)return n+"PrintableString '"+ne(o(l,i))+"'\n";if("14"==u)return n+"TeletexString '"+ne(o(l,i))+"'\n";if("16"==u)return n+"IA5String '"+ne(o(l,i))+"'\n";if("17"==u)return n+"UTCTime "+ne(o(l,i))+"\n";if("18"==u)return n+"GeneralizedTime "+ne(o(l,i))+"\n";if("1a"==u)return n+"VisualString '"+ne(o(l,i))+"'\n";if("1e"==u)return n+"BMPString '"+he(o(l,i))+"'\n";if("30"==u){if("3000"==l.substr(i,4))return n+"SEQUENCE {}\n";f=n+"SEQUENCE\n";var A=t;if((2==(w=s(l,i)).length||3==w.length)&&"06"==l.substr(w[0],2)&&"04"==l.substr(w[w.length-1],2)){v=r.oidname(o(l,w[0]));var x=JSON.parse(JSON.stringify(t));x.x509ExtName=v,A=x}for(var b=0;b<w.length;b++)f+=a(l,A,w[b],n+" ");return f}if("31"==u){f=n+"SET\n";var w=s(l,i);for(b=0;b<w.length;b++)f+=a(l,t,w[b],n+" ");return f}if(0!=(128&(u=parseInt(u,16)))){var M=31&u;if(0!=(32&u)){for(f=n+"["+M+"]\n",w=s(l,i),b=0;b<w.length;b++)f+=a(l,t,w[b],n+" ");return f}p=o(l,i);if(ge.isASN1HEX(p)){var f=n+"["+M+"]\n";return f+=a(p,t,0,n+" ")}return("68747470"==p.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==M)&&(p=ne(p)),f=n+"["+M+"] "+p+"\n"}return n+"UNKNOWN("+u+") "+o(l,i)+"\n"},ge.isContextTag=function(e,t){var i,n;e=e.toLowerCase();try{i=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&i);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&i)&&(31&i)==n))}catch(e){return!1}},ge.isASN1HEX=function(e){var t=ge;if(e.length%2==1)return!1;var i=t.getVblen(e,0),n=e.substr(0,2),r=t.getL(e,0);return e.length-n.length-r.length==2*i},ge.checkStrictDER=function(e,t,i,n,r){var o=ge;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!c.lang.String.isHex(e))throw new Error("not hex string");i=e.length,r=(n=e.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(e,t).length>2*r)throw new Error("L of TLV too long: idx="+t);var a=o.getVblen(e,t);if(a>n)throw new Error("value of L too long than hex: idx="+t);var s=o.getTLV(e,t),l=s.length-2-o.getL(e,t).length;if(l!==2*a)throw new Error("V string length and L's value not the same:"+l+"/"+2*a);if(0===t&&e.length!=s.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+s.length);var h=e.substr(t,2);if("02"===h){var u=o.getVidx(e,t);if("00"==e.substr(u,2)&&e.charCodeAt(u+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(h,16)){for(var d=o.getVblen(e,t),p=0,f=o.getChildIdx(e,t),m=0;m<f.length;m++){p+=o.getTLV(e,f[m]).length,o.checkStrictDER(e,f[m],i,n,r)}if(2*d!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*d+"!="+p)}},ge.oidname=function(e){var t=c.asn1;c.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==c.asn1&&c.asn1||(c.asn1={}),void 0!==c.asn1.x509&&c.asn1.x509||(c.asn1.x509={}),c.asn1.x509.Certificate=function(e){c.asn1.x509.Certificate.superclass.constructor.call(this);var t=c.asn1,i=t.DERBitString,n=t.DERSequence,r=t.x509,o=r.TBSCertificate,a=r.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var i=e.tbsobj.getEncodedHex(),n=new c.crypto.Signature({alg:t});n.init(e.cakey),n.updateHex(i),e.sighex=n.sign()},this.getPEM=function(){return se(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new o(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new i({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},fe(c.asn1.x509.Certificate,c.asn1.ASN1Object),c.asn1.x509.TBSCertificate=function(e){c.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=c.asn1,i=t.x509,n=t.DERTaggedObject,r=t.DERInteger,o=t.DERSequence,a=i.AlgorithmIdentifier,s=i.Time,l=i.X500Name,h=i.Extensions,u=i.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var i=2;null!=t.version&&(i=t.version-1);var d=new n({obj:new r({int:i})});e.push(d)}return e.push(new r(t.serial)),e.push(new a({name:t.sigalg})),e.push(new l(t.issuer)),e.push(new o({array:[new s(t.notbefore),new s(t.notafter)]})),e.push(new l(t.subject)),e.push(new u(me.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new n({tag:"a3",obj:new h(t.ext)})),new c.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.TBSCertificate,c.asn1.ASN1Object),c.asn1.x509.Extensions=function(e){c.asn1.x509.Extensions.superclass.constructor.call(this);var t=c.asn1,i=t.DERSequence,n=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var r=this.aParam[t],o=r.extname,a=null;if(null!=r.extn)a=new n.PrivateExtension(r);else if("subjectKeyIdentifier"==o)a=new n.SubjectKeyIdentifier(r);else if("keyUsage"==o)a=new n.KeyUsage(r);else if("subjectAltName"==o)a=new n.SubjectAltName(r);else if("issuerAltName"==o)a=new n.IssuerAltName(r);else if("basicConstraints"==o)a=new n.BasicConstraints(r);else if("cRLDistributionPoints"==o)a=new n.CRLDistributionPoints(r);else if("certificatePolicies"==o)a=new n.CertificatePolicies(r);else if("authorityKeyIdentifier"==o)a=new n.AuthorityKeyIdentifier(r);else if("extKeyUsage"==o)a=new n.ExtKeyUsage(r);else if("authorityInfoAccess"==o)a=new n.AuthorityInfoAccess(r);else if("cRLNumber"==o)a=new n.CRLNumber(r);else if("cRLReason"==o)a=new n.CRLReason(r);else if("ocspNonce"==o)a=new n.OCSPNonce(r);else if("ocspNoCheck"==o)a=new n.OCSPNoCheck(r);else if("adobeTimeStamp"==o)a=new n.AdobeTimeStamp(r);else{if("subjectDirectoryAttributes"!=o)throw new Error("extension not supported:"+JSON.stringify(r));a=new n.SubjectDirectoryAttributes(r)}null!=a&&e.push(a)}return new i({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},fe(c.asn1.x509.Extensions,c.asn1.ASN1Object),c.asn1.x509.Extension=function(e){c.asn1.x509.Extension.superclass.constructor.call(this);var t=c.asn1,i=t.DERObjectIdentifier,n=t.DEROctetString;t.DERBitString;var r=t.DERBoolean,o=t.DERSequence;this.getEncodedHex=function(){var e=new i({oid:this.oid}),t=new n({hex:this.getExtnValueHex()}),a=new Array;return a.push(e),this.critical&&a.push(new r),a.push(t),new o({array:a}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},fe(c.asn1.x509.Extension,c.asn1.ASN1Object),c.asn1.x509.KeyUsage=function(e){c.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=xe.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new c.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var i=e.names,n="000000000",r=0;r<i.length;r++)for(var o=0;o<t.length;o++)i[r]===t[o]&&(n=n.substring(0,o)+"1"+n.substring(o+1,n.length));this.asn1ExtnValue=new c.asn1.DERBitString({bin:n})}},fe(c.asn1.x509.KeyUsage,c.asn1.x509.Extension),c.asn1.x509.BasicConstraints=function(e){c.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=c.asn1,i=t.DERBoolean,n=t.DERInteger,r=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new n({int:this.pathLen}));var t=new r({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},fe(c.asn1.x509.BasicConstraints,c.asn1.x509.Extension),c.asn1.x509.CRLDistributionPoints=function(e){c.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=c.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var n=[],r=0;r<e.length;r++)if(e[r]instanceof c.asn1.ASN1Object)n.push(e[r]);else{var o=new i.DistributionPoint(e[r]);n.push(o)}this.asn1ExtnValue=new t.DERSequence({array:n})},this.setByOneURI=function(e){var t=new i.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},fe(c.asn1.x509.CRLDistributionPoints,c.asn1.x509.Extension),c.asn1.x509.DistributionPoint=function(e){c.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=c.asn1,i=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var i=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(i)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new i(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))},fe(c.asn1.x509.DistributionPoint,c.asn1.ASN1Object),c.asn1.x509.DistributionPointName=function(e){c.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=c.asn1,i=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new i({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},fe(c.asn1.x509.DistributionPointName,c.asn1.ASN1Object),c.asn1.x509.CertificatePolicies=function(e){c.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=c.asn1,i=t.x509,n=t.DERSequence,r=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new r(this.params.array[t]));var i=new n({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},fe(c.asn1.x509.CertificatePolicies,c.asn1.x509.Extension),c.asn1.x509.PolicyInformation=function(e){c.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=c.asn1,i=t.DERSequence,n=t.DERObjectIdentifier,r=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],o=0;o<this.params.array.length;o++)t.push(new r(this.params.array[o]));t.length>0&&e.push(new i({array:t}))}return new i({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},fe(c.asn1.x509.PolicyInformation,c.asn1.ASN1Object),c.asn1.x509.PolicyQualifierInfo=function(e){c.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=c.asn1,i=t.DERSequence,n=t.DERIA5String,r=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new i({array:[new r({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new i({array:[new r({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},fe(c.asn1.x509.PolicyQualifierInfo,c.asn1.ASN1Object),c.asn1.x509.UserNotice=function(e){c.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=c.asn1.DERSequence;c.asn1.DERInteger;var i=c.asn1.x509.DisplayText,n=c.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new i(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},fe(c.asn1.x509.UserNotice,c.asn1.ASN1Object),c.asn1.x509.NoticeReference=function(e){c.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=c.asn1.DERSequence,i=c.asn1.DERInteger,n=c.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var r=[],o=this.params.noticenum,a=0;a<o.length;a++)r.push(new i(o[a]));e.push(new t({array:r}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},fe(c.asn1.x509.NoticeReference,c.asn1.ASN1Object),c.asn1.x509.DisplayText=function(e){c.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},fe(c.asn1.x509.DisplayText,c.asn1.DERAbstractString),c.asn1.x509.ExtKeyUsage=function(e){c.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=c.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var n=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},fe(c.asn1.x509.ExtKeyUsage,c.asn1.x509.Extension),c.asn1.x509.AuthorityKeyIdentifier=function(e){c.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=c,i=t.asn1,n=i.DERTaggedObject,r=i.x509.GeneralNames;t.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new n({explicit:!1,tag:"a1",obj:new r([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new i.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new c.asn1.DEROctetString(e);else if("object"==typeof e&&c.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=me.getKey(e));var i=me.getKeyID(t);this.asn1KID=new c.asn1.DEROctetString({hex:i})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new c.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new c.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new c.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new xe;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new c.asn1.DERInteger({hex:i})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},fe(c.asn1.x509.AuthorityKeyIdentifier,c.asn1.x509.Extension),c.asn1.x509.SubjectKeyIdentifier=function(e){c.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=c.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&c.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=me.getKey(e));var n=me.getKeyID(i);this.asn1KID=new c.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},fe(c.asn1.x509.SubjectKeyIdentifier,c.asn1.x509.Extension),c.asn1.x509.AuthorityInfoAccess=function(e){c.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=c.asn1,n=i.DERSequence,r=i.DERObjectIdentifier,o=i.x509.GeneralName,a=0;a<e.length;a++){var s,l=e[a];if(void 0!==l.ocsp)s=new n({array:[new r({oid:"1.3.6.1.5.5.7.48.1"}),new o({uri:l.ocsp})]});else{if(void 0===l.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(l));s=new n({array:[new r({oid:"1.3.6.1.5.5.7.48.2"}),new o({uri:l.caissuer})]})}t.push(s)}this.asn1ExtnValue=new n({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},fe(c.asn1.x509.AuthorityInfoAccess,c.asn1.x509.Extension),c.asn1.x509.SubjectAltName=function(e){c.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new c.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},fe(c.asn1.x509.SubjectAltName,c.asn1.x509.Extension),c.asn1.x509.IssuerAltName=function(e){c.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new c.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},fe(c.asn1.x509.IssuerAltName,c.asn1.x509.Extension),c.asn1.x509.SubjectDirectoryAttributes=function(e){c.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=c.asn1,i=t.DERSequence,n=t.ASN1Util.newObject,r=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var o=this.params.array[t],a={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==o.attr)a.seq[0].oid=r(o.attr),a.seq[1].set[0]={gentime:o.str};else if("placeOfBirth"==o.attr)a.seq[0].oid=r(o.attr),a.seq[1].set[0]={utf8str:o.str};else if("gender"==o.attr)a.seq[0].oid=r(o.attr),a.seq[1].set[0]={prnstr:o.str};else if("countryOfCitizenship"==o.attr)a.seq[0].oid=r(o.attr),a.seq[1].set[0]={prnstr:o.str};else{if("countryOfResidence"!=o.attr)throw new Error("unsupported attribute: "+o.attr);a.seq[0].oid=r(o.attr),a.seq[1].set[0]={prnstr:o.str}}e.push(new n(a))}var s=new i({array:e});return this.asn1ExtnValue=s,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},fe(c.asn1.x509.SubjectDirectoryAttributes,c.asn1.x509.Extension),c.asn1.x509.PrivateExtension=function(e){c.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=c,i=t.lang.String.isHex,n=t.asn1,r=n.x509.OID.name2oid,o=n.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=r(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&i(e))return e;if("object"==typeof e)try{return o(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},fe(c.asn1.x509.PrivateExtension,c.asn1.x509.Extension),c.asn1.x509.CRL=function(e){c.asn1.x509.CRL.superclass.constructor.call(this);var t=c.asn1,i=t.DERSequence,n=t.DERBitString,r=t.x509,o=r.AlgorithmIdentifier,a=r.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).getEncodedHex(),t=new c.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return se(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new o({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new i({array:t}).getEncodedHex()},null!=e&&(this.params=e)},fe(c.asn1.x509.CRL,c.asn1.ASN1Object),c.asn1.x509.TBSCertList=function(e){c.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=c.asn1,i=t.DERInteger,n=t.DERSequence,r=t.DERTaggedObject;t.DERObjectIdentifier;var o=t.x509,a=o.AlgorithmIdentifier,s=o.Time,l=o.Extensions,h=o.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,r=0;r<t.length;r++){var o=[new i(t[r].sn),new s(t[r].date)];null!=t[r].ext&&o.push(new l(t[r].ext)),e.push(new n({array:o}))}return new n({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var o=t.version-1,c=new i({int:o});e.push(c)}if(e.push(new a({name:t.sigalg})),e.push(new h(t.issuer)),e.push(new s(t.thisupdate)),null!=t.nextupdate&&e.push(new s(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var u=new l(t.ext);e.push(new r({tag:"a0",explicit:!0,obj:u}))}return new n({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.TBSCertList,c.asn1.ASN1Object),c.asn1.x509.CRLEntry=function(e){c.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=c.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},fe(c.asn1.x509.CRLEntry,c.asn1.ASN1Object),c.asn1.x509.CRLNumber=function(e){c.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new c.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},fe(c.asn1.x509.CRLNumber,c.asn1.x509.Extension),c.asn1.x509.CRLReason=function(e){c.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new c.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},fe(c.asn1.x509.CRLReason,c.asn1.x509.Extension),c.asn1.x509.OCSPNonce=function(e){c.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new c.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},fe(c.asn1.x509.OCSPNonce,c.asn1.x509.Extension),c.asn1.x509.OCSPNoCheck=function(e){c.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new c.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},fe(c.asn1.x509.OCSPNoCheck,c.asn1.x509.Extension),c.asn1.x509.AdobeTimeStamp=function(e){c.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=c.asn1,i=t.DERInteger,n=t.DERBoolean,r=t.DERSequence,o=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new i(1)];return t.push(new o({uri:e.uri})),null!=e.reqauth&&t.push(new n(e.reqauth)),this.asn1ExtnValue=new r({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.AdobeTimeStamp,c.asn1.x509.Extension),c.asn1.x509.X500Name=function(e){c.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=c.asn1,i=t.x509,n=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var r=[],o=0;o<i.length;o++)if(i[o].match(/^[^=]+=.+$/))r.push(i[o]);else{var a=r.length-1;r[a]=r[a]+"/"+i[o]}for(o=0;o<r.length;o++)this.asn1Array.push(new n({str:r[o],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var n=i.X500Name.ldapToCompat(e);this.setByString(n,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var r=new n({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(r):this.asn1Array=[r]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new xe).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new xe).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i={array:this.paramArray[e]};"utf8"!=this.sRule&&(i.rule=this.sRule);var r=new n(i);this.asn1Array.push(r)}var o=new t.DERSequence({array:this.asn1Array});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.X500Name,c.asn1.ASN1Object),c.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},c.asn1.x509.X500Name.onelineToLDAP=function(e){return c.asn1.x509.X500Name.compatToLDAP(e)},c.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,n=[],r=0;t.length>0;r++){var o=t.shift();if(!0===i){var a=(n.pop()+","+o).replace(/\\,/g,",");n.push(a),i=!1}else n.push(o);"\\"===o.substr(-1,1)&&(i=!0)}return(n=n.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+n.join("/")},c.asn1.x509.X500Name.ldapToOneline=function(e){return c.asn1.x509.X500Name.ldapToCompat(e)},c.asn1.x509.RDN=function(e){c.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=c.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new c.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=c.asn1.x509.RDN.parseString(e),i=0;i<t.length;i++)this.addByString(t[i])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i=this.paramArray[e];void 0!==i.rule&&"utf8"!=this.sRule&&(i.rule=this.sRule);var n=new t(i);this.asn1Array.push(n)}var r=new c.asn1.DERSet({array:this.asn1Array});return this.TLV=r.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.RDN,c.asn1.ASN1Object),c.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,n=[],r=0;t.length>0;r++){var o=t.shift();if(!0===i){var a=(n.pop()+"+"+o).replace(/\\\+/g,"+");n.push(a),i=!1}else n.push(o);"\\"===o.substr(-1,1)&&(i=!0)}var s=!1,c=[];for(r=0;n.length>0;r++){o=n.shift();if(!0===s){var l=c.pop();if(o.match(/"$/)){a=(l+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2");c.push(a),s=!1}else c.push(l+"+"+o)}else c.push(o);o.match(/^[^=]+="/)&&(s=!0)}return c},c.asn1.x509.AttributeTypeAndValue=function(e){c.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=c,i=t.asn1,n=i.DERSequence,r=i.DERUTF8String,o=i.DERPrintableString,a=i.DERTeletexString,s=i.DERIA5String,l=i.DERVisibleString,h=i.DERBMPString,u=t.lang.String.isMail,d=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.match(/^([^=]+)=(.+)$/);if(!i)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(i[1],i[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,i=this.sRule;return"prn"===i?"CN"==e&&u(t)?"ia5":d(t)?"prn":"utf8":"utf8"===i?"CN"==e&&u(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,i){void 0!==i&&(this.sRule=i),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new r({str:t});if("prn"==e)return new o({str:t});if("tel"==e)return new a({str:t});if("ia5"==e)return new s({str:t});if("vis"==e)return new l({str:t});if("bmp"==e)return new h({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=c.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new n({array:[e,t]});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.AttributeTypeAndValue,c.asn1.ASN1Object),c.asn1.x509.SubjectPublicKeyInfo=function(e){c.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=c,i=t.asn1,n=i.DERInteger,r=i.DERBitString,o=i.DERObjectIdentifier,a=i.DERSequence,s=i.ASN1Util.newObject,l=i.x509.AlgorithmIdentifier,h=t.crypto;h.ECDSA,h.DSA,this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new a({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof X){var t=s({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new l({name:"rsaEncryption"}),this.asn1SubjPKey=new r({hex:"00"+t})}}catch(e){}try{if(e instanceof c.crypto.ECDSA){var i=new o({name:e.curveName});this.asn1AlgId=new l({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new r({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof c.crypto.DSA){i=new s({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new l({name:"dsa",asn1params:i});var a=new n({bigint:e.y});this.asn1SubjPKey=new r({hex:"00"+a.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},fe(c.asn1.x509.SubjectPublicKeyInfo,c.asn1.ASN1Object),c.asn1.x509.Time=function(e){c.asn1.x509.Time.superclass.constructor.call(this);var t=c.asn1,i=t.DERUTCTime,n=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new i(this.timeParams):new n(this.timeParams):"utc"==this.type?new i:new n,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},fe(c.asn1.x509.Time,c.asn1.ASN1Object),c.asn1.x509.AlgorithmIdentifier=function(e){c.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=c.asn1,i=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var n in i)n===this.nameAlg&&(e=i[n]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var r=[this.asn1Alg];null!==this.asn1Params&&r.push(this.asn1Params);var o=new t.DERSequence({array:r});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},fe(c.asn1.x509.AlgorithmIdentifier,c.asn1.ASN1Object),c.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},c.asn1.x509.GeneralName=function(e){c.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},i=c.asn1;i.DERSequence;var n=i.DEROctetString,r=i.DERIA5String,o=i.DERTaggedObject,a=i.ASN1Object,s=i.x509.X500Name,l=ce;this.explicit=!1,this.setByParam=function(e){var i=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",i=new r({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",i=new r({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",i=new r({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,i="string"==typeof e.dn?new s({str:e.dn}):e.dn instanceof c.asn1.x509.X500Name?e.dn:new s(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,i=new s({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var h=null;if((d=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(h=l(d)),null==h)throw"certissuer param not cert";(p=new xe).hex=h;var u=p.getIssuerHex();(i=new a).hTLV=u}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var d,p;h=null;if((d=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(h=l(d)),null==h)throw"certsubj param not cert";(p=new xe).hex=h;u=p.getSubjectHex();(i=new a).hTLV=u}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var f,m=e.ip,g="malformed IP address";if(m.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(f=function(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,i){var n=parseInt(e);if(n<0||255<n)throw"integer not in range 0-255";return("00"+n.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}("["+m.split(".").join(",")+"]")).length)throw g}else if(m.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))f=function(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var i=(e=e.toLowerCase()).split(":").length-1;if(i<2)throw t;var n=":".repeat(7-i+2),r=(e=e.replace("::",n)).split(":");if(8!=r.length)throw t;for(var o=0;o<8;o++)r[o]=("0000"+r[o]).slice(-4);return r.join("")}(m);else{if(!m.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;f=m}i=new n({hex:f})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new o({explicit:this.explicit,tag:t[this.type],obj:i})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},fe(c.asn1.x509.GeneralName,c.asn1.ASN1Object),c.asn1.x509.GeneralNames=function(e){c.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=c.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var n=new t.x509.GeneralName(e[i]);this.asn1Array.push(n)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},fe(c.asn1.x509.GeneralNames,c.asn1.ASN1Object),c.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],i=new c.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var i=new c.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=i,i}},c.asn1.x509.OID.oid2name=function(e){var t=c.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},c.asn1.x509.OID.oid2atype=function(e){var t=c.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},c.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=c.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},c.asn1.x509.X509Util={},c.asn1.x509.X509Util.newCertPEM=function(e){var t=c.asn1.x509;return t.TBSCertificate,new(0,t.Certificate)(e).getPEM()},X.getPosArrayOfChildrenFromHex=function(e){return ge.getChildIdx(e,0)},X.getHexValueArrayOfChildrenFromHex=function(e){var t,i=ge.getV,n=i(e,(t=X.getPosArrayOfChildrenFromHex(e))[0]),r=i(e,t[1]),o=i(e,t[2]),a=i(e,t[3]),s=i(e,t[4]),c=i(e,t[5]),l=i(e,t[6]),h=i(e,t[7]),u=i(e,t[8]);return(t=new Array).push(n,r,o,a,s,c,l,h,u),t},X.prototype.readPrivateKeyFromPEMString=function(e){var t=ce(e),i=X.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},X.prototype.readPKCS5PrvKeyHex=function(e){var t=X.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},X.prototype.readPKCS8PrvKeyHex=function(e){var t,i,n,r,o,a,s,c,l=ge,h=l.getVbyListEx;if(!1===l.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=h(e,0,[2,0,1],"02"),i=h(e,0,[2,0,2],"02"),n=h(e,0,[2,0,3],"02"),r=h(e,0,[2,0,4],"02"),o=h(e,0,[2,0,5],"02"),a=h(e,0,[2,0,6],"02"),s=h(e,0,[2,0,7],"02"),c=h(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,i,n,r,o,a,s,c)},X.prototype.readPKCS5PubKeyHex=function(e){var t=ge,i=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(2!==n.length||"02"!==e.substr(n[0],2)||"02"!==e.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var r=i(e,n[0]),o=i(e,n[1]);this.setPublic(r,o)},X.prototype.readPKCS8PubKeyHex=function(e){var t=ge;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var i=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(i)},X.prototype.readCertPubKeyHex=function(e,t){var i,n;(i=new xe).readCertHex(e),n=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},X.prototype.sign=function(e,t){var i,n=(i=e,c.crypto.Util.hashString(i,t));return this.signWithMessageHash(n,t)},X.prototype.signWithMessageHash=function(e,t){var i=q(c.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return ve(this.doPrivate(i).toString(16),this.n.bitLength())},X.prototype.signPSS=function(e,t,i){var n,r=(n=oe(e),c.crypto.Util.hashHex(n,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(r,t,i)},X.prototype.signWithMessageHashPSS=function(e,t,i){var n,r=re(e),o=r.length,a=this.n.bitLength()-1,s=Math.ceil(a/8),l=function(e){return c.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=o;else if(-2===i)i=s-o-2;else if(i<-2)throw new Error("invalid salt length");if(s<o+i+2)throw new Error("data too long");var h="";i>0&&(h=new Array(i),(new W).nextBytes(h),h=String.fromCharCode.apply(String,h));var d=re(l(oe("\0\0\0\0\0\0\0\0"+r+h))),p=[];for(n=0;n<s-i-o-2;n+=1)p[n]=0;var f=String.fromCharCode.apply(String,p)+""+h,m=ye(d,f.length,l),g=[];for(n=0;n<f.length;n+=1)g[n]=f.charCodeAt(n)^m.charCodeAt(n);var v=65280>>8*s-a&255;for(g[0]&=~v,n=0;n<o;n++)g.push(d.charCodeAt(n));return g.push(188),ve(this.doPrivate(new u(g)).toString(16),this.n.bitLength())},X.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=q(t,16),n=this.n.bitLength();if(i.bitLength()>n)return!1;var r=this.doPublic(i).toString(16);if(r.length+3!=n/4)return!1;var o=Ae(r.replace(/^1f+00/,""));if(0==o.length)return!1;var a,s=o[0];return o[1]==(a=e,c.crypto.Util.hashString(a,s))},X.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=q(t,16);if(i.bitLength()>this.n.bitLength())return 0;var n=Ae(this.doPublic(i).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==e)},X.prototype.verifyPSS=function(e,t,i,n){var r,o=(r=oe(e),c.crypto.Util.hashHex(r,i));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(o,t,i,n)},X.prototype.verifyWithMessageHashPSS=function(e,t,i,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r,o=new u(t,16),a=function(e){return c.crypto.Util.hashHex(e,i)},s=re(e),l=s.length,h=this.n.bitLength()-1,d=Math.ceil(h/8);if(-1===n||void 0===n)n=l;else if(-2===n)n=d-l-2;else if(n<-2)throw new Error("invalid salt length");if(d<l+n+2)throw new Error("data too long");var p=this.doPublic(o).toByteArray();for(r=0;r<p.length;r+=1)p[r]&=255;for(;p.length<d;)p.unshift(0);if(188!==p[d-1])throw new Error("encoded message does not end in 0xbc");var f=(p=String.fromCharCode.apply(String,p)).substr(0,d-l-1),m=p.substr(f.length,l),g=65280>>8*d-h&255;if(0!=(f.charCodeAt(0)&g))throw new Error("bits beyond keysize not zero");var v=ye(m,f.length,a),y=[];for(r=0;r<f.length;r+=1)y[r]=f.charCodeAt(r)^v.charCodeAt(r);y[0]&=~g;var A=d-l-n-2;for(r=0;r<A;r+=1)if(0!==y[r])throw new Error("leftmost octets not zero");if(1!==y[A])throw new Error("0x01 marker not found");return m===re(a(oe("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,y.slice(-n)))))},X.SALT_LEN_HLEN=-1,X.SALT_LEN_MAX=-2,X.SALT_LEN_RECOVER=-2,xe.hex2dn=function(e,t){void 0===t&&(t=0);var i=new xe;return ge.getTLV(e,t),i.getX500Name(e).str},xe.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var i=new Array,n=ge.getChildIdx(e,t),r=0;r<n.length;r++)i.push(xe.hex2attrTypeValue(e,n[r]));return(i=i.map((function(e){return e.replace("+","\\+")}))).join("+")},xe.hex2attrTypeValue=function(e,t){var i=ge,n=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var r=i.getChildIdx(e,t);2!==r.length||e.substr(r[0],2);var o=n(e,r[0]),a=c.asn1.ASN1Util.oidHexToInt(o);return c.asn1.x509.OID.oid2atype(a)+"="+re(n(e,r[1]))},xe.getPublicKeyFromCertHex=function(e){var t=new xe;return t.readCertHex(e),t.getPublicKey()},xe.getPublicKeyFromCertPEM=function(e){var t=new xe;return t.readCertPEM(e),t.getPublicKey()},xe.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,n=ge.getVbyList,r={};return r.algparam=null,(t=new xe).readCertPEM(e),i=t.getPublicKeyHex(),r.keyhex=n(i,0,[1],"03").substr(2),r.algoid=n(i,0,[0,0],"06"),"2a8648ce3d0201"===r.algoid&&(r.algparam=n(i,0,[0,1],"06")),r},xe.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var we,Me=[(we=new xe,we.readCertPEM(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@\tPPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\\QN>Z\tN\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@ebN[bqx=ng?\tS^w@|XAz|qUTwfzn]Bu<qs_ae\\y<}u`eRAoE`_\\s\0r|b{rp_o<oC@o=x\bw_cUUZPApQevD\\FxFoFgE=<sq[p<coqyn>TEpP@aSC_YDU8\0|8TB?c>r\\=rp`pcwP}c\0PP_\\RS\\EPVSy8x`\0?R|NP\tP>}A^VP}Ex\bUZa=syDw}>Ya8wPp[pRnn\brU^dE8U?a\bcW|<FEbbupn^`ZNr\tsof[wA}e{\\z}w[YDQ|dt=wC\tNvbRZ@@U|ZAYpFsabCBB\\`wrqxsYW8uFyWdaWezeUeA_8VoVupvY[TD[OYdpO\bC[wX\\O]=[QRpV\0d`N\0RXt^Z}vEpdC=\bY?=V}?^W\bad|qN@Ww>@PycaqANE]asPcE^OB_VA?>wzeftac\tZ\tguf\bF]DCP?znNYf\tuaYu[`=b|v]Bp=RAS``\\PRDW]_`UXdUg=SuqwVFDeB\tD8{B>\\sPYbEU\tFQXz\0@`zsqgfD\0[WY\bPeZc}\t\0bx?Rfed}BUe|Uo\0y?\bsSXZOSBCgbFqf\0Bs?b?d<VE\\Zzns\\d@?dPvf\\{}_\0Sd[<q_YBY`Ffg=sY>{t<fu]xrFNtZONNTwbQO\\ZO=TN>bqQt^dOOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNZOt[cU_ZROaNQN^U<ZN=TP`\0T`Vo@Q^ROPbNNAVPN^P\0{y\0Bs\\8\0R[z]w??qZP?NpgdenSuvv?>|f_?UpYPcQ\\gCb8zxtSvsOQNg>[\\\0\bx\b_o@8\0g`Z<PyUE`8yu}\\g{@`s`zUgErRtve{YdCvoO@>WFDtABNp\0feUWszpQaEYNAc]^xB[@]BDAN8\b}XA=EnO}Pud8TA\t?yPrVv{\\>E]o`BO^RE^X[W[rEU?x\bf>V\tOUwY=>X[\\E`tW[8}VwpFBQcnrPF}yUtd8<Doe_\b[oOVUep@pYY\0cegY{r\t?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<StX\tNx\0\b\t\0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V\tCVrRVtAAc[\tQp|d|tqoQ=T|XX\t=u\\N8XNCx\\aU>wz\tX<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ\tP\bZ\b\\YNNSZ_\\w^|TsD8db\t_\tY\\o^Cw>Z\0x\\^aN]wWf\bA}\tC^d_{ZC@\by]gY@E\tBFY?OsaqbDcVgQbZeFc\tovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z\tZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),we)];function Ee(e,t){var i=e.getIssuerHex();if(i===e.getSubjectHex())return e.verifySignature(e.getPublicKey());var n=function(e,t){for(var i=0,n=t;i<n.length;i++){var r=n[i];if(r.getSubjectHex()===e)return r}}(i,t);return!!n&&(!1!==e.verifySignature(n.getPublicKey())&&Ee(n,t))}function Se(e){return e.getIssuerHex()!==e.getSubjectHex()&&Ee(e,Me)}!function(e){var t=new xe;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);var i=Se(t);Me.push(t)}(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU\tPPONrtNVONtVWNW=_SVw\tVE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ\t[QSnS=\b[aNBZQZ\\aZ\t[QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tRbZOVTN>bRPtYoTyuoz}}f`Bwo?=RQN\\Ot[cONZO>Wyfd\tgdbRaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdyndB{^T}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F\tSAe`tn[t\tu\b8^a]qx\bE_^ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r\tAo\0\tF`fdzCnRtq\br\t\b8eBp=Z\\TRaadc}@Eub`quuNqAdF\0aUay{}x>tgVz`\t_YBFwu_q?egt8v[o\x008\twTQcrA\t<z{DZoEE^rZTrpaZQzqpBY]^zt8[bQv}yEWw\tXDYQB\0QB\bx_^X]|uEDtPf[n[r_bpB[bE}?ung|bnU|NYOoedY_tvXySZfYPdWV]OE^\bOFwA}<uXoO}_NDz8aonzWOfcv@?>snfqu@FeEx^\\\bVfuO`\\\0tSg]zDU}QrAT|\tOZV|OvpVD<sN@z`<_cSrNCW>?=Au?g_8v{|}}WF>Sr>QBxO\td_D}eBb?Uq^b\t[y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zUxOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`FyWadZcAD\tpeXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx\ta[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef`\t?^x>X}esa{>\\r?eE]CC_cZ[vQs\t\t>gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC>>gvb}ACd\t``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc\tXSq\t{\0DvAVBbnTqEE[QzDyqF`bF}R=Q?VeDo<Vzb\0w}D}NZ\0t}^?OyFP\bVaVNrTNYqe?[NRYTSQby@yzWvT`wQo}y]c_WgxBYCy\tRNRg@NZCaaq8?`\t^`?ryD\t=obzw?E]Ou]n@>bVzqAQT?@_zo@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug8^f[YQAWad8FNqxFQE?ZOo\t}RnO\bsQc\txyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var _e,Te=(_e="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(_e,">$"):Symbol(_e));function Ce(e){return e[Te]||(e[Te]={}),e[Te]}var Ie=function(){function e(){}return e.prototype.hasListener=function(e){var t=Ce(this);return t&&t[e]&&t[e].length>0},e.prototype.on=function(e,t,i){var n=this,r=Ce(this);return r[e]||(r[e]=[]),r[e].push([t,i||!1]),function(){return n.off(e,t)}},e.prototype.once=function(e,t){return this.on(e,t,!0)},e.prototype.off=function(e,t){if(void 0!==e){var i,n=Ce(this);if(n[e]||(n[e]=[]),void 0!==t){for(var r=0;r<n[e].length&&n[e][r][0]!==t;r++);r<n[e].length&&n[e].splice(r,1)}else n[e].length=0}else(i=this)[Te]||delete i[Te]},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=!1,r=Ce(this),o=r[e]||[],a=0,s=o.slice();a<s.length;a++){var c=s[a],l=c[0],h=c[1],u=void 0!==h&&h,d=l.apply(void 0,t);u&&this.off(e,l),!1===d&&(n=!0)}return n},e}();function Pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}var Re="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),Le="undefined"!=typeof performance?function(){return Re+performance.now()}:function(){return Date.now()};function Be(e){Object.freeze(e);var t="function"==typeof e,i=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(n){!i.call(e,n)||t&&("caller"===n||"callee"===n||"arguments"===n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||Be(e[n])})),e}var De=/^([^.]+)(\.([^.]+))*$/;function Oe(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function Ne(e,t){return De.test(e)&&De.test(t)&&function(e,t){if("*"===e)return!0;var i=e.split(".").reverse(),n=t.split(".").reverse();if(i.length<=1)return e===t;for(var r=0;r<i.length;r++)if(i[r]!==n[r])return!1;return!0}(e,t)}var ke=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Fe=Be(JSON.parse(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j"))),Ve=function(e){function i(t,i,n){return e.call(this,"[NETWORK]: response error(type: ".concat(i,", reason: ").concat(n,"): ").concat(t))||this}return t.__extends(i,e),i}(Error),ze=function(e){function i(t,i,n){var r=e.call(this,"[NETWORK]: response error(type: ".concat(i,", status: ").concat(n,"): ").concat(t))||this;return r.httpStatus=n,r}return t.__extends(i,e),i}(Error);!function(e){function i(t,i){return e.call(this,"[NETWORK]: request abort(type: ".concat(i,"): ").concat(t))||this}t.__extends(i,e)}(Error);var He=function(e){function i(t,i,n){return e.call(this,"[NETWORK]: request timeout(type: ".concat(i,", timeout: ").concat(n,"ms): ").concat(t))||this}return t.__extends(i,e),i}(Error);function Ue(e){for(var t=0,i=ke;t<i.length;t++){var n=i[t],r=e.match(n);if(r)return"jsonp_"+r[1]}return null}function Ge(e){return null!==Ue(e)}function je(e){return ke.reduce((function(e,t){return e.replace(t,"")}),e)}function Qe(e){var t=e.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[2]:location.hostname}!function(e){function i(t,i,n){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(i,", reason: ").concat(n,"): ").concat(t))||this}t.__extends(i,e)}(Error);var We=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(i,e),i}(Ie);function qe(e,t,i,n,r){return void 0===t&&(t={}),void 0===i&&(i=Pe),void 0===n&&(n=Pe),void 0===r&&(r=Pe),new Promise((function(o,a){var s;t.requestProxy&&(e=t.requestProxy(e));var c=t.allowHosts?Fe.concat(t.allowHosts):Fe.slice(),l=Qe(e),h=Ue(e);if(0!==location.hostname.length&&!Oe(location.hostname)&&0===Fe.filter((function(e){return Ne(e,location.hostname)})).length&&!Oe(l)&&0===c.filter((function(e){return Ne(e,l)})).length){var u=h?"Script":"XMLHttpRequest",d=new Ve(e,u,"request host(".concat(l,") is not allowed"));return n(d),a(d),void(null===(s=t.networkSubscribe)||void 0===s||s.emit("network",e,u,"forbidden",d.message))}if(h){var p=window,f=null,m=!1,g=Le(),v=document.createElement("script");p[h]=function(r){var s,c,l=Le(),u=l-g;if(delete p[h],v.parentNode&&v.parentNode.removeChild(v),null!==f&&(window.clearTimeout(f),f=null),!0!==m){if(0!==r.indexOf("data:")){var d=new ze(e,"Script",500);return n(d),a(d),void(null===(s=t.networkSubscribe)||void 0===s||s.emit("network",e,"Script","error",d.message))}var y=r.split(","),A=(y[0].match(/:(.*?);/)||[])[1],x=y[1];if("arraybuffer"===t.responseType||"blob"===t.responseType){for(var b=atob(y[1]),w=b.length,M=new Uint8Array(w),E=0;E<w;E++)M[E]=b.charCodeAt(E);x="arraybuffer"===t.responseType?M.buffer:new Blob([M],{type:A})}var S={body:x,meta:{source:e,requestTime:g,responseTime:l,costs:u,headers:{}}};i(S),o(S),null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Script","ok",JSON.stringify(S.meta)),m=!0}},v.src=e,document.body.appendChild(v),"number"==typeof t.timeout&&(f=window.setTimeout((function(){var i;if(f=null,!0!==m){m=!0;var r=new He(e,"Script",t.timeout||NaN);n(r),a(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Script","timeout",r.message)}}),t.timeout))}else{var y=Le(),A=!1,x=new XMLHttpRequest,b=function(){x&&(x.removeEventListener("timeout",w,!1),x.removeEventListener("progress",M,!1),x.removeEventListener("load",E,!1),x.removeEventListener("error",S,!1)),x=null,b=Pe},w=function(){var i;if(!0!==A){A=!0,b();var r=new He(e,"XMLHttpRequest",t.timeout||NaN);n(r),a(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","timeout",r.message)}},M=function(e){!0!==A&&e.lengthComputable&&(e.total<=0||r(e.loaded/e.total))},E=function(n){var r;if(!0!==A){var a=this.status;if(0===a||a>=200&&a<400){A=!0,b();var s=Le(),c=s-y,l=function(e){if(!e)return{};for(var t={},i=e.trim().split("\n"),n=0;n<i.length;n++){var r=i[n],o=r.indexOf(":"),a=r.slice(0,o).trim().toLowerCase(),s=r.slice(o+1).trim();s&&(t[a]?t[a]+=", "+s:t[a]=s)}return t}(this.getAllResponseHeaders()),h=n.total,u={body:this.response,meta:{source:e,requestTime:y,responseTime:s,costs:c,headers:l,size:h}};i(u),o(u),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(u.meta))}else S.call(this)}},S=function(){var i;if(!0!==A){A=!0,b();var r=new ze(e,"XMLHttpRequest",this.status);n(r),a(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","error",r.message)}};x.addEventListener("timeout",w,!1),x.addEventListener("progress",M,!1),x.addEventListener("load",E,!1),x.addEventListener("error",S,!1),t.responseType&&(x.responseType=t.responseType),"number"==typeof t.timeout&&(x.timeout=t.timeout),x.open("GET",e,!0),x.send(null)}}))}var Ke={};function Xe(e,t,i,n,r,o){return void 0===t&&(t={}),void 0===i&&(i=Pe),void 0===n&&(n=Pe),void 0===r&&(r=Pe),new Promise((function(a,s){var c;t.requestProxy&&(e=t.requestProxy(e));var l=t.allowHosts?Fe.concat(t.allowHosts):Fe.slice(),h=Qe(e);if(0!==location.hostname.length&&!Oe(location.hostname)&&0===Fe.filter((function(e){return Ne(e,location.hostname)})).length&&!Oe(h)&&0===l.filter((function(e){return Ne(e,h)})).length){var u=new Ve(e,"Image","request host(".concat(h,") is not allowed"));return n(u),s(u),void(null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Image","forbidden",u.message))}var d=null!=o?o:new Image,p=Le(),f=!1,m=null;"number"==typeof t.timeout&&(m=window.setTimeout((function(){var i;if(d.onload=Pe,d.onerror=Pe,m=null,!0!==f){f=!0;var r=new He(e,"Image",t.timeout);n(r),s(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","timeout",r.message)}}),t.timeout)),d.onload=function(){var n;if(d.onload=Pe,d.onerror=Pe,null!==m&&(clearTimeout(m),m=null),!0!==f){var o=Le();f=!0;var s={body:d,meta:{headers:{},source:e,requestTime:p,responseTime:o,costs:o-p}};r(1),i(s),a(s),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","ok",JSON.stringify(s.meta))}},d.onerror=function(){var i;if(d.onload=Pe,d.onerror=Pe,null!==m&&(clearTimeout(m),m=null),!0!==f){f=!0;var r=new ze(e,"Image",0);n(r),s(r),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Image","ok",r.message)}},r(0),d.src=e}))}var Ye=function(){if("undefined"!=typeof window){var e=window;return e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){return setTimeout(e,16)}}return function(e){return setTimeout(e,16)}}(),Ze=16,Je=function(){function e(){this.frames=[],this.stoped=!1,this.time=Le(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.getFrameTime=function(){return Ze},e.prototype.loop=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];if(!this.stoped){var n=Le(),r=n-this.time;this.time=n;var o=[];Ze=r;for(var a=0,s=this.frames;a<s.length;a++){var c=s[a];if(c.delay>0)c.delay=c.delay-1;else{try{c.callback.apply(c,t.__spreadArray([n,r],e,!1))}catch(e){console.error(e)}c.once&&o.push(c)}}o.length>0&&(this.frames=this.frames.filter((function(e){return-1===o.indexOf(e)}))),this.requestAnimationFrame(this.loop)}},e.prototype.setContext=function(e){this.cancelAnimationFrame(this.requestId),this.context=e,this.requestId=this.requestAnimationFrame(this.loop)},e.prototype.getContext=function(){return this.context},e.prototype.requestAnimationFrame=function(e){return this.context?this.context.requestAnimationFrame(e):Ye(e)},e.prototype.cancelAnimationFrame=function(e){this.context?this.context.cancelAnimationFrame(e):function(e){var t;if("undefined"!=typeof window){var i=window;t=i.cancelAnimationFrame||i.mozCancelAnimationFrame||i.webkitCancelAnimationFrame||i.msCancelAnimationFrame||function(e){return window.clearTimeout(e)}}else t=function(e){return window.clearTimeout(e)};t(e)}(this.loop),this.requestId=null},e.prototype.remove=function(e){var t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)},e.prototype.add=function(e,t,i,n){var r=this;void 0===t&&(t=!1),void 0===i&&(i=0),void 0===n&&(n=5);var o={callback:e,once:t,delay:i,order:n};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return r.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),$e=/^https?\:\/\/?([^\/]+)/;function et(e,t){return e.replace($e,(function(e,i){return e.slice(0,e.length-i.length)+t}))}var tt={"vrlab-public.ljcdn.com":{pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-1.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"test-vr-public.realsee-cdn.com":{pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}};function it(e,i){var n=t.__assign(t.__assign({},tt),i.mappings),r=function(e){var t=e.match($e);return null===t?null:t[1]}(e);if(null===r)return e;var o=n[r];return o?(/\.basis(\?|$)/.test(e)&&!0!==i.basisLoaderInitialized&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),function(e,t){var i,n=e.split("?")[0],r=n.split(".").pop();if("jpeg"===r&&(r="jpg"),"png"!==r&&"jpg"!==r)return e;var o="";if(void 0!==t.format&&t.format!==r&&(o+="/format/".concat(t.format)),void 0!==t.cut&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),void 0!==t.quality){var a=null!==(i=t.format)&&void 0!==i?i:r;a&&["jpg","webp","tpg","heif","avif"].indexOf(a)>=0&&(o+="/quality/".concat(t.quality))}if(void 0!==t.size){var s=e.match(/\/cube_(\d+)\//);(s?Number(s[1]):NaN)!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return void 0!==t.sharpen&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),n+o}(function(e,t,i){var n=t.split("."),r=n[0],o=n.slice(1);if("texture"===r)return et(e,i.texture[0]);if("pano"===r||"pano_luminance"===r)switch(o[0],o[1]){case"front":case"left":case"up":return et(e,i.pano[0]);case"down":case"right":case"back":return et(e,i.pano[1])}else if("pano_tile"===r||"pano_tile_luminance"===r){o[0],o[1];var a=o[2],s=o[3],c=o[4],l=Math.pow(2,Number(a))*Number(s)+Number(c);if(!isNaN(l))return et(e,i.tile[l%2])}return et(e,i.default[0])}(e,i.key,o),i)):e}function nt(e){return new Promise((function(t){var i=new Image,n=setTimeout((function(){i.onload=i.onerror=function(){},clearTimeout(n),t(!1)}));i.onload=i.onerror=function(){i.onload=i.onerror=function(){},clearTimeout(n),t(2===i.height)},i.src=e}))}var rt=null;var ot=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t.needsRender=!0,t}return t.__extends(i,e),i}(r.Mesh),at=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t.enableTransparent=!0,t}return t.__extends(i,e),i.prototype.getTransparent=function(){return this.enableTransparent},i.prototype.setTransparent=function(e){this.enableTransparent=e,this.traverse((function(t){t instanceof ot&&t.material.forEach((function(t){t.transparent=e}))}))},i.prototype.getMaterial=function(){var e=null;return this.traverse((function(t){if(null===e&&t instanceof ot){var i=t.material[0];e={pano0:i.pano0,pano1:i.pano1,modelAlpha:i.modelAlpha,progress:i.progress,useBlackTransition:i.useBlackTransition,useXRBlackTransition:i.useXRBlackTransition,perspToOrtho:i.perspToOrtho,opacity:i.opacity,floorInfo:i.floorInfo}}})),e},i.prototype.setMaterial=function(e){this.traverse((function(t){t instanceof ot&&t.material.forEach((function(t){void 0!==e.pano0&&(t.pano0=e.pano0),void 0!==e.pano1&&(t.pano1=e.pano1),void 0!==e.modelAlpha&&(t.modelAlpha=e.modelAlpha),void 0!==e.progress&&(t.progress=e.progress),void 0!==e.useBlackTransition&&(t.useBlackTransition=e.useBlackTransition),void 0!==e.useXRBlackTransition&&(t.useXRBlackTransition=e.useXRBlackTransition),void 0!==e.perspToOrtho&&(t.perspToOrtho=e.perspToOrtho),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.floorInfo&&(t.floorInfo=e.floorInfo)}))}))},i.prototype.disposeMaterial=function(){this.traverse((function(e){if(e instanceof ot){var t=[];e.material.forEach((function(e){var i=e.uniforms;Object.keys(i).map((function(e){if(/^pano\d\_/.test(e))i[e].value=null;else{var n=i[e].value;n&&"function"==typeof n.dispose&&-1===t.indexOf(n)&&(i[e].value=null,t.push(n))}})),e.dispose()})),t.forEach((function(e){return e.dispose()}))}}))},i.prototype.disposeGeometry=function(){this.traverse((function(e){e instanceof ot&&e.geometry.dispose()}))},i}(r.Group),st=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.floorIndex=0,t}return t.__extends(i,e),i}(at),ct=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}("{vs|z-rp@-z|qryPr{rH{vs|z-sy|n-}r}a|\\u|Hn\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--<<-修正正交相机模拟--rp@-pnzrn[|zny-J-5z|qrycvrZnv-7-rpA5=;=9-=;=9->;=9-=;=66;\b\tH--sy|n-|u|Qvn{pr-J-zn5=;===>9-no5q|5pnzrn[|zny9-z|qryPr{r-:-pnzrn]|vv|{666H--tyl]|vv|{;-J-zv5-tyl]|vv|{;9-tyl]|vv|{;-7-5-tyl]|vv|{;\t-<-|u|Qvn{pr-69-}r}a|\\u|-6H--tyl]|vv|{;\b-J-zv5-tyl]|vv|{;\b9-tyl]|vv|{;\b-7-5-tyl]|vv|{;\t-<-|u|Qvn{pr-69-}r}a|\\u|-6H--0v{pyqr-Iunq|zn}lrrK\f"),lt=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-e_lOYNPXlP\\Y\\_-rpA5=;=9=;=9=;=9>;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6{vs|z-rp?-}n{|cvqr|lv\trH{vs|z-znA-}n{|cvqr|lznvH{vs|z-sy|n-}n{|cvqr|lny}unH{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlPYV]SY\\\\_6{vs|z-rp@-sy||V{s|H0r{qvsn\bv{t-rpA-|yq]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-I}npxv{tK0v{pyqr-Ip|y|l}nlsntzr{K0v{pyqr-Il}nlsntzr{K0v{pyqr-I?l}nlsntzr{K0v{pyqr-Izn}l}nlsntzr{K0v{pyqr-Iny}unzn}l}nlsntzr{K0v{pyqr-In|zn}l}nlsntzr{K0v{pyqr-Iyvtuzn}l}nlsntzr{K0v{pyqr-Irzvvrzn}l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Itnqvr{zn}l}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-IoqsK0v{pyqr-Iyvtul}nlortv{K0v{pyqr-Iyvtul}u|{tl}nlsntzr{K0v{pyqr-Iunq|zn}l}nlsntzr{Krp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n0vs-qrsv{rq5b`RlPYV]SY\\\\_6vs-5|yq]|vv|{;\b-I-sy||V{s|;-\v\v-|yq]|vv|{;\b-K-sy||V{s|;t6-\nqvpnqH\f0r{qvs--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\b\t9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr-J-5|yq]|vv|{;\b\t-:-}n{|=lznvh@j;\b\t6-7-zn@5}n{|=lznv6H--rp@-}n{|>a|crr-J-5|yq]|vv|{;\b\t-:-}n{|>lznvh@j;\b\t6-7-zn@5}n{|>lznv6H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-rrPor5}n{|=lzn}9-}n{|=a|crr6H--rpA-}n{|>P|y|-J-rrPor5}n{|>lzn}9-}n{|>a|crr6H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-rrPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr6;H----}n{|>P|y|;n-J->;=-:-rrPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr6;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-zn5=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rle_lOYNPXla_N[`VaV\\[6}n{|P|y|-J-zv5}n{|=P|y|9e_lOYNPXlP\\Y\\_9zv{5>;=9-}|tr66H0ryr----}n{|P|y|-J-zv5}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr-J-|yq]|vv|{;\b\t-:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr9->;=6-7-}n{|cvqr|lznvH----rp?--J-rp?5------=;B-8-zn}P||q;-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;9------=;B-:-zn}P||q;\b-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;\b----6H----rpA-vqr|P|y|-J-rr?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q;\t66-7-5>;=-:-r}5=;B9-no5;-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H--tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H\f");function ht(){return"undefined"==typeof document?{}:document.createElementNS("http://www.w3.org/1999/xhtml","img")}var ut=ht();ut.width=ut.height=8;var dt=new r.Texture(ut);dt.name="EMPTY_TEXTURE";var pt=new r.CubeTexture([ut,ut,ut,ut,ut,ut]);pt.name="EMPTY_CUBE_TEXTURE",dt.dispose=pt.dispose=function(){};var ft=Object.assign({modelAlpha:new r.Uniform(0),progress:new r.Uniform(0),pano0_map:new r.Uniform(pt),pano0_luminanceMap:new r.Uniform(null),pano0_matrix:new r.Uniform(new r.Matrix4),pano1_map:new r.Uniform(pt),pano1_luminanceMap:new r.Uniform(null),pano1_matrix:new r.Uniform(new r.Matrix4),modelCenter:new r.Uniform(new r.Vector3),perspToOrtho:new r.Uniform(0),floorInfo:new r.Vector3(0,0,0)},{exposure:new r.Uniform(1),emissive:new r.Uniform(new r.Color(0)),emissiveMap:new r.Uniform(null),specular:new r.Uniform(new r.Color(1118481)),specularMap:new r.Uniform(null),normalMap:new r.Uniform(null),bumpMap:new r.Uniform(null),shininess:new r.Uniform(30)},r.UniformsUtils.clone(r.UniformsLib.common),r.UniformsUtils.clone(r.UniformsLib.lights)),mt=function(e){function i(t){void 0===t&&(t={});var i,n,o,a,s,c,l,h,u,d=this;return d=e.call(this,{vertexShader:ct,fragmentShader:lt,uniforms:r.UniformsUtils.clone(ft),defines:{USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_XR_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_CLIPFLOOR:!1},blending:r.NoBlending,lights:!0})||this,Object.defineProperties(d,{pano0:{get:function(){return this.uniforms.pano0_map.value===pt?null:{map:this.uniforms.pano0_map.value,luminanceMap:this.uniforms.pano0_luminanceMap.value,matrix:this.uniforms.pano0_matrix.value.clone()}},set:function(e){null===e?(this.uniforms.pano0_map.value=pt,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap,this.uniforms.pano0_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}},pano1:{get:function(){return this.uniforms.pano1_map.value===pt?null:{map:this.uniforms.pano1_map.value,luminanceMap:this.uniforms.pano1_luminanceMap.value,matrix:this.uniforms.pano1_matrix.value.clone()}},set:function(e){null===e?(this.uniforms.pano1_map.value=pt,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap,this.uniforms.pano1_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},progress:{get:function(){return this.uniforms.progress.value},set:function(e){this.uniforms.progress.value=e}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(e){this.defines.USE_BLACK_TRANSITION!==e&&(this.defines.USE_BLACK_TRANSITION=e,this.needsUpdate=!0)}},useXRBlackTransition:{get:function(){return this.defines.USE_XR_BLACK_TRANSITION},set:function(e){this.defines.USE_XR_BLACK_TRANSITION!==e&&(this.defines.USE_XR_BLACK_TRANSITION=e,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e;var t=e<1?r.NormalBlending:r.NoBlending;t!==this.blending&&(this.blending=t,this.needsUpdate=!0)}},perspToOrtho:{get:function(){return this.uniforms.perspToOrtho.value},set:function(e){this.uniforms.perspToOrtho.value=e}},floorInfo:{get:function(){return this.uniforms.floorInfo.value},set:function(e){e&&e.equals(new r.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!1,this.needsUpdate=!0),e&&!e.equals(new r.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!0,this.uniforms.floorInfo.value=e,this.needsUpdate=!0)}}}),d.pano0=null!==(i=t.pano0)&&void 0!==i?i:null,d.pano1=null!==(n=t.pano1)&&void 0!==n?n:null,d.modelAlpha=null!==(o=t.modelAlpha)&&void 0!==o?o:1,d.progress=null!==(a=t.progress)&&void 0!==a?a:0,d.useBlackTransition=null!==(s=t.useBlackTransition)&&void 0!==s&&s,d.useXRBlackTransition=null!==(c=t.useXRBlackTransition)&&void 0!==c&&c,d.perspToOrtho=null!==(l=t.perspToOrtho)&&void 0!==l?l:0,d.opacity=null!==(h=t.opacity)&&void 0!==h?h:1,d.originOpacity=1,d.floorInfo=null!==(u=t.floorInfo)&&void 0!==u?u:null,d}return t.__extends(i,e),i}(r.ShaderMaterial),gt=function(e){function i(t){var i=t.preserveDrawingBuffer,n=void 0===i||i,o=t.backgroundColor,a=void 0===o?1579548:o,s=t.backgroundAlpha,c=void 0===s?1:s,l=t.pixelRatio,h=void 0===l?1:l,u=t.antialias,d=void 0!==u&&u,p=t.webgl2,f=this;if(void 0!==p&&p){var m=document.createElement("canvas"),g=m.getContext("webgl2");if(null===g)throw new Error("error occurred when getting webgl2 canvas context");f=e.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:c<1,canvas:m,context:g})||this}else f=e.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:c<1})||this;return f.setPixelRatio(h),f.setClearColor(a,c),f.outputEncoding=r.sRGBEncoding,f.autoClear=!0,f}return t.__extends(i,e),i}(r.WebGLRenderer),vt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(i,e),i.prototype.add=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.prototype.add.apply(this,t)},i.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.prototype.remove.apply(this,t)},i}(r.Scene);var yt=2*Math.PI,At=Math.PI/2;function xt(e){return e>0&&e<=yt?e:(e%yt+yt)%yt}var bt,wt,Mt,Et,St=function(e){function i(t){var i=e.call(this,t,1,.1,1e3)||this;return i.pose={longitude:0,latitude:0,fov:t,distance:0,offset:new r.Vector3},i.computePose(),i}return t.__extends(i,e),i.prototype.computePose=function(){var e=this.getWorldDirection(new r.Vector3);return this.pose.longitude=xt(-Math.atan2(e.x,-e.z)),this.pose.latitude=-Math.asin(e.y/1),this.pose.fov=this.fov,this.pose.distance=0,this.pose.offset.copy(this.position),this},i.prototype.setFromPose=function(e){var t,i,n,o,a,s=xt(null!==(t=e.longitude)&&void 0!==t?t:this.pose.longitude),c=Math.max(1e-4-At,Math.min(At-1e-4,null!==(i=e.latitude)&&void 0!==i?i:this.pose.latitude)),l=null!==(n=e.fov)&&void 0!==n?n:this.pose.fov,h=null!==(o=e.distance)&&void 0!==o?o:this.pose.distance,u=null!==(a=e.offset)&&void 0!==a?a:this.pose.offset,d=function(e){var t=Math.abs(Math.cos(e.latitude));return new r.Vector3(-Math.sin(e.longitude)*t,-Math.sin(e.latitude),-Math.cos(e.longitude)*t)}({longitude:s,latitude:c}).normalize();return this.position.set(0,0,0),this.lookAt(d),this.position.add(u).sub(d.clone().setLength(h)),this.fov!==l&&(this.fov=l,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=s,this.pose.latitude=c,this.pose.fov=l,this.pose.distance=h,this.pose.offset.copy(u),this},i.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},i}(r.PerspectiveCamera),_t=function(){function e(e,t,i){this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e.prototype.set=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.fromArray=function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},e.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},e.prototype.cross=function(e){var t=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-t*e.z,this.z=t*e.y-i*e.x,this},e.prototype.crossVectors=function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),Tt=function(e,t,i){this.extents=e,this.startIndex=t,this.endIndex=i},Ct=function(e,t){this.triangle=e,this.intersectionPoint=t},It=(bt=new _t(0,0,0),wt=new _t(0,0,0),Mt=new _t(0,0,0),Et=new _t(0,0,0),function(e,t,i,n,r,o){wt.subVectors(t,e),Mt.subVectors(i,e),Et.crossVectors(wt,Mt);var a,s=r.dot(Et);if(s>0){if(o)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}bt.subVectors(n,e);var c=a*r.dot(Mt.crossVectors(bt,Mt));if(c<0)return null;var l=a*r.dot(wt.cross(bt));if(l<0)return null;if(c+l>s)return null;var h=-a*bt.dot(Et);if(h<0)return null;var u=h/s;return new _t(0,0,0).copy(r).multiplyScalar(u).add(n)}),Pt=function(e,t){this.min=e,this.max=t};function Rt(e,t,i){var n=new Pt(0,0);t.x>=0?(n.min=(i.extents[0]-e.x)*t.x,n.max=(i.extents[3]-e.x)*t.x):(n.min=(i.extents[3]-e.x)*t.x,n.max=(i.extents[0]-e.x)*t.x);var r=new Pt(0,0);if(t.y>=0?(r.min=(i.extents[1]-e.y)*t.y,r.max=(i.extents[4]-e.y)*t.y):(r.min=(i.extents[4]-e.y)*t.y,r.max=(i.extents[1]-e.y)*t.y),n.min>r.max||r.min>n.max)return!1;r.min>n.min&&(n.min=r.min),r.max<n.max&&(n.max=r.max);var o=new Pt(0,0);return t.z>=0?(o.min=(i.extents[2]-e.z)*t.z,o.max=(i.extents[5]-e.z)*t.z):(o.min=(i.extents[5]-e.z)*t.z,o.max=(i.extents[2]-e.z)*t.z),!(n.min>o.max||o.min>n.max)&&(o.min>n.min&&(n.min=o.min),o.max<n.max&&(n.max=o.max),!(n.max<0))}function Lt(e,t,i,n,r){if(i>=n)return[0,0,0,0,0,0];for(var o=1/0,a=1/0,s=1/0,c=-1/0,l=-1/0,h=-1/0,u=i,d=void 0,p=void 0;u<n;u++)(p=t[d=6*e[u]])<o&&(o=p),(p=t[d+1])<a&&(a=p),(p=t[d+2])<s&&(s=p),(p=t[d+3])>c&&(c=p),(p=t[d+4])>l&&(l=p),(p=t[d+5])>h&&(h=p);return[o-r,a-r,s-r,c+r,l+r,h+r]}var Bt=function(){function e(){}return e.prototype.create=function(e){return this.trianglesArray=e,this},e.prototype.splitNode=function(e){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");for(var t=this.trianglesArray,i=t.length/9,n=new Uint32Array(i),r=new Float32Array(6*i),o=[],a=1/0,s=1/0,c=1/0,l=-1/0,h=-1/0,u=-1/0,d=0,p=0,f=0,m=void 0,g=void 0,v=void 0,y=void 0,A=void 0,x=void 0,b=void 0;d<i;d++,p+=6,f+=9)n[d]=d,m=y=t[f],(b=t[f+3])<m&&(m=b),b>y&&(y=b),(b=t[f+6])<m&&(m=b),b>y&&(y=b),g=A=t[f+1],(b=t[f+4])<g&&(g=b),b>A&&(A=b),(b=t[f+7])<g&&(g=b),b>A&&(A=b),v=x=t[f+2],(b=t[f+5])<v&&(v=b),b>x&&(x=b),(b=t[f+8])<v&&(v=b),b>x&&(x=b),m<a&&(a=m),y>l&&(l=y),g<s&&(s=g),A>h&&(h=A),v<c&&(c=v),x>u&&(u=x),r[p]=m,r[p+1]=g,r[p+2]=v,r[p+3]=y,r[p+4]=A,r[p+5]=x;var w,M=new Tt([a,s,c,l,h,u],0,i);function E(t){for(var i=t.startIndex,a=t.endIndex,s=t.extents,c=[s[3]-s[0],s[4]-s[1],s[5]-s[2]],l=[0,1,2].sort((function(e,t){return c[t]-c[e]})),h=0;h<3;h++){for(var u=l[h],d=s[u]+s[u+3],p=i,f=a-1,m=-1,g=void 0;p<=f;)-1===m?(g=n[p],r[6*g+u]+r[6*g+u+3]<d?p++:m=g):(g=n[f],r[6*g+u]+r[6*g+u+3]>=d||(n[p]=g,n[f]=m,m=-1,p++),f--);if(p>i&&p<a){var v=new Tt(Lt(n,r,i,p,1e-6),i,p);v.endIndex-v.startIndex>e&&o.push(v);var y=new Tt(Lt(n,r,p,a,1e-6),p,a);y.endIndex-y.startIndex>e&&o.push(y),t.node0=v,t.node1=y,t.startIndex=0,t.endIndex=0;break}}}for(o.push(M);w=o.pop();)E(w);return this.offsetArray=n,this.rootNode=M,this},e.prototype.intersectRay=function(e,t,i){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");if(!this.rootNode||!this.offsetArray)throw new Error("bvh-tree never perpared. call `splitNode` to perpare.");for(var n,r=this.trianglesArray,o=this.offsetArray,a=this.rootNode,s=[],c=[],l=new _t(1/t.x,1/t.y,1/t.z),h=[a];n=h.pop();)if(Rt(e,l,n)){n.node0&&h.push(n.node0),n.node1&&h.push(n.node1);for(var u=n.startIndex;u<n.endIndex;u++)s.push(o[u])}for(var d=new _t(0,0,0),p=new _t(0,0,0),f=new _t(0,0,0),m=new _t(e.x,e.y,e.z),g=new _t(t.x,t.y,t.z),v=(u=0,void 0),y=s.length;u<y;u++){v=9*s[u],d.x=r[v],d.y=r[v+1],d.z=r[v+2],p.x=r[v+3],p.y=r[v+3+1],p.z=r[v+3+2],f.x=r[v+6],f.y=r[v+6+1],f.z=r[v+6+2];var A=It(d,p,f,m,g,i);A&&c.push(new Ct([d.clone(),p.clone(),f.clone()],A))}return c},e.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},e}(),Dt=!1,Ot=[];function Nt(e){if(void 0===e&&(e=!1),e||!Dt){Dt=!0;var t=Ot.shift();if(t){try{t()}catch(e){}Je.shared.add((function(){return Nt(!0)}),!0,2)}else Dt=!1}}function kt(e){return new Promise((function(t,i){Ot.push((function(){try{t(e())}catch(e){i(e)}})),Nt()}))}function Ft(){var e={OutWindow:function(){this._windowSize=0}};return e.OutWindow.prototype.create=function(e){this._buffer&&this._windowSize===e||(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(0!==e){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var i=this._pos-e-1;for(i<0&&(i+=this._windowSize);t--;)i>=this._windowSize&&(i=0),this._buffer[this._pos++]=this._buffer[i++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t,i=0,n=e;n--;)this._range>>>=1,t=this._code-this._range>>>31,this._code-=this._range&t-1,i=i<<1|1-t,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return i},e.RangeDecoder.prototype.decodeBit=function(e,t){var i=e[t],n=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^n)?(this._range=n,e[t]+=2048-i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,e[t]-=i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,i=this._numBitLevels;i--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t,i=1,n=0,r=0;r<this._numBitLevels;++r)i=i<<1|(t=e.decodeBit(this._models,i)),n|=t<<r;return n},e.reverseDecode2=function(e,t,i,n){for(var r,o=1,a=0,s=0;s<n;++s)o=o<<1|(r=i.decodeBit(e,t+o)),a|=r<<s;return a},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return 0===e.decodeBit(this._choice,0)?this._lowCoder[t].decode(e):0===e.decodeBit(this._choice,1)?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do{t=t<<1|e.decodeBit(this._decoders,t)}while(t<256);return 255&t},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var i,n,r=1;do{if(i=t>>7&1,t<<=1,r=r<<1|(n=e.decodeBit(this._decoders,(1+i<<8)+r)),i!==n){for(;r<256;)r=r<<1|e.decodeBit(this._decoders,r);break}}while(r<256);return 255&r},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,i){var n;if(!this._coders||this._numPrevBits!==i||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=i,this._coders=[],n=1<<this._numPrevBits+this._numPosBits;n--;)this._coders[n]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((255&t)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return!(e<0)&&(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},e.Decoder.prototype.setLcLpPb=function(e,t,i){var n=1<<i;return!(e>8||t>4||i>4)&&(this._literalDecoder.create(t,e),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,!0)},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,i,n){var r,o,a,s,c,l,h=0,u=0,d=0,p=0,f=0,m=0,g=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(i),this.init();n<0||m<n;)if(r=m&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(h<<4)+r))o=this._literalDecoder.getDecoder(m++,g),g=h>=7?o.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(u)):o.decodeNormal(this._rangeDecoder),this._outWindow.putByte(g),h=h<4?0:h-(h<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,h))a=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,h)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(h<<4)+r)&&(h=h<7?9:11,a=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,h)?s=d:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,h)?s=p:(s=f,f=p),p=d),d=u,u=s),0===a&&(a=2+this._repLenDecoder.decode(this._rangeDecoder,r),h=h<7?8:11);else if(f=p,p=d,d=u,a=2+this._lenDecoder.decode(this._rangeDecoder,r),h=h<7?7:10,(c=this._posSlotDecoder[a<=5?a-2:3].decode(this._rangeDecoder))>=4){if(u=(2|1&c)<<(l=(c>>1)-1),c<14)u+=e.reverseDecode2(this._posDecoders,u-c-1,this._rangeDecoder,l);else if(u+=this._rangeDecoder.decodeDirectBits(l-4)<<4,(u+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===u)break;return!1}}else u=c;if(u>=m||u>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(u,a),m+=a,g=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,i,n,r,o;return!(e.size<5)&&(i=(t=e.readByte())%9,n=(t=~~(t/9))%5,r=~~(t/5),!!this.setLcLpPb(i,n,r)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,i,n,r){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(i,n,r))throw"Error in data stream";return!0},e.decompressFile=function(t,i){var n,r=new e.Decoder;if(!r.setDecoderProperties(t))throw"Incorrect stream properties";if(n=t.readByte(),n|=t.readByte()<<8,n|=t.readByte()<<16,n+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,i,n))throw"Error in data stream";return!0},e}var Vt=Ft();var zt="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(Ft.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var n={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},r=n.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/r);this.data[t]||(this.data[t]=new Uint8Array(r)),this.data[t][this.offset%r]=e,this.offset++}};e.decompressFile(n,o);for(var a=new Uint8Array(o.offset),s=0;s<o.offset;s++)a[s]=o.data[Math.floor(s/r)][s%r];i(null,a)}catch(e){i(e)}}.toString(),")(LZMA, data, callback);\n }\n})();\n\nvar decodeLZMAWithWASM = (function() {\n var LZMA_WASM = (").concat(function(){return function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(256),n=0;n<t.length;n++)i[t.charCodeAt(n)]=n;var r,o,a,s,c,l=.75*e.length,h=e.length,u=0;"="===e[e.length-1]&&(l--,"="===e[e.length-2]&&l--);var d=new ArrayBuffer(l),p=new Uint8Array(d);for(r=0;r<h;r+=4)o=i[e.charCodeAt(r)],a=i[e.charCodeAt(r+1)],s=i[e.charCodeAt(r+2)],c=i[e.charCodeAt(r+3)],p[u++]=o<<2|a>>4,p[u++]=(15&a)<<4|s>>2,p[u++]=(3&s)<<6|63&c;return d}("AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAgAEEMEAY2AjQgAEEMEAY2AjggAEEMEAY2AjwgAEEMEAY2AkAgAEHAARAGNgJEIAAQCDYCSCAAEAg2AkwgABAJNgIEIAAQCjYCCCAACx8BAX9BCBABIgBBADYCACAAQQA2AgQgABALNgIAIAALCgAjACQBEAwkAwthAQF/IAFB+P///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EYdCAFQQh2cjYCACAAQQxqIAFBD2ooAgAiBUEYdCADQQh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsLCyACQRBxBEAgACABIgMtAAA6AAAgAEEBaiIBIAEgA0EBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEIcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEEcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAALIAJBAnEEQCAAIAEtAAA6AAAgAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAACyACQQFxBEAgACABLQAAOgAACwvVAgECfyAAIAFGBEAPCyABIAJqIABNIgNFBEAgACACaiABTSEDCyADBEAgACABIAIQGw8LIAAgAUkEQCABQQdxIABBB3FGBEADQCAAQQdxBEAgAkUEQA8LIAJBAWshAiAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAMAQsLA0AgAkEITwRAIAAgASkDADcDACACQQhrIQIgAEEIaiEAIAFBCGohAQwBCwsLA0AgAgRAIAAiBEEBaiEAIAEiA0EBaiEBIAQgAy0AADoAACACQQFrIQIMAQsLBSABQQdxIABBB3FGBEADQCAAIAJqQQdxBEAgAkUEQA8LIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwNAIAJBCE8EQCACQQhrIgIgAGogASACaikDADcDAAwBCwsLA0AgAgRAIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwsL4AoBCH8gACgCACIGIgQoAgAgBCgCBGovAQgiCCABIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAhrQf//A3FBBXYgCGohCCAHIAQ2AgxBAAUgCCAIQf//A3FBBXZrIQggByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyAGKAIEIAYoAgBqIAg7AQggByIFKAIMIwJJBEAgBSAFKAIMQQh0NgIMIAUoAhBBCHQhByAFKAIAIQYgBSAFKAIIIglBAWo2AgggBSAGIAkQEUH/AXEgB3I2AhALQf//A3FFBEAgAiAAKAIEKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEDIAEhBEEBIQgDQCAKIAMoAgRJBEAgAygCACIHKAIAIQEgBCgCECAHKAIEIAgiBUEBdCIIIAFqai8BCCIGIAQoAgxBC3ZsIglJBH9BgBAgBmtB//8DcUEFdiAGaiEGIAQgCTYCDEEABSAGIAZB//8DcUEFdmshBiAEIAQoAhAgCWs2AhAgBCAEKAIMIAlrNgIMQQELIAcoAgQgBygCACAFQQF0amogBjsBCCAEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhACAEKAIAIQUgBCAEKAIIIgFBAWo2AgggBCAFIAEQEUH/AXEgAHI2AhALQf//A3EgCGohCCAKQQFqIQoMAQsLIAhBASADKAIEdGsPCyAAKAIAIgooAgAhCCAFKAIQIAooAgQgCEECamovAQgiBCABKAIMQQt2bCIDSQR/IAUgAzYCDEEAIQlBgBAgBGtB//8DcUEFdiAEagUgBSAFKAIQIANrNgIQIAUgBSgCDCADazYCDEEBIQkgBCAEQf//A3FBBXZrCyEEIAoiBygCBCAHKAIAQQJqaiAEOwEIIAUiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQUgBigCACEHIAYgBigCCCIIQQFqNgIIIAYgByAIEBFB/wFxIAVyNgIQCyAJQf//A3FFBEAgAiAAKAIIKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEJIAEhA0EBIQRBACECA0AgAiAJKAIESQRAIAMoAhAgCSgCACIFKAIEIAQiBkEBdCIEIAUoAgBqai8BCCIHIAMoAgxBC3ZsIghJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAMgCDYCDEEABSAHIAdB//8DcUEFdmshByADIAMoAhAgCGs2AhAgAyADKAIMIAhrNgIMQQELIAUoAgQgBSgCACAGQQF0amogBzsBCCADKAIMIwJJBEAgAyADKAIMQQh0NgIMIAMoAhBBCHQhBSADKAIAIQcgAyADKAIIIgZBAWo2AgggAyAHIAYQEUH/AXEgBXI2AhALQf//A3EgBGohBCACQQFqIQIMAQsLIARBASAJKAIEdGtBCGoPCyAAKAIMIQQgASEDQQEhCUEAIQIDQCACIAQoAgRJBEAgBCgCACIIKAIAIQogAygCECAIKAIEIAogCSIHQQF0IgFqai8BCCIFIAMoAgxBC3ZsIgZJBH8gAyAGNgIMQQAhBkGAECAFa0H//wNxQQV2IAVqBSADIAMoAhAgBms2AhAgAyADKAIMIAZrNgIMQQEhBiAFIAVB//8DcUEFdmsLIQUgCCgCBCAIKAIAIAdBAXRqaiAFOwEIIAMoAgwjAkkEQCADIAMoAgxBCHQ2AgwgAygCEEEIdCEAIAMoAgAhBSADIAMoAggiCkEBajYCCCADIAUgChARQf8BcSAAcjYCEAsgBkH//wNxIAFqIQkgAkEBaiECDAELCyAJQQEgBCgCBHRrQRBqC5YCAQh/QQEhBwNAAkAgBiABTg0AIAIoAhAgACgCBCAAKAIAIAMgB2oiCUEBdGpqLwEIIgQgAigCDEELdmwiBUkEfyACIAU2AgxBACEFQYAQIARrQf//A3FBBXYgBGoFIAIgAigCECAFazYCECACIAIoAgwgBWs2AgxBASEFIAQgBEH//wNxQQV2awshBCAAKAIEIAAoAgAgCUEBdGpqIAQ7AQggAiIEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhCiAEKAIAIQsgBCAEKAIIIglBAWo2AgggBCALIAkQEUH/AXEgCnI2AhALIAVB//8DcSIEIAdBAXRqIQcgBCAGdCAIciEIIAZBAWohBgwBCwsgCAvwBAEIf0EDIAEgAUEDSxsiAiAAKAIkKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACyEEIAAoAgQhAkEBIQEDQCAHIAQoAgRJBEAgBCgCACIFKAIAIQMgAigCECAFKAIEIAFBAXQiCSADamovAQgiAyACKAIMQQt2bCIGSQR/IAIgBjYCDEEAIQhBgBAgA2tB//8DcUEFdiADagUgAiACKAIQIAZrNgIQIAIgAigCDCAGazYCDEEBIQggAyADQf//A3FBBXZrCyEDIAUoAgQgBSgCACABQQF0amogAzsBCCACKAIMIwJJBEAgAiACKAIMQQh0NgIMIAIoAhBBCHQhBiACKAIAIQUgAiACKAIIIgNBAWo2AgggAiAFIAMQEUH/AXEgBnI2AhALIAhB//8DcSAJaiEBIAdBAWohBwwBCwsgAUEBIAQoAgR0ayIBQQRJBEAgAQ8LIAFBAXFBAnIgAUEBdkEBayICdCEDIAFBDkkEfyAAKAIsIAIgACgCBCADIAFrEB4gA2oFIAAoAgQhASACQQRrIQJBACEEA0AgASABKAIMQQF2NgIMIAEgASgCECABKAIMazYCECABIAEoAhBBACABKAIQQR92ayIHIAEoAgxxajYCECABKAIQIAEoAgxGBEAgAUEBOgAECyABKAIMIwJJBEAgASABKAIMQQh0NgIMIAEoAhBBCHQhBSABKAIAIQggASABKAIIIgZBAWo2AgggASAIIAYQEUH/AXEgBXI2AhALIAdBAWogBEEBdGohBCACQQFrIgINAAsgBEEEdCADaiAAKAIoIgQoAgAgBCgCBCAAKAIEQQAQHmoLC9AcAQ9/IAAQGiAAKAIEIgdBADoABCAHKAIAIAcgBygCCCIDQQFqNgIIIAMQEUH/AXEEQCAHQQE6AAQLIAdBfzYCDCAHQQA2AhBBACEDA0AgA0EESARAIAcoAhBBCHQhBSAHKAIAIQwgByAHKAIIIghBAWo2AgggByAMIAgQEUH/AXEgBXI2AhAgA0EBaiEDDAELCyAHKAIQIAcoAgxGBEAgB0EBOgAECyABBEAgACgCCCACEA82AgQFIAAoAghBBBAPNgIEC0EAIQwDQAJAIAJFIAEgARsiBwR/IAAtAABFBSAHCwRAIAAoAgQoAhBFBEBBAw8LCyAAKAIwIgUoAgAhByAFKAIEIAAoAggoAgBBASAAKAIQdEEBa3EiCyAMQQR0Qf8BcWoiBkEBdCAHamovAQghAyAGIQcgACgCBCIEKAIMQQt2IANsIQggBCgCECAISQR/IAQgCDYCDEEAIQlBgBAgA2tB//8DcUEFdiADagUgBCAEKAIQIAhrNgIQIAQgBCgCDCAIazYCDEEBIQkgAyADQf//A3FBBXZrCyEIIAUiAygCBCADKAIAIAdBAXRqaiAIOwEIIAQiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQggBigCACEDIAYgBigCCCIHQQFqNgIIIAYgAyAHEBFB/wFxIAhyNgIQCyAJQf//A3FFBEAgAkUgASABGw0BIAwhCEEAIQYgACgCCCIFKAIMRSIEBH8gBS0AGEUFIAQLRQRAIAAoAggiBSgCCCIGKAIEQQEgBSgCDEwEfyAFKAIMQQFrBSAFKAIMIAUoAhRBAWtqCyAGKAIAamotAAghBgtBASEEIAAoAggoAgBBASAALQAUdEEBa3EgACgCDHQgBkEIIAAoAgxrdmpBgAZsIQcgCEEHTwRAIAAoAggiBigCCCIJKAIEIA5BAWoiDSAGKAIMTAR/IAYoAgwgDWsFIAYoAgwgBigCFCANa2oLIAkoAgBqai0ACCENA0ACQCANQf8BcUEHdiEGIA1BAXQhDSAAKAIgIgkoAgAhCyAJKAIEIAZBAWpBCHQgB2ogBGoiDEEBdCALamovAQgiCyAAKAIEIgMoAgxBC3ZsIQogAygCECAKSQR/QYAQIAtrQf//A3FBBXYgC2ohCyADIAo2AgxBAAUgCyALQf//A3FBBXZrIQsgAyADKAIQIAprNgIQIAMgAygCDCAKazYCDEEBCyEFIAkoAgQgCSgCACAMQQF0amogCzsBCCADIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEDIAooAgAhDCAKIAooAggiC0EBajYCCCAKIAwgCxARQf8BcSADcjYCEAsgBEEBdCAFciEEIAVB//8DcSAGRw0AIARB//8DcUGAAkkNAQsLCwNAIARBgAJJBEAgBEEBdCEJIAAoAiAiBSgCACEMIAUoAgQgBCAHaiIGQQF0IAxqai8BCCILIAAoAgQiDSgCDEELdmwhCiANKAIQIApJBH9BgBAgC2tB//8DcUEFdiALaiELIA0gCjYCDEEABSALIAtB//8DcUEFdmshCyANIA0oAhAgCms2AhAgDSANKAIMIAprNgIMQQELIAUoAgQgBSgCACAGQQF0amogCzsBCCANIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEGIAooAgAhBSAKIAooAggiDEEBajYCCCAKIAUgDBARQf8BcSAGcjYCEAsgCXIhBAwBCwsgACgCCCIDIAMoAgBBAWo2AgAgAygCCCELIAMgAygCDCIGQQFqNgIMIAsoAgQgCygCACAGamogBEGAAmsiCjoACCADKAIMIAMoAhRGBEAgA0EANgIMIANBAToAGAsgAygCBCgCCCADKAIQRgRAIAMgAygCBCIGKAIIQQF0EA82AgQgAygCBCgCACADKAIEKAIEakEIaiAGKAIAIAYoAgRqQQhqIAYoAggQHCAGKAIAGgsgAygCBCEJIAMgAygCECIMQQFqNgIQIAkoAgQgCSgCACAMamogCjoACCAIIgVBBEkEf0EABSAFQQNrIAVBBmsgBUEKSRsLIQwgAkEBayECDAILIAAoAjQiBigCACEFIAYoAgQgDCIDQQF0IAVqai8BCCIHIAAoAgQiCigCDEELdmwhBCAKKAIQIARJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAogBDYCDEEABSAHIAdB//8DcUEFdmshByAKIAooAhAgBGs2AhAgCiAKKAIMIARrNgIMQQELIAMhBSAGIgMoAgAhDSADKAIEIAVBAXQgDWpqIAc7AQggCiIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhBiAJKAIAIQMgCSAJKAIIIgVBAWo2AgggCSADIAUQEUH/AXEgBnI2AhALQf//A3EEQCACRSABIAEbDQEgACgCCCIIKAIMRSIEBH8gCC0AGEUFIAQLDQEgACgCOCIDKAIAIQggAygCBCAMQQF0IAhqai8BCCIEIAAoAgQiBSgCDEELdmwhByAFKAIQIAdJBH9BgBAgBGtB//8DcUEFdiAEaiEEIAUgBzYCDEEABSAEIARB//8DcUEFdmshBCAFIAUoAhAgB2s2AhAgBSAFKAIMIAdrNgIMQQELIAMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEFIAkoAgAhAyAJIAkoAggiCEEBajYCCCAJIAMgCBARQf8BcSAFcjYCEAtB//8DcQRAIAAoAjwiCCgCACEHIAgoAgQgDEEBdCAHamovAQgiBCAAKAIEIgUoAgxBC3ZsIQYgBSgCECAGSQR/QYAQIARrQf//A3FBBXYgBGohBCAFIAY2AgxBAAUgBCAEQf//A3FBBXZrIQQgBSAFKAIQIAZrNgIQIAUgBSgCDCAGazYCDEEBCyAIIgMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiB0EBajYCCCAJIAMgBxARQf8BcSAIcjYCEAtB//8DcQRAIAAoAkAiAygCACEKIAMoAgQgDEEBdCAKamovAQgiBiAAKAIEIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAZrQf//A3FBBXYgBmohBiAHIAQ2AgxBAAUgBiAGQf//A3FBBXZrIQYgByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyADKAIEIAMoAgAgDEEBdGpqIAY7AQggByIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhCCAJKAIAIQMgCSAJKAIIIgpBAWo2AgggCSADIAoQEUH/AXEgCHI2AhALQf//A3EEQCARIQMgDyERBSAPIQMLIBAhDwUgECEDCyAOIRAgAyEOBSAAKAJEIgYoAgAhCiAGKAIEIAxBBHRB/wFxIAtqIgNBAXQgCmpqLwEIIgcgACgCBCIIKAIMQQt2bCEEIAgoAhAgBEkEf0GAECAHa0H//wNxQQV2IAdqIQcgCCAENgIMQQAFIAcgB0H//wNxQQV2ayEHIAggCCgCECAEazYCECAIIAgoAgwgBGs2AgxBAQsgAyEKIAYiAygCACENIAMoAgQgCkEBdCANamogBzsBCCAIIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiCkEBajYCCCAJIAMgChARQf8BcSAIcjYCEAtB//8DcUUEQEEJQQsgDEEHSRshDCAAKAIIIQQgACgCCCIFKAIIIgMoAgQgDkEBaiIHIAUoAgxMBH8gBSgCDCAHawUgBSgCDCAFKAIUIAdragsgAygCAGpqLQAIIQcgBCAEKAIAQQFqNgIAIAQoAgghBSAEIAQoAgwiBkEBajYCDCAFKAIEIAUoAgAgBmpqIAc6AAggBCgCDCAEKAIURgRAIARBADYCDCAEQQE6ABgLIAQoAgQoAgggBCgCEEYEQCAEIAQoAgQiBigCCEEBdBAPNgIEIAQoAgQoAgAgBCgCBCgCBGpBCGogBigCACAGKAIEakEIaiAGKAIIEBwgBigCABoLIAQoAgQhAyAEIAQoAhAiCEEBajYCECADKAIEIAMoAgAgCGpqIAc6AAggAkEBayECDAQLCyAAKAJMIAAoAgQgCxAdIQtBCEELIAxBB0kbIQwFIA8hESAQIQ8gDiEQQQdBCiAMQQdJGyEMIAAgACgCSCAAKAIEIAsQHSILEB8iDkF/RgRAIAAoAgQoAhAEf0EBBUECCw8LIAJFIAEgARsNASAOIAAoAhhPIgUEfyAFBSAOIAAoAggiBCgCDEwiBgR/IAYFIAQtABgLRQsNAQtBACENIAAoAgghBSAOQQFqIQQgAiALQQJqIgtIIAEgARsEQEEBIQ0gAiELCyALIQYDQCAGQQBKBEAgBSIIKAIIIgkoAgQgBCAFKAIMTAR/IAUoAgwgBGsFIAUoAgwgBSgCFCAEa2oLIAkoAgBqai0ACCEHIAggCCgCAEEBajYCACAIKAIIIQMgCCAIKAIMIgpBAWo2AgwgAygCBCADKAIAIApqaiAHOgAIIAgoAgwgCCgCFEYEQCAIQQA2AgwgCEEBOgAYCyAIKAIEKAIIIAgoAhBGBEAgCCAIKAIEIgMoAghBAXQQDzYCBCAIKAIEKAIAIAgoAgQoAgRqQQhqIAMoAgAgAygCBGpBCGogAygCCBAcIAMoAgAaCyAIKAIEIQkgCCAIKAIQIgNBAWo2AhAgCSgCBCAJKAIAIANqaiAHOgAIIAZBAWshBgwBCwsgAiALayECIA1FDQELC0EBCyYBAX9BEBABIgQgADYCACAEIAE2AgQgBCACNgIIIAQgAzYCDCAEC7YEAQZ/IAAgATYCBEENEA8hAgNAAkAgA0ENTg0AIAIgAyABIAMQEUH/AXEQEiADQQFqIQMMAQsLIAAoAgAhBCACIQZBBBAPIgIoAgQgAigCAGogBigCBCAGKAIAai0ACCIDOgAIIANB/wFxQeEBTwRAQQBBgAFBoQFBDBAAAAsgAigCBCACKAIAQQFqaiADQf8BcUEJcCIHOgAIIAIoAgQgAigCAGogA0H/AXFBCW4iAzoACCADQQVwIQUgAigCBCACKAIAQQJqaiADQQVuIgM6AAggAigCBCACKAIAQQNqaiAFOgAIIAQgBzYCDCAEIAM2AhAgBCAFOgAUIARBADYCHEEAIQIDQAJAIAJBBE8NACAEIAQoAhwgBigCBCAGKAIAIAJBAWpqai0ACCACQQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=")}.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,i){try{var n=new WebAssembly.Memory({initial:16}),r=new WebAssembly.Module(e),o=new WebAssembly.Instance(r,{env:{memory:n,abort:function(){i(new Error("webAssembly abort"))}}}).exports,a=o.newU8Array(t.length);new Uint8Array(n.buffer,a+24,t.length).set(t);var s=o.decode(a),c=new Uint32Array(n.buffer,s,4),l=c[0],h=c[2],u=c[3];l?i(null,new Uint8Array(n.buffer,u+24,h).slice(0,h)):i(new Error("lzma deocder error"))}catch(e){i(e)}}.toString(),')(LZMA_WASM, data, callback);\n }\n})();\n\nself.onmessage = function(event) {\n var packet = event.data;\n if (!packet.id) {\n postMessage({ id: packet.id, error: "No incoming id." });\n return;\n }\n if (!packet.data) {\n postMessage({ id: packet.id, error: "No input data." });\n return;\n }\n if (packet.type == "decompress") {\n if (packet.data.constructor !== Uint8Array) {\n postMessage({ id: packet.id, error: "Input data is not Uint8Array." });\n }\n const callback = function(error, result) {\n if (error) {\n postMessage({ id: packet.id, error: error.toString() });\n } else {\n postMessage({ id: packet.id, result: result, error: null }, [ result.buffer ]);\n }\n }\n if (typeof WebAssembly !== "undefined" && WebAssembly.instantiate) {\n decodeLZMAWithWASM(packet.data, callback);\n } else {\n decodeLZMA(packet.data, callback);\n }\n return;\n }\n postMessage({ id: packet.id, error: "type never matched." });\n};\n'),Ht="undefined"!=typeof Worker&&"undefined"!=typeof Blob,Ut="";if(Ht)try{var Gt=new Blob([zt],{type:"text/javascript"});Ut=URL.createObjectURL(Gt)}catch(e){}var jt=function(){function e(){var e=this;if(!Ht)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(Ut);t.onmessage=function(t){var i=t.data,n=i.id,r=i.result,o=i.error,a=e.getKey(n);e.requests[a]&&(o?e.requests[a](new Error(o)):e.requests[a](null,r),delete e.requests[a])},t.onerror=function(e){return console.error(e)}}return e.prototype.getKey=function(e){return"key_"+String(e)},e.prototype.decompress=function(e,t){var i=++this.callCounter;this.requests[this.getKey(i)]=t,this.worker.postMessage({type:"decompress",id:i,data:e},[e.buffer])},e.prototype.terminate=function(){this.worker.terminate()},e.support=Ht,e}();function Qt(e){return Array.prototype.reduce.call(e,(function(e,t,i){return e|t<<8*i}),0)}function Wt(e){var t=new Uint8Array(e),i=Qt(t.slice(0,4));if(i>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var n=[],r=[],o=4+4*i,a=0;a<i;a++)r[a]=Qt(t.slice(4+4*a,8+4*a)),n[a]=a===i-1?t.subarray(o,o+r[a]):t.slice(o,o+r[a]),o+=r[a];return jt.support?function(e){for(var t=[],i=e.length,n=function(i){t.push(new Promise((function(t,n){var r=new jt;r.decompress(e[i],(function(e,i){if(r.terminate(),e)return n(e);t(i)}))})))},r=0;r<i;r++)n(r);return Promise.all(t)}(n):Promise.resolve(function(e){for(var t,i=[],n=e.length,r=function(n){var r={data:e[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,a={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/o);this.data[t]||(this.data[t]=new Uint8Array(o)),this.data[t][this.offset%o]=e,this.offset++}};Vt.decompressFile(r,a),t=new Uint8Array(a.offset);for(var s=0;s<a.offset;s++)t[s]=a.data[Math.floor(s/o)][s%o];i.push(t)},o=0;o<n;o++)r(o);return i}(n))}function qt(e,t){for(var i={},n=0,r=t;n<r.length;n++){var o=r[n];o in e&&(i[o]=e[o])}return i}var Kt=!1;try{Kt="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}var Xt=[];function Yt(){var e=this.src;this.onerror=this.onload=Pe,this.removeAttribute("src"),/^blob\:/.test(e)&&URL.revokeObjectURL(e),this.close=Pe}function Zt(){Xt.push(this)}function Jt(){return Object.assign(new Image,{crossOrigin:"",close:Yt})}function $t(e){return new Promise((function(t,i){var n=Jt();n.onload=function(){n.onload=n.onerror=Pe,setTimeout((function(){return t(n)}),30)},n.onerror=function(){var e=n.src;n.onload=n.onerror=Pe,n.close(),i(new Error("image load error: ".concat(e)))},n.src=URL.createObjectURL(e)}))}function ei(e,t){if(t&&(e.width>t.width||e.height>t.height)){var i=function(e,t){var i=Xt.shift();if(i)return i.width=e,i.height=t,i;if(Kt){var n=new OffscreenCanvas(e,t);return Object.assign(n,{close:Zt})}return n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),Object.assign(n,{close:Zt})}(Math.min(e.width,t.width),Math.min(e.height,t.height)),n=i.getContext("2d");n.clearRect(0,0,i.width,i.height),n.drawImage(e,0,0,i.width,i.height),e.close();var o=new r.Texture(i);o.needsUpdate=!0,o.flipY=!0;var a=o.dispose;return o.dispose=function(){i.close(),a.call(o),delete o.dispose},o}var s=new r.Texture(e);s.needsUpdate=!0,s.minFilter=r.LinearFilter,s.magFilter=r.LinearFilter,s.flipY=!0;var c=s.dispose;return s.dispose=function(){e.close(),c.call(s),delete s.dispose},s}var ti=new r.WebGLRenderTarget(1,1),ii=new r.OrthographicCamera(-1,1,1,-1,0,1),ni=new r.BufferGeometry;ni.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),ni.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));var ri=new r.Mesh(ni),oi=new r.Scene;oi.add(ri);var ai,si=new r.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0));\n }\n "}),ci=new r.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n "});function li(e,t,i){return void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.format&&(e.format=t.format),void 0!==t.encoding&&(e.encoding=t.encoding),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.magFilter&&(e.magFilter=t.magFilter),i?new Promise((function(t){Je.shared.add((function(){try{var n=i.getRenderTarget();i.setRenderTarget(ti),e instanceof r.CubeTexture?(ri.material=ci,ci.uniforms.map.value=e,i.render(oi,ii),ci.uniforms.map.value=null):(ri.material=si,si.uniforms.map.value=e,i.render(oi,ii),ci.uniforms.map.value=null),i.setRenderTarget(n),t(e)}catch(i){t(e)}}),!0,1)})):Promise.resolve(e)}var hi='\nvar config, transcoderPending, _BasisFile;\nself.onmessage = function(e) {\n var message = e.data;\n switch (message.type) {\n case "init":\n config = message.config;\n init(message.transcoderBinary);\n break;\n case "transcode":\n transcoderPending.then(function() {\n try {\n var result = transcode(message.buffer);\n var width = result.width;\n var height = result.height;\n var hasAlpha = result.hasAlpha;\n var mipmaps = result.mipmaps;\n var format = result.format;\n var buffers = [];\n for (var i = 0; i < mipmaps.length; ++i) {\n buffers.push(mipmaps[i].data.buffer);\n }\n self.postMessage({ type: "transcode", id: message.id, width, height, hasAlpha, mipmaps, format }, buffers);\n } catch (error) {\n console.error(error);\n self.postMessage({ type: "error", id: message.id, error: error.message });\n }\n });\n break;\n default: break;\n }\n};\n\nfunction init(wasmBinary) {\n var BasisModule;\n transcoderPending = new Promise(function(resolve) {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve };\n BASIS(BasisModule); // eslint-disable-line no-undef\n }).then(function() {\n _BasisFile = BasisModule.BasisFile;\n BasisModule.initializeBasis();\n self.postMessage({ type: "initialized" });\n });\n}\n\nfunction transcode(buffer) {\n var basisFile = new _BasisFile(new Uint8Array(buffer));\n var width = basisFile.getImageWidth(0, 0);\n var height = basisFile.getImageHeight(0, 0);\n var levels = basisFile.getNumLevels(0);\n var hasAlpha = basisFile.getHasAlpha();\n function cleanup() {\n basisFile.close();\n basisFile.delete();\n }\n if (!hasAlpha) {\n switch (config.format) {\n case 9: // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA\n config.format = 8; // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB;\n break;\n default: break;\n }\n }\n if (!width || !height || !levels) {\n cleanup();\n throw new Error("BasisTextureLoader: Invalid .basis file");\n }\n if (!basisFile.startTranscoding()) {\n cleanup();\n throw new Error("BasisTextureLoader: .startTranscoding failed");\n }\n var mipmaps = [];\n for (var mip = 0; mip < levels; mip++) {\n var mipWidth = basisFile.getImageWidth(0, mip);\n var mipHeight = basisFile.getImageHeight(0, mip);\n var dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, config.format));\n var status = basisFile.transcodeImage(dst, 0, mip, config.format, 0, hasAlpha);\n if (!status) {\n cleanup();\n throw new Error("BasisTextureLoader: .transcodeImage failed.");\n }\n mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });\n }\n cleanup();\n return { width, height, hasAlpha, mipmaps, format: config.format };\n}\n',ui={cTFETC1:0,cTFETC2:1,cTFBC1:2,cTFBC3:3,cTFBC4:4,cTFBC5:5,cTFBC7_M6_OPAQUE_ONLY:6,cTFBC7_M5:7,cTFPVRTC1_4_RGB:8,cTFPVRTC1_4_RGBA:9,cTFASTC_4x4:10,cTFATC_RGB:11,cTFATC_RGBA_INTERPOLATED_ALPHA:12,cTFRGBA32:13,cTFRGB565:14,cTFBGR565:15,cTFRGBA4444:16},di={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},pi=((ai={})[ui.cTFBC1]=di.COMPRESSED_RGB_S3TC_DXT1_EXT,ai[ui.cTFBC3]=di.COMPRESSED_RGBA_S3TC_DXT5_EXT,ai),fi=function(){function e(){}return e.setTranscoderPath=function(e){return this.transcoderPath=e,this},e.setWorkerLimit=function(e){return this.workerLimit=e,this},e.isInitialized=function(){return 0!==this.workerPool.filter((function(e){return e._initialized})).length},e.detectSupport=function(t){var i=this.workerConfig;if(i.astcSupported=!!t.extensions.get("WEBGL_compressed_texture_astc"),i.bptcSupported=!!t.extensions.get("EXT_texture_compression_bptc"),i.etcSupported=!!t.extensions.get("WEBGL_compressed_texture_etc1"),i.dxtSupported=!!t.extensions.get("WEBGL_compressed_texture_s3tc"),i.pvrtcSupported=!!t.extensions.get("WEBGL_compressed_texture_pvrtc")||!!t.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),i.astcSupported)i.format=e.BASIS_FORMAT.cTFASTC_4x4;else if(i.bptcSupported)i.format=e.BASIS_FORMAT.cTFBC7_M5;else if(i.dxtSupported)i.format=e.BASIS_FORMAT.cTFBC3;else if(i.pvrtcSupported)i.format=e.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!i.etcSupported)throw new Error("BasisTextureLoader: No suitable compressed texture format found.");i.format=e.BASIS_FORMAT.cTFETC1}return this},e.createTexture=function(e){var t,i,n=this,o=e.byteLength,a=this._allocateWorker(o).then((function(r){return t=r,i=n.workerNextTaskID++,new Promise((function(n,r){t._callbacks[i]={resolve:n,reject:r},t.postMessage({type:"transcode",id:i,buffer:e},[e])}))})).then((function(e){var t,i=n.workerConfig,o=e.width,a=e.height,s=e.mipmaps;switch(e.format){case ui.cTFASTC_4x4:t=new r.CompressedTexture(s,o,a,r.RGBA_ASTC_4x4_Format);break;case ui.cTFBC1:case ui.cTFBC3:t=new r.CompressedTexture(s,o,a,pi[i.format],r.UnsignedByteType);break;case ui.cTFETC1:t=new r.CompressedTexture(s,o,a,r.RGB_ETC1_Format);break;case ui.cTFPVRTC1_4_RGB:t=new r.CompressedTexture(s,o,a,r.RGB_PVRTC_4BPPV1_Format);break;case ui.cTFPVRTC1_4_RGBA:t=new r.CompressedTexture(s,o,a,r.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("BasisTextureLoader: No supported format available.")}return t.minFilter=1===s.length?r.LinearFilter:r.LinearMipmapLinearFilter,t.magFilter=r.LinearFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t}));return a.catch((function(){return!0})).then((function(){t&&i&&(t._taskLoad-=o,delete t._callbacks[i])})),a},e._initTranscoder=function(){var e=this;if(!this.transcoderPending){var t=new r.FileLoader;t.setPath(this.transcoderPath);var i=new Promise((function(e,i){t.load("basis_transcoder.js",e,void 0,i)})),n=new r.FileLoader;n.setPath(this.transcoderPath),n.setResponseType("arraybuffer");var o=new Promise((function(e,t){n.load("basis_transcoder.wasm",e,void 0,t)}));this.transcoderPending=Promise.all([i,o]).then((function(t){var i=t[0],n=t[1],r=["/* basis_transcoder.js */",i,"/* worker */",hi].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([r])),e.transcoderBinary=n}))}return this.transcoderPending},e._allocateWorker=function(e){var t=this;return this._initTranscoder().then((function(){if(t.workerPool.length<t.workerLimit){var i=function(e){var t=new Worker(e);return Object.assign(t,{_callbacks:{},_initialized:!1,_taskLoad:0})}(t.workerSourceURL);i._callbacks={},i._initialized=!1,i._taskLoad=0,i.postMessage({type:"init",config:t.workerConfig,transcoderBinary:t.transcoderBinary}),i.onmessage=function(e){var t=e.data;switch(t.type){case"initialized":i._initialized=!0,console.info("BasisTextureLoader: basis loader initialized");break;case"transcode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('BasisTextureLoader: Unexpected message, "'.concat(t.type,'"'))}},t.workerPool.push(i)}else t.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n=t.workerPool[t.workerPool.length-1];return n._taskLoad+=e,n}))},e.prototype.dispose=function(){for(var t=0;t<e.workerPool.length;t++)e.workerPool[t].terminate();return e.workerPool.length=0,this},e.BASIS_FORMAT=ui,e.DXT_FORMAT=di,e.DXT_FORMAT_MAP=pi,e.transcoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/basis/",e.transcoderBinary=null,e.transcoderPending=null,e.workerLimit=1,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.workerConfig={format:null,astcSupported:!1,bptcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1},e}();function mi(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}var gi=function(){function e(e){this.timeout=e.timeout,this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return e.prototype.setAllowHosts=function(e){this.allowHosts=e},e.prototype.setRequestProxy=function(e){this.requestProxy=e},e.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e},e.prototype.load=function(e,i,n,o,a,s){var c;void 0===i&&(i={}),void 0===n&&(n=Pe),void 0===o&&(o=Pe),void 0===a&&(a=Pe);var l=mi(e),h={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},u=null!==(c=i.viaAjax)&&void 0!==c&&c,d=Ge(e),p=/^https?:$/.test(l),f=/\.basis$/.test(je(e).split("?")[0]);if(d?u=!0:p||(u=!1),u){if(f){var m=null,g="arraybuffer";return!0===i.flipY?Promise.reject(new Error(".basis cannnot set flipY: true.")):qe(e,t.__assign(t.__assign({},h),{responseType:g}),void 0,void 0,a).then((function(e){return m=e.meta,fi.createTexture(e.body)})).then((function(e){return!1!==i.preInit?li(e,t.__assign({flipY:!1,encoding:r.sRGBEncoding},qt(i,["wrapS","wrapT"])),s):e})).then((function(e){var t={meta:m,body:e};return n(t),t})).catch((function(e){return o(e),Promise.reject(e)}))}g="blob";return qe(e,t.__assign(t.__assign({},h),{responseType:g}),void 0,void 0,a).then((function(e){return $t(e.body)})).then((function(e){return ei(e,i.maxSize)})).then((function(e){return!1!==i.preInit?li(e,t.__assign({flipY:!0,encoding:r.sRGBEncoding},i),s):e})).then((function(e){var t={meta:null,body:e};return n(t),t})).catch((function(e){return o(e),Promise.reject(e)}))}if(f){var v=new Error("cannot load basis texture via image");return o(v),Promise.reject(v)}var y=null,A=Jt();return Xe(e,h,void 0,void 0,a,A).then((function(e){return y=e.meta,ei(e.body,i.maxSize)})).then((function(e){return!1!==i.preInit?li(e,t.__assign({flipY:!0,encoding:r.sRGBEncoding},i),s):e})).then((function(e){var t={meta:y,body:e};return n(t),t})).catch((function(e){return A.close(),o(e),Promise.reject(e)}))},e.prototype.loadCube=function(e,i,n,o,a,s){var c;void 0===i&&(i={}),void 0===n&&(n=Pe),void 0===o&&(o=Pe),void 0===a&&(a=Pe),performance.now(),Array.isArray(e)||(e=[e.right,e.left,e.up,e.down,e.front,e.back]);for(var l={timeout:this.timeout,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe},h=[],u=[0,0,0,0,0,0],d=[],p=function(n){var r=e[n],s=mi(r),p=function(e){u[n]=e,a(u.reduce((function(e,t){return e+t}),0)/6)},f=null!==(c=i.viaAjax)&&void 0!==c&&c,m=/^https?:$/.test(s),g=Ge(r),v=/\.basis$/.test(je(r).split("?")[0]);if(g?f=!0:m||(f=!1),f)if(v){var y="arraybuffer",A=qe(r,t.__assign(t.__assign({},l),{responseType:y}),void 0,void 0,p).then((function(e){return d[n]=e.meta,fi.createTexture(e.body)}));h.push(A)}else{y="blob",A=qe(r,t.__assign(t.__assign({},l),{responseType:y}),void 0,void 0,p).then((function(e){return d[n]=e.meta,$t(e.body)}));h.push(A)}else{if(v){var x=new Error("cannot load basis texture via image");return o(x),{value:Promise.reject(x)}}var b=Jt();A=Xe(r,l,void 0,void 0,p,b).then((function(e){return d[n]=e.meta,e.body})).catch((function(e){return b.close(),Promise.reject(e)}));h.push(A)}},f=0;f<6;f++){var m=p(f);if("object"==typeof m)return m.value}return Promise.all(h).then((function(e){return performance.now(),e[0]instanceof r.CompressedTexture?function(e){var t=new r.CubeTexture(e);t.needsUpdate=!0;var i=t.dispose;return t.dispose=function(){for(var n=0,r=e;n<r.length;n++)r[n].dispose();i.call(t),delete t.dispose},t.isCompressedTexture=!0,t.format=e[0].format,t.minFilter=e[0].minFilter,t.magFilter=e[0].magFilter,t}(e):function(e){var t=new r.CubeTexture(e);t.needsUpdate=!0,t.minFilter=r.LinearFilter,t.magFilter=r.LinearFilter,t.flipY=!1;var i=t.dispose;return t.dispose=function(){for(var n=0,r=e;n<r.length;n++)r[n].close();i.call(t),delete t.dispose},t}(e)})).then((function(e){return!1!==i.preInit?e.isCompressedTexture?li(e,t.__assign({flipY:!1,encoding:r.sRGBEncoding},qt(i,["wrapS","wrapT"])),s):li(e,t.__assign({flipY:!1,encoding:r.sRGBEncoding},i),s):e})).then((function(e){var t={body:e,meta:d};return n(t),t})).catch((function(e){for(var t=0,i=h;t<i.length;t++){i[t].then((function(e){e instanceof r.Texture?e.dispose():e.close()})).catch(Pe)}return o(e),Promise.reject(e)}))},e}();const vi=o.Reader,yi=o.util,Ai=o.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(o.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),xi=Ai.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.chunks=yi.emptyArray,e.decode=function(e,t){e instanceof vi||(e=vi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ai.Model;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Ai.Chunk.decode(e,e.uint32()));break;default:e.skipType(7&t)}}return n},e})();function bi(e){var t,i,n=(new r.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);function o(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function a(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function s(e){return 1e6*o(e.name)+1e3*a(e.name)+function(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}(e.name)}for(var c=[],l=0,h=(null!==(t=e.chunks)&&void 0!==t?t:[]).sort((function(e,t){return s(e)-s(t)}));l<h.length;l++){var u=o((L=h[l]).name);c[u]||(c[u]=[]),c[u].push(L)}for(var d=[],p=0;p<c.length;p++){var f=c[p];if(f){for(var m=0,g=0,v=0;v<f.length;v++){g+=(L=f[v]).vertices.xyz.length/3,m+=L.faces.indices.length}for(var y=3*g,A=2*g,x=3*g,b=m,w=new ArrayBuffer(4*y+4*A+4*x+4*b),M=new Float32Array(w,0,y),E=new Float32Array(w,4*y,A),S=new Float32Array(w,4*y+4*A,x),_=new Uint32Array(w,4*y+4*A+4*x,b),T=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],I=0,P=0,R=0;R<f.length;R++){var L,B=(L=f[R]).vertices.xyz,D=L.vertices.uvs,O=L.faces.indices,N=B.length/3,k=O.length,F=[1/0,1/0,1/0,-1/0,-1/0,-1/0];for(v=0;v<N;v++){var V=B[3*v],z=B[3*v+1],H=B[3*v+2],U=n.elements,G=1/(U[3]*V+U[7]*z+U[11]*H+U[15]),j=(U[0]*V+U[4]*z+U[8]*H+U[12])*G,Q=(U[1]*V+U[5]*z+U[9]*H+U[13])*G,W=(U[2]*V+U[6]*z+U[10]*H+U[14])*G;M[3*P+3*v]=j,M[3*P+3*v+1]=Q,M[3*P+3*v+2]=W,E[2*P+2*v]=D[2*v],E[2*P+2*v+1]=D[2*v+1],j<F[0]&&(F[0]=j),Q<F[1]&&(F[1]=Q),W<F[2]&&(F[2]=W),j>F[3]&&(F[3]=j),Q>F[4]&&(F[4]=Q),W>F[5]&&(F[5]=W)}F[0]<C[0]&&(C[0]=F[0]),F[1]<C[1]&&(C[1]=F[1]),F[2]<C[2]&&(C[2]=F[2]),F[3]>C[3]&&(C[3]=F[3]),F[4]>C[4]&&(C[4]=F[4]),F[5]>C[5]&&(C[5]=F[5]);for(v=0;v<k;v++)_[I+v]=P+O[v];T.push({materialIndex:R,name:L.name,chunkName:a(L.name),start:I,count:L.faces.indices.length,texture:null!==(i=L.texture)&&void 0!==i?i:void 0}),P+=N,I+=k}for(v=0;v<m;v+=3){var q,K,X,Y,Z,J,$,ee,te,ie,ne,re,oe,ae,se,ce,le,he,ue;q=3*_[v],K=3*_[v+1],X=3*_[v+2],Y=M[q],Z=M[q+1],J=M[q+2],$=M[K],ee=M[K+1],te=M[K+2],ie=M[X],le=(re=M[X+1]-ee)*(ce=J-te)-(oe=M[X+2]-te)*(se=Z-ee),he=oe*(ae=Y-$)-(ne=ie-$)*ce,ue=ne*se-re*ae,S[q]+=le,S[q+1]+=he,S[q+2]+=ue,S[K]+=le,S[K+1]+=he,S[K+2]+=ue,S[X]+=le,S[X+1]+=he,S[X+2]+=ue}d.push({floorIndex:p,vertices:M,uvs:E,indices:_,normals:S,groups:T,extents:C})}}return d}function wi(e,i,n,o,a){var s=t.__assign({key:"texture.pbm",basisLoaderInitialized:fi.isInitialized()},qt(i,["format","quality","size","sharpen","mappings"]));return e=i.transform?i.transform(e,s):it(e,s),new gi({allowHosts:n,requestProxy:o,networkSubscribe:a}).load(e,{wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,minFilter:r.LinearFilter,maxSize:"number"==typeof s.size?new r.Vector2(s.size,s.size):void 0,preInit:!0}).then((function(e){var t=e.body;return t.needsUpdate=!0,t}))}function Mi(e,t,i,n,o,a,s,c){void 0===o&&(o={});for(var l=[],h=0,u=bi(e);h<u.length;h++){var d=u[h],p=d.floorIndex,f=d.vertices,m=d.uvs,g=d.indices,v=d.normals,y=d.groups,A=d.extents,x=new r.Box3;x.min.x=A[0],x.min.y=A[1],x.min.z=A[2],x.max.x=A[3],x.max.y=A[4],x.max.z=A[5];var b=new r.BufferGeometry;b.setAttribute("position",new r.BufferAttribute(f,3)),b.setAttribute("uv",new r.BufferAttribute(m,2)),b.setAttribute("normal",new r.BufferAttribute(v,3)),b.setIndex(new r.BufferAttribute(g,1)),b.boundingBox=x,b.boundingSphere=x.getBoundingSphere(new r.Sphere);for(var w=0,M=y;w<M.length;w++){var E=M[w];b.addGroup(E.start,E.count,E.materialIndex)}for(var S=[],_=function(e){var l=i[e.chunkName]||(e.texture?t+e.texture:void 0),h=new mt;if(S.push(h),l){var u=void 0;l in o?u=o[l]:(u=wi(l,n,a,s,c),o[l]=u),u.then((function(e){h.uniforms.map.value=e,h.uniforms.exposure.value=3.3}),(function(){h.defines.USE_MAP=!1,h.uniforms.diffuse.value=new r.Color(16777215)}))}else h.defines.USE_MAP=!1,h.uniforms.diffuse.value=new r.Color(16777215)},T=0,C=y;T<C.length;T++){_(E=C[T])}var I=new ot(b,S);I.name="model_floor_"+p,I.floorIndex=p,l.push(I)}return{objects:l,texturePromise:Promise.all(Object.keys(o).map((function(e){return o[e].catch(Pe)}))).then(Pe)}}function Ei(e,t){return!1!==(e=Object.assign({},e)).autoResize&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>12?e.size=Math.min(e.size||1/0,800):t>3&&(e.size=Math.min(e.size||1/0,1024))),e}function Si(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}Ai.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name="",e.prototype.texture="",e.decode=function(e,t){e instanceof vi||(e=vi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ai.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.vertices=Ai.Vertices.decode(e,e.uint32());break;case 2:n.faces=Ai.Faces.decode(e,e.uint32());break;case 3:n.name=e.string();break;case 4:n.texture=e.string();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("vertices"))throw yi.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw yi.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw yi.ProtocolError("missing required 'name'",{instance:n});return n},e})(),Ai.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.xyz=yi.emptyArray,e.prototype.uvs=yi.emptyArray,e.decode=function(e,t){e instanceof vi||(e=vi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ai.Vertices;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.xyz.push(e.float())}else n.xyz.push(e.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.uvs.push(e.float())}else n.uvs.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ai.Faces=(()=>{function e(e){if(this.indices=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.indices=yi.emptyArray,e.decode=function(e,t){e instanceof vi||(e=vi.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ai.Faces;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.indices.push(e.uint32())}else n.indices.push(e.uint32());break;default:e.skipType(7&t)}}return n},e})();const _i=o.Reader,Ti=o.util,Ci=o.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(o.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),Ii=Ci.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.meshes=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Model;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(Ci.Mesh.decode(e,e.uint32()));break;default:e.skipType(7&t)}}return n},e})();function Pi(e){for(var t=[0,0,0],i=0;i<e.attributes.normal.array.length/9;i++)t[0]=e.attributes.normal.array[9*i],t[1]=e.attributes.normal.array[9*i+1],t[2]=e.attributes.normal.array[9*i+2],e.attributes.normal.array[9*i]=e.attributes.normal.array[9*i+6],e.attributes.normal.array[9*i+1]=e.attributes.normal.array[9*i+7],e.attributes.normal.array[9*i+2]=e.attributes.normal.array[9*i+8],e.attributes.normal.array[9*i+6]=t[0],e.attributes.normal.array[9*i+7]=t[1],e.attributes.normal.array[9*i+8]=t[2];for(i=0;i<e.attributes.position.array.length/9;i++)t[0]=e.attributes.position.array[9*i],t[1]=e.attributes.position.array[9*i+1],t[2]=e.attributes.position.array[9*i+2],e.attributes.position.array[9*i]=e.attributes.position.array[9*i+6],e.attributes.position.array[9*i+1]=e.attributes.position.array[9*i+7],e.attributes.position.array[9*i+2]=e.attributes.position.array[9*i+8],e.attributes.position.array[9*i+6]=t[0],e.attributes.position.array[9*i+7]=t[1],e.attributes.position.array[9*i+8]=t[2];for(i=0;i<e.attributes.uv.array.length/6;i++)t[0]=e.attributes.uv.array[6*i],t[1]=e.attributes.uv.array[6*i+1],e.attributes.uv.array[6*i]=e.attributes.uv.array[6*i+4],e.attributes.uv.array[6*i+1]=e.attributes.uv.array[6*i+5],e.attributes.uv.array[6*i+4]=t[0],e.attributes.uv.array[6*i+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function Ri(e){var t=e.position,i=e.normal,n=e.uv,o=e.uv2,a=e.groups,s=new r.BufferGeometry;s.setAttribute("position",new r.BufferAttribute(new Float32Array(t.array),3)),i&&s.setAttribute("normal",new r.BufferAttribute(new Float32Array(i.array),3)),n&&s.setAttribute("uv",new r.BufferAttribute(new Float32Array(n.array),2)),o&&s.setAttribute("uv2",new r.BufferAttribute(new Float32Array(o.array),2));for(var c=0,l=a;c<l.length;c++){var h=l[c];s.addGroup(h.start,h.count,h.materialIndex)}return s}function Li(e,i,n,o,a,s){if(s.hasOwnProperty(e))return s[e];Si(e=e.split("?")[0])||(e=i+e),0===(e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(e="https:"+e);var c=t.__assign({key:"texture.dome",size:64,basisLoaderInitialized:fi.isInitialized()},qt(n,["quality","format","sharpen","mappings"]));return s[e=n.transform?n.transform(e,c):it(e,c)]=a.load(e,{wrapS:r.RepeatWrapping,wrapT:r.RepeatWrapping}).then((function(e){var t=e.body;return o&&t.repeat.copy(o),t.needsUpdate=!0,t.updateMatrix(),t}))}function Bi(e,t,i,n,o){var a=[],s=new mt,c=s.uniforms;c.exposure.value=4.3;var l=s.defines;if(l.USE_MAP=!1,l.USE_UV=!1,e.kd&&(c.diffuse.value=(new r.Color).fromArray(e.kd.rgb)),e.mapkd){var h=null;if(e.mapkdrepeat){var u=e.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),d=u[0],p=u[1];h=new r.Vector2(d,p)}a.push(Li(e.mapkd,t,i,h,n,o).then((function(e){l.USE_MAP=!0,l.USE_UV=!0,c.map.value=e,c.uvTransform.value=e.matrix,s.needsUpdate=!0})).catch(Pe))}if(e.ks&&(c.specular.value=(new r.Color).fromArray(e.ks.rgb)),e.mapks&&a.push(Li(e.mapks,t,i,null,n,o).then((function(e){c.specularMap.value=e})).catch(Pe)),e.ke&&(c.emissive.value=(new r.Color).fromArray(e.ke.rgb)),e.mapke&&a.push(Li(e.mapke,t,i,null,n,o).then((function(e){c.emissiveMap.value=e})).catch(Pe)),e.norm&&a.push(Li(e.norm,t,i,null,n,o).then((function(e){c.normalMap.value=e})).catch(Pe)),e.mapbump&&a.push(Li(e.mapbump,t,i,null,n,o).then((function(e){c.bumpMap.value=e})).catch(Pe)),e.bump&&a.push(Li(e.bump,t,i,null,n,o).then((function(e){c.bumpMap.value=e})).catch(Pe)),"number"==typeof e.ns&&(c.shininess.value=e.ns),"number"==typeof e.d){var f=e.d;f>0&&f<1&&(s.originOpacity=f,s.opacity=f)}return{material:s,textureReady:Promise.all(a).then(Pe)}}function Di(e,t,i,n,o,a){for(var s,c=[],l=[],h=(s=e,Ii.decode(s).meshes),u=new gi({allowHosts:n,requestProxy:o,networkSubscribe:a}),d=new r.Matrix4,p=new r.Vector3,f=new r.Quaternion,m=new r.Vector3,g={},v=0,y=h;v<y.length;v++){var A=y[v],x=A.name,b=A.chunks,w=A.matrix;if("Ceiling"!==x&&"CeilingDrop"!==x)for(var M=0,E=w;M<E.length;M++){var S=E[M];d.elements=S.elements;var _=new st;_.renderOrder=-3;for(var T=0;T<b.length;T++){var C=Ri(b[T].geometry);C.applyMatrix4(d),d.decompose(p,f,m),m.x*m.y*m.z<0&&C.attributes.normal&&C.attributes.position&&C.attributes.uv&&Pi(C);for(var I=[],P=0,R=b[T].material;P<R.length;P++){var L=Bi(R[P],t,i,u,g),B=L.material,D=L.textureReady;l.push(D),I.push(B)}var O=new ot(C,I);O.name="chunk_"+T,_.add(O)}_.floorIndex=0,_.name=x,c.push(_)}}return{objects:c,texturePromise:Promise.all(l).catch(Pe)}}function Oi(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}Ci.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.name="",e.prototype.chunks=Ti.emptyArray,e.prototype.matrix=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Mesh;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.name=e.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Ci.Chunk.decode(e,e.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(Ci.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("name"))throw Ti.ProtocolError("missing required 'name'",{instance:n});return n},e})(),Ci.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.elements=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Matrix;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.elements&&n.elements.length||(n.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.elements.push(e.float())}else n.elements.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ci.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.geometry=null,e.prototype.material=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Chunk;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 2:n.geometry=Ci.Geometry.decode(e,e.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(Ci.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("geometry"))throw Ti.ProtocolError("missing required 'geometry'",{instance:n});return n},e})(),Ci.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Geometry;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.position=Ci.Position.decode(e,e.uint32());break;case 2:n.uv=Ci.UV.decode(e,e.uint32());break;case 3:n.uv2=Ci.UV.decode(e,e.uint32());break;case 4:n.normal=Ci.Normal.decode(e,e.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(Ci.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("position"))throw Ti.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw Ti.ProtocolError("missing required 'normal'",{instance:n});return n},e})(),Ci.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Position;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ci.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.UV;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ci.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.array=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Normal;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),Ci.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Group;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.start=e.uint32();break;case 2:n.count=e.uint32();break;case 3:n.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("start"))throw Ti.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw Ti.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw Ti.ProtocolError("missing required 'materialIndex'",{instance:n});return n},e})(),Ci.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd="",e.prototype.mapks="",e.prototype.mapke="",e.prototype.norm="",e.prototype.mapbump="",e.prototype.bump="",e.prototype.mapd="",e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat="",e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Material;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:n.kd=Ci.Color.decode(e,e.uint32());break;case 2:n.ks=Ci.Color.decode(e,e.uint32());break;case 3:n.ke=Ci.Color.decode(e,e.uint32());break;case 4:n.mapkd=e.string();break;case 5:n.mapks=e.string();break;case 6:n.mapke=e.string();break;case 7:n.norm=e.string();break;case 8:n.mapbump=e.string();break;case 9:n.bump=e.string();break;case 10:n.mapd=e.string();break;case 11:n.ns=e.float();break;case 12:n.d=e.float();break;case 13:n.tr=e.float();break;case 14:n.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return n},e})(),Ci.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.rgb=Ti.emptyArray,e.decode=function(e,t){e instanceof _i||(e=_i.create(e));let i=void 0===t?e.len:e.pos+t,n=new Ci.Color;for(;e.pos<i;){let t=e.uint32();switch(t>>>3){case 1:if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.rgb.push(e.float())}else n.rgb.push(e.float());break;default:e.skipType(7&t)}}return n},e})();const Ni={};function ki(e,{precision:t=Ni.precision||4}={}){return e=function(e){return Math.round(e/Ni.EPSILON)*Ni.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function Fi(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Vi(e,t,i){const n=Ni.EPSILON;i&&(Ni.EPSILON=i);try{if(e===t)return!0;if(Fi(e)&&Fi(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!Vi(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=Ni.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{Ni.EPSILON=n}}Ni.EPSILON=1e-12,Ni.debug=!1,Ni.precision=4,Ni.printTypes=!1,Ni.printDegrees=!1,Ni.printRowMajor=!0;class zi extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){get ELEMENTS(){return Oi(!1),0}clone(){return(new this.constructor).copy(this)}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}fromArray(e,t=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=e[i+t];return this.check()}to(e){return e===this?this:Fi(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toArray(e=[],t=0){for(let i=0;i<this.ELEMENTS;++i)e[t+i]=this[i];return e}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Ni)}formatString(e){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+ki(this[i],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Vi(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,i){void 0===i&&(i=t,t=e,e=this);for(let n=0;n<this.ELEMENTS;++n){const r=e[n];this[n]=r+i*(t[n]-r)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e[i]),t[i]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if(Array.isArray(e))return this.multiply(e);for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.scale(1/e)}clampScalar(e,t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e),t);return this.check()}multiplyByScalar(e){return this.scale(e)}get elements(){return this}check(){if(Ni.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}function Hi(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function Ui(e,t,i=""){if(Ni.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(i," some fields set to invalid numbers'"));return e}const Gi={};function ji(e,t){Gi[e]||(Gi[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}class Qi extends zi{get ELEMENTS(){return Oi(!1),0}copy(e){return Oi(!1),this}get x(){return this[0]}set x(e){this[0]=Hi(e)}get y(){return this[1]}set y(e){this[1]=Hi(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let i=0;i<this.ELEMENTS;++i){const n=this[i]-e[i];t+=n*n}return Hi(t)}dot(e){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*e[i];return Hi(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Oi(e>=0&&e<this.ELEMENTS,"index is out of range"),Hi(this[e])}setComponent(e,t){return Oi(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var Wi="undefined"!=typeof Float32Array?Float32Array:Array;function qi(){var e=new Wi(3);return Wi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Ki(e,t,i){var n=new Wi(3);return n[0]=e,n[1]=t,n[2]=i,n}function Xi(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Yi(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[0],s=i[1],c=i[2];return e[0]=r*c-o*s,e[1]=o*a-n*c,e[2]=n*s-r*a,e}function Zi(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return a=a||1,e[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/a,e[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,e[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,e}function Ji(e,t,i){var n=t[0],r=t[1],o=t[2];return e[0]=n*i[0]+r*i[3]+o*i[6],e[1]=n*i[1]+r*i[4]+o*i[7],e[2]=n*i[2]+r*i[5]+o*i[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var $i=function(e){var t=e[0],i=e[1],n=e[2];return Math.hypot(t,i,n)};function en(e,t,i){const n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o||1;return e[0]=(i[0]*n+i[4]*r+i[8]*o)/a,e[1]=(i[1]*n+i[5]*r+i[9]*o)/a,e[2]=(i[2]*n+i[6]*r+i[10]*o)/a,e}qi();const tn=[0,0,0],nn={};class rn extends Qi{static get ZERO(){return nn.ZERO=nn.ZERO||Object.freeze(new rn(0,0,0,0))}constructor(e=0,t=0,i=0){super(-0,-0,-0),1===arguments.length&&Fi(e)?this.copy(e):(Ni.debug&&(Hi(e),Hi(t),Hi(i)),this[0]=e,this[1]=t,this[2]=i)}set(e,t,i){return this[0]=e,this[1]=t,this[2]=i,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Ni.debug&&(Hi(e.x),Hi(e.y),Hi(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Hi(e)}angle(e){return i=e,n=(t=this)[0],r=t[1],o=t[2],a=i[0],s=i[1],c=i[2],l=Math.sqrt(n*n+r*r+o*o)*Math.sqrt(a*a+s*s+c*c),h=l&&Xi(t,i)/l,Math.acos(Math.min(Math.max(h,-1),1));var t,i,n,r,o,a,s,c,l,h}cross(e){return Yi(this,this,e),this.check()}rotateX({radians:e,origin:t=tn}){var i,n,r,o,a,s;return i=this,r=t,o=e,s=[],(a=[])[0]=(n=this)[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],s[0]=a[0],s[1]=a[1]*Math.cos(o)-a[2]*Math.sin(o),s[2]=a[1]*Math.sin(o)+a[2]*Math.cos(o),i[0]=s[0]+r[0],i[1]=s[1]+r[1],i[2]=s[2]+r[2],this.check()}rotateY({radians:e,origin:t=tn}){var i,n,r,o,a,s;return i=this,r=t,o=e,s=[],(a=[])[0]=(n=this)[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],s[0]=a[2]*Math.sin(o)+a[0]*Math.cos(o),s[1]=a[1],s[2]=a[2]*Math.cos(o)-a[0]*Math.sin(o),i[0]=s[0]+r[0],i[1]=s[1]+r[1],i[2]=s[2]+r[2],this.check()}rotateZ({radians:e,origin:t=tn}){var i,n,r,o,a,s;return i=this,r=t,o=e,s=[],(a=[])[0]=(n=this)[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],s[0]=a[0]*Math.cos(o)-a[1]*Math.sin(o),s[1]=a[0]*Math.sin(o)+a[1]*Math.cos(o),s[2]=a[2],i[0]=s[0]+r[0],i[1]=s[1]+r[1],i[2]=s[2]+r[2],this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Zi(this,this,e),this.check()}transformAsVector(e){return en(this,this,e),this.check()}transformByMatrix3(e){return Ji(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,i){const n=t[0],r=t[1];e[0]=i[0]*n+i[2]*r,e[1]=i[1]*n+i[3]*r,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return function(e,t,i){var n=i[0],r=i[1],o=i[2],a=i[3],s=t[0],c=t[1],l=t[2],h=r*l-o*c,u=o*s-n*l,d=n*c-r*s,p=r*d-o*u,f=o*h-n*d,m=n*u-r*h,g=2*a;h*=g,u*=g,d*=g,p*=2,f*=2,m*=2,e[0]=s+h+p,e[1]=c+u+f,e[2]=l+d+m}(this,this,e),this.check()}}var on={throttleRequests:!0,maxRequests:5},an=function(){function e(e){void 0===e&&(e={}),this.props=t.__assign(t.__assign({},on),e),this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return e.prototype.scheduleRequest=function(e,t){if(void 0===t&&(t=function(){return 0}),!this.props.throttleRequests)return Promise.resolve({done:function(){}});if(this.requestMap.has(e))return this.requestMap.get(e);var i={identiy:e,priority:0,getPriority:t,resolve:function(){}},n=new Promise((function(e){return i.resolve=e}));return this.requestQueue.push(i),this.requestMap.set(e,n),this.issueNewRequests(),n},e.prototype.issueRequest=function(e){var t=this,i=e.identiy,n=e.resolve,r=!1;this.activeRequestCount++,n({done:function(){r||(r=!0,t.requestMap.delete(i),t.activeRequestCount--,t.issueNewRequests())}})},e.prototype.issueNewRequests=function(){var e=this;this.deferred||(this.deferred=setTimeout((function(){return e.issueNewRequestsAsync()}),0))},e.prototype.issueNewRequestsAsync=function(){this.deferred=null;var e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this.updateAllRequests();for(var t=0;t<e;t++){var i=this.requestQueue.shift();i&&this.issueRequest(i)}}},e.prototype.updateAllRequests=function(){for(var e=this.requestQueue,t=0;t<e.length;t++){var i=e[t];this.updateRequest(i)||(e.splice(t,1),this.requestMap.delete(i.identiy),t--)}e.sort((function(e,t){return e.priority-t.priority}))},e.prototype.updateRequest=function(e){return e.priority=e.getPriority(e.identiy),!(e.priority<0)||(e.resolve(null),!1)},e}(),sn=function(e,t,i){this.item=e,this.previous=t,this.next=i},cn=function(){function e(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=new sn(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t},e.prototype.remove=function(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--},e.prototype.splice=function(e,t){e!==t&&(this.remove(t),this.insert(e,t))},e.prototype.insert=function(e,t){var i=e.next;e.next=t,this.tail===e?this.tail=t:i.previous=t,t.next=i,t.previous=e,this._length++},e}(),ln=function(){function e(){this.list=new cn,this.sentinel=this.list.add("sentinel")}return e.prototype.reset=function(){this.list.splice(this.list.tail,this.sentinel)},e.prototype.touch=function(e){var t=e.cacheNode;t&&this.list.splice(this.sentinel,t)},e.prototype.add=function(e,t){e.cacheNode||(e.cacheNode=this.list.add(e),t&&t(e))},e.prototype.unloadTile=function(e,t){var i=e.cacheNode;i&&(this.list.remove(i),e.cacheNode=void 0,t&&t(e))},e.prototype.unloadTiles=function(e,t){for(var i=this.list.head;i!==this.sentinel&&e();){var n=i.item;i=i.next,this.unloadTile(n,t)}},e}();class hn extends zi{get ELEMENTS(){return Oi(!1),0}get RANK(){return Oi(!1),0}toString(){let e="[";if(Ni.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let i=0;i<this.RANK;++i)e+=" ".concat(this[i*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,i){return this[t*this.RANK+e]=Hi(i),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const i=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[i+e];return t}setColumn(e,t){const i=e*this.RANK;for(let e=0;e<this.RANK;++e)this[i+e]=t[e];return this}}function un(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],v=t[14],y=t[15],A=i[0],x=i[1],b=i[2],w=i[3];return e[0]=A*n+x*s+b*u+w*m,e[1]=A*r+x*c+b*d+w*g,e[2]=A*o+x*l+b*p+w*v,e[3]=A*a+x*h+b*f+w*y,A=i[4],x=i[5],b=i[6],w=i[7],e[4]=A*n+x*s+b*u+w*m,e[5]=A*r+x*c+b*d+w*g,e[6]=A*o+x*l+b*p+w*v,e[7]=A*a+x*h+b*f+w*y,A=i[8],x=i[9],b=i[10],w=i[11],e[8]=A*n+x*s+b*u+w*m,e[9]=A*r+x*c+b*d+w*g,e[10]=A*o+x*l+b*p+w*v,e[11]=A*a+x*h+b*f+w*y,A=i[12],x=i[13],b=i[14],w=i[15],e[12]=A*n+x*s+b*u+w*m,e[13]=A*r+x*c+b*d+w*g,e[14]=A*o+x*l+b*p+w*v,e[15]=A*a+x*h+b*f+w*y,e}function dn(e,t,i){var n=i[0],r=i[1],o=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}!function(){var e,t=(e=new Wi(2),Wi!=Float32Array&&(e[0]=0,e[1]=0),e)}(),function(){var e,t=(e=new Wi(4),Wi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();const pn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),fn=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),mn=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),gn={};class vn extends hn{static get IDENTITY(){return gn.IDENTITY=gn.IDENTITY||Object.freeze(new vn(pn)),gn.IDENTITY}static get ZERO(){return gn.ZERO=gn.ZERO||Object.freeze(new vn(fn)),gn.ZERO}get INDICES(){return mn}get ELEMENTS(){return 16}get RANK(){return 4}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,i,n,r,o,a,s,c,l,h,u,d,p,f,m){return this[0]=e,this[1]=t,this[2]=i,this[3]=n,this[4]=r,this[5]=o,this[6]=a,this[7]=s,this[8]=c,this[9]=l,this[10]=h,this[11]=u,this[12]=d,this[13]=p,this[14]=f,this[15]=m,this.check()}setRowMajor(e,t,i,n,r,o,a,s,c,l,h,u,d,p,f,m){return this[0]=e,this[1]=r,this[2]=c,this[3]=d,this[4]=t,this[5]=o,this[6]=l,this[7]=p,this[8]=i,this[9]=a,this[10]=h,this[11]=f,this[12]=n,this[13]=s,this[14]=u,this[15]=m,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(pn)}fromQuaternion(e){return function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=i+i,s=n+n,c=r+r,l=i*a,h=n*a,u=n*s,d=r*a,p=r*s,f=r*c,m=o*a,g=o*s,v=o*c;e[0]=1-u-f,e[1]=h+v,e[2]=d-g,e[3]=0,e[4]=h-v,e[5]=1-l-f,e[6]=p+m,e[7]=0,e[8]=d+g,e[9]=p-m,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum({left:e,right:t,bottom:i,top:n,near:r,far:o}){return o===1/0?vn._computeInfinitePerspectiveOffCenter(this,e,t,i,n,r):function(e,t,i,n,r,o,a){var s=1/(i-t),c=1/(r-n),l=1/(o-a);e[0]=2*o*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*c,e[6]=0,e[7]=0,e[8]=(i+t)*s,e[9]=(r+n)*c,e[10]=(a+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*l,e[15]=0}(this,e,t,i,n,r,o),this.check()}static _computeInfinitePerspectiveOffCenter(e,t,i,n,r,o){const a=2*o/(i-t),s=2*o/(r-n),c=(i+t)/(i-t),l=(r+n)/(r-n),h=-2*o;return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}lookAt(e,t,i){return 1===arguments.length&&({eye:e,center:t,up:i}=e),function(e,t,i,n){var r,o,a,s,c,l,h,u,d,p,f=t[0],m=t[1],g=t[2],v=n[0],y=n[1],A=n[2],x=i[0],b=i[1],w=i[2];Math.abs(f-x)<1e-6&&Math.abs(m-b)<1e-6&&Math.abs(g-w)<1e-6?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(h=f-x,u=m-b,d=g-w,r=y*(d*=p=1/Math.hypot(h,u,d))-A*(u*=p),o=A*(h*=p)-v*d,a=v*u-y*h,(p=Math.hypot(r,o,a))?(r*=p=1/p,o*=p,a*=p):(r=0,o=0,a=0),s=u*a-d*o,c=d*r-h*a,l=h*o-u*r,(p=Math.hypot(s,c,l))?(s*=p=1/p,c*=p,l*=p):(s=0,c=0,l=0),e[0]=r,e[1]=s,e[2]=h,e[3]=0,e[4]=o,e[5]=c,e[6]=u,e[7]=0,e[8]=a,e[9]=l,e[10]=d,e[11]=0,e[12]=-(r*f+o*m+a*g),e[13]=-(s*f+c*m+l*g),e[14]=-(h*f+u*m+d*g),e[15]=1)}(this,e,t=t||[0,0,0],i=i||[0,1,0]),this.check()}ortho({left:e,right:t,bottom:i,top:n,near:r=.1,far:o=500}){return function(e,t,i,n,r,o,a){var s=1/(t-i),c=1/(n-r),l=1/(o-a);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+i)*s,e[13]=(r+n)*c,e[14]=(a+o)*l,e[15]=1}(this,e,t,i,n,r,o),this.check()}orthographic({fovy:e=45*Math.PI/180,aspect:t=1,focalDistance:i=1,near:n=.1,far:r=500}){if(e>2*Math.PI)throw Error("radians");const o=e/2,a=i*Math.tan(o),s=a*t;return(new vn).ortho({left:-s,right:s,bottom:-a,top:a,near:n,far:r})}perspective({fovy:e,fov:t=45*Math.PI/180,aspect:i=1,near:n=.1,far:r=500}={}){if((e=e||t)>2*Math.PI)throw Error("radians");return function(e,t,i,n,r){var o,a=1/Math.tan(t/2);e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(o=1/(n-r),e[10]=(r+n)*o,e[14]=2*r*n*o):(e[10]=-1,e[14]=-2*n)}(this,e,i,n,r),this.check()}determinant(){return t=(e=this)[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],c=e[7],l=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],(t*a-i*o)*(u*g-d*m)-(t*s-n*o)*(h*g-d*f)+(t*c-r*o)*(h*m-u*f)+(i*s-n*a)*(l*g-d*p)-(i*c-r*a)*(l*m-u*p)+(n*c-r*s)*(l*f-h*p);var e,t,i,n,r,o,a,s,c,l,h,u,d,p,f,m,g}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const i=this.getScale(t||[-0,-0,-0]),n=1/i[0],r=1/i[1],o=1/i[2];return e[0]=this[0]*n,e[1]=this[1]*r,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*n,e[5]=this[5]*r,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*n,e[9]=this[9]*r,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const i=this.getScale(t||[-0,-0,-0]),n=1/i[0],r=1/i[1],o=1/i[2];return e[0]=this[0]*n,e[1]=this[1]*r,e[2]=this[2]*o,e[3]=this[4]*n,e[4]=this[5]*r,e[5]=this[6]*o,e[6]=this[8]*n,e[7]=this[9]*r,e[8]=this[10]*o,e}transpose(){return function(e,t){if(e===t){var i=t[1],n=t[2],r=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=r,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){var e,t,i,n,r,o,a,s,c,l,h,u,d,p,f,m,g,v,y,A,x,b,w,M,E,S,_,T,C,I,P;return e=this,i=(t=this)[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],c=t[6],l=t[7],h=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],(P=(y=i*s-n*a)*(I=d*v-p*g)-(A=i*c-r*a)*(C=u*v-p*m)+(x=i*l-o*a)*(T=u*g-d*m)+(b=n*c-r*s)*(_=h*v-p*f)-(w=n*l-o*s)*(S=h*g-d*f)+(M=r*l-o*c)*(E=h*m-u*f))&&(P=1/P,e[0]=(s*I-c*C+l*T)*P,e[1]=(r*C-n*I-o*T)*P,e[2]=(m*M-g*w+v*b)*P,e[3]=(d*w-u*M-p*b)*P,e[4]=(c*_-a*I-l*S)*P,e[5]=(i*I-r*_+o*S)*P,e[6]=(g*x-f*M-v*A)*P,e[7]=(h*M-d*x+p*A)*P,e[8]=(a*C-s*_+l*E)*P,e[9]=(n*_-i*C-o*E)*P,e[10]=(f*w-m*x+v*y)*P,e[11]=(u*x-h*w-p*y)*P,e[12]=(s*S-a*T-c*E)*P,e[13]=(i*T-n*S+r*E)*P,e[14]=(m*A-f*b-g*y)*P,e[15]=(h*b-u*A+d*y)*P),this.check()}multiplyLeft(e){return un(this,e,this),this.check()}multiplyRight(e){return un(this,this,e),this.check()}rotateX(e){var t,i,n,r,o,a,s,c,l,h,u,d,p;return t=this,i=this,n=e,r=Math.sin(n),o=Math.cos(n),a=i[4],s=i[5],c=i[6],l=i[7],h=i[8],u=i[9],d=i[10],p=i[11],i!==t&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[4]=a*o+h*r,t[5]=s*o+u*r,t[6]=c*o+d*r,t[7]=l*o+p*r,t[8]=h*o-a*r,t[9]=u*o-s*r,t[10]=d*o-c*r,t[11]=p*o-l*r,this.check()}rotateY(e){var t,i,n,r,o,a,s,c,l,h,u,d,p;return t=this,i=this,n=e,r=Math.sin(n),o=Math.cos(n),a=i[0],s=i[1],c=i[2],l=i[3],h=i[8],u=i[9],d=i[10],p=i[11],i!==t&&(t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[0]=a*o-h*r,t[1]=s*o-u*r,t[2]=c*o-d*r,t[3]=l*o-p*r,t[8]=a*r+h*o,t[9]=s*r+u*o,t[10]=c*r+d*o,t[11]=l*r+p*o,this.check()}rotateZ(e){var t,i,n,r,o,a,s,c,l,h,u,d,p;return t=this,i=this,n=e,r=Math.sin(n),o=Math.cos(n),a=i[0],s=i[1],c=i[2],l=i[3],h=i[4],u=i[5],d=i[6],p=i[7],i!==t&&(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]),t[0]=a*o+h*r,t[1]=s*o+u*r,t[2]=c*o+d*r,t[3]=l*o+p*r,t[4]=h*o-a*r,t[5]=u*o-s*r,t[6]=d*o-c*r,t[7]=p*o-l*r,this.check()}rotateXYZ([e,t,i]){return this.rotateX(e).rotateY(t).rotateZ(i)}rotateAxis(e,t){return function(e,t,i,n){var r,o,a,s,c,l,h,u,d,p,f,m,g,v,y,A,x,b,w,M,E,S,_,T,C=n[0],I=n[1],P=n[2],R=Math.hypot(C,I,P);R<1e-6||(C*=R=1/R,I*=R,P*=R,r=Math.sin(i),a=1-(o=Math.cos(i)),s=t[0],c=t[1],l=t[2],h=t[3],u=t[4],d=t[5],p=t[6],f=t[7],m=t[8],g=t[9],v=t[10],y=t[11],A=C*C*a+o,x=I*C*a+P*r,b=P*C*a-I*r,w=C*I*a-P*r,M=I*I*a+o,E=P*I*a+C*r,S=C*P*a+I*r,_=I*P*a-C*r,T=P*P*a+o,e[0]=s*A+u*x+m*b,e[1]=c*A+d*x+g*b,e[2]=l*A+p*x+v*b,e[3]=h*A+f*x+y*b,e[4]=s*w+u*M+m*E,e[5]=c*w+d*M+g*E,e[6]=l*w+p*M+v*E,e[7]=h*w+f*M+y*E,e[8]=s*S+u*_+m*T,e[9]=c*S+d*_+g*T,e[10]=l*S+p*_+v*T,e[11]=h*S+f*_+y*T,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return Array.isArray(e)?dn(this,this,e):dn(this,this,[e,e,e]),this.check()}translate(e){return function(e,t,i){var n,r,o,a,s,c,l,h,u,d,p,f,m=i[0],g=i[1],v=i[2];t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],e[0]=n,e[1]=r,e[2]=o,e[3]=a,e[4]=s,e[5]=c,e[6]=l,e[7]=h,e[8]=u,e[9]=d,e[10]=p,e[11]=f,e[12]=n*m+s*g+u*v+t[12],e[13]=r*m+c*g+d*v+t[13],e[14]=o*m+l*g+p*v+t[14],e[15]=a*m+h*g+f*v+t[15])}(this,this,e),this.check()}transform(e,t){return 4===e.length?(Ui(t=function(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,e[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,e[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,e[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,e}(t||[-0,-0,-0,-0],e,this),4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:i}=e;switch(i){case 2:n=t||[-0,-0],o=this,a=(r=e)[0],s=r[1],n[0]=o[0]*a+o[4]*s+o[12],n[1]=o[1]*a+o[5]*s+o[13],t=n;break;case 3:t=Zi(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}var n,r,o,a,s;return Ui(t,e.length),t}transformAsVector(e,t){switch(e.length){case 2:t=function(e,t,i){const n=t[0],r=t[1],o=i[3]*n+i[7]*r||1;return e[0]=(i[0]*n+i[4]*r)/o,e[1]=(i[1]*n+i[5]*r)/o,e}(t||[-0,-0],e,this);break;case 3:t=en(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Ui(t,e.length),t}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,i){return this.identity().translate([e,t,i])}transformPoint(e,t){return ji("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}transformVector(e,t){return ji("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}transformDirection(e,t){return ji("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}var yn=new rn,An=new rn,xn=function(){function e(e,t){void 0===e&&(e=[0,0,1]),void 0===t&&(t=0),this.normal=new rn,this.distance=-0,this.fromNormalDistance(e,t)}return e.prototype.fromNormalDistance=function(e,t){return this.normal.from(e).normalize(),this.distance=t,this},e.prototype.fromPointNormal=function(e,t){e=yn.from(e),this.normal.from(t).normalize();var i=-this.normal.dot(e);return this.distance=i,this},e.prototype.fromCoefficients=function(e,t,i,n){return this.normal.set(e,t,i),this.distance=n,this},e.prototype.clone=function(){return new e(this.normal,this.distance)},e.prototype.equals=function(e){return this.distance===e.distance&&this.normal.equals(e.normal)},e.prototype.getPointDistance=function(e){return this.normal.dot(e)+this.distance},e.prototype.transform=function(e){var t=An.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,t)},e.prototype.projectPointOntoPlane=function(e,t){void 0===t&&(t=[0,0,0]),e=yn.from(e);var i=this.getPointDistance(e),n=An.copy(this.normal).scale(i);return e.subtract(n).to(t)},e}(),bn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),wn=[new rn([1,0,0]),new rn([0,1,0]),new rn([0,0,1])],Mn=new rn,En=new rn,Sn=function(){function e(e){void 0===e&&(e=[]),this.planes=e}return Object.defineProperty(e,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),e.prototype.fromBoundingSphere=function(e){this.planes.length=2*wn.length;for(var t=e.center,i=e.radius,n=0,r=0,o=wn;r<o.length;r++){var a=o[r],s=this.planes[n],c=this.planes[n+1];s||(s=this.planes[n]=new xn),c||(c=this.planes[n+1]=new xn);var l=Mn.copy(a).scale(-i).add(t);s.fromPointNormal(l,a);var h=Mn.copy(a).scale(i).add(t),u=En.copy(a).negate();c.fromPointNormal(h,u),n+=2}return this},e.prototype.computeVisibilityWithPlaneMask=function(t,i){if(i===e.MASK_OUTSIDE||i===e.MASK_INSIDE)return i;for(var n=e.MASK_INSIDE,r=this.planes,o=0;o<this.planes.length;++o){var a=o<31?1<<o:0;if(!(o<31&&0==(i&a))){var s=r[o],c=t.intersectPlane(s);if(c===bn.OUTSIDE)return e.MASK_OUTSIDE;c===bn.INTERSECTING&&(n|=a)}}return n},e}();function _n(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=i[0],p=i[1],f=i[2],m=i[3],g=i[4],v=i[5],y=i[6],A=i[7],x=i[8];return e[0]=d*n+p*a+f*l,e[1]=d*r+p*s+f*h,e[2]=d*o+p*c+f*u,e[3]=m*n+g*a+v*l,e[4]=m*r+g*s+v*h,e[5]=m*o+g*c+v*u,e[6]=y*n+A*a+x*l,e[7]=y*r+A*s+x*h,e[8]=y*o+A*c+x*u,e}function Tn(e,t,i){var n=i[0],r=i[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Cn(){var e=new Wi(4);return Wi!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function In(e,t,i){i*=.5;var n=Math.sin(i);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(i),e}function Pn(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=i[0],c=i[1],l=i[2],h=i[3];return e[0]=n*h+a*s+r*l-o*c,e[1]=r*h+a*c+o*s-n*l,e[2]=o*h+a*l+n*c-r*s,e[3]=a*h-n*s-r*c-o*l,e}function Rn(e,t,i,n){var r,o,a,s,c,l=t[0],h=t[1],u=t[2],d=t[3],p=i[0],f=i[1],m=i[2],g=i[3];return(o=l*p+h*f+u*m+d*g)<0&&(o=-o,p=-p,f=-f,m=-m,g=-g),1-o>1e-6?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-n)*r)/a,c=Math.sin(n*r)/a):(s=1-n,c=n),e[0]=s*l+c*p,e[1]=s*h+c*f,e[2]=s*u+c*m,e[3]=s*d+c*g,e}function Ln(e,t){var i,n=t[0]+t[4]+t[8];if(n>0)i=Math.sqrt(n+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*o+o]-t[3*a+a]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*o+a]-t[3*a+o])*i,e[o]=(t[3*o+r]+t[3*r+o])*i,e[a]=(t[3*a+r]+t[3*r+a])*i}return e}var Bn,Dn,On,Nn,kn=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e},Fn=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},Vn=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},zn=function(e,t,i,n){var r=t[0],o=t[1],a=t[2],s=t[3];return e[0]=r+n*(i[0]-r),e[1]=o+n*(i[1]-o),e[2]=a+n*(i[2]-a),e[3]=s+n*(i[3]-s),e},Hn=function(e){var t=e[0],i=e[1],n=e[2],r=e[3];return Math.hypot(t,i,n,r)},Un=function(e){var t=e[0],i=e[1],n=e[2],r=e[3];return t*t+i*i+n*n+r*r},Gn=function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=i*i+n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=i*a,e[1]=n*a,e[2]=r*a,e[3]=o*a,e},jn=(Bn=qi(),Dn=Ki(1,0,0),On=Ki(0,1,0),function(e,t,i){var n=Xi(t,i);return n<-.999999?(Yi(Bn,Dn,t),$i(Bn)<1e-6&&Yi(Bn,On,t),function(e,t){var i=t[0],n=t[1],r=t[2],o=i*i+n*n+r*r;o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o}(Bn,Bn),In(e,Bn,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Yi(Bn,t,i),e[0]=Bn[0],e[1]=Bn[1],e[2]=Bn[2],e[3]=1+n,Gn(e,e))});Cn(),Cn(),Nn=new Wi(9),Wi!=Float32Array&&(Nn[1]=0,Nn[2]=0,Nn[3]=0,Nn[5]=0,Nn[6]=0,Nn[7]=0),Nn[0]=1,Nn[4]=1,Nn[8]=1;const Qn=[0,0,0,1];class Wn extends zi{constructor(e=0,t=0,i=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&1===arguments.length?this.copy(e):this.set(e,t,i,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,i,n){return this[0]=e,this[1]=t,this[2]=i,this[3]=n,this.check()}fromMatrix3(e){return Ln(this,e),this.check()}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}fromAxisRotation(e,t){return In(this,e,t),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=Hi(e)}get y(){return this[1]}set y(e){this[1]=Hi(e)}get z(){return this[2]}set z(e){this[2]=Hi(e)}get w(){return this[3]}set w(e){this[3]=Hi(e)}len(){return Hn(this)}lengthSquared(){return Un(this)}dot(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return Vn(this,e)}rotationTo(e,t){return jn(this,e,t),this.check()}add(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return kn(this,this,e),this.check()}calculateW(){return function(e,t){var i=t[0],n=t[1],r=t[2];e[0]=i,e[1]=n,e[2]=r,e[3]=Math.sqrt(Math.abs(1-i*i-n*n-r*r))}(this,this),this.check()}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}invert(){return function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=i*i+n*n+r*r+o*o,s=a?1/a:0;e[0]=-i*s,e[1]=-n*s,e[2]=-r*s,e[3]=o*s}(this,this),this.check()}lerp(e,t,i){return zn(this,e,t,i),this.check()}multiplyRight(e,t){return Oi(!t),Pn(this,this,e),this.check()}multiplyLeft(e,t){return Oi(!t),Pn(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return function(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(i),c=Math.cos(i);e[0]=n*c+a*s,e[1]=r*c+o*s,e[2]=o*c-r*s,e[3]=a*c-n*s}(this,this,e),this.check()}rotateY(e){return function(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(i),c=Math.cos(i);e[0]=n*c-o*s,e[1]=r*c+a*s,e[2]=o*c+n*s,e[3]=a*c-r*s}(this,this,e),this.check()}rotateZ(e){return function(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(i),c=Math.cos(i);e[0]=n*c+r*s,e[1]=r*c-n*s,e[2]=o*c+a*s,e[3]=a*c-o*s}(this,this,e),this.check()}scale(e){return Fn(this,this,e),this.check()}slerp(e,t,i){switch(arguments.length){case 1:({start:e=Qn,target:t,ratio:i}=arguments[0]);break;case 2:[t,i]=arguments,e=this}return Rn(this,e,t,i),this.check()}transformVector4(e,t=e){return function(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[0],s=i[1],c=i[2],l=i[3],h=l*n+s*o-c*r,u=l*r+c*n-a*o,d=l*o+a*r-s*n,p=-a*n-s*r-c*o;e[0]=h*l+p*-a+u*-c-d*-s,e[1]=u*l+p*-s+d*-a-h*-c,e[2]=d*l+p*-c+h*-s-u*-a,e[3]=t[3]}(t,e,this),Ui(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e,t){return this.multiplyLeft(e,t)}multiply(e,t){return this.multiplyRight(e,t)}}const qn=Object.freeze([1,0,0,0,1,0,0,0,1]),Kn=Object.freeze([0,0,0,0,0,0,0,0,0]),Xn=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Yn={};class Zn extends hn{static get IDENTITY(){return Yn.IDENTITY=Yn.IDENTITY||Object.freeze(new Zn(qn)),Yn.IDENTITY}static get ZERO(){return Yn.ZERO=Yn.ZERO||Object.freeze(new Zn(Kn)),Yn.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Xn}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}set(e,t,i,n,r,o,a,s,c){return this[0]=e,this[1]=t,this[2]=i,this[3]=n,this[4]=r,this[5]=o,this[6]=a,this[7]=s,this[8]=c,this.check()}setRowMajor(e,t,i,n,r,o,a,s,c){return this[0]=e,this[1]=n,this[2]=a,this[3]=t,this[4]=r,this[5]=s,this[6]=i,this[7]=o,this[8]=c,this.check()}determinant(){return t=(e=this)[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],c=e[7],l=e[8],t*(l*o-a*c)+i*(-l*r+a*s)+n*(c*r-o*s);var e,t,i,n,r,o,a,s,c,l}identity(){return this.copy(qn)}fromQuaternion(e){return function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=i+i,s=n+n,c=r+r,l=i*a,h=n*a,u=n*s,d=r*a,p=r*s,f=r*c,m=o*a,g=o*s,v=o*c;e[0]=1-u-f,e[3]=h-v,e[6]=d+g,e[1]=h+v,e[4]=1-l-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-l-u}(this,e),this.check()}transpose(){return function(e,t){if(e===t){var i=t[1],n=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=n,e[7]=r}else 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,this),this.check()}invert(){return function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],c=t[6],l=t[7],h=t[8],u=h*a-s*l,d=-h*o+s*c,p=l*o-a*c,f=i*u+n*d+r*p;f&&(f=1/f,e[0]=u*f,e[1]=(-h*n+r*l)*f,e[2]=(s*n-r*a)*f,e[3]=d*f,e[4]=(h*i-r*c)*f,e[5]=(-s*i+r*o)*f,e[6]=p*f,e[7]=(-l*i+n*c)*f,e[8]=(a*i-n*o)*f)}(this,this),this.check()}multiplyLeft(e){return _n(this,e,this),this.check()}multiplyRight(e){return _n(this,this,e),this.check()}rotate(e){return function(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=Math.sin(i),p=Math.cos(i);e[0]=p*n+d*a,e[1]=p*r+d*s,e[2]=p*o+d*c,e[3]=p*a-d*n,e[4]=p*s-d*r,e[5]=p*c-d*o,e[6]=l,e[7]=h,e[8]=u}(this,this,e),this.check()}scale(e){return Array.isArray(e)?Tn(this,this,e):Tn(this,this,[e,e,e]),this.check()}translate(e){return function(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=i[0],p=i[1];e[0]=n,e[1]=r,e[2]=o,e[3]=a,e[4]=s,e[5]=c,e[6]=d*n+p*a+l,e[7]=d*r+p*s+h,e[8]=d*o+p*c+u}(this,this,e),this.check()}transform(e,t){switch(e.length){case 2:t=function(e,t,i){var n=t[0],r=t[1];return e[0]=i[0]*n+i[3]*r+i[6],e[1]=i[1]*n+i[4]*r+i[7],e}(t||[-0,-0],e,this);break;case 3:t=Ji(t||[-0,-0,-0],e,this);break;case 4:t=function(e,t,i){const n=t[0],r=t[1],o=t[2];return e[0]=i[0]*n+i[3]*r+i[6]*o,e[1]=i[1]*n+i[4]*r+i[7]*o,e[2]=i[2]*n+i[5]*r+i[8]*o,e[3]=t[3],e}(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Ui(t,e.length),t}transformVector(e,t){return ji("Matrix3.transformVector"),this.transform(e,t)}transformVector2(e,t){return ji("Matrix3.transformVector"),this.transform(e,t)}transformVector3(e,t){return ji("Matrix3.transformVector"),this.transform(e,t)}}var Jn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),$n=new rn,er=new rn,tr=function(){function e(e,t){void 0===e&&(e=[0,0,0]),void 0===t&&(t=0),this.radius=-0,this.center=new rn,this.fromCenterRadius(e,t)}return e.prototype.fromCenterRadius=function(e,t){return this.center.from(e),this.radius=t,this},e.prototype.fromCornerPoints=function(e,t){return t=$n.from(t),this.center=(new rn).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this},e.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius},e.prototype.clone=function(){return new e(this.center,this.radius)},e.prototype.union=function(e){var t=this.center,i=this.radius,n=e.center,r=e.radius,o=$n.copy(n).subtract(t),a=o.magnitude();if(i>=a+r)return this.clone();if(r>=a+i)return e.clone();var s=.5*(i+a+r);return er.copy(o).scale((-i+s)/a).add(t),this.center.copy(er),this.radius=s,this},e.prototype.expand=function(e){var t=(e=$n.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this},e.prototype.transform=function(e){this.center.transform(e);var t=function(e,t){var i=t[0],n=t[1],r=t[2],o=t[4],a=t[5],s=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(o,a,s),e[2]=Math.hypot(c,l,h),e}($n,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this},e.prototype.distanceSquaredTo=function(e){var t=this.distanceTo(e);return t*t},e.prototype.distanceTo=function(e){var t=(e=$n.from(e)).subtract(this.center);return Math.max(0,t.len()-this.radius)},e.prototype.intersectPlane=function(e){var t=this.center,i=this.radius,n=e.normal.dot(t)+e.distance;return n<-i?Jn.OUTSIDE:n<i?Jn.INTERSECTING:Jn.INSIDE},e}(),ir=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),nr=new rn,rr=new rn,or=new rn,ar=new rn,sr=new rn,cr=new rn,lr=new rn,hr=0,ur=1,dr=2,pr=3,fr=4,mr=5,gr=6,vr=7,yr=8,Ar=function(){function e(e,t){void 0===e&&(e=[0,0,0]),void 0===t&&(t=[0,0,0,0,0,0,0,0,0]),this.center=(new rn).from(e),this.halfAxes=new Zn(t)}return Object.defineProperty(e.prototype,"halfSize",{get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new rn(e).len(),new rn(t).len(),new rn(i).len()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quaternion",{get:function(){var e=this.halfAxes.getColumn(0),i=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),r=new rn(e).normalize(),o=new rn(i).normalize(),a=new rn(n).normalize();return(new Wn).fromMatrix3(new Zn(t.__spreadArray(t.__spreadArray(t.__spreadArray([],r,!0),o,!0),a,!0)))},enumerable:!1,configurable:!0}),e.prototype.fromCenterHalfSizeQuaternion=function(e,t,i){var n=new Wn(i),r=(new Zn).fromQuaternion(n);return r[0]=r[0]*t[0],r[1]=r[1]*t[0],r[2]=r[2]*t[0],r[3]=r[3]*t[1],r[4]=r[4]*t[1],r[5]=r[5]*t[1],r[6]=r[6]*t[2],r[7]=r[7]*t[2],r[8]=r[8]*t[2],this.center=(new rn).from(e),this.halfAxes=r,this},e.prototype.clone=function(){return new e(this.center,this.halfAxes)},e.prototype.equals=function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)},e.prototype.getBoundingSphere=function(e){void 0===e&&(e=new tr);var t=this.halfAxes,i=t.getColumn(0,or),n=t.getColumn(1,ar),r=t.getColumn(2,sr),o=nr.copy(i).add(n).add(r);return e.center.copy(this.center),e.radius=o.magnitude(),e},e.prototype.intersectPlane=function(e){var t=this.center,i=e.normal,n=this.halfAxes,r=i.x,o=i.y,a=i.z,s=Math.abs(r*n[hr]+o*n[ur]+a*n[dr])+Math.abs(r*n[pr]+o*n[fr]+a*n[mr])+Math.abs(r*n[gr]+o*n[vr]+a*n[yr]),c=i.dot(t)+e.distance;return c<=-s?ir.OUTSIDE:c>=s?ir.INSIDE:ir.INTERSECTING},e.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},e.prototype.distanceSquaredTo=function(e){var t=rr.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,or),r=i.getColumn(1,ar),o=i.getColumn(2,sr),a=n.magnitude(),s=r.magnitude(),c=o.magnitude();n.normalize(),r.normalize(),o.normalize();var l,h=0;return(l=Math.abs(t.dot(n))-a)>0&&(h+=l*l),(l=Math.abs(t.dot(r))-s)>0&&(h+=l*l),(l=Math.abs(t.dot(o))-c)>0&&(h+=l*l),h},e.prototype.computePlaneDistances=function(e,t,i){void 0===i&&(i=[-0,-0]);var n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,s=a.getColumn(0,or),c=a.getColumn(1,ar),l=a.getColumn(2,sr),h=cr.copy(s).add(c).add(l).add(o),u=lr.copy(h).subtract(e),d=t.dot(u);return n=Math.min(d,n),r=Math.max(d,r),h.copy(o).add(s).add(c).subtract(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),h.copy(o).add(s).subtract(c).add(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),h.copy(o).add(s).subtract(c).subtract(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),o.copy(h).subtract(s).add(c).add(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),o.copy(h).subtract(s).add(c).subtract(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),o.copy(h).subtract(s).subtract(c).add(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),o.copy(h).subtract(s).subtract(c).subtract(l),u.copy(h).subtract(e),d=t.dot(u),n=Math.min(d,n),r=Math.max(d,r),i[0]=n,i[1]=r,i},e.prototype.transform=function(e){this.center.transformAsPoint(e);var i=this.halfAxes.getColumn(0,or);i.transformAsPoint(e);var n=this.halfAxes.getColumn(1,ar);n.transformAsPoint(e);var r=this.halfAxes.getColumn(2,sr);return r.transformAsPoint(e),this.halfAxes=new Zn(t.__spreadArray(t.__spreadArray(t.__spreadArray([],i,!0),n,!0),r,!0)),this},e}();function xr(e,i){if(e.box)return function(e,i){var n=new rn(e[0],e[1],e[2]);i.transform(n,n);var r=[];if(10===e.length){var o=e.slice(3,6),a=new Wn;a.fromArray(e,6);var s=new rn([1,0,0]),c=new rn([0,1,0]),l=new rn([0,0,1]);s.transformByQuaternion(a),s.scale(o[0]),c.transformByQuaternion(a),c.scale(o[1]),l.transformByQuaternion(a),l.scale(o[2]),r=t.__spreadArray(t.__spreadArray(t.__spreadArray([],s.toArray(),!0),c.toArray(),!0),l.toArray(),!0)}else r=t.__spreadArray(t.__spreadArray(t.__spreadArray([],e.slice(3,6),!0),e.slice(6,9),!0),e.slice(9,12),!0);var h=i.transformAsVector(r.slice(0,3),[0,0,0]),u=i.transformAsVector(r.slice(3,6),[0,0,0]),d=i.transformAsVector(r.slice(6,9),[0,0,0]),p=new Zn([h[0],h[1],h[2],u[0],u[1],u[2],d[0],d[1],d[2]]);return new Ar(n,p)}(e.box,i);throw new Error("3D Tile: boundingVolume must only can be box")}function br(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var i=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return function(e,t){var i=e*t;return 1-Math.exp(-i*i)}(t,i)*n}return 0}function wr(e,t,i){var n=new TextDecoder("utf8"),r=new Uint8Array(e,t,i);return n.decode(r)}function Mr(e,t,i){return void 0===i&&(i=0),i=function(e,t,i){void 0===i&&(i=0);var n=e.header,r=n.featureTableJsonByteLength,o=n.featureTableBinaryByteLength,a=n.batchLength;if(e.featureTableJson={BATCH_LENGTH:a||0},r>0){var s=wr(t,i,r);e.featureTableJson=JSON.parse(s)}return i+=r,e.featureTableBinary=new Uint8Array(t,i,o),i+=o}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var n=e.header,r=n.batchTableJsonByteLength,o=n.batchTableBinaryByteLength;if(r>0){var a=wr(t,i,r);e.batchTableJson=JSON.parse(a),i+=r,o>0&&(e.batchTableBinary=new Uint8Array(t,i,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),i+=o)}return i}(e,t,i)}function Er(e,t,i){void 0===i&&(i=0);var n=e.byteOffset+e.byteLength-i;if(0===n)throw new Error("glTF byte length must be greater than 0.");return e.rotateYtoZ=!0,e.gltfUpAxis="Y",e.gltfArrayBuffer=function(e,t,i){var n=void 0!==i?new Uint8Array(e).subarray(t,t+i):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}(t,i,n),e.gltfByteOffset=0,e.gltfByteLength=n,i%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}function Sr(e,t,i){i=function(e,t,i){void 0===i&&(i=0);var n=new DataView(t);if(e.magic=n.getUint32(i,!0),i+=4,e.version=n.getUint32(i,!0),i+=4,e.byteLength=n.getUint32(i,!0),i+=4,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return i}(e,t,i),i=function(e,t,i){void 0===i&&(i=0);var n,r=new DataView(t);e.header=e.header||{};var o=r.getUint32(i,!0);i+=4;var a=r.getUint32(i,!0);i+=4;var s=r.getUint32(i,!0);i+=4;var c=r.getUint32(i,!0);return i+=4,s>=570425344?(i-=8,n=o,s=a,c=0,o=0,a=0,console.warn("b3dm tile in legacy format.")):c>=570425344&&(i-=4,n=s,s=o,c=a,o=0,a=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=a,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=n,i}(e,t,i),i=Er(e,t,i=Mr(e,t,i));var n=e.featureTableJson.RTC_CENTER;return n&&Number.isFinite(n.byteOffset)&&(e.rtcCenter=new Float32Array(e.featureTableBinary.buffer,e.featureTableBinary.buffer.byteOffset+n.byteOffset,3)),i}var _r=function(){function e(e,t,i){this.header=t,this.tileset=e,this.parent=i,this.children=[],this.contentState="UNLOADED",this.transform=this.header.transform?new vn(this.header.transform.slice()):new vn;var n=this.parent&&this.parent.computedTransform?this.parent.computedTransform.clone():e.modelMatrix.clone();this.computedTransform=new vn(n).multiplyRight(this.transform),this.boundingVolume=xr(this.header.boundingVolume,this.computedTransform),this.depth=this.parent?this.parent.depth+1:0,this.distanceToCamera=0,this.centerZDepth=0,this.screenSpaceError=0,this.shouldRefine=!1,this.visibilityPlaneMask=Sn.MASK_INDETERMINATE,this.visible=!1,this.selectionDepth=0,this.frameNumber=0,this.touchedFrameNumber=0,this.selectedFrameNumber=0,this.requestedFrameNumber=0}return Object.defineProperty(e.prototype,"id",{get:function(){return this.header.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refine",{get:function(){return this.header.refine||this.parent&&this.parent.refine||"REPLACE"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this.header.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentUrl",{get:function(){if(this.header.content.uri){var e=this.tileset.b3dmMapping.b3dm_base_url;e=/\/$/.test(e)?e:e+"/";var t=this.tileset.b3dmMapping.b3dm_url[this.header.content.uri];t=/^\//.test(t)?t.slice(1):t;var i=/^https?:/.test(t)?t:e+t;if(-1!==i.indexOf("http")&&-1===i.indexOf("https")){var n=i.slice(4);i="https"+n}return i}return this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricType",{get:function(){return this.header.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricValue",{get:function(){return this.header.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasEmptyContent",{get:function(){return!this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRenderContent",{get:function(){return!this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChildren",{get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentReady",{get:function(){return"READY"===this.contentState||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentAvailable",{get:function(){return Boolean(this.contentReady&&this.hasRenderContent||!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUnloadedContent",{get:function(){return this.hasRenderContent&&this.contentUnloaded},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentUnloaded",{get:function(){return"UNLOADED"===this.contentState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentFailed",{get:function(){return"FAILED"===this.contentState},enumerable:!1,configurable:!0}),e.prototype.getScreenSpaceError=function(e,t){if("TILES3D"===this.tileset.type)return function(e,t,i){var n=e.tileset,r=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=i?r:e.lodMetricValue;if(0===o)return 0;var a=Math.max(e.distanceToCamera,1e-7),s=n.options.viewDistanceScale,c=o*t.height*s/(a*t.sseDenominator);return c-br(n,a)}(this,e,t);throw new Error("Unsupported tileset type")},e.prototype.getPriority=function(){var e=this.tileset.traverser,t=e.options.skipLevelOfDetail,i="ADD"===this.refine||t;if(i&&!this.visible)return-1;if(this.tileset.frameNumber-this.touchedFrameNumber>=1)return-1;if("UNLOADED"===this.contentState)return-1;var n=this.parent,r=n&&(!i||0===this.screenSpaceError)?n.screenSpaceError:this.screenSpaceError,o=e.root?e.root.screenSpaceError:0;return Math.max(o-r,0)},e.prototype.loadContent=function(){var e=this;return this.hasEmptyContent||!this.contentUrl?Promise.resolve(!1):this.content?Promise.resolve(!0):(this.contentState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,(function(){return e.getPriority()})).then((function(t){return t?qe(e.contentUrl,{responseType:"arraybuffer",allowHosts:e.tileset.options.allowHosts,networkSubscribe:e.tileset.options.networkSubscribe,requestProxy:e.tileset.options.requestProxy}).then((function(e){return e.body})).then((function(e){return Sr(t={byteOffset:0,type:"b3dm"},e,t.byteOffset),t;var t})).then((function(i){return e.content=i,e.tileset.options.contentLoader(e).then((function(){return e.contentState="READY",t.done(),!0}))})).catch((function(i){return e.contentState="FAILED",t.done(),Promise.reject(i)})):(e.contentState="UNLOADED",Promise.resolve(!1))})))},e.prototype.unloadContent=function(){this.content=void 0,this.contentState="UNLOADED"},e.prototype.updateVisibility=function(e){if(this.frameNumber!==e.frameNumber){var t=this.parent,i=t?t.visibilityPlaneMask:Sn.MASK_INDETERMINATE,n=t?t.computedTransform:this.tileset.modelMatrix;this.updateTransform(n),this.distanceToCamera=this.distanceToTile(e),this.screenSpaceError=this.getScreenSpaceError(e,!1),this.visibilityPlaneMask=this.visibility(e,i),this.visible=this.visibilityPlaneMask!==Sn.MASK_OUTSIDE,this.frameNumber=e.frameNumber}},e.prototype.visibility=function(e,t){return e.cullingVolume.computeVisibilityWithPlaneMask(this.boundingVolume,t)},e.prototype.distanceToTile=function(e){return Math.sqrt(Math.max(this.boundingVolume.distanceSquaredTo(e.camera.position),0))},e.prototype.updateTransform=function(e){void 0===e&&(e=new vn);var t=e.clone().multiplyRight(this.transform);!t.equals(this.computedTransform)&&(this.computedTransform.copy(t),this.boundingVolume=xr(this.header.boundingVolume,this.computedTransform))},e}(),Tr=function(){function e(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this.array[e]},e.prototype.set=function(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)},e.prototype.delete=function(e){var t=this.map.get(e);void 0!==t&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)},e.prototype.push=function(e){if(!this.map.has(e)){var t=this._length++;this.array[t]=e,this.map.set(e,t)}},e.prototype.pop=function(){var e=this.array[--this._length];return this.map.delete(e),e},e.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},e.prototype.find=function(e){return this.map.has(e)},e}(),Cr=function(){function e(e){this.options=e,this._traversalStack=new Tr,this._emptyTraversalStack=new Tr,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return e.prototype.traverse=function(e,t){this.root=e,this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)},e.prototype.reset=function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()},e.prototype.executeTraversal=function(e,t){var i=this._traversalStack;for(e.selectionDepth=1,i.push(e);i.length>0;){var n=i.pop(),r=!1;if(this.canTraverse(n,t)){this.updateChildTiles(n,t);var o=n.hasRenderContent?n.selectionDepth+1:n.selectionDepth;r=this.updateAndPushChildren(n,t,i,o)}var a=n.parent,s=Boolean(!a||a.shouldRefine),c=!r;n.hasRenderContent?"ADD"===n.refine?(this.loadTile(n,t),this.selectTile(n,t)):"REPLACE"===n.refine&&(this.loadTile(n,t),c&&this.selectTile(n,t)):(this.emptyTiles[n.id]=n,this.loadTile(n,t),c&&this.selectTile(n,t)),this.touchTile(n,t),n.shouldRefine=r&&s}this.options.onTraversalEnd(t)},e.prototype.updateChildTiles=function(e,t){for(var i=0,n=e.children;i<n.length;i++){var r=n[i];this.updateTile(r,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,i,n){var r=this.options,o=r.loadSiblings,a=r.skipLevelOfDetail,s=e.children;s.sort(this.compareDistanceToCamera.bind(this));for(var c="REPLACE"===e.refine&&e.hasRenderContent&&!a,l=!1,h=!0,u=0,d=s;u<d.length;u++){var p=d[u];if(p.selectionDepth=n,p.visible?(i.find(p)&&i.delete(p),i.push(p),l=!0):(c||o)&&(this.loadTile(p,t),this.touchTile(p,t)),c){var f=void 0;if(f=p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,t),!(h=h&&f))return!1}}return l||(h=!1),h},e.prototype.updateTile=function(e,t){this.updateTileVisibility(e,t)},e.prototype.selectTile=function(e,t){this.shouldSelectTile(e)&&(e.selectedFrameNumber=t.frameNumber,this.selectedTiles[e.id]=e)},e.prototype.loadTile=function(e,t){this.shouldLoadTile(e)&&(e.requestedFrameNumber=t.frameNumber,this.requestedTiles[e.id]=e)},e.prototype.touchTile=function(e,t){e.tileset.cache.touch(e),e.touchedFrameNumber=t.frameNumber},e.prototype.canTraverse=function(e,t,i,n){return void 0===i&&(i=!1),void 0===n&&(n=!1),!!e.hasChildren&&(!(!n&&!e.visible)&&this.shouldRefine(e,t,i))},e.prototype.shouldLoadTile=function(e){var t=!this.options.maxDepth||e.depth<=this.options.maxDepth;return e.hasUnloadedContent&&t},e.prototype.shouldSelectTile=function(e){var t=!this.options.maxDepth||e.depth<=this.options.maxDepth;return e.contentAvailable&&!this.options.skipLevelOfDetail&&t},e.prototype.shouldRefine=function(e,t,i){var n=e.screenSpaceError;return i&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maxScreenSpaceError},e.prototype.updateTileVisibility=function(e,t){if(e.updateVisibility(t),e.visible){var i=e.children.length>0;this.meetsScreenSpaceErrorEarly(e,t)?e.visible=!1:"REPLACE"!==e.refine||!i||this.anyChildrenVisible(e,t)||(e.visible=!1)}},e.prototype.meetsScreenSpaceErrorEarly=function(e,t){var i=e.parent;return!(!i||"ADD"!==i.refine)&&!this.shouldRefine(e,t,!0)},e.prototype.compareDistanceToCamera=function(e,t){return 0===t.distanceToCamera&&0===e.distanceToCamera?t.centerZDepth-e.centerZDepth:t.distanceToCamera-e.distanceToCamera},e.prototype.anyChildrenVisible=function(e,t){for(var i=!1,n=0,r=e.children;n<r.length;n++){var o=r[n];o.updateVisibility(t),i=i||o.visible}return i},e.prototype.everyChildrenVisibleIsLoaded=function(e){for(var t=!0,i=0,n=e.children;i<n.length;i++){var r=n[i];r.visible&&"READY"!==r.contentState&&(t=!1)}return t},e.prototype.executeEmptyTraversal=function(e,t){var i=!0,n=this._emptyTraversalStack;for(n.push(e);n.length>0&&i;){var r=n.pop();if(this.updateTile(r,t),r.visible||this.loadTile(r,t),this.touchTile(r,t),!r.hasRenderContent&&this.canTraverse(r,t,!1,!0))for(var o=0,a=r.children;o<a.length;o++){var s=a[o];n.find(s)&&n.delete(s),n.push(s)}else r.contentAvailable||(i=!1)}return i},e}();function Ir(e){for(var t=[],i=0,n=Object.keys(e);i<n.length;i++){var r=n[i];t.push(e[r])}return t}var Pr=function(){function e(e,t){var i=this;this.rawJson=e,this.b3dmMapping=e.b3dmMapping,this.options=t,this.traverser=new Cr({loadSiblings:!1,maxScreenSpaceError:this.options.maxScreenSpaceError,skipLevelOfDetail:!1,maxDepth:this.options.maxDepth,onTraversalEnd:function(e){return i.onTraversalEnd(e)}}),this.cache=new ln,this.requestScheduler=new an({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.frameNumber=0,this.pendingCount=0,this._tiles={},this.selectedTiles=[],this.requestedTiles=[],this.memoryUsageInBytes=0,this.root=new _r(this,e.root);for(var n=[this.root];n.length>0;)for(var r=n.pop(),o=0,a=r.header.children||[];o<a.length;o++){var s=a[o],c=new _r(this,s,r);c.depth=r.depth+1,r.children.push(c),n.push(c)}}return Object.defineProperty(e.prototype,"maxMemoryUsage",{get:function(){return this.options.maxMemoryUsage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"asset",{get:function(){return this.rawJson.asset},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this.rawJson.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"basePath",{get:function(){return this.rawJson.basePath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"modelMatrix",{get:function(){return this.options.modelMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometricError",{get:function(){return this.rawJson.geometricError},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricType",{get:function(){return this.rawJson.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lodMetricValue",{get:function(){return this.rawJson.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refine",{get:function(){return this.rawJson.root.refine},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tiles",{get:function(){return Ir(this._tiles)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"floorInfo",{get:function(){return this.rawJson.floorInfo||this.rawJson.floor_info||[]},enumerable:!1,configurable:!0}),e.prototype.reset=function(){for(var e=[this.root];e.length>0;){for(var t=e.pop(),i=0,n=t.children;i<n.length;i++){var r=n[i];e.push(r)}this.cache.unloadTile(t),this.unloadTile(t)}this.cache.reset(),this.traverser.reset(),this.selectedTiles=[],this.requestedTiles=[]},e.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},e.prototype.onTraversalEnd=function(e){var t=this,i=new rn(e.camera.position);this.selectedTiles=this.options.onTraversalComplete(Ir(this.traverser.selectedTiles)),this.requestedTiles=Ir(this.traverser.requestedTiles).slice().sort((function(e,t){return e.boundingVolume.center.distanceTo(i)-t.boundingVolume.center.distanceTo(i)}));for(var n=0,r=this.selectedTiles;n<r.length;n++){var o=r[n];this._tiles[o.id]=o}for(var a=0,s=this.requestedTiles;a<s.length;a++){(o=s[a]).contentUnloaded&&this.loadTile(o)}this.cache.unloadTiles((function(){return t.memoryUsageInBytes>1024*t.maxMemoryUsage*1024}),(function(e){return t.unloadTile(e)}))},e.prototype.loadTile=function(e){var t=this;this.pendingCount++,e.loadContent().catch((function(i){var n=i.message||i.toString();return console.error("A 3D tile failed to load: ".concat(e.id," ").concat(n)),t.options.onTileError(e,n),!1})).then((function(i){t.pendingCount--,i&&(t.cache.add(e,(function(){e.content&&(t.memoryUsageInBytes+=e.content.byteLength||0)})),t.options.onTileLoad(e))}))},e.prototype.unloadTile=function(e){this.memoryUsageInBytes-=e.content&&e.content.byteLength||0,this.options.onTileUnload(e),e.unloadContent()},e}();function Rr(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function Lr(){return(Rr()+Rr()+"-"+Rr()+"-4"+Rr().substr(0,3)+"-"+Rr()+"-"+Rr()+Rr()+Rr()).toLowerCase()}function Br(e,t){var i;return e.content&&(e.contentUrl="".concat(t,"/").concat(e.content.uri||e.content.url)),e.id=null!==(i=e.contentUrl)&&void 0!==i?i:"empty:"+Lr(),e.lodMetricType="geometricError",e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=e.contentUrl?"SCENEGRAPH":"EMPTY",e.refine=function(e){switch(e){case"REPLACE":case"replace":return"REPLACE";case"ADD":case"add":return"ADD";default:throw new Error("refine ".concat(e," is not supported."))}}(e.refine),e}function Dr(e,t){var i,n=JSON.parse(JSON.stringify(e));return n.basePath=t,n.root=function(e,t){e=Br(e,t);var i=[];for(i.push(e);i.length>0;)for(var n=0,r=(i.pop()||{}).children||[];n<r.length;n++){var o=r[n];Br(o,t),i.push(o)}return e}(n.root,t),n.type="TILES3D",n.lodMetricType="geometricError",n.lodMetricValue=(null===(i=n.root)||void 0===i?void 0:i.lodMetricValue)||0,n}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let e=1;e<arguments.length;e++){const i=arguments[e];if(null!=i)for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t});function Or(){}Object.assign(Or.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners[e];if(void 0!==i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var i=t.slice(0),n=0,r=i.length;n<r;n++)i[n].call(this,e)}}}});for(var Nr=[],kr=0;kr<256;kr++)Nr[kr]=(kr<16?"0":"")+kr.toString(16);var Fr,Vr={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Nr[255&e]+Nr[e>>8&255]+Nr[e>>16&255]+Nr[e>>24&255]+"-"+Nr[255&t]+Nr[t>>8&255]+"-"+Nr[t>>16&15|64]+Nr[t>>24&255]+"-"+Nr[63&i|128]+Nr[i>>8&255]+"-"+Nr[i>>16&255]+Nr[i>>24&255]+Nr[255&n]+Nr[n>>8&255]+Nr[n>>16&255]+Nr[n>>24&255]).toUpperCase()},clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Vr.DEG2RAD},radToDeg:function(e){return e*Vr.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,i,n,r){var o=Math.cos,a=Math.sin,s=o(i/2),c=a(i/2),l=o((t+n)/2),h=a((t+n)/2),u=o((t-n)/2),d=a((t-n)/2),p=o((n-t)/2),f=a((n-t)/2);switch(r){case"XYX":e.set(s*h,c*u,c*d,s*l);break;case"YZY":e.set(c*d,s*h,c*u,s*l);break;case"ZXZ":e.set(c*u,c*d,s*h,s*l);break;case"XZX":e.set(s*h,c*f,c*p,s*l);break;case"YXY":e.set(c*p,s*h,c*f,s*l);break;case"ZYZ":e.set(c*f,c*p,s*h,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function zr(e,t){this.x=e||0,this.y=t||0}function Hr(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(zr.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(zr.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(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:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*n+e.x,this.y=r*n+o*i+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(Hr.prototype,{isMatrix3:!0,set:function(e,t,i,n,r,o,a,s,c){var l=this.elements;return l[0]=e,l[1]=n,l[2]=a,l[3]=t,l[4]=r,l[5]=s,l[6]=i,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var 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:function(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var 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:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,o=i[0],a=i[3],s=i[6],c=i[1],l=i[4],h=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],A=n[7],x=n[2],b=n[5],w=n[8];return r[0]=o*f+a*v+s*x,r[3]=o*m+a*y+s*b,r[6]=o*g+a*A+s*w,r[1]=c*f+l*v+h*x,r[4]=c*m+l*y+h*b,r[7]=c*g+l*A+h*w,r[2]=u*f+d*v+p*x,r[5]=u*m+d*y+p*b,r[8]=u*g+d*A+p*w,this},multiplyScalar:function(e){var 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:function(){var e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],c=e[7],l=e[8];return t*o*l-t*a*c-i*r*l+i*a*s+n*r*c-n*o*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var i=e.elements,n=this.elements,r=i[0],o=i[1],a=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],d=i[8],p=d*c-l*u,f=l*h-d*s,m=u*s-c*h,g=r*p+o*f+a*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);var v=1/g;return n[0]=p*v,n[1]=(a*u-d*o)*v,n[2]=(l*o-a*c)*v,n[3]=f*v,n[4]=(d*r-a*h)*v,n[5]=(a*s-l*r)*v,n[6]=m*v,n[7]=(o*h-u*r)*v,n[8]=(c*r-o*s)*v,this},transpose:function(){var e,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:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var 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:function(e,t,i,n,r,o,a){var s=Math.cos(r),c=Math.sin(r);this.set(i*s,i*c,-i*(s*o+c*a)+o+e,-n*c,n*s,-n*(-c*o+s*a)+a+t,0,0,1)},scale:function(e,t){var i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this},rotate:function(e){var t=Math.cos(e),i=Math.sin(e),n=this.elements,r=n[0],o=n[3],a=n[6],s=n[1],c=n[4],l=n[7];return n[0]=t*r+i*s,n[3]=t*o+i*c,n[6]=t*a+i*l,n[1]=-i*r+t*s,n[4]=-i*o+t*c,n[7]=-i*a+t*l,this},translate:function(e,t){var i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this},equals:function(e){for(var t=this.elements,i=e.elements,n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<9;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var 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}});var Ur={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Fr&&(Fr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Fr.width=e.width,Fr.height=e.height;var i=Fr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Fr}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Gr=0;function jr(e,t,i,n,r,o,a,s,c,l){Object.defineProperty(this,"id",{value:Gr++}),this.uuid=Vr.generateUUID(),this.name="",this.image=void 0!==e?e:jr.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:jr.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:1001,this.wrapT=void 0!==n?n:1001,this.magFilter=void 0!==r?r:1006,this.minFilter=void 0!==o?o:1008,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:1023,this.internalFormat=null,this.type=void 0!==s?s:1009,this.offset=new zr(0,0),this.repeat=new zr(1,1),this.center=new zr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Hr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:3e3,this.version=0,this.onUpdate=null}function Qr(e,t,i,n){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==n?n:1}function Wr(e,t,i){this.width=e,this.height=t,this.scissor=new Qr(0,0,e,t),this.scissorTest=!1,this.viewport=new Qr(0,0,e,t),i=i||{},this.texture=new jr(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function qr(e,t,i){Wr.call(this,e,t,i),this.samples=4}function Kr(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==n?n:1}jr.DEFAULT_IMAGE=void 0,jr.DEFAULT_MAPPING=300,jr.prototype=Object.assign(Object.create(Or.prototype),{constructor:jr,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=Vr.generateUUID()),!t&&void 0===e.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var o=0,a=n.length;o<a;o++)r.push(Ur.getDataURL(n[o]))}else r=Ur.getDataURL(n);e.images[n.uuid]={uuid:n.uuid,url:r}}i.image=n.uuid}return t||(e.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(jr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Qr.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Qr.prototype,{isVector4:!0,set:function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(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:function(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:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var 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:function(e){var t,i,n,r,o=.01,a=.1,s=e.elements,c=s[0],l=s[4],h=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(l-u)<o&&Math.abs(h-f)<o&&Math.abs(p-m)<o){if(Math.abs(l+u)<a&&Math.abs(h+f)<a&&Math.abs(p+m)<a&&Math.abs(c+d+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var v=(c+1)/2,y=(d+1)/2,A=(g+1)/2,x=(l+u)/4,b=(h+f)/4,w=(p+m)/4;return v>y&&v>A?v<o?(i=0,n=.707106781,r=.707106781):(n=x/(i=Math.sqrt(v)),r=b/i):y>A?y<o?(i=.707106781,n=0,r=.707106781):(i=x/(n=Math.sqrt(y)),r=w/n):A<o?(i=.707106781,n=.707106781,r=0):(i=b/(r=Math.sqrt(A)),n=w/r),this.set(i,n,r,t),this}var M=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(u-l)*(u-l));return Math.abs(M)<.001&&(M=1),this.x=(m-p)/M,this.y=(h-f)/M,this.z=(u-l)/M,this.w=Math.acos((c+d+g-1)/2),this},min:function(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:function(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:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){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:function(){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:function(){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:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(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:function(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:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),Wr.prototype=Object.assign(Object.create(Or.prototype),{constructor:Wr,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),qr.prototype=Object.assign(Object.create(Wr.prototype),{constructor:qr,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Wr.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(Kr,{slerp:function(e,t,i,n){return i.copy(e).slerp(t,n)},slerpFlat:function(e,t,i,n,r,o,a){var s=i[n+0],c=i[n+1],l=i[n+2],h=i[n+3],u=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(h!==f||s!==u||c!==d||l!==p){var m=1-a,g=s*u+c*d+l*p+h*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var A=Math.sqrt(y),x=Math.atan2(A,g*v);m=Math.sin(m*x)/A,a=Math.sin(a*x)/A}var b=a*v;if(s=s*m+u*b,c=c*m+d*b,l=l*m+p*b,h=h*m+f*b,m===1-a){var w=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=w,c*=w,l*=w,h*=w}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h},multiplyQuaternionsFlat:function(e,t,i,n,r,o){var a=i[n],s=i[n+1],c=i[n+2],l=i[n+3],h=r[o],u=r[o+1],d=r[o+2],p=r[o+3];return e[t]=a*p+l*h+s*d-c*u,e[t+1]=s*p+l*u+c*h-a*d,e[t+2]=c*p+l*d+a*u-s*h,e[t+3]=l*p-a*h-s*u-c*d,e}}),Object.defineProperties(Kr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Kr.prototype,{isQuaternion:!0,set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=e._x,n=e._y,r=e._z,o=e.order,a=Math.cos,s=Math.sin,c=a(i/2),l=a(n/2),h=a(r/2),u=s(i/2),d=s(n/2),p=s(r/2);switch(o){case"XYZ":this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p;break;case"YXZ":this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p;break;case"ZXY":this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p;break;case"ZYX":this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p;break;case"YZX":this._x=u*l*h+c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h-u*d*p;break;case"XZY":this._x=u*l*h-c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,n=i[0],r=i[4],o=i[8],a=i[1],s=i[5],c=i[9],l=i[2],h=i[6],u=i[10],d=n+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(h-c)*t,this._y=(o-l)*t,this._z=(a-r)*t):n>s&&n>u?(t=2*Math.sqrt(1+n-s-u),this._w=(h-c)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+l)/t):s>u?(t=2*Math.sqrt(1+s-n-u),this._w=(o-l)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-n-s),this._w=(a-r)/t,this._x=(o+l)/t,this._y=(c+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var i=e.dot(t)+1;return i<1e-6?(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:function(e){return 2*Math.acos(Math.abs(Vr.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var i=this.angleTo(e);if(0===i)return this;var n=Math.min(1,t/i);return this.slerp(e,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(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:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,n=e._y,r=e._z,o=e._w,a=t._x,s=t._y,c=t._z,l=t._w;return this._x=i*l+o*a+n*c-r*s,this._y=n*l+o*s+r*a-i*c,this._z=r*l+o*c+i*s-n*a,this._w=o*l-i*a-n*s-r*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*e._w+i*e._x+n*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var c=1-t;return this._w=c*o+t*this._w,this._x=c*i+t*this._x,this._y=c*n+t*this._y,this._z=c*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=o*u+this._w*d,this._x=i*u+this._x*d,this._y=n*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Xr=new Zr,Yr=new Kr;function Zr(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}Object.assign(Zr.prototype,{isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Yr.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Yr.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,n=this.z,r=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*n-a*i,l=s*i+a*t-r*n,h=s*n+r*i-o*t,u=-r*t-o*i-a*n;return this.x=c*s+u*-r+l*-a-h*-o,this.y=l*s+u*-o+h*-r-c*-a,this.z=h*s+u*-a+c*-o-l*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(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:function(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:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(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:function(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:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)},projectOnPlane:function(e){return Xr.copy(this).projectOnVector(e),this.sub(Xr)},reflect:function(e){return this.sub(Xr.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var i=this.dot(e)/t;return Math.acos(Vr.clamp(i,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,i){var n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var Jr=new Zr,$r=new oo,eo=new Zr(0,0,0),to=new Zr(1,1,1),io=new Zr,no=new Zr,ro=new Zr;function oo(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(oo.prototype,{isMatrix4:!0,set:function(e,t,i,n,r,o,a,s,c,l,h,u,d,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=l,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new oo).fromArray(this.elements)},copy:function(e){var 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:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(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:function(e){var t=this.elements,i=e.elements,n=1/Jr.setFromMatrixColumn(e,0).length(),r=1/Jr.setFromMatrixColumn(e,1).length(),o=1/Jr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,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:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,n=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),c=Math.sin(n),l=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=o*l,d=o*h,p=a*l,f=a*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=d+p*c,t[5]=u-f*c,t[9]=-a*s,t[2]=f-u*c,t[6]=p+d*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m+y*a,t[4]=v*a-g,t[8]=o*c,t[1]=o*h,t[5]=o*l,t[9]=-a,t[2]=g*a-v,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m-y*a,t[4]=-o*h,t[8]=v+g*a,t[1]=g+v*a,t[5]=o*l,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){u=o*l,d=o*h,p=a*l,f=a*h;t[0]=s*l,t[4]=p*c-d,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=d*c-p,t[2]=-c,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var A=o*s,x=o*c,b=a*s,w=a*c;t[0]=s*l,t[4]=w-A*h,t[8]=b*h+x,t[1]=h,t[5]=o*l,t[9]=-a*l,t[2]=-c*l,t[6]=x*h+b,t[10]=A-w*h}else if("XZY"===e.order){A=o*s,x=o*c,b=a*s,w=a*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=A*h+w,t[5]=o*l,t[9]=x*h-b,t[2]=b*h-x,t[6]=a*l,t[10]=w*h+A}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(eo,e,to)},lookAt:function(e,t,i){var n=this.elements;return ro.subVectors(e,t),0===ro.lengthSq()&&(ro.z=1),ro.normalize(),io.crossVectors(i,ro),0===io.lengthSq()&&(1===Math.abs(i.z)?ro.x+=1e-4:ro.z+=1e-4,ro.normalize(),io.crossVectors(i,ro)),io.normalize(),no.crossVectors(ro,io),n[0]=io.x,n[4]=no.x,n[8]=ro.x,n[1]=io.y,n[5]=no.y,n[9]=ro.y,n[2]=io.z,n[6]=no.z,n[10]=ro.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],l=i[1],h=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],A=i[11],x=i[15],b=n[0],w=n[4],M=n[8],E=n[12],S=n[1],_=n[5],T=n[9],C=n[13],I=n[2],P=n[6],R=n[10],L=n[14],B=n[3],D=n[7],O=n[11],N=n[15];return r[0]=o*b+a*S+s*I+c*B,r[4]=o*w+a*_+s*P+c*D,r[8]=o*M+a*T+s*R+c*O,r[12]=o*E+a*C+s*L+c*N,r[1]=l*b+h*S+u*I+d*B,r[5]=l*w+h*_+u*P+d*D,r[9]=l*M+h*T+u*R+d*O,r[13]=l*E+h*C+u*L+d*N,r[2]=p*b+f*S+m*I+g*B,r[6]=p*w+f*_+m*P+g*D,r[10]=p*M+f*T+m*R+g*O,r[14]=p*E+f*C+m*L+g*N,r[3]=v*b+y*S+A*I+x*B,r[7]=v*w+y*_+A*P+x*D,r[11]=v*M+y*T+A*R+x*O,r[15]=v*E+y*C+A*L+x*N,this},multiplyScalar:function(e){var 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:function(){var e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],o=e[1],a=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*s*h-n*c*h-r*a*u+i*c*u+n*a*d-i*s*d)+e[7]*(+t*s*d-t*c*u+r*o*u-n*o*d+n*c*l-r*s*l)+e[11]*(+t*c*h-t*a*d-r*o*h+i*o*d+r*a*l-i*c*l)+e[15]*(-n*a*l-t*s*h+t*a*u+n*o*h-i*o*u+i*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,i){var n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var i=this.elements,n=e.elements,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],l=n[5],h=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],A=n[15],x=p*y*u-v*f*u+v*h*m-l*y*m-p*h*A+l*f*A,b=g*f*u-d*y*u-g*h*m+c*y*m+d*h*A-c*f*A,w=d*v*u-g*p*u+g*l*m-c*v*m-d*l*A+c*p*A,M=g*p*h-d*v*h-g*l*f+c*v*f+d*l*y-c*p*y,E=r*x+o*b+a*w+s*M;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/E;return i[0]=x*S,i[1]=(v*f*s-p*y*s-v*a*m+o*y*m+p*a*A-o*f*A)*S,i[2]=(l*y*s-v*h*s+v*a*u-o*y*u-l*a*A+o*h*A)*S,i[3]=(p*h*s-l*f*s-p*a*u+o*f*u+l*a*m-o*h*m)*S,i[4]=b*S,i[5]=(d*y*s-g*f*s+g*a*m-r*y*m-d*a*A+r*f*A)*S,i[6]=(g*h*s-c*y*s-g*a*u+r*y*u+c*a*A-r*h*A)*S,i[7]=(c*f*s-d*h*s+d*a*u-r*f*u-c*a*m+r*h*m)*S,i[8]=w*S,i[9]=(g*p*s-d*v*s-g*o*m+r*v*m+d*o*A-r*p*A)*S,i[10]=(c*v*s-g*l*s+g*o*u-r*v*u-c*o*A+r*l*A)*S,i[11]=(d*l*s-c*p*s-d*o*u+r*p*u+c*o*m-r*l*m)*S,i[12]=M*S,i[13]=(d*v*a-g*p*a+g*o*f-r*v*f-d*o*y+r*p*y)*S,i[14]=(g*l*a-c*v*a-g*o*h+r*v*h+c*o*y-r*l*y)*S,i[15]=(c*p*a-d*l*a+d*o*h-r*p*h-c*o*f+r*l*f)*S,this},scale:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this},getMaxScaleOnAxis:function(){var 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],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var 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:function(e){var 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:function(e){var 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:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,o=e.x,a=e.y,s=e.z,c=r*o,l=r*a;return this.set(c*o+i,c*a-n*s,c*s+n*a,0,c*a+n*s,l*a+i,l*s-n*o,0,c*s-n*a,l*s+n*o,r*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(e,t,i){return this.set(1,t,i,0,e,1,i,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,i){var n=this.elements,r=t._x,o=t._y,a=t._z,s=t._w,c=r+r,l=o+o,h=a+a,u=r*c,d=r*l,p=r*h,f=o*l,m=o*h,g=a*h,v=s*c,y=s*l,A=s*h,x=i.x,b=i.y,w=i.z;return n[0]=(1-(f+g))*x,n[1]=(d+A)*x,n[2]=(p-y)*x,n[3]=0,n[4]=(d-A)*b,n[5]=(1-(u+g))*b,n[6]=(m+v)*b,n[7]=0,n[8]=(p+y)*w,n[9]=(m-v)*w,n[10]=(1-(u+f))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},decompose:function(e,t,i){var n=this.elements,r=Jr.set(n[0],n[1],n[2]).length(),o=Jr.set(n[4],n[5],n[6]).length(),a=Jr.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],$r.copy(this);var s=1/r,c=1/o,l=1/a;return $r.elements[0]*=s,$r.elements[1]*=s,$r.elements[2]*=s,$r.elements[4]*=c,$r.elements[5]*=c,$r.elements[6]*=c,$r.elements[8]*=l,$r.elements[9]*=l,$r.elements[10]*=l,t.setFromRotationMatrix($r),i.x=r,i.y=o,i.z=a,this},makePerspective:function(e,t,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(t-e),c=2*r/(i-n),l=(t+e)/(t-e),h=(i+n)/(i-n),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,i,n,r,o){var a=this.elements,s=1/(t-e),c=1/(i-n),l=1/(o-r),h=(t+e)*s,u=(i+n)*c,d=(o+r)*l;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<16;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var 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}});var ao=new oo,so=new Kr;function co(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._order=n||co.DefaultOrder}function lo(){this.mask=1}co.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],co.DefaultOrder="XYZ",Object.defineProperties(co.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(co.prototype,{isEuler:!0,set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._order=n||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var n=Vr.clamp,r=e.elements,o=r[0],a=r[4],s=r[8],c=r[1],l=r[5],h=r[9],u=r[2],d=r[6],p=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-n(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,o),this._z=0);break;case"ZXY":this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,o));break;case"ZYX":this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-n(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==i&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,i){return ao.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ao,t,i)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return so.setFromEuler(this),this.setFromQuaternion(so,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Zr(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(lo.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});let ho=0;const uo=new Zr,po=new Kr,fo=new oo,mo=new Zr,go=new Zr,vo=new Zr,yo=new Kr,Ao=new Zr(1,0,0),xo=new Zr(0,1,0),bo=new Zr(0,0,1),wo={type:"added"},Mo={type:"removed"};function Eo(){Object.defineProperty(this,"id",{value:ho++}),this.uuid=Vr.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Eo.DefaultUp.clone();var e=new Zr,t=new co,i=new Kr,n=new Zr(1,1,1);t._onChange((function(){i.setFromEuler(t,!1)})),i._onChange((function(){t.setFromQuaternion(i,void 0,!1)})),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:n},modelViewMatrix:{value:new oo},normalMatrix:{value:new Hr}}),this.matrix=new oo,this.matrixWorld=new oo,this.matrixAutoUpdate=Eo.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new lo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function So(){Eo.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Eo.DefaultUp=new Zr(0,1,0),Eo.DefaultMatrixAutoUpdate=!0,Eo.prototype=Object.assign(Object.create(Or.prototype),{constructor:Eo,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return po.setFromAxisAngle(e,t),this.quaternion.multiply(po),this},rotateOnWorldAxis:function(e,t){return po.setFromAxisAngle(e,t),this.quaternion.premultiply(po),this},rotateX:function(e){return this.rotateOnAxis(Ao,e)},rotateY:function(e){return this.rotateOnAxis(xo,e)},rotateZ:function(e){return this.rotateOnAxis(bo,e)},translateOnAxis:function(e,t){return uo.copy(e).applyQuaternion(this.quaternion),this.position.add(uo.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Ao,e)},translateY:function(e){return this.translateOnAxis(xo,e)},translateZ:function(e){return this.translateOnAxis(bo,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(fo.getInverse(this.matrixWorld))},lookAt:function(e,t,i){e.isVector3?mo.copy(e):mo.set(e,t,i);var n=this.parent;this.updateWorldMatrix(!0,!1),go.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fo.lookAt(go,mo,this.up):fo.lookAt(mo,go,this.up),this.quaternion.setFromRotationMatrix(fo),n&&(fo.extractRotation(n.matrixWorld),po.setFromRotationMatrix(fo),this.quaternion.premultiply(po.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(wo)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var i=this.children.indexOf(e);return-1!==i&&(e.parent=null,this.children.splice(i,1),e.dispatchEvent(Mo)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),fo.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),fo.multiply(e.parent.matrixWorld)),e.applyMatrix4(fo),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Zr),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new Kr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(go,e,vo),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Zr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(go,yo,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Zr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,i=0,n=t.length;i<n;i++)t[i].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,i=0,n=t.length;i<n;i++)t[i].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var n=this.children,r=0,o=n.length;r<o;r++)n[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function r(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);var o=this.geometry.parameters;if(void 0!==o&&void 0!==o.shapes){var a=o.shapes;if(Array.isArray(a))for(var s=0,c=a.length;s<c;s++){var l=a[s];r(e.shapes,l)}else r(e.shapes,a)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,c=this.material.length;s<c;s++)h.push(r(e.materials,this.material[s]));n.material=h}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(e).object)}if(t){var u=m(e.geometries),d=m(e.materials),p=m(e.textures),f=m(e.images);a=m(e.shapes);u.length>0&&(i.geometries=u),d.length>0&&(i.materials=d),p.length>0&&(i.textures=p),f.length>0&&(i.images=f),a.length>0&&(i.shapes=a)}return i.object=n,i;function m(e){var t=[];for(var i in e){var n=e[i];delete n.metadata,t.push(n)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var i=0;i<e.children.length;i++){var n=e.children[i];this.add(n.clone())}return this}}),So.prototype=Object.assign(Object.create(Eo.prototype),{constructor:So,isScene:!0,copy:function(e,t){return Eo.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=Eo.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var _o=[new Zr,new Zr,new Zr,new Zr,new Zr,new Zr,new Zr,new Zr],To=new Zr,Co=new Vo,Io=new Zr,Po=new Zr,Ro=new Zr,Lo=new Zr,Bo=new Zr,Do=new Zr,Oo=new Zr,No=new Zr,ko=new Zr,Fo=new Zr;function Vo(e,t){this.min=void 0!==e?e:new Zr(1/0,1/0,1/0),this.max=void 0!==t?t:new Zr(-1/0,-1/0,-1/0)}function zo(e,t,i,n,r){var o,a;for(o=0,a=e.length-3;o<=a;o+=3){Fo.fromArray(e,o);var s=r.x*Math.abs(Fo.x)+r.y*Math.abs(Fo.y)+r.z*Math.abs(Fo.z),c=t.dot(Fo),l=i.dot(Fo),h=n.dot(Fo);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>s)return!1}return!0}Object.assign(Vo.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],h=e[s+1],u=e[s+2];l<t&&(t=l),h<i&&(i=h),u<n&&(n=u),l>r&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,i,n),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),h=e.getY(s),u=e.getZ(s);l<t&&(t=l),h<i&&(i=h),u<n&&(n=u),l>r&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,i,n),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var i=To.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){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:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Zr),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Zr),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),Co.copy(t.boundingBox),Co.applyMatrix4(e.matrixWorld),this.union(Co));for(var i=e.children,n=0,r=i.length;n<r;n++)this.expandByObject(i[n]);return this},containsPoint:function(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:function(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:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Zr),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:function(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:function(e){return this.clampPoint(e.center,To),To.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var 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:function(e){if(this.isEmpty())return!1;this.getCenter(Oo),No.subVectors(this.max,Oo),Io.subVectors(e.a,Oo),Po.subVectors(e.b,Oo),Ro.subVectors(e.c,Oo),Lo.subVectors(Po,Io),Bo.subVectors(Ro,Po),Do.subVectors(Io,Ro);var t=[0,-Lo.z,Lo.y,0,-Bo.z,Bo.y,0,-Do.z,Do.y,Lo.z,0,-Lo.x,Bo.z,0,-Bo.x,Do.z,0,-Do.x,-Lo.y,Lo.x,0,-Bo.y,Bo.x,0,-Do.y,Do.x,0];return!!zo(t,Io,Po,Ro,No)&&(!!zo(t=[1,0,0,0,1,0,0,0,1],Io,Po,Ro,No)&&(ko.crossVectors(Lo,Bo),zo(t=[ko.x,ko.y,ko.z],Io,Po,Ro,No)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Zr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return To.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(To).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(_o[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_o[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_o[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_o[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_o[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_o[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_o[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_o[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_o)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Ho=new Vo;function Uo(e,t){this.center=void 0!==e?e:new Zr,this.radius=void 0!==t?t:-1}Object.assign(Uo.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var i=this.center;void 0!==t?i.copy(t):Ho.setFromPoints(e).getCenter(i);for(var n=0,r=0,o=e.length;r<o;r++)n=Math.max(n,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var i=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Zr),t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Vo),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Go=new Zr,jo=new Zr,Qo=new Zr,Wo=new Zr,qo=new Zr,Ko=new Zr,Xo=new Zr;function Yo(e,t){this.origin=void 0!==e?e:new Zr,this.direction=void 0!==t?t:new Zr(0,0,-1)}Object.assign(Yo.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Zr),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Go)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Zr),t.subVectors(e,this.origin);var i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Go.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Go.copy(this.direction).multiplyScalar(t).add(this.origin),Go.distanceToSquared(e))},distanceSqToSegment:function(e,t,i,n){jo.copy(e).add(t).multiplyScalar(.5),Qo.copy(t).sub(e).normalize(),Wo.copy(this.origin).sub(jo);var r,o,a,s,c=.5*e.distanceTo(t),l=-this.direction.dot(Qo),h=Wo.dot(this.direction),u=-Wo.dot(Qo),d=Wo.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(o=l*h-u,s=c*p,(r=l*u-h)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+l*(o*=f)+2*h)+o*(l*r+o+2*u)+d}else o=c,a=-(r=Math.max(0,-(l*o+h)))*r+o*(o+2*u)+d;else o=-c,a=-(r=Math.max(0,-(l*o+h)))*r+o*(o+2*u)+d;else o<=-s?a=-(r=Math.max(0,-(-l*c+h)))*r+(o=r>0?-c:Math.min(Math.max(-c,-u),c))*(o+2*u)+d:o<=s?(r=0,a=(o=Math.min(Math.max(-c,-u),c))*(o+2*u)+d):a=-(r=Math.max(0,-(l*c+h)))*r+(o=r>0?c:Math.min(Math.max(-c,-u),c))*(o+2*u)+d;else o=l>0?-c:c,a=-(r=Math.max(0,-(l*o+h)))*r+o*(o+2*u)+d;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(Qo).multiplyScalar(o).add(jo),a},intersectSphere:function(e,t){Go.subVectors(e.center,this.origin);var i=Go.dot(this.direction),n=Go.dot(Go)-i*i,r=e.radius*e.radius;if(n>r)return null;var o=Math.sqrt(r-n),a=i-o,s=i+o;return a<0&&s<0?null:a<0?this.at(s,t):this.at(a,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var i,n,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,n=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,n=(e.min.x-u.x)*c),l>=0?(r=(e.min.y-u.y)*l,o=(e.max.y-u.y)*l):(r=(e.max.y-u.y)*l,o=(e.min.y-u.y)*l),i>o||r>n?null:((r>i||i!=i)&&(i=r),(o<n||n!=n)&&(n=o),h>=0?(a=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(a=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),i>s||a>n?null:((a>i||i!=i)&&(i=a),(s<n||n!=n)&&(n=s),n<0?null:this.at(i>=0?i:n,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Go)},intersectTriangle:function(e,t,i,n,r){qo.subVectors(t,e),Ko.subVectors(i,e),Xo.crossVectors(qo,Ko);var o,a=this.direction.dot(Xo);if(a>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Wo.subVectors(this.origin,e);var s=o*this.direction.dot(Ko.crossVectors(Wo,Ko));if(s<0)return null;var c=o*this.direction.dot(qo.cross(Wo));if(c<0)return null;if(s+c>a)return null;var l=-o*Wo.dot(Xo);return l<0?null:this.at(l/a,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Zo=new Zr,Jo=new Zr,$o=new Hr;function ea(e,t){this.normal=void 0!==e?e:new Zr(1,0,0),this.constant=void 0!==t?t:0}Object.assign(ea.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,i){var n=Zo.subVectors(i,t).cross(Jo.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Zr),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Zr);var i=e.delta(Zo),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:t.copy(i).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Zr),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var i=t||$o.getNormalMatrix(e),n=this.coplanarPoint(Zo).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var ta=new Zr,ia=new Zr,na=new Zr,ra=new Zr,oa=new Zr,aa=new Zr,sa=new Zr,ca=new Zr,la=new Zr,ha=new Zr;function ua(e,t,i){this.a=void 0!==e?e:new Zr,this.b=void 0!==t?t:new Zr,this.c=void 0!==i?i:new Zr}Object.assign(ua,{getNormal:function(e,t,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new Zr),n.subVectors(i,t),ta.subVectors(e,t),n.cross(ta);var r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)},getBarycoord:function(e,t,i,n,r){ta.subVectors(n,t),ia.subVectors(i,t),na.subVectors(e,t);var o=ta.dot(ta),a=ta.dot(ia),s=ta.dot(na),c=ia.dot(ia),l=ia.dot(na),h=o*c-a*a;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Zr),0===h)return r.set(-2,-1,-1);var u=1/h,d=(c*s-a*l)*u,p=(o*l-a*s)*u;return r.set(1-d-p,p,d)},containsPoint:function(e,t,i,n){return ua.getBarycoord(e,t,i,n,ra),ra.x>=0&&ra.y>=0&&ra.x+ra.y<=1},getUV:function(e,t,i,n,r,o,a,s){return this.getBarycoord(e,t,i,n,ra),s.set(0,0),s.addScaledVector(r,ra.x),s.addScaledVector(o,ra.y),s.addScaledVector(a,ra.z),s},isFrontFacing:function(e,t,i,n){return ta.subVectors(i,t),ia.subVectors(e,t),ta.cross(ia).dot(n)<0}}),Object.assign(ua.prototype,{set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return ta.subVectors(this.c,this.b),ia.subVectors(this.a,this.b),.5*ta.cross(ia).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Zr),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return ua.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new ea),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return ua.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,i,n,r){return ua.getUV(e,this.a,this.b,this.c,t,i,n,r)},containsPoint:function(e){return ua.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return ua.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Zr);var i,n,r=this.a,o=this.b,a=this.c;oa.subVectors(o,r),aa.subVectors(a,r),ca.subVectors(e,r);var s=oa.dot(ca),c=aa.dot(ca);if(s<=0&&c<=0)return t.copy(r);la.subVectors(e,o);var l=oa.dot(la),h=aa.dot(la);if(l>=0&&h<=l)return t.copy(o);var u=s*h-l*c;if(u<=0&&s>=0&&l<=0)return i=s/(s-l),t.copy(r).addScaledVector(oa,i);ha.subVectors(e,a);var d=oa.dot(ha),p=aa.dot(ha);if(p>=0&&d<=p)return t.copy(a);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return n=c/(c-p),t.copy(r).addScaledVector(aa,n);var m=l*p-d*h;if(m<=0&&h-l>=0&&d-p>=0)return sa.subVectors(a,o),n=(h-l)/(h-l+(d-p)),t.copy(o).addScaledVector(sa,n);var g=1/(m+f+u);return i=f*g,n=u*g,t.copy(r).addScaledVector(oa,i).addScaledVector(aa,n)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var da={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},pa={h:0,s:0,l:0},fa={h:0,s:0,l:0};function ma(e,t,i){return void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}function ga(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}function va(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ya(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function Aa(e,t,i,n,r,o){this.a=e,this.b=t,this.c=i,this.normal=n&&n.isVector3?n:new Zr,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new ma,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}Object.assign(ma.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(e,t,i){if(e=Vr.euclideanModulo(e,1),t=Vr.clamp(t,0,1),i=Vr.clamp(i,0,1),0===t)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=ga(r,n,e+1/3),this.g=ga(r,n,e),this.b=ga(r,n,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=i[1],h=l.length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=da[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=va(e.r),this.g=va(e.g),this.b=va(e.b),this},copyLinearToSRGB:function(e){return this.r=ya(e.r),this.g=ya(e.g),this.b=ya(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,i,n=this.r,r=this.g,o=this.b,a=Math.max(n,r,o),s=Math.min(n,r,o),c=(s+a)/2;if(s===a)t=0,i=0;else{var l=a-s;switch(i=c<=.5?l/(a+s):l/(2-a-s),a){case n:t=(r-o)/l+(r<o?6:0);break;case r:t=(o-n)/l+2;break;case o:t=(n-r)/l+4}t/=6}return e.h=t,e.s=i,e.l=c,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){return this.getHSL(pa),pa.h+=e,pa.s+=t,pa.l+=i,this.setHSL(pa.h,pa.s,pa.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(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:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(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},lerpHSL:function(e,t){this.getHSL(pa),e.getHSL(fa);var i=Vr.lerp(pa.h,fa.h,t),n=Vr.lerp(pa.s,fa.s,t),r=Vr.lerp(pa.l,fa.l,t);return this.setHSL(i,n,r),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),ma.NAMES=da,Object.assign(Aa.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,i=e.vertexNormals.length;t<i;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,i=e.vertexColors.length;t<i;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var xa=0;function ba(){Object.defineProperty(this,"id",{value:xa++}),this.uuid=Vr.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function wa(e){ba.call(this),this.type="MeshBasicMaterial",this.color=new ma(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.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}ba.prototype=Object.assign(Object.create(Or.prototype),{constructor:ba,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i)if("shading"!==t){var n=this[t];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(e){var t=[];for(var i in e){var n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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.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),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.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,i.reflectivity=this.reflectivity,i.refractionRatio=this.refractionRatio,void 0!==this.combine&&(i.combine=this.combine),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),t){var r=n(e.textures),o=n(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,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.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;var t=e.clippingPlanes,i=null;if(null!==t){var n=t.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=t[r].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.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(ba.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),wa.prototype=Object.create(ba.prototype),wa.prototype.constructor=wa,wa.prototype.isMeshBasicMaterial=!0,wa.prototype.copy=function(e){return ba.prototype.copy.call(this,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.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var Ma=new Zr;function Ea(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function Sa(e,t,i){Ea.call(this,new Int8Array(e),t,i)}function _a(e,t,i){Ea.call(this,new Uint8Array(e),t,i)}function Ta(e,t,i){Ea.call(this,new Uint8ClampedArray(e),t,i)}function Ca(e,t,i){Ea.call(this,new Int16Array(e),t,i)}function Ia(e,t,i){Ea.call(this,new Uint16Array(e),t,i)}function Pa(e,t,i){Ea.call(this,new Int32Array(e),t,i)}function Ra(e,t,i){Ea.call(this,new Uint32Array(e),t,i)}function La(e,t,i){Ea.call(this,new Float32Array(e),t,i)}function Ba(e,t,i){Ea.call(this,new Float64Array(e),t,i)}function Da(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Oa(e){if(0===e.length)return-1/0;let t=e[0];for(let i=1,n=e.length;i<n;++i)e[i]>t&&(t=e[i]);return t}Object.defineProperty(Ea.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ea.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(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},copyAt:function(e,t,i){e*=this.itemSize,i*=t.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[e+n]=t.array[i+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;n<r;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new ma),t[i++]=o.r,t[i++]=o.g,t[i++]=o.b}return this},copyVector2sArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;n<r;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new zr),t[i++]=o.x,t[i++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;n<r;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new Zr),t[i++]=o.x,t[i++]=o.y,t[i++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;n<r;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new Qr),t[i++]=o.x,t[i++]=o.y,t[i++]=o.z,t[i++]=o.w}return this},applyMatrix3:function(e){for(var t=0,i=this.count;t<i;t++)Ma.x=this.getX(t),Ma.y=this.getY(t),Ma.z=this.getZ(t),Ma.applyMatrix3(e),this.setXYZ(t,Ma.x,Ma.y,Ma.z);return this},applyMatrix4:function(e){for(var t=0,i=this.count;t<i;t++)Ma.x=this.getX(t),Ma.y=this.getY(t),Ma.z=this.getZ(t),Ma.applyMatrix4(e),this.setXYZ(t,Ma.x,Ma.y,Ma.z);return this},applyNormalMatrix:function(e){for(var t=0,i=this.count;t<i;t++)Ma.x=this.getX(t),Ma.y=this.getY(t),Ma.z=this.getZ(t),Ma.applyNormalMatrix(e),this.setXYZ(t,Ma.x,Ma.y,Ma.z);return this},transformDirection:function(e){for(var t=0,i=this.count;t<i;t++)Ma.x=this.getX(t),Ma.y=this.getY(t),Ma.z=this.getZ(t),Ma.transformDirection(e),this.setXYZ(t,Ma.x,Ma.y,Ma.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Sa.prototype=Object.create(Ea.prototype),Sa.prototype.constructor=Sa,_a.prototype=Object.create(Ea.prototype),_a.prototype.constructor=_a,Ta.prototype=Object.create(Ea.prototype),Ta.prototype.constructor=Ta,Ca.prototype=Object.create(Ea.prototype),Ca.prototype.constructor=Ca,Ia.prototype=Object.create(Ea.prototype),Ia.prototype.constructor=Ia,Pa.prototype=Object.create(Ea.prototype),Pa.prototype.constructor=Pa,Ra.prototype=Object.create(Ea.prototype),Ra.prototype.constructor=Ra,La.prototype=Object.create(Ea.prototype),La.prototype.constructor=La,Ba.prototype=Object.create(Ea.prototype),Ba.prototype.constructor=Ba,Object.assign(Da.prototype,{computeGroups:function(e){for(var t,i=[],n=void 0,r=e.faces,o=0;o<r.length;o++){var a=r[o];a.materialIndex!==n&&(n=a.materialIndex,void 0!==t&&(t.count=3*o-t.start,i.push(t)),t={start:3*o,materialIndex:n})}void 0!==t&&(t.count=3*o-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,i=e.faces,n=e.vertices,r=e.faceVertexUvs,o=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,d=u.length;if(d>0){h=[];for(l=0;l<d;l++)h[l]={name:u[l].name,data:[]};this.morphTargets.normal=h}var p=e.skinIndices,f=e.skinWeights,m=p.length===n.length,g=f.length===n.length;n.length>0&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<i.length;l++){var v=i[l];this.vertices.push(n[v.a],n[v.b],n[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var A=v.normal;this.normals.push(A,A,A)}var x,b=v.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=v.color;this.colors.push(w,w,w)}if(!0===o)void 0!==(x=r[0][l])?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new zr,new zr,new zr));if(!0===a)void 0!==(x=r[1][l])?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new zr,new zr,new zr));for(var M=0;M<c;M++){var E=s[M].vertices;t[M].data.push(E[v.a],E[v.b],E[v.c])}for(M=0;M<d;M++){var S=u[M].vertexNormals[l];h[M].data.push(S.a,S.b,S.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var Na=1,ka=new oo,Fa=new Eo,Va=new Zr,za=new Vo,Ha=new Vo,Ua=new Zr;function Ga(){Object.defineProperty(this,"id",{value:Na+=2}),this.uuid=Vr.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Ga.prototype=Object.assign(Object.create(Or.prototype),{constructor:Ga,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Oa(e)>65535?Ra:Ia)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new Hr).getNormalMatrix(e);i.applyNormalMatrix(n),i.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return ka.makeRotationX(e),this.applyMatrix4(ka),this},rotateY:function(e){return ka.makeRotationY(e),this.applyMatrix4(ka),this},rotateZ:function(e){return ka.makeRotationZ(e),this.applyMatrix4(ka),this},translate:function(e,t,i){return ka.makeTranslation(e,t,i),this.applyMatrix4(ka),this},scale:function(e,t,i){return ka.makeScale(e,t,i),this.applyMatrix4(ka),this},lookAt:function(e){return Fa.lookAt(e),Fa.updateMatrix(),this.applyMatrix4(Fa.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Va).negate(),this.translate(Va.x,Va.y,Va.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var i=new La(3*t.vertices.length,3),n=new La(3*t.colors.length,3);if(this.setAttribute("position",i.copyVector3sArray(t.vertices)),this.setAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new La(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],i=0,n=e.length;i<n;i++){var r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new La(t,3)),this},updateFromObject:function(e){var t,i=e.geometry;if(e.isMesh){var n=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(n=void 0,i.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(i);n.verticesNeedUpdate=i.verticesNeedUpdate,n.normalsNeedUpdate=i.normalsNeedUpdate,n.colorsNeedUpdate=i.colorsNeedUpdate,n.uvsNeedUpdate=i.uvsNeedUpdate,n.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=n}return!0===i.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(i.vertices),t.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(i.normals),t.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(i.colors),t.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(i.uvs),t.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(i.lineDistances),t.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(e.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Da).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new Ea(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var i=new Float32Array(3*e.normals.length);this.setAttribute("normal",new Ea(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.setAttribute("color",new Ea(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new Ea(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Ea(o,2).copyVector2sArray(e.uvs2))}for(var a in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[a],l=0,h=c.length;l<h;l++){var u=c[l],d=new La(3*u.data.length,3);d.name=u.name,s.push(d.copyVector3sArray(u.data))}this.morphAttributes[a]=s}if(e.skinIndices.length>0){var p=new La(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new La(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Vo);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var i=0,n=t.length;i<n;i++){var r=t[i];za.setFromBufferAttribute(r),this.morphTargetsRelative?(Ua.addVectors(this.boundingBox.min,za.min),this.boundingBox.expandByPoint(Ua),Ua.addVectors(this.boundingBox.max,za.max),this.boundingBox.expandByPoint(Ua)):(this.boundingBox.expandByPoint(za.min),this.boundingBox.expandByPoint(za.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Uo);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var i=this.boundingSphere.center;if(za.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var o=t[n];Ha.setFromBufferAttribute(o),this.morphTargetsRelative?(Ua.addVectors(za.min,Ha.min),za.expandByPoint(Ua),Ua.addVectors(za.max,Ha.max),za.expandByPoint(Ua)):(za.expandByPoint(Ha.min),za.expandByPoint(Ha.max))}za.getCenter(i);var a=0;for(n=0,r=e.count;n<r;n++)Ua.fromBufferAttribute(e,n),a=Math.max(a,i.distanceToSquared(Ua));if(t)for(n=0,r=t.length;n<r;n++){o=t[n];for(var s=this.morphTargetsRelative,c=0,l=o.count;c<l;c++)Ua.fromBufferAttribute(o,c),s&&(Va.fromBufferAttribute(e,c),Ua.add(Va)),a=Math.max(a,i.distanceToSquared(Ua))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var i=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new Ea(new Float32Array(i.length),3));else for(var n=t.normal.array,r=0,o=n.length;r<o;r++)n[r]=0;var a,s,c,l=t.normal.array,h=new Zr,u=new Zr,d=new Zr,p=new Zr,f=new Zr;if(e){var m=e.array;for(r=0,o=e.count;r<o;r+=3)a=3*m[r+0],s=3*m[r+1],c=3*m[r+2],h.fromArray(i,a),u.fromArray(i,s),d.fromArray(i,c),p.subVectors(d,u),f.subVectors(h,u),p.cross(f),l[a]+=p.x,l[a+1]+=p.y,l[a+2]+=p.z,l[s]+=p.x,l[s+1]+=p.y,l[s+2]+=p.z,l[c]+=p.x,l[c+1]+=p.y,l[c+2]+=p.z}else for(r=0,o=i.length;r<o;r+=9)h.fromArray(i,r),u.fromArray(i,r+3),d.fromArray(i,r+6),p.subVectors(d,u),f.subVectors(h,u),p.cross(f),l[r]=p.x,l[r+1]=p.y,l[r+2]=p.z,l[r+3]=p.x,l[r+4]=p.y,l[r+5]=p.z,l[r+6]=p.x,l[r+7]=p.y,l[r+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var i=this.attributes;for(var n in i)if(void 0!==e.attributes[n])for(var r=i[n].array,o=e.attributes[n],a=o.array,s=o.itemSize*t,c=Math.min(a.length,r.length-s),l=0,h=s;l<c;l++,h++)r[h]=a[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,i=e.count;t<i;t++)Ua.x=e.getX(t),Ua.y=e.getY(t),Ua.z=e.getZ(t),Ua.normalize(),e.setXYZ(t,Ua.x,Ua.y,Ua.z)},toNonIndexed:function(){function e(e,t){for(var i=e.array,n=e.itemSize,r=e.normalized,o=new i.constructor(t.length*n),a=0,s=0,c=0,l=t.length;c<l;c++){a=t[c]*n;for(var h=0;h<n;h++)o[s++]=i[a++]}return new Ea(o,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Ga,i=this.index.array,n=this.attributes;for(var r in n){var o=e(n[r],i);t.setAttribute(r,o)}var a=this.morphAttributes;for(r in a){for(var s=[],c=a[r],l=0,h=c.length;l<h;l++){o=e(c[l],i);s.push(o)}t.morphAttributes[r]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,d=(l=0,u.length);l<d;l++){var p=u[l];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,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),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var n=this.index;null!==n&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var r=this.attributes;for(var i in r){var o=(d=r[i]).toJSON();""!==d.name&&(o.name=d.name),e.data.attributes[i]=o}var a={},s=!1;for(var i in this.morphAttributes){for(var c=this.morphAttributes[i],l=[],h=0,u=c.length;h<u;h++){var d;o=(d=c[h]).toJSON();""!==d.name&&(o.name=d.name),l.push(o)}l.length>0&&(a[i]=l,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Ga).copy(this)},copy:function(e){var t,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.setAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(i=0,n=l.length;i<n;i++)c.push(l[i].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var h=e.groups;for(i=0,n=h.length;i<n;i++){var u=h[i];this.addGroup(u.start,u.count,u.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var ja=new oo,Qa=new Yo,Wa=new Uo,qa=new Zr,Ka=new Zr,Xa=new Zr,Ya=new Zr,Za=new Zr,Ja=new Zr,$a=new Zr,es=new Zr,ts=new Zr,is=new zr,ns=new zr,rs=new zr,os=new Zr,as=new Zr;function ss(e,t){Eo.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Ga,this.material=void 0!==t?t:new wa,this.updateMorphTargets()}function cs(e,t,i,n,r,o,a,s){if(null===(1===t.side?n.intersectTriangle(a,o,r,!0,s):n.intersectTriangle(r,o,a,2!==t.side,s)))return null;as.copy(s),as.applyMatrix4(e.matrixWorld);var c=i.ray.origin.distanceTo(as);return c<i.near||c>i.far?null:{distance:c,point:as.clone(),object:e}}function ls(e,t,i,n,r,o,a,s,c,l,h,u){qa.fromBufferAttribute(r,l),Ka.fromBufferAttribute(r,h),Xa.fromBufferAttribute(r,u);var d=e.morphTargetInfluences;if(t.morphTargets&&o&&d){$a.set(0,0,0),es.set(0,0,0),ts.set(0,0,0);for(var p=0,f=o.length;p<f;p++){var m=d[p],g=o[p];0!==m&&(Ya.fromBufferAttribute(g,l),Za.fromBufferAttribute(g,h),Ja.fromBufferAttribute(g,u),a?($a.addScaledVector(Ya,m),es.addScaledVector(Za,m),ts.addScaledVector(Ja,m)):($a.addScaledVector(Ya.sub(qa),m),es.addScaledVector(Za.sub(Ka),m),ts.addScaledVector(Ja.sub(Xa),m)))}qa.add($a),Ka.add(es),Xa.add(ts)}e.isSkinnedMesh&&(e.boneTransform(l,qa),e.boneTransform(h,Ka),e.boneTransform(u,Xa));var v=cs(e,t,i,n,qa,Ka,Xa,os);if(v){s&&(is.fromBufferAttribute(s,l),ns.fromBufferAttribute(s,h),rs.fromBufferAttribute(s,u),v.uv=ua.getUV(os,qa,Ka,Xa,is,ns,rs,new zr)),c&&(is.fromBufferAttribute(c,l),ns.fromBufferAttribute(c,h),rs.fromBufferAttribute(c,u),v.uv2=ua.getUV(os,qa,Ka,Xa,is,ns,rs,new zr));var y=new Aa(l,h,u);ua.getNormal(qa,Ka,Xa,y.normal),v.face=y}return v}ss.prototype=Object.assign(Object.create(Eo.prototype),{constructor:ss,isMesh:!0,copy:function(e){return Eo.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)i=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var i,n=this.geometry,r=this.material,o=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),Wa.copy(n.boundingSphere),Wa.applyMatrix4(o),!1!==e.ray.intersectsSphere(Wa)&&(ja.getInverse(o),Qa.copy(e.ray).applyMatrix4(ja),null===n.boundingBox||!1!==Qa.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var a,s,c,l,h,u,d,p,f,m=n.index,g=n.attributes.position,v=n.morphAttributes.position,y=n.morphTargetsRelative,A=n.attributes.uv,x=n.attributes.uv2,b=n.groups,w=n.drawRange;if(null!==m)if(Array.isArray(r))for(l=0,u=b.length;l<u;l++)for(f=r[(p=b[l]).materialIndex],h=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);h<d;h+=3)a=m.getX(h),s=m.getX(h+1),c=m.getX(h+2),(i=ls(this,f,e,Qa,g,v,y,A,x,a,s,c))&&(i.faceIndex=Math.floor(h/3),i.face.materialIndex=p.materialIndex,t.push(i));else for(l=Math.max(0,w.start),u=Math.min(m.count,w.start+w.count);l<u;l+=3)a=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(i=ls(this,r,e,Qa,g,v,y,A,x,a,s,c))&&(i.faceIndex=Math.floor(l/3),t.push(i));else if(void 0!==g)if(Array.isArray(r))for(l=0,u=b.length;l<u;l++)for(f=r[(p=b[l]).materialIndex],h=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);h<d;h+=3)(i=ls(this,f,e,Qa,g,v,y,A,x,a=h,s=h+1,c=h+2))&&(i.faceIndex=Math.floor(h/3),i.face.materialIndex=p.materialIndex,t.push(i));else for(l=Math.max(0,w.start),u=Math.min(g.count,w.start+w.count);l<u;l+=3)(i=ls(this,r,e,Qa,g,v,y,A,x,a=l,s=l+1,c=l+2))&&(i.faceIndex=Math.floor(l/3),t.push(i))}else if(n.isGeometry){var M,E,S,_,T=Array.isArray(r),C=n.vertices,I=n.faces,P=n.faceVertexUvs[0];P.length>0&&(_=P);for(var R=0,L=I.length;R<L;R++){var B=I[R],D=T?r[B.materialIndex]:r;if(void 0!==D&&(M=C[B.a],E=C[B.b],S=C[B.c],i=cs(this,D,e,Qa,M,E,S,os))){if(_&&_[R]){var O=_[R];is.copy(O[0]),ns.copy(O[1]),rs.copy(O[2]),i.uv=ua.getUV(os,M,E,S,is,ns,rs,new zr)}i.face=B,i.faceIndex=R,t.push(i)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var hs=0,us=new oo,ds=new Eo,ps=new Zr;function fs(){Object.defineProperty(this,"id",{value:hs+=2}),this.uuid=Vr.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}fs.prototype=Object.assign(Object.create(Or.prototype),{constructor:fs,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Hr).getNormalMatrix(e),i=0,n=this.vertices.length;i<n;i++){this.vertices[i].applyMatrix4(e)}for(i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(t).normalize();for(var o=0,a=r.vertexNormals.length;o<a;o++)r.vertexNormals[o].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return us.makeRotationX(e),this.applyMatrix4(us),this},rotateY:function(e){return us.makeRotationY(e),this.applyMatrix4(us),this},rotateZ:function(e){return us.makeRotationZ(e),this.applyMatrix4(us),this},translate:function(e,t,i){return us.makeTranslation(e,t,i),this.applyMatrix4(us),this},scale:function(e,t,i){return us.makeScale(e,t,i),this.applyMatrix4(us),this},lookAt:function(e){return ds.lookAt(e),ds.updateMatrix(),this.applyMatrix4(ds.matrix),this},fromBufferGeometry:function(e){var t=this,i=null!==e.index?e.index.array:void 0,n=e.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=n.position.array,o=void 0!==n.normal?n.normal.array:void 0,a=void 0!==n.color?n.color.array:void 0,s=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=0;l<r.length;l+=3)t.vertices.push((new Zr).fromArray(r,l)),void 0!==a&&t.colors.push((new ma).fromArray(a,l));function h(e,i,n,r){var l=void 0===a?[]:[t.colors[e].clone(),t.colors[i].clone(),t.colors[n].clone()],h=new Aa(e,i,n,void 0===o?[]:[(new Zr).fromArray(o,3*e),(new Zr).fromArray(o,3*i),(new Zr).fromArray(o,3*n)],l,r);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new zr).fromArray(s,2*e),(new zr).fromArray(s,2*i),(new zr).fromArray(s,2*n)]),void 0!==c&&t.faceVertexUvs[1].push([(new zr).fromArray(c,2*e),(new zr).fromArray(c,2*i),(new zr).fromArray(c,2*n)])}var u=e.groups;if(u.length>0)for(l=0;l<u.length;l++)for(var d=u[l],p=d.start,f=p,m=p+d.count;f<m;f+=3)void 0!==i?h(i[f],i[f+1],i[f+2],d.materialIndex):h(f,f+1,f+2,d.materialIndex);else if(void 0!==i)for(l=0;l<i.length;l+=3)h(i[l],i[l+1],i[l+2]);else for(l=0;l<r.length/3;l+=3)h(l,l+1,l+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ps).negate(),this.translate(ps.x,ps.y,ps.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,n=new oo;return n.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){for(var e=new Zr,t=new Zr,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],o=this.vertices[r.a],a=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,a),t.subVectors(o,a),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,i,n,r,o,a;for(void 0===e&&(e=!0),a=new Array(this.vertices.length),t=0,i=this.vertices.length;t<i;t++)a[t]=new Zr;if(e){var s,c,l,h=new Zr,u=new Zr;for(n=0,r=this.faces.length;n<r;n++)o=this.faces[n],s=this.vertices[o.a],c=this.vertices[o.b],l=this.vertices[o.c],h.subVectors(l,c),u.subVectors(s,c),h.cross(u),a[o.a].add(h),a[o.b].add(h),a[o.c].add(h)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;n<r;n++)a[(o=this.faces[n]).a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(t=0,i=this.vertices.length;t<i;t++)a[t].normalize();for(n=0,r=this.faces.length;n<r;n++){var d=(o=this.faces[n]).vertexNormals;3===d.length?(d[0].copy(a[o.a]),d[1].copy(a[o.b]),d[2].copy(a[o.c])):(d[0]=a[o.a].clone(),d[1]=a[o.b].clone(),d[2]=a[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var n=(i=this.faces[e]).vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for((r=this.faces[i]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var o=new fs;for(o.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var a=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)c=new Zr,l={a:new Zr,b:new Zr,c:new Zr},a.push(c),s.push(l)}var c,l,h=this.morphNormals[e];for(o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals(),i=0,n=this.faces.length;i<n;i++)r=this.faces[i],c=h.faceNormals[i],l=h.vertexNormals[i],c.copy(r.normal),l.a.copy(r.vertexNormals[0]),l.b.copy(r.vertexNormals[1]),l.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)(r=this.faces[i]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Vo),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Uo),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(e&&e.isGeometry){var n,r=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,c=e.faces,l=this.colors,h=e.colors;void 0===i&&(i=0),void 0!==t&&(n=(new Hr).getNormalMatrix(t));for(var u=0,d=a.length;u<d;u++){var p=a[u].clone();void 0!==t&&p.applyMatrix4(t),o.push(p)}for(u=0,d=h.length;u<d;u++)l.push(h[u].clone());for(u=0,d=c.length;u<d;u++){var f,m,g,v=c[u],y=v.vertexNormals,A=v.vertexColors;(f=new Aa(v.a+r,v.b+r,v.c+r)).normal.copy(v.normal),void 0!==n&&f.normal.applyMatrix3(n).normalize();for(var x=0,b=y.length;x<b;x++)m=y[x].clone(),void 0!==n&&m.applyMatrix3(n).normalize(),f.vertexNormals.push(m);f.color.copy(v.color);for(x=0,b=A.length;x<b;x++)g=A[x],f.vertexColors.push(g.clone());f.materialIndex=v.materialIndex+i,s.push(f)}for(u=0,d=e.faceVertexUvs.length;u<d;u++){var w=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(x=0,b=w.length;x<b;x++){for(var M=w[x],E=[],S=0,_=M.length;S<_;S++)E.push(M[S].clone());this.faceVertexUvs[u].push(E)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,i,n,r,o,a,s,c={},l=[],h=[],u=Math.pow(10,4);for(i=0,n=this.vertices.length;i<n;i++)e=this.vertices[i],void 0===c[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(c[t]=i,l.push(this.vertices[i]),h[i]=l.length-1):h[i]=h[c[t]];var d=[];for(i=0,n=this.faces.length;i<n;i++){(r=this.faces[i]).a=h[r.a],r.b=h[r.b],r.c=h[r.c],o=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(o[p]===o[(p+1)%3]){d.push(i);break}}for(i=d.length-1;i>=0;i--){var f=d[i];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,i=e.length;t<i;t++){var n=e[t];this.vertices.push(new Zr(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,i=0;i<t;i++)e[i]._id=i;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var n,r,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];o&&o.length===t&&(n=[]),a&&a.length===t&&(r=[]);for(i=0;i<t;i++){var s=e[i]._id;n&&n.push(o[s]),r&&r.push(a[s])}n&&(this.faceVertexUvs[0]=n),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}for(var n=[],r=0;r<this.vertices.length;r++){var o=this.vertices[r];n.push(o.x,o.y,o.z)}var a=[],s=[],c={},l=[],h={},u=[],d={};for(r=0;r<this.faces.length;r++){var p=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=p.normal.length()>0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,A=0;if(A=M(A,0,0),A=M(A,1,!0),A=M(A,2,!1),A=M(A,3,f),A=M(A,4,m),A=M(A,5,g),A=M(A,6,v),A=M(A,7,y),a.push(A),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var x=this.faceVertexUvs[0][r];a.push(_(x[0]),_(x[1]),_(x[2]))}if(m&&a.push(E(p.normal)),g){var b=p.vertexNormals;a.push(E(b[0]),E(b[1]),E(b[2]))}if(v&&a.push(S(p.color)),y){var w=p.vertexColors;a.push(S(w[0]),S(w[1]),S(w[2]))}}function M(e,t,i){return i?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function S(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=l.length,l.push(e.getHex())),h[t]}function _(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=u.length/2,u.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=n,e.data.normals=s,l.length>0&&(e.data.colors=l),u.length>0&&(e.data.uvs=[u]),e.data.faces=a,e},clone:function(){return(new fs).copy(this)},copy:function(e){var t,i,n,r,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,i=s.length;t<i;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,i=c.length;t<i;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,i=l.length;t<i;t++)this.faces.push(l[t].clone());for(t=0,i=e.faceVertexUvs.length;t<i;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),n=0,r=h.length;n<r;n++){var u=h[n],d=[];for(o=0,a=u.length;o<a;o++){var p=u[o];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,i=f.length;t<i;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],n=0,r=f[t].vertices.length;n<r;n++)m.vertices.push(f[t].vertices[n].clone());if(void 0!==f[t].normals)for(m.normals=[],n=0,r=f[t].normals.length;n<r;n++)m.normals.push(f[t].normals[n].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,i=g.length;t<i;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],n=0,r=g[t].vertexNormals.length;n<r;n++){var y=g[t].vertexNormals[n],A={};A.a=y.a.clone(),A.b=y.b.clone(),A.c=y.c.clone(),v.vertexNormals.push(A)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],n=0,r=g[t].faceNormals.length;n<r;n++)v.faceNormals.push(g[t].faceNormals[n].clone());this.morphNormals.push(v)}var x=e.skinWeights;for(t=0,i=x.length;t<i;t++)this.skinWeights.push(x[t].clone());var b=e.skinIndices;for(t=0,i=b.length;t<i;t++)this.skinIndices.push(b[t].clone());var w=e.lineDistances;for(t=0,i=w.length;t<i;t++)this.lineDistances.push(w[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=e.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class ms extends Ga{constructor(e,t,i,n,r,o){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:o};const a=this;e=e||1,t=t||1,i=i||1,n=Math.floor(n)||1,r=Math.floor(r)||1,o=Math.floor(o)||1;const s=[],c=[],l=[],h=[];let u=0,d=0;function p(e,t,i,n,r,o,p,f,m,g,v){const y=o/m,A=p/g,x=o/2,b=p/2,w=f/2,M=m+1,E=g+1;let S=0,_=0;const T=new Zr;for(let o=0;o<E;o++){const a=o*A-b;for(let s=0;s<M;s++){const u=s*y-x;T[e]=u*n,T[t]=a*r,T[i]=w,c.push(T.x,T.y,T.z),T[e]=0,T[t]=0,T[i]=f>0?1:-1,l.push(T.x,T.y,T.z),h.push(s/m),h.push(1-o/g),S+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const i=u+t+M*e,n=u+t+M*(e+1),r=u+(t+1)+M*(e+1),o=u+(t+1)+M*e;s.push(i,n,o),s.push(n,r,o),_+=6}a.addGroup(d,_,v),d+=_,u+=S}p("z","y","x",-1,-1,i,t,e,o,r,0),p("z","y","x",1,-1,i,t,-e,o,r,1),p("x","z","y",1,1,e,i,t,n,o,2),p("x","z","y",1,-1,e,i,-t,n,o,3),p("x","y","z",1,-1,e,t,i,n,r,4),p("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(s),this.setAttribute("position",new La(c,3)),this.setAttribute("normal",new La(l,3)),this.setAttribute("uv",new La(h,2))}}function gs(e){var t={};for(var i in e)for(var n in t[i]={},e[i]){var r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}return t}function vs(e){for(var t={},i=0;i<e.length;i++){var n=gs(e[i]);for(var r in n)t[r]=n[r]}return t}var ys={clone:gs,merge:vs};function As(e){ba.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function xs(){Eo.call(this),this.type="Camera",this.matrixWorldInverse=new oo,this.projectionMatrix=new oo,this.projectionMatrixInverse=new oo}function bs(e,t,i,n){xs.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}As.prototype=Object.create(ba.prototype),As.prototype.constructor=As,As.prototype.isShaderMaterial=!0,As.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=gs(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},As.prototype.toJSON=function(e){var t=ba.prototype.toJSON.call(this,e);for(var i in t.uniforms={},this.uniforms){var n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var o in this.extensions)!0===this.extensions[o]&&(r[o]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},xs.prototype=Object.assign(Object.create(Eo.prototype),{constructor:xs,isCamera:!0,copy:function(e,t){return Eo.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Zr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Eo.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){Eo.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),bs.prototype=Object.assign(Object.create(xs.prototype),{constructor:bs,isPerspectiveCamera:!0,copy:function(e,t){return xs.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Vr.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Vr.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Vr.RAD2DEG*Math.atan(Math.tan(.5*Vr.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,i,n,r,o){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Vr.DEG2RAD*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*n/a,t-=o.offsetY*i/s,n*=o.width/a,i*=o.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Eo.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function ws(e,t,i){if(Eo.call(this),this.type="CubeCamera",!0===i.isWebGLCubeRenderTarget){this.renderTarget=i;var n=new bs(90,1,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new Zr(1,0,0)),this.add(n);var r=new bs(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Zr(-1,0,0)),this.add(r);var o=new bs(90,1,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Zr(0,1,0)),this.add(o);var a=new bs(90,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new Zr(0,-1,0)),this.add(a);var s=new bs(90,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Zr(0,0,1)),this.add(s);var c=new bs(90,1,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new Zr(0,0,-1)),this.add(c),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var l=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;var u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,n),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,s),i.texture.generateMipmaps=u,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(h),e.xr.enabled=l},this.clear=function(e,t,n,r){for(var o=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(i,a),e.clear(t,n,r);e.setRenderTarget(o)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function Ms(e,t,i){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=i),Wr.call(this,e,e,t)}function Es(e,t,i,n,r,o,a,s,c,l,h,u){jr.call(this,null,o,a,s,c,l,n,r,h,u),this.image={data:e||null,width:t||1,height:i||1},this.magFilter=void 0!==c?c:1003,this.minFilter=void 0!==l?l:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}ws.prototype=Object.create(Eo.prototype),ws.prototype.constructor=ws,Ms.prototype=Object.create(Wr.prototype),Ms.prototype.constructor=Ms,Ms.prototype.isWebGLCubeRenderTarget=!0,Ms.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var i=new So,n={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV = equirectUv( direction );","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new As({type:"CubemapFromEquirect",uniforms:gs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;var o=new ss(new ms(5,5,5),r);return i.add(o),new ws(1,10,this).update(e,i),o.geometry.dispose(),o.material.dispose(),this},Es.prototype=Object.create(jr.prototype),Es.prototype.constructor=Es,Es.prototype.isDataTexture=!0;var Ss=new Uo,_s=new Zr;function Ts(e,t,i,n,r,o){this.planes=[void 0!==e?e:new ea,void 0!==t?t:new ea,void 0!==i?i:new ea,void 0!==n?n:new ea,void 0!==r?r:new ea,void 0!==o?o:new ea]}Object.assign(Ts.prototype,{set:function(e,t,i,n,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromProjectionMatrix:function(e){var t=this.planes,i=e.elements,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],c=i[5],l=i[6],h=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(a-n,h-s,f-u,y-m).normalize(),t[1].setComponents(a+n,h+s,f+u,y+m).normalize(),t[2].setComponents(a+r,h+c,f+d,y+g).normalize(),t[3].setComponents(a-r,h-c,f-d,y-g).normalize(),t[4].setComponents(a-o,h-l,f-p,y-v).normalize(),t[5].setComponents(a+o,h+l,f+p,y+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ss.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)},intersectsSprite:function(e){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)},intersectsSphere:function(e){for(var t=this.planes,i=e.center,n=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,i=0;i<6;i++){var n=t[i];if(_s.x=n.normal.x>0?e.max.x:e.min.x,_s.y=n.normal.y>0?e.max.y:e.min.y,_s.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(_s)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}});var Cs={common:{diffuse:{value:new ma(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Hr},uv2Transform:{value:new Hr},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new zr(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ma(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new ma(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Hr}},sprite:{diffuse:{value:new ma(15658734)},opacity:{value:1},center:{value:new zr(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Hr}}};function Is(){var e=null,t=!1,i=null;function n(r,o){!1!==t&&(i(r,o),e.requestAnimationFrame(n))}return{start:function(){!0!==t&&null!==i&&(e.requestAnimationFrame(n),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function Ps(e,t){var i=t.isWebGL2,n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var i=n.get(t);i&&(e.deleteBuffer(i.buffer),n.delete(t))},update:function(t,r){t.isInterleavedBufferAttribute&&(t=t.data);var o=n.get(t);void 0===o?n.set(t,function(t,i){var n=t.array,r=t.usage,o=e.createBuffer();e.bindBuffer(i,o),e.bufferData(i,n,r),t.onUploadCallback();var a=5126;return n instanceof Float32Array?a=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?a=5123:n instanceof Int16Array?a=5122:n instanceof Uint32Array?a=5125:n instanceof Int32Array?a=5124:n instanceof Int8Array?a=5120:n instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version}}(t,r)):o.version<t.version&&(!function(t,n,r){var o=n.array,a=n.updateRange;e.bindBuffer(r,t),-1===a.count?e.bufferSubData(r,0,o):(i?e.bufferSubData(r,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):e.bufferSubData(r,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,t,r),o.version=t.version)}}}function Rs(e,t,i,n){fs.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Ls(e,t,i,n)),this.mergeVertices()}function Ls(e,t,i,n){Ga.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};var r,o,a=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(i)||1,l=Math.floor(n)||1,h=c+1,u=l+1,d=e/c,p=t/l,f=[],m=[],g=[],v=[];for(o=0;o<u;o++){var y=o*p-s;for(r=0;r<h;r++){var A=r*d-a;m.push(A,-y,0),g.push(0,0,1),v.push(r/c),v.push(1-o/l)}}for(o=0;o<l;o++)for(r=0;r<c;r++){var x=r+h*o,b=r+h*(o+1),w=r+1+h*(o+1),M=r+1+h*o;f.push(x,b,M),f.push(b,w,M)}this.setIndex(f),this.setAttribute("position",new La(m,3)),this.setAttribute("normal",new La(g,3)),this.setAttribute("uv",new La(v,2))}Rs.prototype=Object.create(fs.prototype),Rs.prototype.constructor=Rs,Ls.prototype=Object.create(Ga.prototype),Ls.prototype.constructor=Ls;var Bs={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Ds={basic:{uniforms:vs([Cs.common,Cs.specularmap,Cs.envmap,Cs.aomap,Cs.lightmap,Cs.fog]),vertexShader:Bs.meshbasic_vert,fragmentShader:Bs.meshbasic_frag},lambert:{uniforms:vs([Cs.common,Cs.specularmap,Cs.envmap,Cs.aomap,Cs.lightmap,Cs.emissivemap,Cs.fog,Cs.lights,{emissive:{value:new ma(0)}}]),vertexShader:Bs.meshlambert_vert,fragmentShader:Bs.meshlambert_frag},phong:{uniforms:vs([Cs.common,Cs.specularmap,Cs.envmap,Cs.aomap,Cs.lightmap,Cs.emissivemap,Cs.bumpmap,Cs.normalmap,Cs.displacementmap,Cs.fog,Cs.lights,{emissive:{value:new ma(0)},specular:{value:new ma(1118481)},shininess:{value:30}}]),vertexShader:Bs.meshphong_vert,fragmentShader:Bs.meshphong_frag},standard:{uniforms:vs([Cs.common,Cs.envmap,Cs.aomap,Cs.lightmap,Cs.emissivemap,Cs.bumpmap,Cs.normalmap,Cs.displacementmap,Cs.roughnessmap,Cs.metalnessmap,Cs.fog,Cs.lights,{emissive:{value:new ma(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bs.meshphysical_vert,fragmentShader:Bs.meshphysical_frag},toon:{uniforms:vs([Cs.common,Cs.specularmap,Cs.aomap,Cs.lightmap,Cs.emissivemap,Cs.bumpmap,Cs.normalmap,Cs.displacementmap,Cs.gradientmap,Cs.fog,Cs.lights,{emissive:{value:new ma(0)},specular:{value:new ma(1118481)},shininess:{value:30}}]),vertexShader:Bs.meshtoon_vert,fragmentShader:Bs.meshtoon_frag},matcap:{uniforms:vs([Cs.common,Cs.bumpmap,Cs.normalmap,Cs.displacementmap,Cs.fog,{matcap:{value:null}}]),vertexShader:Bs.meshmatcap_vert,fragmentShader:Bs.meshmatcap_frag},points:{uniforms:vs([Cs.points,Cs.fog]),vertexShader:Bs.points_vert,fragmentShader:Bs.points_frag},dashed:{uniforms:vs([Cs.common,Cs.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bs.linedashed_vert,fragmentShader:Bs.linedashed_frag},depth:{uniforms:vs([Cs.common,Cs.displacementmap]),vertexShader:Bs.depth_vert,fragmentShader:Bs.depth_frag},normal:{uniforms:vs([Cs.common,Cs.bumpmap,Cs.normalmap,Cs.displacementmap,{opacity:{value:1}}]),vertexShader:Bs.normal_vert,fragmentShader:Bs.normal_frag},sprite:{uniforms:vs([Cs.sprite,Cs.fog]),vertexShader:Bs.sprite_vert,fragmentShader:Bs.sprite_frag},background:{uniforms:{uvTransform:{value:new Hr},t2D:{value:null}},vertexShader:Bs.background_vert,fragmentShader:Bs.background_frag},cube:{uniforms:vs([Cs.envmap,{opacity:{value:1}}]),vertexShader:Bs.cube_vert,fragmentShader:Bs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bs.equirect_vert,fragmentShader:Bs.equirect_frag},distanceRGBA:{uniforms:vs([Cs.common,Cs.displacementmap,{referencePosition:{value:new Zr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bs.distanceRGBA_vert,fragmentShader:Bs.distanceRGBA_frag},shadow:{uniforms:vs([Cs.lights,Cs.fog,{color:{value:new ma(0)},opacity:{value:1}}]),vertexShader:Bs.shadow_vert,fragmentShader:Bs.shadow_frag}};function Os(e,t,i,n){var r,o,a=new ma(0),s=0,c=null,l=0,h=null;function u(e,i){t.buffers.color.setClear(e.r,e.g,e.b,i,n)}return{getClearColor:function(){return a},setClearColor:function(e,t){a.set(e),u(a,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(a,s=e)},render:function(t,n,d,p){var f=n.background,m=e.xr,g=m.getSession&&m.getSession();if(g&&"additive"===g.environmentBlendMode&&(f=null),null===f?u(a,s):f&&f.isColor&&(u(f,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)){void 0===o&&((o=new ss(new ms(1,1,1),new As({type:"BackgroundCubeMaterial",uniforms:gs(Ds.cube.uniforms),vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o));var v=f.isWebGLCubeRenderTarget?f.texture:f;o.material.uniforms.envMap.value=v,o.material.uniforms.flipEnvMap.value=v.isCubeTexture?-1:1,c===f&&l===v.version&&h===e.toneMapping||(o.material.needsUpdate=!0,c=f,l=v.version,h=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null)}else f&&f.isTexture&&(void 0===r&&((r=new ss(new Ls(2,2),new As({type:"BackgroundMaterial",uniforms:gs(Ds.background.uniforms),vertexShader:Ds.background.vertexShader,fragmentShader:Ds.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(r)),r.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),r.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&l===f.version&&h===e.toneMapping||(r.material.needsUpdate=!0,c=f,l=f.version,h=e.toneMapping),t.unshift(r,r.geometry,r.material,0,0,null))}}}function Ns(e,t,i,n){var r,o=n.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,n){e.drawArrays(r,t,n),i.update(n,r)},this.renderInstances=function(n,a,s,c){if(0!==c){var l,h;if(o)l=e,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](r,a,s,c),i.update(s,r,c)}}}function ks(e,t,i){var n;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=!0===i.logarithmicDepthBuffer,l=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=h>0,y=o||!!t.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==n)return n;var i=t.get("EXT_texture_filter_anisotropic");return n=null!==i?e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:o?e.getParameter(36183):0}}function Fs(){var e=this,t=null,i=0,n=!1,r=!1,o=new ea,a=new Hr,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function l(t,i,n,r){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==r||null===l){var h=n+4*c,u=i.matrixWorldInverse;a.getNormalMatrix(u),(null===l||l.length<h)&&(l=new Float32Array(h));for(var d=0,p=n;d!==c;++d,p+=4)o.copy(t[d]).applyMatrix4(u,a),o.normal.toArray(l,p),l[p+3]=o.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,r,o){var a=0!==e.length||r||0!==i||n;return n=r,t=l(e,o,0),i=e.length,a},this.beginShadows=function(){r=!0,l(null)},this.endShadows=function(){r=!1,c()},this.setState=function(e,o,a,h,u,d){if(!n||null===e||0===e.length||r&&!a)r?l(null):c();else{var p=r?0:i,f=4*p,m=u.clippingState||null;s.value=m,m=l(e,h,f,d);for(var g=0;g!==f;++g)m[g]=t[g];u.clippingState=m,this.numIntersection=o?this.numPlanes:0,this.numPlanes+=p}}}function Vs(e){var t={};return{get:function(i){if(void 0!==t[i])return t[i];var n;switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),t[i]=n,n}}}function zs(e,t,i){var n=new WeakMap,r=new WeakMap;function o(e){var a=e.target,s=n.get(a);for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);a.removeEventListener("dispose",o),n.delete(a);var l=r.get(s);l&&(t.remove(l),r.delete(s)),i.memory.geometries--}function a(e){var i=[],n=e.index,o=e.attributes.position,a=0;if(null!==n){var s=n.array;a=n.version;for(var c=0,l=s.length;c<l;c+=3){var h=s[c+0],u=s[c+1],d=s[c+2];i.push(h,u,u,d,d,h)}}else{s=o.array;a=o.version;for(c=0,l=s.length/3-1;c<l;c+=3){h=c+0,u=c+1,d=c+2;i.push(h,u,u,d,d,h)}}var p=new(Oa(i)>65535?Ra:Ia)(i,1);p.version=a,t.update(p,34963);var f=r.get(e);f&&t.remove(f),r.set(e,p)}return{get:function(e,t){var r=n.get(t);return r||(t.addEventListener("dispose",o),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Ga).setFromObject(e)),r=t._bufferGeometry),n.set(t,r),i.memory.geometries++,r)},update:function(e){var i=e.index,n=e.attributes;for(var r in null!==i&&t.update(i,34963),n)t.update(n[r],34962);var o=e.morphAttributes;for(var r in o)for(var a=o[r],s=0,c=a.length;s<c;s++)t.update(a[s],34962)},getWireframeAttribute:function(e){var t=r.get(e);if(t){var i=e.index;null!==i&&t.version<i.version&&a(e)}else a(e);return r.get(e)}}}function Hs(e,t,i,n){var r,o,a,s=n.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){o=e.type,a=e.bytesPerElement},this.render=function(t,n){e.drawElements(r,n,o,t*a),i.update(n,r)},this.renderInstances=function(n,c,l,h){if(0!==h){var u,d;if(s)u=e,d="drawElementsInstanced";else if(d="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[d](r,l,o,c*a,h),i.update(l,r,h)}}}function Us(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,i,n){switch(n=n||1,t.calls++,i){case 4:t.triangles+=n*(e/3);break;case 1:t.lines+=n*(e/2);break;case 3:t.lines+=n*(e-1);break;case 2:t.lines+=n*e;break;case 0:t.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Gs(e,t){return Math.abs(t[1])-Math.abs(e[1])}function js(e){var t={},i=new Float32Array(8);return{update:function(n,r,o,a){var s=n.morphTargetInfluences,c=void 0===s?0:s.length,l=t[r.id];if(void 0===l){l=[];for(var h=0;h<c;h++)l[h]=[h,0];t[r.id]=l}var u=o.morphTargets&&r.morphAttributes.position,d=o.morphNormals&&r.morphAttributes.normal;for(h=0;h<c;h++){0!==(f=l[h])[1]&&(u&&r.deleteAttribute("morphTarget"+h),d&&r.deleteAttribute("morphNormal"+h))}for(h=0;h<c;h++){(f=l[h])[0]=h,f[1]=s[h]}l.sort(Gs);var p=0;for(h=0;h<8;h++){var f;if(f=l[h]){var m=f[0],g=f[1];if(g){u&&r.setAttribute("morphTarget"+h,u[m]),d&&r.setAttribute("morphNormal"+h,d[m]),i[h]=g,p+=g;continue}}i[h]=0}var v=r.morphTargetsRelative?1:1-p;a.getUniforms().setValue(e,"morphTargetBaseInfluence",v),a.getUniforms().setValue(e,"morphTargetInfluences",i)}}}function Qs(e,t,i,n){var r=new WeakMap;return{update:function(e){var o=n.render.frame,a=e.geometry,s=t.get(e,a);return r.get(s)!==o&&(a.isGeometry&&s.updateFromObject(e),t.update(s),r.set(s,o)),e.isInstancedMesh&&i.update(e.instanceMatrix,34962),s},dispose:function(){r=new WeakMap}}}function Ws(e,t,i,n,r,o,a,s,c,l){e=void 0!==e?e:[],t=void 0!==t?t:301,a=void 0!==a?a:1022,jr.call(this,e,t,i,n,r,o,a,s,c,l),this.flipY=!1}function qs(e,t,i,n){jr.call(this,null),this.image={data:e||null,width:t||1,height:i||1,depth:n||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ks(e,t,i,n){jr.call(this,null),this.image={data:e||null,width:t||1,height:i||1,depth:n||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Ds.physical={uniforms:vs([Ds.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new zr(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new ma(0)},transparency:{value:0}}]),vertexShader:Bs.meshphysical_vert,fragmentShader:Bs.meshphysical_frag},Ws.prototype=Object.create(jr.prototype),Ws.prototype.constructor=Ws,Ws.prototype.isCubeTexture=!0,Object.defineProperty(Ws.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),qs.prototype=Object.create(jr.prototype),qs.prototype.constructor=qs,qs.prototype.isDataTexture2DArray=!0,Ks.prototype=Object.create(jr.prototype),Ks.prototype.constructor=Ks,Ks.prototype.isDataTexture3D=!0;var Xs=new jr,Ys=new qs,Zs=new Ks,Js=new Ws,$s=[],ec=[],tc=new Float32Array(16),ic=new Float32Array(9),nc=new Float32Array(4);function rc(e,t,i){var n=e[0];if(n<=0||n>0)return e;var r=t*i,o=$s[r];if(void 0===o&&(o=new Float32Array(r),$s[r]=o),0!==t){n.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=i,e[a].toArray(o,s)}return o}function oc(e,t){if(e.length!==t.length)return!1;for(var i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0}function ac(e,t){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]}function sc(e,t){var i=ec[t];void 0===i&&(i=new Int32Array(t),ec[t]=i);for(var n=0;n!==t;++n)i[n]=e.allocateTextureUnit();return i}function cc(e,t){var i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function lc(e,t){var i=this.cache;if(void 0!==t.x)i[0]===t.x&&i[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(oc(i,t))return;e.uniform2fv(this.addr,t),ac(i,t)}}function hc(e,t){var i=this.cache;if(void 0!==t.x)i[0]===t.x&&i[1]===t.y&&i[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)i[0]===t.r&&i[1]===t.g&&i[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(oc(i,t))return;e.uniform3fv(this.addr,t),ac(i,t)}}function uc(e,t){var i=this.cache;if(void 0!==t.x)i[0]===t.x&&i[1]===t.y&&i[2]===t.z&&i[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(oc(i,t))return;e.uniform4fv(this.addr,t),ac(i,t)}}function dc(e,t){var i=this.cache,n=t.elements;if(void 0===n){if(oc(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),ac(i,t)}else{if(oc(i,n))return;nc.set(n),e.uniformMatrix2fv(this.addr,!1,nc),ac(i,n)}}function pc(e,t){var i=this.cache,n=t.elements;if(void 0===n){if(oc(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),ac(i,t)}else{if(oc(i,n))return;ic.set(n),e.uniformMatrix3fv(this.addr,!1,ic),ac(i,n)}}function fc(e,t){var i=this.cache,n=t.elements;if(void 0===n){if(oc(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),ac(i,t)}else{if(oc(i,n))return;tc.set(n),e.uniformMatrix4fv(this.addr,!1,tc),ac(i,n)}}function mc(e,t,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(t||Xs,r)}function gc(e,t,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(t||Ys,r)}function vc(e,t,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(t||Zs,r)}function yc(e,t,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(t||Js,r)}function Ac(e,t){var i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function xc(e,t){var i=this.cache;oc(i,t)||(e.uniform2iv(this.addr,t),ac(i,t))}function bc(e,t){var i=this.cache;oc(i,t)||(e.uniform3iv(this.addr,t),ac(i,t))}function wc(e,t){var i=this.cache;oc(i,t)||(e.uniform4iv(this.addr,t),ac(i,t))}function Mc(e,t){var i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function Ec(e,t){e.uniform1fv(this.addr,t)}function Sc(e,t){e.uniform1iv(this.addr,t)}function _c(e,t){e.uniform2iv(this.addr,t)}function Tc(e,t){e.uniform3iv(this.addr,t)}function Cc(e,t){e.uniform4iv(this.addr,t)}function Ic(e,t){var i=rc(t,this.size,2);e.uniform2fv(this.addr,i)}function Pc(e,t){var i=rc(t,this.size,3);e.uniform3fv(this.addr,i)}function Rc(e,t){var i=rc(t,this.size,4);e.uniform4fv(this.addr,i)}function Lc(e,t){var i=rc(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function Bc(e,t){var i=rc(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function Dc(e,t){var i=rc(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function Oc(e,t,i){var n=t.length,r=sc(i,n);e.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.safeSetTexture2D(t[o]||Xs,r[o])}function Nc(e,t,i){var n=t.length,r=sc(i,n);e.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.safeSetTextureCube(t[o]||Js,r[o])}function kc(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return cc;case 35664:return lc;case 35665:return hc;case 35666:return uc;case 35674:return dc;case 35675:return pc;case 35676:return fc;case 5124:case 35670:return Ac;case 35667:case 35671:return xc;case 35668:case 35672:return bc;case 35669:case 35673:return wc;case 5125:return Mc;case 35678:case 36198:case 36298:case 36306:case 35682:return mc;case 35679:case 36299:case 36307:return vc;case 35680:case 36300:case 36308:case 36293:return yc;case 36289:case 36303:case 36311:case 36292:return gc}}(t.type)}function Fc(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ec;case 35664:return Ic;case 35665:return Pc;case 35666:return Rc;case 35674:return Lc;case 35675:return Bc;case 35676:return Dc;case 5124:case 35670:return Sc;case 35667:case 35671:return _c;case 35668:case 35672:return Tc;case 35669:case 35673:return Cc;case 35678:case 36198:case 36298:case 36306:case 35682:return Oc;case 35680:case 36300:case 36308:case 36293:return Nc}}(t.type)}function Vc(e){this.id=e,this.seq=[],this.map={}}Fc.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ac(t,e)},Vc.prototype.setValue=function(e,t,i){for(var n=this.seq,r=0,o=n.length;r!==o;++r){var a=n[r];a.setValue(e,t[a.id],i)}};var zc=/([\w\d_]+)(\])?(\[|\.)?/g;function Hc(e,t){e.seq.push(t),e.map[t.id]=t}function Uc(e,t,i){var n=e.name,r=n.length;for(zc.lastIndex=0;;){var o=zc.exec(n),a=zc.lastIndex,s=o[1],c="]"===o[2],l=o[3];if(c&&(s|=0),void 0===l||"["===l&&a+2===r){Hc(i,void 0===l?new kc(s,e,t):new Fc(s,e,t));break}var h=i.map[s];void 0===h&&Hc(i,h=new Vc(s)),i=h}}function Gc(e,t){this.seq=[],this.map={};for(var i=e.getProgramParameter(t,35718),n=0;n<i;++n){var r=e.getActiveUniform(t,n);Uc(r,e.getUniformLocation(t,r.name),this)}}function jc(e,t,i){var n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),n}Gc.prototype.setValue=function(e,t,i,n){var r=this.map[t];void 0!==r&&r.setValue(e,i,n)},Gc.prototype.setOptional=function(e,t,i){var n=t[i];void 0!==n&&this.setValue(e,i,n)},Gc.upload=function(e,t,i,n){for(var r=0,o=t.length;r!==o;++r){var a=t[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}},Gc.seqWithValue=function(e,t){for(var i=[],n=0,r=e.length;n!==r;++n){var o=e[n];o.id in t&&i.push(o)}return i};var Qc=0;function Wc(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function qc(e,t,i){var n=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return n&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}(e.getShaderSource(t))}function Kc(e,t){var i=Wc(t);return"vec4 "+e+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Xc(e,t){var i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="Uncharted2";break;case 4:i="OptimizedCineon";break;case 5:i="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Yc(e){return""!==e}function Zc(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Jc(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var $c=/^[ \t]*#include +<([\w\d./]+)>/gm;function el(e){return e.replace($c,tl)}function tl(e,t){var i=Bs[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return el(i)}var il=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,nl=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function rl(e){return e.replace(nl,al).replace(il,ol)}function ol(e,t,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),al(e,t,i,n)}function al(e,t,i,n){for(var r="",o=parseInt(t);o<parseInt(i);o++)r+=n.replace(/\[ i \]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return r}function sl(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function cl(e,t,i){var n,r,o,a,s,c=e.getContext(),l=i.defines,h=i.vertexShader,u=i.fragmentShader,d=function(e){var t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(i),p=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:t="ENVMAP_TYPE_EQUIREC";break;case 305:t="ENVMAP_TYPE_SPHERE"}return t}(i),f=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 304:t="ENVMAP_MODE_REFRACTION"}return t}(i),m=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),g=e.gammaFactor>0?e.gammaFactor:1,v=i.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Yc).join("\n")}(i),y=function(e){var t=[];for(var i in e){var n=e[i];!1!==n&&t.push("#define "+i+" "+n)}return t.join("\n")}(l),A=c.createProgram();if(i.isRawShaderMaterial?((n=[y].filter(Yc).join("\n")).length>0&&(n+="\n"),(r=[v,y].filter(Yc).join("\n")).length>0&&(r+="\n")):(n=[sl(i),"#define SHADER_NAME "+i.shaderName,y,i.instancing?"#define USE_INSTANCING":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Yc).join("\n"),r=[v,sl(i),"#define SHADER_NAME "+i.shaderName,y,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.envMap?"#define "+f:"",i.envMap?"#define "+m:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Bs.tonemapping_pars_fragment:"",0!==i.toneMapping?Xc("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.matcapEncoding||i.envMapEncoding||i.emissiveMapEncoding||i.lightMapEncoding?Bs.encodings_pars_fragment:"",i.mapEncoding?Kc("mapTexelToLinear",i.mapEncoding):"",i.matcapEncoding?Kc("matcapTexelToLinear",i.matcapEncoding):"",i.envMapEncoding?Kc("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?Kc("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMapEncoding?Kc("lightMapTexelToLinear",i.lightMapEncoding):"",i.outputEncoding?(o="linearToOutputTexel",a=i.outputEncoding,s=Wc(a),"vec4 "+o+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Yc).join("\n")),h=Jc(h=Zc(h=el(h),i),i),u=Jc(u=Zc(u=el(u),i),i),h=rl(h),u=rl(u),i.isWebGL2&&!i.isRawShaderMaterial){var x=!1,b=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&null!==h.match(b)&&null!==u.match(b)&&(x=!0,h=h.replace(b,""),u=u.replace(b,"")),n=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+n,r=["#version 300 es\n","#define varying in",x?"":"out highp vec4 pc_fragColor;",x?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+r}var w,M,E=r+u,S=jc(c,35633,n+h),_=jc(c,35632,E);if(c.attachShader(A,S),c.attachShader(A,_),void 0!==i.index0AttributeName?c.bindAttribLocation(A,0,i.index0AttributeName):!0===i.morphTargets&&c.bindAttribLocation(A,0,"position"),c.linkProgram(A),e.debug.checkShaderErrors){var T=c.getProgramInfoLog(A).trim(),C=c.getShaderInfoLog(S).trim(),I=c.getShaderInfoLog(_).trim(),P=!0,R=!0;if(!1===c.getProgramParameter(A,35714)){P=!1;var L=qc(c,S,"vertex"),B=qc(c,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",c.getError(),"35715",c.getProgramParameter(A,35715),"gl.getProgramInfoLog",T,L,B)}else""!==T?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",T):""!==C&&""!==I||(R=!1);R&&(this.diagnostics={runnable:P,programLog:T,vertexShader:{log:C,prefix:n},fragmentShader:{log:I,prefix:r}})}return c.deleteShader(S),c.deleteShader(_),this.getUniforms=function(){return void 0===w&&(w=new Gc(c,A)),w},this.getAttributes=function(){return void 0===M&&(M=function(e,t){for(var i={},n=e.getProgramParameter(t,35721),r=0;r<n;r++){var o=e.getActiveAttrib(t,r).name;i[o]=e.getAttribLocation(t,o)}return i}(c,A)),M},this.destroy=function(){c.deleteProgram(A),this.program=void 0},this.name=i.shaderName,this.id=Qc++,this.cacheKey=t,this.usedTimes=1,this.program=A,this.vertexShader=S,this.fragmentShader=_,this}function ll(e,t,i){var n=[],r=i.isWebGL2,o=i.logarithmicDepthBuffer,a=i.floatVertexTextures,s=i.precision,c=i.maxVertexUniforms,l=i.vertexTextures,h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},u=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function d(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=3e3,t}this.getParameters=function(n,u,p,f,m,g,v){var y=f.fog,A=n.isMeshStandardMaterial?f.environment:null,x=n.envMap||A,b=h[n.type],w=v.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(a)return 1024;var i=c,n=Math.floor((i-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}(v):0;null!==n.precision&&(s=i.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",s,"instead.");var M=function(e,t){var i;if(t){var n=Ds[t];i={name:e.type,uniforms:ys.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else i={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return i}(n,b);n.onBeforeCompile(M,e);var E=e.getRenderTarget();return{isWebGL2:r,shaderID:b,shaderName:M.name,uniforms:M.uniforms,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,defines:n.defines,isRawShaderMaterial:n.isRawShaderMaterial,isShaderMaterial:n.isShaderMaterial,precision:s,instancing:!0===v.isInstancedMesh,supportsVertexTextures:l,outputEncoding:null!==E?d(E.texture):e.outputEncoding,map:!!n.map,mapEncoding:d(n.map),matcap:!!n.matcap,matcapEncoding:d(n.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:d(x),envMapCubeUV:!!x&&(306===x.mapping||307===x.mapping),lightMap:!!n.lightMap,lightMapEncoding:d(n.lightMap),aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:d(n.emissiveMap),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,objectSpaceNormalMap:1===n.normalMapType,tangentSpaceNormalMap:0===n.normalMapType,clearcoatMap:!!n.clearcoatMap,clearcoatRoughnessMap:!!n.clearcoatRoughnessMap,clearcoatNormalMap:!!n.clearcoatNormalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,sheen:!!n.sheen,combine:n.combine,vertexTangents:n.normalMap&&n.vertexTangents,vertexColors:n.vertexColors,vertexUvs:!!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatMap||n.clearcoatRoughnessMap||n.clearcoatNormalMap||n.displacementMap),uvsVertexOnly:!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatNormalMap||!n.displacementMap),fog:!!y,useFog:n.fog,fogExp2:y&&y.isFogExp2,flatShading:n.flatShading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:o,skinning:n.skinning&&w>0,maxBones:w,useVertexTexture:a,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:g,dithering:n.dithering,shadowMapEnabled:e.shadowMap.enabled&&p.length>0,shadowMapType:e.shadowMap.type,toneMapping:n.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:2===n.side,flipSided:1===n.side,depthPacking:void 0!==n.depthPacking&&n.depthPacking,index0AttributeName:n.index0AttributeName,extensionDerivatives:n.extensions&&n.extensions.derivatives,extensionFragDepth:n.extensions&&n.extensions.fragDepth,extensionDrawBuffers:n.extensions&&n.extensions.drawBuffers,extensionShaderTextureLOD:n.extensions&&n.extensions.shaderTextureLOD,rendererExtensionFragDepth:r||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:n.onBeforeCompile}},this.getProgramCacheKey=function(t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);if(void 0===t.isRawShaderMaterial){for(var r=0;r<u.length;r++)i.push(t[u[r]]);i.push(e.outputEncoding),i.push(e.gammaFactor)}return i.push(t.onBeforeCompile.toString()),i.join()},this.acquireProgram=function(t,i){for(var r,o=0,a=n.length;o<a;o++){var s=n[o];if(s.cacheKey===i){++(r=s).usedTimes;break}}return void 0===r&&(r=new cl(e,i,t),n.push(r)),r},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=n.indexOf(e);n[t]=n[n.length-1],n.pop(),e.destroy()}},this.programs=n}function hl(){var e=new WeakMap;return{get:function(t){var i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,n){e.get(t)[i]=n},dispose:function(){e=new WeakMap}}}function ul(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function dl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function pl(){var e=[],t=0,i=[],n=[],r={id:-1};function o(i,n,o,a,s,c){var l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:n,material:o,program:o.program||r,groupOrder:a,renderOrder:i.renderOrder,z:s,group:c},e[t]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=o,l.program=o.program||r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=c),t++,l}return{opaque:i,transparent:n,init:function(){t=0,i.length=0,n.length=0},push:function(e,t,r,a,s,c){var l=o(e,t,r,a,s,c);(!0===r.transparent?n:i).push(l)},unshift:function(e,t,r,a,s,c){var l=o(e,t,r,a,s,c);(!0===r.transparent?n:i).unshift(l)},finish:function(){for(var i=t,n=e.length;i<n;i++){var r=e[i];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(e,t){i.length>1&&i.sort(e||ul),n.length>1&&n.sort(t||dl)}}}function fl(){var e=new WeakMap;function t(i){var n=i.target;n.removeEventListener("dispose",t),e.delete(n)}return{get:function(i,n){var r,o=e.get(i);return void 0===o?(r=new pl,e.set(i,new WeakMap),e.get(i).set(n,r),i.addEventListener("dispose",t)):void 0===(r=o.get(n))&&(r=new pl,o.set(n,r)),r},dispose:function(){e=new WeakMap}}}function ml(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var i;switch(t.type){case"DirectionalLight":i={direction:new Zr,color:new ma};break;case"SpotLight":i={position:new Zr,direction:new Zr,color:new ma,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Zr,color:new ma,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Zr,skyColor:new ma,groundColor:new ma};break;case"RectAreaLight":i={color:new ma,position:new Zr,halfWidth:new Zr,halfHeight:new Zr}}return e[t.id]=i,i}}}var gl=0;function vl(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function yl(){for(var e,t=new ml,i=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var i;switch(t.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowRadius:1,shadowMapSize:new zr};break;case"PointLight":i={shadowBias:0,shadowRadius:1,shadowMapSize:new zr,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=i,i}}),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new Zr);var o=new Zr,a=new oo,s=new oo;return{setup:function(e,r,c){for(var l=0,h=0,u=0,d=0;d<9;d++)n.probe[d].set(0,0,0);var p=0,f=0,m=0,g=0,v=0,y=0,A=0,x=0,b=c.matrixWorldInverse;e.sort(vl),d=0;for(var w=e.length;d<w;d++){var M=e[d],E=M.color,S=M.intensity,_=M.distance,T=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)l+=E.r*S,h+=E.g*S,u+=E.b*S;else if(M.isLightProbe)for(var C=0;C<9;C++)n.probe[C].addScaledVector(M.sh.coefficients[C],S);else if(M.isDirectionalLight){if((R=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),R.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),R.direction.sub(o),R.direction.transformDirection(b),M.castShadow){var I=M.shadow;(P=i.get(M)).shadowBias=I.bias,P.shadowRadius=I.radius,P.shadowMapSize=I.mapSize,n.directionalShadow[p]=P,n.directionalShadowMap[p]=T,n.directionalShadowMatrix[p]=M.shadow.matrix,y++}n.directional[p]=R,p++}else if(M.isSpotLight){if((R=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),R.position.applyMatrix4(b),R.color.copy(E).multiplyScalar(S),R.distance=_,R.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),R.direction.sub(o),R.direction.transformDirection(b),R.coneCos=Math.cos(M.angle),R.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),R.decay=M.decay,M.castShadow){I=M.shadow;(P=i.get(M)).shadowBias=I.bias,P.shadowRadius=I.radius,P.shadowMapSize=I.mapSize,n.spotShadow[m]=P,n.spotShadowMap[m]=T,n.spotShadowMatrix[m]=M.shadow.matrix,x++}n.spot[m]=R,m++}else if(M.isRectAreaLight){(R=t.get(M)).color.copy(E).multiplyScalar(S),R.position.setFromMatrixPosition(M.matrixWorld),R.position.applyMatrix4(b),s.identity(),a.copy(M.matrixWorld),a.premultiply(b),s.extractRotation(a),R.halfWidth.set(.5*M.width,0,0),R.halfHeight.set(0,.5*M.height,0),R.halfWidth.applyMatrix4(s),R.halfHeight.applyMatrix4(s),n.rectArea[g]=R,g++}else if(M.isPointLight){if((R=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),R.position.applyMatrix4(b),R.color.copy(M.color).multiplyScalar(M.intensity),R.distance=M.distance,R.decay=M.decay,M.castShadow){var P;I=M.shadow;(P=i.get(M)).shadowBias=I.bias,P.shadowRadius=I.radius,P.shadowMapSize=I.mapSize,P.shadowCameraNear=I.camera.near,P.shadowCameraFar=I.camera.far,n.pointShadow[f]=P,n.pointShadowMap[f]=T,n.pointShadowMatrix[f]=M.shadow.matrix,A++}n.point[f]=R,f++}else if(M.isHemisphereLight){var R;(R=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),R.direction.transformDirection(b),R.direction.normalize(),R.skyColor.copy(M.color).multiplyScalar(S),R.groundColor.copy(M.groundColor).multiplyScalar(S),n.hemi[v]=R,v++}}n.ambient[0]=l,n.ambient[1]=h,n.ambient[2]=u;var L=n.hash;L.directionalLength===p&&L.pointLength===f&&L.spotLength===m&&L.rectAreaLength===g&&L.hemiLength===v&&L.numDirectionalShadows===y&&L.numPointShadows===A&&L.numSpotShadows===x||(n.directional.length=p,n.spot.length=m,n.rectArea.length=g,n.point.length=f,n.hemi.length=v,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=A,n.pointShadowMap.length=A,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=A,n.spotShadowMatrix.length=x,L.directionalLength=p,L.pointLength=f,L.spotLength=m,L.rectAreaLength=g,L.hemiLength=v,L.numDirectionalShadows=y,L.numPointShadows=A,L.numSpotShadows=x,n.version=gl++)},state:n}}function Al(){var e=new yl,t=[],i=[];return{init:function(){t.length=0,i.length=0},state:{lightsArray:t,shadowsArray:i,lights:e},setupLights:function(n){e.setup(t,i,n)},pushLight:function(e){t.push(e)},pushShadow:function(e){i.push(e)}}}function xl(){var e=new WeakMap;function t(i){var n=i.target;n.removeEventListener("dispose",t),e.delete(n)}return{get:function(i,n){var r;return!1===e.has(i)?(r=new Al,e.set(i,new WeakMap),e.get(i).set(n,r),i.addEventListener("dispose",t)):!1===e.get(i).has(n)?(r=new Al,e.get(i).set(n,r)):r=e.get(i).get(n),r},dispose:function(){e=new WeakMap}}}function bl(e){ba.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function wl(e){ba.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Zr,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}bl.prototype=Object.create(ba.prototype),bl.prototype.constructor=bl,bl.prototype.isMeshDepthMaterial=!0,bl.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},wl.prototype=Object.create(ba.prototype),wl.prototype.constructor=wl,wl.prototype.isMeshDistanceMaterial=!0,wl.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function Ml(e,t,i){var n=new Ts,r=new zr,o=new zr,a=new Qr,s=[],c=[],l={},h={0:1,1:0,2:2},u=new As({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new zr},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=u.clone();d.defines.HORIZONAL_PASS=1;var p=new Ga;p.setAttribute("position",new Ea(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new ss(p,u),m=this;function g(i,n){var r=t.update(f);u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(n,null,r,u,f,null),d.uniforms.shadow_pass.value=i.mapPass.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(n,null,r,d,f,null)}function v(e,t,i){var n=e<<0|t<<1|i<<2,r=s[n];return void 0===r&&(r=new bl({depthPacking:3201,morphTargets:e,skinning:t}),s[n]=r),r}function y(e,t,i){var n=e<<0|t<<1|i<<2,r=c[n];return void 0===r&&(r=new wl({morphTargets:e,skinning:t}),c[n]=r),r}function A(t,i,n,r,o,a,s){var c=null,u=v,d=t.customDepthMaterial;if(!0===r.isPointLight&&(u=y,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===n.morphTargets&&(p=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===n.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),c=u(p,f,!0===t.isInstancedMesh)}else c=d;if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var m=c.uuid,g=n.uuid,A=l[m];void 0===A&&(A={},l[m]=A);var x=A[g];void 0===x&&(x=c.clone(),A[g]=x),c=x}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=3===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=o,c.farDistance=a),c}function x(i,r,o,a,s){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===s)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);var c=t.update(i),l=i.material;if(Array.isArray(l))for(var h=c.groups,u=0,d=h.length;u<d;u++){var p=h[u],f=l[p.materialIndex];if(f&&f.visible){var m=A(i,c,f,a,o.near,o.far,s);e.renderBufferDirect(o,null,c,m,i,p)}}else if(l.visible){m=A(i,c,l,a,o.near,o.far,s);e.renderBufferDirect(o,null,c,m,i,null)}}for(var g=i.children,v=0,y=g.length;v<y;v++)x(g[v],r,o,a,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,c){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,f=t.length;p<f;p++){var v=t[p],y=v.shadow;if(void 0!==y){r.copy(y.mapSize);var A=y.getFrameExtents();if(r.multiply(A),o.copy(y.mapSize),(r.x>i||r.y>i)&&(r.x>i&&(o.x=Math.floor(i/A.x),r.x=o.x*A.x,y.mapSize.x=o.x),r.y>i&&(o.y=Math.floor(i/A.y),r.y=o.y*A.y,y.mapSize.y=o.y)),null===y.map&&!y.isPointLightShadow&&3===this.type){var b={minFilter:1006,magFilter:1006,format:1023};y.map=new Wr(r.x,r.y,b),y.map.texture.name=v.name+".shadowMap",y.mapPass=new Wr(r.x,r.y,b),y.camera.updateProjectionMatrix()}if(null===y.map){b={minFilter:1003,magFilter:1003,format:1023};y.map=new Wr(r.x,r.y,b),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var w=y.getViewportCount(),M=0;M<w;M++){var E=y.getViewport(M);a.set(o.x*E.x,o.y*E.y,o.x*E.z,o.y*E.w),d.viewport(a),y.updateMatrices(v,M),n=y.getFrustum(),x(s,c,y.camera,v,this.type)}y.isPointLightShadow||3!==this.type||g(y,c)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(l,h,u)}}}function El(e,t,i){var n=i.isWebGL2;var r=new function(){var t=!1,i=new Qr,n=null,r=new Qr(0,0,0,0);return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,o,a,s){!0===s&&(t*=a,n*=a,o*=a),i.set(t,n,o,a),!1===r.equals(i)&&(e.clearColor(t,n,o,a),r.copy(i))},reset:function(){t=!1,n=null,r.set(-1,0,0,0)}}},o=new function(){var t=!1,i=null,n=null,r=null;return{setTest:function(e){e?F(2929):V(2929)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}},a=new function(){var t=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?F(2960):V(2960))},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,a){n===t&&r===i&&o===a||(e.stencilFunc(t,i,a),n=t,r=i,o=a)},setOp:function(t,i,n){a===t&&s===i&&c===n||(e.stencilOp(t,i,n),a=t,s=i,c=n)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,l=null}}},s=e.getParameter(34921),c=new Uint8Array(s),l=new Uint8Array(s),h=new Uint8Array(s),u={},d=null,p=null,f=null,m=null,g=null,v=null,y=null,A=null,x=null,b=!1,w=null,M=null,E=null,S=null,_=null,T=e.getParameter(35661),C=!1,I=0,P=e.getParameter(7938);-1!==P.indexOf("WebGL")?(I=parseFloat(/^WebGL\ ([0-9])/.exec(P)[1]),C=I>=1):-1!==P.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(P)[1]),C=I>=2);var R=null,L={},B=new Qr,D=new Qr;function O(t,i,n){var r=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var a=0;a<n;a++)e.texImage2D(i+a,0,6408,1,1,0,6408,5121,r);return o}var N={};function k(i,r){(c[i]=1,0===l[i]&&(e.enableVertexAttribArray(i),l[i]=1),h[i]!==r)&&((n?e:t.get("ANGLE_instanced_arrays"))[n?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),h[i]=r)}function F(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function V(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}N[3553]=O(3553,3553,1),N[34067]=O(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),F(2929),o.setFunc(3),j(!1),Q(1),F(2884),G(0);var z={100:32774,101:32778,102:32779};if(n)z[103]=32775,z[104]=32776;else{var H=t.get("EXT_blend_minmax");null!==H&&(z[103]=H.MIN_EXT,z[104]=H.MAX_EXT)}var U={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function G(t,i,n,r,o,a,s,c){if(0!==t){if(p||(F(3042),p=!0),5===t)o=o||i,a=a||n,s=s||r,i===m&&o===y||(e.blendEquationSeparate(z[i],z[o]),m=i,y=o),n===g&&r===v&&a===A&&s===x||(e.blendFuncSeparate(U[n],U[r],U[a],U[s]),g=n,v=r,A=a,x=s),f=t,b=null;else if(t!==f||c!==b){if(100===m&&100===y||(e.blendEquation(32774),m=100,y=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}g=null,v=null,A=null,x=null,f=t,b=c}}else p&&(V(3042),p=!1)}function j(t){w!==t&&(t?e.frontFace(2304):e.frontFace(2305),w=t)}function Q(t){0!==t?(F(2884),t!==M&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):V(2884),M=t}function W(t,i,n){t?(F(32823),S===i&&_===n||(e.polygonOffset(i,n),S=i,_=n)):V(32823)}function q(t){void 0===t&&(t=33984+T-1),R!==t&&(e.activeTexture(t),R=t)}return{buffers:{color:r,depth:o,stencil:a},initAttributes:function(){for(var e=0,t=c.length;e<t;e++)c[e]=0},enableAttribute:function(e){k(e,0)},enableAttributeAndDivisor:k,disableUnusedAttributes:function(){for(var t=0,i=l.length;t!==i;++t)l[t]!==c[t]&&(e.disableVertexAttribArray(t),l[t]=0)},vertexAttribPointer:function(t,i,r,o,a,s){!0!==n||5124!==r&&5125!==r?e.vertexAttribPointer(t,i,r,o,a,s):e.vertexAttribIPointer(t,i,r,o,a,s)},enable:F,disable:V,useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:G,setMaterial:function(e,t){2===e.side?V(2884):F(2884);var i=1===e.side;t&&(i=!i),j(i),1===e.blending&&!1===e.transparent?G(0):G(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),r.setMask(e.colorWrite);var n=e.stencilWrite;a.setTest(n),n&&(a.setMask(e.stencilWriteMask),a.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),a.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),W(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:j,setCullFace:Q,setLineWidth:function(t){t!==E&&(C&&e.lineWidth(t),E=t)},setPolygonOffset:W,setScissorTest:function(e){e?F(3089):V(3089)},activeTexture:q,bindTexture:function(t,i){null===R&&q();var n=L[R];void 0===n&&(n={type:void 0,texture:void 0},L[R]=n),n.type===t&&n.texture===i||(e.bindTexture(t,i||N[t]),n.type=t,n.texture=i)},unbindTexture:function(){var t=L[R];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===B.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),B.copy(t))},viewport:function(t){!1===D.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),D.copy(t))},reset:function(){for(var t=0;t<l.length;t++)1===l[t]&&(e.disableVertexAttribArray(t),l[t]=0);u={},R=null,L={},d=null,f=null,w=null,M=null,r.reset(),o.reset(),a.reset()}}}function Sl(e,t,i,n,r,o,a){var s,c=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,d=r.maxSamples,p=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(e,t,i,n){var r=1;if((e.width>n||e.height>n)&&(r=n/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var o=t?Vr.floorPowerOfTwo:Math.floor,a=o(r*e.width),c=o(r*e.height);void 0===s&&(s=m(a,c));var l=i?m(a,c):s;return l.width=a,l.height=c,l.getContext("2d").drawImage(e,0,0,a,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+c+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function v(e){return Vr.isPowerOfTwo(e.width)&&Vr.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function A(t,i,r,o){e.generateMipmap(t),n.get(i).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function x(i,n,r){if(!1===c)return n;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}var o=n;return 6403===n&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===n&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===n&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function b(e){return 1003===e||1004===e||1005===e?9728:9729}function w(t){var i=t.target;i.removeEventListener("dispose",w),function(t){var i=n.get(t);if(void 0===i.__webglInit)return;e.deleteTexture(i.__webglTexture),n.remove(t)}(i),i.isVideoTexture&&p.delete(i),a.memory.textures--}function M(t){var i=t.target;i.removeEventListener("dispose",M),function(t){var i=n.get(t),r=n.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)e.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[o]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&e.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer);n.remove(t.texture),n.remove(t)}(i),a.memory.textures--}var E=0;function S(e,t){var r=n.get(e);if(e.isVideoTexture&&function(e){var t=a.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&r.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void L(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+t),i.bindTexture(3553,r.__webglTexture)}function _(t,r){if(6===t.image.length){var a=n.get(t);if(t.version>0&&a.__version!==t.version){R(a,t),i.activeTexture(33984+r),i.bindTexture(34067,a.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),l=t.image[0]&&t.image[0].isDataTexture,u=[],d=0;d<6;d++)u[d]=s||l?l?t.image[d].image:t.image[d]:g(t.image[d],!1,!0,h);var p,f=u[0],m=v(f)||c,b=o.convert(t.format),w=o.convert(t.type),M=x(t.internalFormat,b,w);if(P(34067,t,m),s){for(d=0;d<6;d++){p=u[d].mipmaps;for(var E=0;E<p.length;E++){var S=p[E];1023!==t.format&&1022!==t.format?null!==b?i.compressedTexImage2D(34069+d,E,M,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+d,E,M,S.width,S.height,0,b,w,S.data)}}a.__maxMipLevel=p.length-1}else{p=t.mipmaps;for(d=0;d<6;d++)if(l){i.texImage2D(34069+d,0,M,u[d].width,u[d].height,0,b,w,u[d].data);for(E=0;E<p.length;E++){var _=(S=p[E]).image[d].image;i.texImage2D(34069+d,E+1,M,_.width,_.height,0,b,w,_.data)}}else{i.texImage2D(34069+d,0,M,b,w,u[d]);for(E=0;E<p.length;E++){S=p[E];i.texImage2D(34069+d,E+1,M,b,w,S.image[d])}}a.__maxMipLevel=p.length}y(t,m)&&A(34067,t,f.width,f.height),a.__version=t.version,t.onUpdate&&t.onUpdate(t)}else i.activeTexture(33984+r),i.bindTexture(34067,a.__webglTexture)}}function T(e,t){i.activeTexture(33984+t),i.bindTexture(34067,n.get(e).__webglTexture)}var C={1e3:10497,1001:33071,1002:33648},I={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(i,o,a){a?(e.texParameteri(i,10242,C[o.wrapS]),e.texParameteri(i,10243,C[o.wrapT]),32879!==i&&35866!==i||e.texParameteri(i,32882,C[o.wrapR]),e.texParameteri(i,10240,I[o.magFilter]),e.texParameteri(i,10241,I[o.minFilter])):(e.texParameteri(i,10242,33071),e.texParameteri(i,10243,33071),32879!==i&&35866!==i||e.texParameteri(i,32882,33071),1001===o.wrapS&&1001===o.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(i,10240,b(o.magFilter)),e.texParameteri(i,10241,b(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(1015===o.type&&null===t.get("OES_texture_float_linear"))return;if(1016===o.type&&null===(c||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function R(t,i){void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",w),t.__webglTexture=e.createTexture(),a.memory.textures++)}function L(t,n,r){var a=3553;n.isDataTexture2DArray&&(a=35866),n.isDataTexture3D&&(a=32879),R(t,n),i.activeTexture(33984+r),i.bindTexture(a,t.__webglTexture),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment);var s=function(e){return!c&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)}(n)&&!1===v(n.image),l=g(n.image,s,!1,u),h=v(l)||c,d=o.convert(n.format),p=o.convert(n.type),f=x(n.internalFormat,d,p);P(a,n,h);var m,b=n.mipmaps;if(n.isDepthTexture)f=6402,c?f=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===f&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,p=o.convert(n.type)),1027===n.format&&6402===f&&(f=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,p=o.convert(n.type))),i.texImage2D(3553,0,f,l.width,l.height,0,d,p,null);else if(n.isDataTexture)if(b.length>0&&h){for(var w=0,M=b.length;w<M;w++)m=b[w],i.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);n.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else i.texImage2D(3553,0,f,l.width,l.height,0,d,p,l.data),t.__maxMipLevel=0;else if(n.isCompressedTexture){for(w=0,M=b.length;w<M;w++)m=b[w],1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(3553,w,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);t.__maxMipLevel=b.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,f,l.width,l.height,l.depth,0,d,p,l.data),t.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,f,l.width,l.height,l.depth,0,d,p,l.data),t.__maxMipLevel=0;else if(b.length>0&&h){for(w=0,M=b.length;w<M;w++)m=b[w],i.texImage2D(3553,w,f,d,p,m);n.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else i.texImage2D(3553,0,f,d,p,l),t.__maxMipLevel=0;y(n,h)&&A(a,n,l.width,l.height),t.__version=n.version,n.onUpdate&&n.onUpdate(n)}function B(t,r,a,s){var c=o.convert(r.texture.format),l=o.convert(r.texture.type),h=x(r.texture.internalFormat,c,l);i.texImage2D(s,0,h,r.width,r.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,a,s,n.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function D(t,i,n){if(e.bindRenderbuffer(36161,t),i.depthBuffer&&!i.stencilBuffer){var r=33189;if(n){var a=i.depthTexture;a&&a.isDepthTexture&&(1015===a.type?r=36012:1014===a.type&&(r=33190));var s=N(i);e.renderbufferStorageMultisample(36161,s,r,i.width,i.height)}else e.renderbufferStorage(36161,r,i.width,i.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(i.depthBuffer&&i.stencilBuffer){if(n){s=N(i);e.renderbufferStorageMultisample(36161,s,35056,i.width,i.height)}else e.renderbufferStorage(36161,34041,i.width,i.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=o.convert(i.texture.format),l=o.convert(i.texture.type);r=x(i.texture.internalFormat,c,l);if(n){s=N(i);e.renderbufferStorageMultisample(36161,s,r,i.width,i.height)}else e.renderbufferStorage(36161,r,i.width,i.height)}e.bindRenderbuffer(36161,null)}function O(t){var i=n.get(t),r=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),S(i.depthTexture,0);var r=n.get(i.depthTexture).__webglTexture;if(1026===i.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,r,0);else{if(1027!==i.depthTexture.format)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,r,0)}}(i.__webglFramebuffer,t)}else if(r){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(36160,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),D(i.__webglDepthbuffer[o],t,!1)}else e.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),D(i.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function N(e){return c&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}var k=!1,F=!1;this.allocateTextureUnit=function(){var e=E;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=S,this.setTexture2DArray=function(e,t){var r=n.get(e);e.version>0&&r.__version!==e.version?L(r,e,t):(i.activeTexture(33984+t),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=n.get(e);e.version>0&&r.__version!==e.version?L(r,e,t):(i.activeTexture(33984+t),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=_,this.setTextureCubeDynamic=T,this.setupRenderTarget=function(t){var r=n.get(t),s=n.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),a.memory.textures++;var l=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=v(t)||c;if(!c||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){r.__webglFramebuffer=[];for(var d=0;d<6;d++)r.__webglFramebuffer[d]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),h)if(c){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var p=o.convert(t.texture.format),f=o.convert(t.texture.type),m=x(t.texture.internalFormat,p,f),g=N(t);e.renderbufferStorageMultisample(36161,g,m,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),D(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){i.bindTexture(34067,s.__webglTexture),P(34067,t.texture,u);for(d=0;d<6;d++)B(r.__webglFramebuffer[d],t,36064,34069+d);y(t.texture,u)&&A(34067,t.texture,t.width,t.height),i.bindTexture(34067,null)}else i.bindTexture(3553,s.__webglTexture),P(3553,t.texture,u),B(r.__webglFramebuffer,t,36064,3553),y(t.texture,u)&&A(3553,t.texture,t.width,t.height),i.bindTexture(3553,null);t.depthBuffer&&O(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,v(e)||c)){var r=e.isWebGLCubeRenderTarget?34067:3553,o=n.get(t).__webglTexture;i.bindTexture(r,o),A(r,t,e.width,e.height),i.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(c){var i=n.get(t);e.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,i.__webglFramebuffer);var r=t.width,o=t.height,a=16384;t.depthBuffer&&(a|=256),t.stencilBuffer&&(a|=1024),e.blitFramebuffer(0,0,r,o,0,0,r,o,a,9728),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===k&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),k=!0),e=e.texture),S(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?_(e,t):T(e,t)}}function _l(e,t,i){var n=i.isWebGL2;return{convert:function(e){var i;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return n?5131:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(i=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return i.COMPRESSED_RGB8_ETC2;if(37496===e)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(i=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(i=t.get("EXT_texture_compression_bptc"))?e:null:1020===e?n?34042:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Tl(e){bs.call(this),this.cameras=e||[]}function Cl(){Eo.call(this),this.type="Group"}function Il(){this._targetRay=null,this._grip=null}function Pl(e,t){var i=this,n=null,r=1,o=null,a="local-floor",s=null,c=[],l=new Map,h=new bs;h.layers.enable(1),h.viewport=new Qr;var u=new bs;u.layers.enable(2),u.viewport=new Qr;var d=[h,u],p=new Tl;p.layers.enable(1),p.layers.enable(2);var f=null,m=null;function g(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function v(){l.forEach((function(e,t){e.disconnect(t)})),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),E.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function y(e){o=e,E.setContext(n),E.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}function A(e){for(var t=n.inputSources,i=0;i<c.length;i++)l.set(t[i],c[i]);for(i=0;i<e.removed.length;i++){var r=e.removed[i];(o=l.get(r))&&(o.dispatchEvent({type:"disconnected",data:r}),l.delete(r))}for(i=0;i<e.added.length;i++){var o;r=e.added[i];(o=l.get(r))&&o.dispatchEvent({type:"connected",data:r})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return void 0===t&&(t=new Il,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=c[e];return void 0===t&&(t=new Il,c[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return n},this.setSession=function(e){if(null!==(n=e)){n.addEventListener("select",g),n.addEventListener("selectstart",g),n.addEventListener("selectend",g),n.addEventListener("squeeze",g),n.addEventListener("squeezestart",g),n.addEventListener("squeezeend",g),n.addEventListener("end",v);var i=t.getContextAttributes();!0!==i.xrCompatible&&t.makeXRCompatible();var o={antialias:i.antialias,alpha:i.alpha,depth:i.depth,stencil:i.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(n,t,o);n.updateRenderState({baseLayer:s}),n.requestReferenceSpace(a).then(y),n.addEventListener("inputsourceschange",A)}};var x=new Zr,b=new Zr;function w(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=u.near=h.near=e.near,p.far=u.far=h.far=e.far,f===p.near&&m===p.far||(n.updateRenderState({depthNear:p.near,depthFar:p.far}),f=p.near,m=p.far);var t=e.parent,i=p.cameras;w(p,t);for(var r=0;r<i.length;r++)w(i[r],t);e.matrixWorld.copy(p.matrixWorld);for(var o=e.children,a=(r=0,o.length);r<a;r++)o[r].updateMatrixWorld(!0);return 2===i.length?function(e,t,i){x.setFromMatrixPosition(t.matrixWorld),b.setFromMatrixPosition(i.matrixWorld);var n=x.distanceTo(b),r=t.projectionMatrix.elements,o=i.projectionMatrix.elements,a=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(o[8]+1)/o[0],d=a*h,p=a*u,f=n/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=a+f,v=s+f,y=d-m,A=p+(n-m),w=c*s/v*g,M=l*s/v*g;e.projectionMatrix.makePerspective(y,A,w,M,g,v)}(p,h,u):p.projectionMatrix.copy(h.projectionMatrix),p};var M=null;var E=new Is;E.setAnimationLoop((function(t,i){if(null!==(s=i.getViewerPose(o))){var r=s.views,a=n.renderState.baseLayer;e.setFramebuffer(a.framebuffer);var l=!1;r.length!==p.cameras.length&&(p.cameras.length=0,l=!0);for(var h=0;h<r.length;h++){var u=r[h],f=a.getViewport(u),m=d[h];m.matrix.fromArray(u.transform.matrix),m.projectionMatrix.fromArray(u.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===h&&p.matrix.copy(m.matrix),!0===l&&p.cameras.push(m)}}var g=n.inputSources;for(h=0;h<c.length;h++){var v=c[h],y=g[h];v.update(y,i,o)}M&&M(t,i)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function Rl(e){function t(t,i,n){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map),i.alphaMap&&(t.alphaMap.value=i.alphaMap),i.specularMap&&(t.specularMap.value=i.specularMap);var r,o,a=i.envMap||n;a&&(t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture?-1:1,t.reflectivity.value=i.reflectivity,t.refractionRatio.value=i.refractionRatio,t.maxMipLevel.value=e.get(a).__maxMipLevel),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap&&(r=i.emissiveMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function i(e,t,i){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||i)&&(e.envMapIntensity.value=t.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,n,r,o,a){n.isMeshBasicMaterial?t(e,n):n.isMeshLambertMaterial?(t(e,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,n)):n.isMeshToonMaterial?(t(e,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,n)):n.isMeshPhongMaterial?(t(e,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,n)):n.isMeshStandardMaterial?(t(e,n,r),n.isMeshPhysicalMaterial?function(e,t,n){i(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(e,n,r):i(e,n,r)):n.isMeshMatcapMaterial?(t(e,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,n)):n.isMeshDepthMaterial?(t(e,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,n)):n.isMeshDistanceMaterial?(t(e,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,n)):n.isMeshNormalMaterial?(t(e,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,n)):n.isPointsMaterial?function(e,t,i,n){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*n,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,n,o,a):n.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,n):n.isShadowMaterial?(e.color.value.copy(n.color),e.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Ll(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),i=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,o=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,u=null,d=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p,f,m,g,v,y,A,x,b,w,M,E,S,_,T,C,I,P,R,L=this,B=!1,D=null,O=0,N=0,k=null,F=null,V=-1,z={geometry:null,program:null,wireframe:!1},H=null,U=null,G=new Qr,j=new Qr,Q=null,W=t.width,q=t.height,K=1,X=null,Y=null,Z=new Qr(0,0,W,q),J=new Qr(0,0,W,q),$=!1,ee=new Ts,te=new Fs,ie=!1,ne=!1,re=new oo,oe=new Zr;function ae(){return null===k?K:1}try{var se={alpha:n,depth:r,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h};if(t.addEventListener("webglcontextlost",ue,!1),t.addEventListener("webglcontextrestored",de,!1),null===(p=i||t.getContext("webgl",se)||t.getContext("experimental-webgl",se)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===p.getShaderPrecisionFormat&&(p.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ce(){f=new Vs(p),!1===(m=new ks(p,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),R=new _l(p,f,m),(g=new El(p,f,m)).scissor(j.copy(J).multiplyScalar(K).floor()),g.viewport(G.copy(Z).multiplyScalar(K).floor()),v=new Us(p),y=new hl,A=new Sl(p,f,g,y,m,R,v),x=new Ps(p,m),b=new zs(p,x,v),w=new Qs(p,b,x,v),C=new js(p),M=new ll(L,f,m),E=new Rl(y),S=new fl,_=new xl,T=new Os(L,g,w,s),I=new Ns(p,f,v,m),P=new Hs(p,f,v,m),v.programs=M.programs,L.capabilities=m,L.extensions=f,L.properties=y,L.renderLists=S,L.state=g,L.info=v}ce();var le=new Pl(L,p);this.xr=le;var he=new Ml(L,w,m.maxTextureSize);function ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),B=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),B=!1,ce()}function pe(e){var t=e.target;t.removeEventListener("dispose",pe),function(e){fe(e),y.remove(e)}(t)}function fe(e){var t=y.get(e).program;e.program=void 0,void 0!==t&&M.releaseProgram(t)}this.shadowMap=he,this.getContext=function(){return p},this.getContextAttributes=function(){return p.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return K},this.setPixelRatio=function(e){void 0!==e&&(K=e,this.setSize(W,q,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new zr),e.set(W,q)},this.setSize=function(e,i,n){le.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(W=e,q=i,t.width=Math.floor(e*K),t.height=Math.floor(i*K),!1!==n&&(t.style.width=e+"px",t.style.height=i+"px"),this.setViewport(0,0,e,i))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new zr),e.set(W*K,q*K).floor()},this.setDrawingBufferSize=function(e,i,n){W=e,q=i,K=n,t.width=Math.floor(e*n),t.height=Math.floor(i*n),this.setViewport(0,0,e,i)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Qr),e.copy(G)},this.getViewport=function(e){return e.copy(Z)},this.setViewport=function(e,t,i,n){e.isVector4?Z.set(e.x,e.y,e.z,e.w):Z.set(e,t,i,n),g.viewport(G.copy(Z).multiplyScalar(K).floor())},this.getScissor=function(e){return e.copy(J)},this.setScissor=function(e,t,i,n){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,i,n),g.scissor(j.copy(J).multiplyScalar(K).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){g.setScissorTest($=e)},this.setOpaqueSort=function(e){X=e},this.setTransparentSort=function(e){Y=e},this.getClearColor=function(){return T.getClearColor()},this.setClearColor=function(){T.setClearColor.apply(T,arguments)},this.getClearAlpha=function(){return T.getClearAlpha()},this.setClearAlpha=function(){T.setClearAlpha.apply(T,arguments)},this.clear=function(e,t,i){var n=0;(void 0===e||e)&&(n|=16384),(void 0===t||t)&&(n|=256),(void 0===i||i)&&(n|=1024),p.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ue,!1),t.removeEventListener("webglcontextrestored",de,!1),S.dispose(),_.dispose(),y.dispose(),w.dispose(),le.dispose(),ve.stop()},this.renderBufferImmediate=function(e,t){g.initAttributes();var i=y.get(e);e.hasPositions&&!i.position&&(i.position=p.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=p.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=p.createBuffer()),e.hasColors&&!i.color&&(i.color=p.createBuffer());var n=t.getAttributes();e.hasPositions&&(p.bindBuffer(34962,i.position),p.bufferData(34962,e.positionArray,35048),g.enableAttribute(n.position),p.vertexAttribPointer(n.position,3,5126,!1,0,0)),e.hasNormals&&(p.bindBuffer(34962,i.normal),p.bufferData(34962,e.normalArray,35048),g.enableAttribute(n.normal),p.vertexAttribPointer(n.normal,3,5126,!1,0,0)),e.hasUvs&&(p.bindBuffer(34962,i.uv),p.bufferData(34962,e.uvArray,35048),g.enableAttribute(n.uv),p.vertexAttribPointer(n.uv,2,5126,!1,0,0)),e.hasColors&&(p.bindBuffer(34962,i.color),p.bufferData(34962,e.colorArray,35048),g.enableAttribute(n.color),p.vertexAttribPointer(n.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),p.drawArrays(4,0,e.count),e.count=0};var me=new So;this.renderBufferDirect=function(e,t,i,n,r,o){null===t&&(t=me);var a=r.isMesh&&r.matrixWorld.determinant()<0,s=we(e,t,n,r);g.setMaterial(n,a);var c=!1;z.geometry===i.id&&z.program===s.id&&z.wireframe===(!0===n.wireframe)||(z.geometry=i.id,z.program=s.id,z.wireframe=!0===n.wireframe,c=!0),(n.morphTargets||n.morphNormals)&&(C.update(r,i,n,s),c=!0),!0===r.isInstancedMesh&&(c=!0);var l=i.index,h=i.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;var u,d=1;!0===n.wireframe&&(l=b.getWireframeAttribute(i),d=2);var v=I;null!==l&&(u=x.get(l),(v=P).setIndex(u)),c&&(!function(e,t,i,n){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;g.initAttributes();var r=t.attributes,o=n.getAttributes(),a=i.defaultAttributeValues;for(var s in o){var c=o[s];if(c>=0){var l=r[s];if(void 0!==l){var h=l.normalized,u=l.itemSize;if(void 0===(M=x.get(l)))continue;var d=M.buffer,v=M.type,y=M.bytesPerElement;if(l.isInterleavedBufferAttribute){var A=l.data,b=A.stride,w=l.offset;A&&A.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(c,A.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=A.meshPerAttribute*A.count)):g.enableAttribute(c),p.bindBuffer(34962,d),g.vertexAttribPointer(c,u,v,h,b*y,w*y)}else l.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=l.meshPerAttribute*l.count)):g.enableAttribute(c),p.bindBuffer(34962,d),g.vertexAttribPointer(c,u,v,h,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=x.get(e.instanceMatrix)))continue;d=M.buffer,v=M.type;g.enableAttributeAndDivisor(c+0,1),g.enableAttributeAndDivisor(c+1,1),g.enableAttributeAndDivisor(c+2,1),g.enableAttributeAndDivisor(c+3,1),p.bindBuffer(34962,d),p.vertexAttribPointer(c+0,4,v,!1,64,0),p.vertexAttribPointer(c+1,4,v,!1,64,16),p.vertexAttribPointer(c+2,4,v,!1,64,32),p.vertexAttribPointer(c+3,4,v,!1,64,48)}else if(void 0!==a){var E=a[s];if(void 0!==E)switch(E.length){case 2:p.vertexAttrib2fv(c,E);break;case 3:p.vertexAttrib3fv(c,E);break;case 4:p.vertexAttrib4fv(c,E);break;default:p.vertexAttrib1fv(c,E)}}}}g.disableUnusedAttributes()}(r,i,n,s),null!==l&&p.bindBuffer(34963,u.buffer));var y=null!==l?l.count:h.count,A=i.drawRange.start*d,w=i.drawRange.count*d,M=null!==o?o.start*d:0,E=null!==o?o.count*d:1/0,S=Math.max(A,M),_=Math.min(y,A+w,M+E)-1,T=Math.max(0,_-S+1);if(0!==T){if(r.isMesh)!0===n.wireframe?(g.setLineWidth(n.wireframeLinewidth*ae()),v.setMode(1)):v.setMode(4);else if(r.isLine){var R=n.linewidth;void 0===R&&(R=1),g.setLineWidth(R*ae()),r.isLineSegments?v.setMode(1):r.isLineLoop?v.setMode(2):v.setMode(3)}else r.isPoints?v.setMode(0):r.isSprite&&v.setMode(4);if(r.isInstancedMesh)v.renderInstances(i,S,T,r.count);else if(i.isInstancedBufferGeometry){var L=Math.min(i.instanceCount,i._maxInstanceCount);v.renderInstances(i,S,T,L)}else v.render(S,T)}},this.compile=function(e,t){(d=_.get(e,t)).init(),e.traverse((function(e){e.isLight&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(t);const i={};e.traverse((function(t){let n=t.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){let o=n[r];o.uuid in i==!1&&(be(o,e,t),i[o.uuid]=!0)}else n.uuid in i==!1&&(be(n,e,t),i[n.uuid]=!0)}))};var ge=null;var ve=new Is;function ye(e,t,i,n){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){n&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re);var r=w.update(e);(o=e.material).visible&&u.push(e,r,o,i,oe.z,null)}}else if(e.isImmediateRenderObject)n&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re),u.push(e,null,e.material,i,oe.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==v.render.frame&&(e.skeleton.update(),e.skeleton.frame=v.render.frame),!e.frustumCulled||ee.intersectsObject(e))){n&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re);r=w.update(e);var o=e.material;if(Array.isArray(o))for(var a=r.groups,s=0,c=a.length;s<c;s++){var l=a[s],h=o[l.materialIndex];h&&h.visible&&u.push(e,r,h,i,oe.z,l)}else o.visible&&u.push(e,r,o,i,oe.z,null)}var p=e.children;for(s=0,c=p.length;s<c;s++)ye(p[s],t,i,n)}}function Ae(e,t,i,n){for(var r=0,o=e.length;r<o;r++){var a=e[r],s=a.object,c=a.geometry,l=void 0===n?a.material:n,h=a.group;if(i.isArrayCamera){U=i;for(var u=i.cameras,p=0,f=u.length;p<f;p++){var m=u[p];s.layers.test(m.layers)&&(g.viewport(G.copy(m.viewport)),d.setupLights(m),xe(s,t,m,c,l,h))}}else U=null,xe(s,t,i,c,l,h)}}function xe(e,t,i,n,r,o){if(e.onBeforeRender(L,t,i,n,r,o),d=_.get(t,U||i),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var a=we(i,t,r,e);g.setMaterial(r),z.geometry=null,z.program=null,z.wireframe=!1,function(e,t){e.render((function(e){L.renderBufferImmediate(e,t)}))}(e,a)}else L.renderBufferDirect(i,t,n,r,e,o);e.onAfterRender(L,t,i,n,r,o),d=_.get(t,U||i)}function be(e,t,i){var n=y.get(e),r=d.state.lights,o=d.state.shadowsArray,a=r.state.version,s=M.getParameters(e,r.state,o,t,te.numPlanes,te.numIntersection,i),c=M.getProgramCacheKey(s),l=n.program,h=!0;if(void 0===l)e.addEventListener("dispose",pe);else if(l.cacheKey!==c)fe(e);else if(n.lightsStateVersion!==a)n.lightsStateVersion=a,h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(l=M.acquireProgram(s,c),n.program=l,n.uniforms=s.uniforms,n.outputEncoding=s.outputEncoding,e.program=l);var u=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var p=0;p<L.maxMorphTargets;p++)u["morphTarget"+p]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(p=0;p<L.maxMorphNormals;p++)u["morphNormal"+p]>=0&&e.numSupportedMorphNormals++}var f=n.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(n.numClippingPlanes=te.numPlanes,n.numIntersection=te.numIntersection,f.clippingPlanes=te.uniform),n.environment=e.isMeshStandardMaterial?t.environment:null,n.fog=t.fog,n.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),n.lightsStateVersion=a,n.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=n.program.getUniforms(),g=Gc.seqWithValue(m.seq,f);n.uniformsList=g}function we(e,t,i,n){A.resetTextureUnits();var r=t.fog,o=i.isMeshStandardMaterial?t.environment:null,a=null===k?L.outputEncoding:k.texture.encoding,s=y.get(i),c=d.state.lights;if(ie&&(ne||e!==H)){var l=e===H&&i.id===V;te.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,e,s,l)}i.version===s.__version?void 0===s.program||i.fog&&s.fog!==r||s.environment!==o||s.needsLights&&s.lightsStateVersion!==c.state.version?be(i,t,n):void 0===s.numClippingPlanes||s.numClippingPlanes===te.numPlanes&&s.numIntersection===te.numIntersection?s.outputEncoding!==a&&be(i,t,n):be(i,t,n):(be(i,t,n),s.__version=i.version);var h=!1,u=!1,f=!1,v=s.program,x=v.getUniforms(),b=s.uniforms;if(g.useProgram(v.program)&&(h=!0,u=!0,f=!0),i.id!==V&&(V=i.id,u=!0),h||H!==e){if(x.setValue(p,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&x.setValue(p,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),H!==e&&(H=e,u=!0,f=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){var w=x.map.cameraPosition;void 0!==w&&w.setValue(p,oe.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&x.setValue(p,"isOrthographic",!0===e.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&x.setValue(p,"viewMatrix",e.matrixWorldInverse)}if(i.skinning){x.setOptional(p,n,"bindMatrix"),x.setOptional(p,n,"bindMatrixInverse");var M=n.skeleton;if(M){var S=M.bones;if(m.floatVertexTextures){if(void 0===M.boneTexture){var _=Math.sqrt(4*S.length);_=Vr.ceilPowerOfTwo(_),_=Math.max(_,4);var T=new Float32Array(_*_*4);T.set(M.boneMatrices);var C=new Es(T,_,_,1023,1015);M.boneMatrices=T,M.boneTexture=C,M.boneTextureSize=_}x.setValue(p,"boneTexture",M.boneTexture,A),x.setValue(p,"boneTextureSize",M.boneTextureSize)}else x.setOptional(p,M,"boneMatrices")}}return(u||s.receiveShadow!==n.receiveShadow)&&(s.receiveShadow=n.receiveShadow,x.setValue(p,"receiveShadow",n.receiveShadow)),u&&(x.setValue(p,"toneMappingExposure",L.toneMappingExposure),x.setValue(p,"toneMappingWhitePoint",L.toneMappingWhitePoint),s.needsLights&&function(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}(b,f),r&&i.fog&&E.refreshFogUniforms(b,r),E.refreshMaterialUniforms(b,i,o,K,q),void 0!==b.ltc_1&&(b.ltc_1.value=Cs.LTC_1),void 0!==b.ltc_2&&(b.ltc_2.value=Cs.LTC_2),Gc.upload(p,s.uniformsList,b,A)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Gc.upload(p,s.uniformsList,b,A),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&x.setValue(p,"center",n.center),x.setValue(p,"modelViewMatrix",n.modelViewMatrix),x.setValue(p,"normalMatrix",n.normalMatrix),x.setValue(p,"modelMatrix",n.matrixWorld),v}ve.setAnimationLoop((function(e){le.isPresenting||ge&&ge(e)})),"undefined"!=typeof window&&ve.setContext(window),this.setAnimationLoop=function(e){ge=e,le.setAnimationLoop(e),ve.start()},this.render=function(e,t){var i,n;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),t&&t.isCamera){if(!B){z.geometry=null,z.program=null,z.wireframe=!1,V=-1,H=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),le.enabled&&le.isPresenting&&(t=le.getCamera(t)),e.onBeforeRender(L,e,t,i||k),(d=_.get(e,t)).init(),re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(re),ne=this.localClippingEnabled,ie=te.init(this.clippingPlanes,ne,t),(u=S.get(e,t)).init(),ye(e,t,0,L.sortObjects),u.finish(),!0===L.sortObjects&&u.sort(X,Y),ie&&te.beginShadows();var r=d.state.shadowsArray;he.render(r,e,t),d.setupLights(t),ie&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),T.render(u,e,t,n);var o=u.opaque,a=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;o.length&&Ae(o,e,t,s),a.length&&Ae(a,e,t,s)}else o.length&&Ae(o,e,t),a.length&&Ae(a,e,t);e.onAfterRender(L,e,t),null!==k&&(A.updateRenderTargetMipmap(k),A.updateMultisampleRenderTarget(k)),g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),g.setPolygonOffset(!1),u=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){D!==e&&null===k&&p.bindFramebuffer(36160,e),D=e},this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return k},this.setRenderTarget=function(e,t,i){k=e,O=t,N=i,e&&void 0===y.get(e).__webglFramebuffer&&A.setupRenderTarget(e);var n=D,r=!1;if(e){var o=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(n=o[t||0],r=!0):n=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:o,G.copy(e.viewport),j.copy(e.scissor),Q=e.scissorTest}else G.copy(Z).multiplyScalar(K).floor(),j.copy(J).multiplyScalar(K).floor(),Q=$;if(F!==n&&(p.bindFramebuffer(36160,n),F=n),g.viewport(G),g.scissor(j),g.setScissorTest(Q),r){var a=y.get(e.texture);p.framebufferTexture2D(36160,36064,34069+(t||0),a.__webglTexture,i||0)}},this.readRenderTargetPixels=function(e,t,i,n,r,o,a){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){var c=!1;s!==F&&(p.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,h=l.format,u=l.type;if(1023!==h&&R.convert(h)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===u||R.convert(u)===p.getParameter(35738)||1015===u&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||1016===u&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?t>=0&&t<=e.width-n&&i>=0&&i<=e.height-r&&p.readPixels(t,i,n,r,R.convert(h),R.convert(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&p.bindFramebuffer(36160,F)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,i){void 0===i&&(i=0);var n=Math.pow(2,-i),r=Math.floor(t.image.width*n),o=Math.floor(t.image.height*n),a=R.convert(t.format);A.setTexture2D(t,0),p.copyTexImage2D(3553,i,a,e.x,e.y,r,o,0),g.unbindTexture()},this.copyTextureToTexture=function(e,t,i,n){void 0===n&&(n=0);var r=t.image.width,o=t.image.height,a=R.convert(i.format),s=R.convert(i.type);A.setTexture2D(i,0),t.isDataTexture?p.texSubImage2D(3553,n,e.x,e.y,r,o,a,s,t.image.data):t.isCompressedTexture?p.compressedTexSubImage2D(3553,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):p.texSubImage2D(3553,n,e.x,e.y,a,s,t.image),0===n&&i.generateMipmaps&&p.generateMipmap(3553),g.unbindTexture()},this.initTexture=function(e){A.setTexture2D(e,0),g.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Bl(e,t){this.name="",this.color=new ma(e),this.density=void 0!==t?t:25e-5}function Dl(e,t,i){this.name="",this.color=new ma(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function Ol(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}Tl.prototype=Object.assign(Object.create(bs.prototype),{constructor:Tl,isArrayCamera:!0}),Cl.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Cl,isGroup:!0}),Object.assign(Il.prototype,{constructor:Il,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Cl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Cl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,i){var n=null,r=null,o=this._targetRay,a=this._grip;return e&&(null!==o&&null!==(n=t.getPose(e.targetRaySpace,i))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),null!==o&&(o.visible=null!==n),null!==a&&(a.visible=null!==r),this}}),Object.assign(Pl.prototype,Or.prototype),Object.assign(Bl.prototype,{isFogExp2:!0,clone:function(){return new Bl(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Dl.prototype,{isFog:!0,clone:function(){return new Dl(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Ol.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ol.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,i){e*=this.stride,i*=t.stride;for(var n=0,r=this.stride;n<r;n++)this.array[e+n]=t.array[i+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Nl,kl=new Zr;function Fl(e,t,i,n){this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=!0===n}function Vl(e){ba.call(this),this.type="SpriteMaterial",this.color=new ma(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Fl.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Fl.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,i=this.data.count;t<i;t++)kl.x=this.getX(t),kl.y=this.getY(t),kl.z=this.getZ(t),kl.applyMatrix4(e),this.setXYZ(t,kl.x,kl.y,kl.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this.data.array[e+3]=r,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var i=t*this.data.stride+this.offset,n=0;n<this.itemSize;n++)e.push(this.data.array[i+n]);return new Ea(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var i=t*this.data.stride+this.offset,n=0;n<this.itemSize;n++)e.push(this.data.array[i+n]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Vl.prototype=Object.create(ba.prototype),Vl.prototype.constructor=Vl,Vl.prototype.isSpriteMaterial=!0,Vl.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var zl=new Zr,Hl=new Zr,Ul=new Zr,Gl=new zr,jl=new zr,Ql=new oo,Wl=new Zr,ql=new Zr,Kl=new Zr,Xl=new zr,Yl=new zr,Zl=new zr;function Jl(e){if(Eo.call(this),this.type="Sprite",void 0===Nl){Nl=new Ga;var t=new Ol(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Nl.setIndex([0,1,2,0,2,3]),Nl.setAttribute("position",new Fl(t,3,0,!1)),Nl.setAttribute("uv",new Fl(t,2,3,!1))}this.geometry=Nl,this.material=void 0!==e?e:new Vl,this.center=new zr(.5,.5)}function $l(e,t,i,n,r,o){Gl.subVectors(e,i).addScalar(.5).multiply(n),void 0!==r?(jl.x=o*Gl.x-r*Gl.y,jl.y=r*Gl.x+o*Gl.y):jl.copy(Gl),e.copy(t),e.x+=jl.x,e.y+=jl.y,e.applyMatrix4(Ql)}Jl.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Jl,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Hl.setFromMatrixScale(this.matrixWorld),Ql.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ul.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Hl.multiplyScalar(-Ul.z);var i,n,r=this.material.rotation;0!==r&&(n=Math.cos(r),i=Math.sin(r));var o=this.center;$l(Wl.set(-.5,-.5,0),Ul,o,Hl,i,n),$l(ql.set(.5,-.5,0),Ul,o,Hl,i,n),$l(Kl.set(.5,.5,0),Ul,o,Hl,i,n),Xl.set(0,0),Yl.set(1,0),Zl.set(1,1);var a=e.ray.intersectTriangle(Wl,ql,Kl,!1,zl);if(null!==a||($l(ql.set(-.5,.5,0),Ul,o,Hl,i,n),Yl.set(0,1),null!==(a=e.ray.intersectTriangle(Wl,Kl,ql,!1,zl)))){var s=e.ray.origin.distanceTo(zl);s<e.near||s>e.far||t.push({distance:s,point:zl.clone(),uv:ua.getUV(zl,Wl,ql,Kl,Xl,Yl,Zl,new zr),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Eo.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var eh,th,ih,nh,rh,oh=new Zr,ah=new Zr;function sh(){Eo.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function ch(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ss.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new oo,this.bindMatrixInverse=new oo}sh.prototype=Object.assign(Object.create(Eo.prototype),{constructor:sh,isLOD:!0,copy:function(e){Eo.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,n=t.length;i<n;i++){var r=t[i];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=this.levels,n=0;n<i.length&&!(t<i[n].distance);n++);return i.splice(n,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var i=1,n=t.length;i<n&&!(e<t[i].distance);i++);return t[i-1].object}return null},raycast:function(e,t){if(this.levels.length>0){oh.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(oh);this.getObjectForDistance(i).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){oh.setFromMatrixPosition(e.matrixWorld),ah.setFromMatrixPosition(this.matrixWorld);var i=oh.distanceTo(ah)/e.zoom;t[0].object.visible=!0;for(var n=1,r=t.length;n<r&&i>=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;n<r;n++)t[n].object.visible=!1}},toJSON:function(e){var t=Eo.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var o=i[n];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}),ch.prototype=Object.assign(Object.create(ss.prototype),{constructor:ch,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Qr,t=this.geometry.attributes.skinWeight,i=0,n=t.count;i<n;i++){e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.w=t.getW(i);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){ss.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:(eh=new Zr,th=new Qr,ih=new Qr,nh=new Zr,rh=new oo,function(e,t){var i=this.skeleton,n=this.geometry;th.fromBufferAttribute(n.attributes.skinIndex,e),ih.fromBufferAttribute(n.attributes.skinWeight,e),eh.fromBufferAttribute(n.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var r=0;r<4;r++){var o=ih.getComponent(r);if(0!==o){var a=th.getComponent(r);rh.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(nh.copy(eh).applyMatrix4(rh),o)}}return t.applyMatrix4(this.bindMatrixInverse)})});var lh=new oo,hh=new oo;function uh(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new oo)}}function dh(){Eo.call(this),this.type="Bone"}Object.assign(uh.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var i=new oo;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},pose:function(){var e,t,i;for(t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,r=0,o=e.length;r<o;r++){var a=e[r]?e[r].matrixWorld:hh;lh.multiplyMatrices(a,t[r]),lh.toArray(i,16*r)}void 0!==n&&(n.needsUpdate=!0)},clone:function(){return new uh(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,i=this.bones.length;t<i;t++){var n=this.bones[t];if(n.name===e)return n}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),dh.prototype=Object.assign(Object.create(Eo.prototype),{constructor:dh,isBone:!0});var ph=new oo,fh=new oo,mh=[],gh=new ss;function vh(e,t,i){ss.call(this,e,t),this.instanceMatrix=new Ea(new Float32Array(16*i),16),this.count=i,this.frustumCulled=!1}function yh(e){ba.call(this),this.type="LineBasicMaterial",this.color=new ma(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}vh.prototype=Object.assign(Object.create(ss.prototype),{constructor:vh,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var i=this.matrixWorld,n=this.count;if(gh.geometry=this.geometry,gh.material=this.material,void 0!==gh.material)for(var r=0;r<n;r++){this.getMatrixAt(r,ph),fh.multiplyMatrices(i,ph),gh.matrixWorld=fh,gh.raycast(e,mh);for(var o=0,a=mh.length;o<a;o++){var s=mh[o];s.instanceId=r,s.object=this,t.push(s)}mh.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),yh.prototype=Object.create(ba.prototype),yh.prototype.constructor=yh,yh.prototype.isLineBasicMaterial=!0,yh.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var Ah=new Zr,xh=new Zr,bh=new oo,wh=new Yo,Mh=new Uo;function Eh(e,t,i){1===i&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Eo.call(this),this.type="Line",this.geometry=void 0!==e?e:new Ga,this.material=void 0!==t?t:new yh,this.updateMorphTargets()}Eh.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Eh,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,i=[0],n=1,r=t.count;n<r;n++)Ah.fromBufferAttribute(t,n-1),xh.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=Ah.distanceTo(xh);e.setAttribute("lineDistance",new La(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var o=e.vertices;(i=e.lineDistances)[0]=0;for(n=1,r=o.length;n<r;n++)i[n]=i[n-1],i[n]+=o[n-1].distanceTo(o[n])}return this},raycast:function(e,t){var i=this.geometry,n=this.matrixWorld,r=e.params.Line.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),Mh.copy(i.boundingSphere),Mh.applyMatrix4(n),Mh.radius+=r,!1!==e.ray.intersectsSphere(Mh)){bh.getInverse(n),wh.copy(e.ray).applyMatrix4(bh);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,s=new Zr,c=new Zr,l=new Zr,h=new Zr,u=this&&this.isLineSegments?2:1;if(i.isBufferGeometry){var d=i.index,p=i.attributes.position.array;if(null!==d)for(var f=d.array,m=0,g=f.length-1;m<g;m+=u){var v=f[m],y=f[m+1];if(s.fromArray(p,3*v),c.fromArray(p,3*y),!(wh.distanceSqToSegment(s,c,h,l)>a))h.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(h))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,g=p.length/3-1;m<g;m+=u){if(s.fromArray(p,3*m),c.fromArray(p,3*m+3),!(wh.distanceSqToSegment(s,c,h,l)>a))h.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(h))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(i.isGeometry){var A=i.vertices,x=A.length;for(m=0;m<x-1;m+=u){var b;if(!(wh.distanceSqToSegment(A[m],A[m+1],h,l)>a))h.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(h))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e,t,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)i=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Sh=new Zr,_h=new Zr;function Th(e,t){Eh.call(this,e,t),this.type="LineSegments"}function Ch(e,t){Eh.call(this,e,t),this.type="LineLoop"}function Ih(e){ba.call(this),this.type="PointsMaterial",this.color=new ma(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Th.prototype=Object.assign(Object.create(Eh.prototype),{constructor:Th,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,i=[],n=0,r=t.count;n<r;n+=2)Sh.fromBufferAttribute(t,n),_h.fromBufferAttribute(t,n+1),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+Sh.distanceTo(_h);e.setAttribute("lineDistance",new La(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var o=e.vertices;for(i=e.lineDistances,n=0,r=o.length;n<r;n+=2)Sh.copy(o[n]),_h.copy(o[n+1]),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+Sh.distanceTo(_h)}return this}}),Ch.prototype=Object.assign(Object.create(Eh.prototype),{constructor:Ch,isLineLoop:!0}),Ih.prototype=Object.create(ba.prototype),Ih.prototype.constructor=Ih,Ih.prototype.isPointsMaterial=!0,Ih.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var Ph=new oo,Rh=new Yo,Lh=new Uo,Bh=new Zr;function Dh(e,t){Eo.call(this),this.type="Points",this.geometry=void 0!==e?e:new Ga,this.material=void 0!==t?t:new Ih,this.updateMorphTargets()}function Oh(e,t,i,n,r,o,a){var s=Rh.distanceSqToPoint(e);if(s<i){var c=new Zr;Rh.closestPointToPoint(e,c),c.applyMatrix4(n);var l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;o.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:a})}}function Nh(e,t,i,n,r,o,a,s,c){jr.call(this,e,t,i,n,r,o,a,s,c),this.format=void 0!==a?a:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1}function kh(e,t,i,n,r,o,a,s,c,l,h,u){jr.call(this,null,o,a,s,c,l,n,r,h,u),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Fh(e,t,i,n,r,o,a,s,c){jr.call(this,e,t,i,n,r,o,a,s,c),this.needsUpdate=!0}function Vh(e,t,i,n,r,o,a,s,c,l){if(1026!==(l=void 0!==l?l:1026)&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===l&&(i=1012),void 0===i&&1027===l&&(i=1020),jr.call(this,null,n,r,o,a,s,l,i,c),this.image={width:e,height:t},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}function zh(e){Ga.call(this),this.type="WireframeGeometry";var t,i,n,r,o,a,s,c,l,h,u=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,n=m.length;t<n;t++){var g=m[t];for(i=0;i<3;i++)s=g[f[i]],c=g[f[(i+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)a=p[l],h=e.vertices[a.index1],u.push(h.x,h.y,h.z),h=e.vertices[a.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var v,y,A,x,b,w,M;if(h=new Zr,null!==e.index){for(v=e.attributes.position,y=e.index,0===(A=e.groups).length&&(A=[{start:0,count:y.count,materialIndex:0}]),r=0,o=A.length;r<o;++r)for(t=b=(x=A[r]).start,n=b+x.count;t<n;t+=3)for(i=0;i<3;i++)s=y.getX(t+i),c=y.getX(t+(i+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)a=p[l],h.fromBufferAttribute(v,a.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(v,a.index2),u.push(h.x,h.y,h.z)}else for(t=0,n=(v=e.attributes.position).count/3;t<n;t++)for(i=0;i<3;i++)w=3*t+i,h.fromBufferAttribute(v,w),u.push(h.x,h.y,h.z),M=3*t+(i+1)%3,h.fromBufferAttribute(v,M),u.push(h.x,h.y,h.z)}this.setAttribute("position",new La(u,3))}function Hh(e,t,i){fs.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i},this.fromBufferGeometry(new Uh(e,t,i)),this.mergeVertices()}function Uh(e,t,i){Ga.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:i};var n,r,o=[],a=[],s=[],c=[],l=1e-5,h=new Zr,u=new Zr,d=new Zr,p=new Zr,f=new Zr;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=t+1;for(n=0;n<=i;n++){var g=n/i;for(r=0;r<=t;r++){var v=r/t;e(v,g,u),a.push(u.x,u.y,u.z),v-l>=0?(e(v-l,g,d),p.subVectors(u,d)):(e(v+l,g,d),p.subVectors(d,u)),g-l>=0?(e(v,g-l,d),f.subVectors(u,d)):(e(v,g+l,d),f.subVectors(d,u)),h.crossVectors(p,f).normalize(),s.push(h.x,h.y,h.z),c.push(v,g)}}for(n=0;n<i;n++)for(r=0;r<t;r++){var y=n*m+r,A=n*m+r+1,x=(n+1)*m+r+1,b=(n+1)*m+r;o.push(y,A,b),o.push(A,x,b)}this.setIndex(o),this.setAttribute("position",new La(a,3)),this.setAttribute("normal",new La(s,3)),this.setAttribute("uv",new La(c,2))}function Gh(e,t,i,n){fs.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:n},this.fromBufferGeometry(new jh(e,t,i,n)),this.mergeVertices()}function jh(e,t,i,n){Ga.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:n},i=i||1;var r=[],o=[];function a(e,t,i,n){var r,o,a=Math.pow(2,n),c=[];for(r=0;r<=a;r++){c[r]=[];var l=e.clone().lerp(i,r/a),h=t.clone().lerp(i,r/a),u=a-r;for(o=0;o<=u;o++)c[r][o]=0===o&&r===a?l:l.clone().lerp(h,o/u)}for(r=0;r<a;r++)for(o=0;o<2*(a-r)-1;o++){var d=Math.floor(o/2);o%2==0?(s(c[r][d+1]),s(c[r+1][d]),s(c[r][d])):(s(c[r][d+1]),s(c[r+1][d+1]),s(c[r+1][d]))}}function s(e){r.push(e.x,e.y,e.z)}function c(t,i){var n=3*t;i.x=e[n+0],i.y=e[n+1],i.z=e[n+2]}function l(e,t,i,n){n<0&&1===e.x&&(o[t]=e.x-1),0===i.x&&0===i.z&&(o[t]=n/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function u(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){for(var i=new Zr,n=new Zr,r=new Zr,o=0;o<t.length;o+=3)c(t[o+0],i),c(t[o+1],n),c(t[o+2],r),a(i,n,r,e)}(n=n||0),function(e){for(var t=new Zr,i=0;i<r.length;i+=3)t.x=r[i+0],t.y=r[i+1],t.z=r[i+2],t.normalize().multiplyScalar(e),r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z}(i),function(){for(var e=new Zr,t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];var i=h(e)/2/Math.PI+.5,n=u(e)/Math.PI+.5;o.push(i,1-n)}(function(){for(var e=new Zr,t=new Zr,i=new Zr,n=new Zr,a=new zr,s=new zr,c=new zr,u=0,d=0;u<r.length;u+=9,d+=6){e.set(r[u+0],r[u+1],r[u+2]),t.set(r[u+3],r[u+4],r[u+5]),i.set(r[u+6],r[u+7],r[u+8]),a.set(o[d+0],o[d+1]),s.set(o[d+2],o[d+3]),c.set(o[d+4],o[d+5]),n.copy(e).add(t).add(i).divideScalar(3);var p=h(n);l(a,d+0,e,p),l(s,d+2,t,p),l(c,d+4,i,p)}})(),function(){for(var e=0;e<o.length;e+=6){var t=o[e+0],i=o[e+2],n=o[e+4],r=Math.max(t,i,n),a=Math.min(t,i,n);r>.9&&a<.1&&(t<.2&&(o[e+0]+=1),i<.2&&(o[e+2]+=1),n<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new La(r,3)),this.setAttribute("normal",new La(r.slice(),3)),this.setAttribute("uv",new La(o,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function Qh(e,t){fs.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Wh(e,t)),this.mergeVertices()}function Wh(e,t){jh.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function qh(e,t){fs.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Kh(e,t)),this.mergeVertices()}function Kh(e,t){jh.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Xh(e,t){fs.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Yh(e,t)),this.mergeVertices()}function Yh(e,t){var i=(1+Math.sqrt(5))/2,n=[-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];jh.call(this,n,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Zh(e,t){fs.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Jh(e,t)),this.mergeVertices()}function Jh(e,t){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];jh.call(this,r,[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function $h(e,t,i,n,r,o){fs.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:n,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new eu(e,t,i,n,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function eu(e,t,i,n,r){Ga.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:n,closed:r},t=t||64,i=i||1,n=n||8,r=r||!1;var o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new Zr,l=new Zr,h=new zr,u=new Zr,d=[],p=[],f=[],m=[];function g(r){u=e.getPointAt(r/t,u);var a=o.normals[r],h=o.binormals[r];for(s=0;s<=n;s++){var f=s/n*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);l.x=g*a.x+m*h.x,l.y=g*a.y+m*h.y,l.z=g*a.z+m*h.z,l.normalize(),p.push(l.x,l.y,l.z),c.x=u.x+i*l.x,c.y=u.y+i*l.y,c.z=u.z+i*l.z,d.push(c.x,c.y,c.z)}}!function(){for(a=0;a<t;a++)g(a);g(!1===r?t:0),function(){for(a=0;a<=t;a++)for(s=0;s<=n;s++)h.x=a/t,h.y=s/n,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(a=1;a<=n;a++){var e=(n+1)*(s-1)+(a-1),i=(n+1)*s+(a-1),r=(n+1)*s+a,o=(n+1)*(s-1)+a;m.push(e,i,o),m.push(i,r,o)}}()}(),this.setIndex(m),this.setAttribute("position",new La(d,3)),this.setAttribute("normal",new La(p,3)),this.setAttribute("uv",new La(f,2))}function tu(e,t,i,n,r,o,a){fs.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:n,p:r,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new iu(e,t,i,n,r,o)),this.mergeVertices()}function iu(e,t,i,n,r,o){Ga.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:n,p:r,q:o},e=e||1,t=t||.4,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,o=o||3;var a,s,c=[],l=[],h=[],u=[],d=new Zr,p=new Zr,f=new Zr,m=new Zr,g=new Zr,v=new Zr,y=new Zr;for(a=0;a<=i;++a){var A=a/i*r*Math.PI*2;for(T(A,r,o,e,f),T(A+.01,r,o,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=n;++s){var x=s/n*Math.PI*2,b=-t*Math.cos(x),w=t*Math.sin(x);d.x=f.x+(b*y.x+w*g.x),d.y=f.y+(b*y.y+w*g.y),d.z=f.z+(b*y.z+w*g.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),h.push(p.x,p.y,p.z),u.push(a/i),u.push(s/n)}}for(s=1;s<=i;s++)for(a=1;a<=n;a++){var M=(n+1)*(s-1)+(a-1),E=(n+1)*s+(a-1),S=(n+1)*s+a,_=(n+1)*(s-1)+a;c.push(M,E,_),c.push(E,S,_)}function T(e,t,i,n,r){var o=Math.cos(e),a=Math.sin(e),s=i/t*e,c=Math.cos(s);r.x=n*(2+c)*.5*o,r.y=n*(2+c)*a*.5,r.z=n*Math.sin(s)*.5}this.setIndex(c),this.setAttribute("position",new La(l,3)),this.setAttribute("normal",new La(h,3)),this.setAttribute("uv",new La(u,2))}function nu(e,t,i,n,r){fs.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new ru(e,t,i,n,r)),this.mergeVertices()}function ru(e,t,i,n,r){Ga.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},e=e||1,t=t||.4,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var o,a,s=[],c=[],l=[],h=[],u=new Zr,d=new Zr,p=new Zr;for(o=0;o<=i;o++)for(a=0;a<=n;a++){var f=a/n*r,m=o/i*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),c.push(d.x,d.y,d.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),p.subVectors(d,u).normalize(),l.push(p.x,p.y,p.z),h.push(a/n),h.push(o/i)}for(o=1;o<=i;o++)for(a=1;a<=n;a++){var g=(n+1)*o+a-1,v=(n+1)*(o-1)+a-1,y=(n+1)*(o-1)+a,A=(n+1)*o+a;s.push(g,v,A),s.push(v,y,A)}this.setIndex(s),this.setAttribute("position",new La(c,3)),this.setAttribute("normal",new La(l,3)),this.setAttribute("uv",new La(h,2))}Dh.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Dh,isPoints:!0,raycast:function(e,t){var i=this.geometry,n=this.matrixWorld,r=e.params.Points.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),Lh.copy(i.boundingSphere),Lh.applyMatrix4(n),Lh.radius+=r,!1!==e.ray.intersectsSphere(Lh)){Ph.getInverse(n),Rh.copy(e.ray).applyMatrix4(Ph);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(i.isBufferGeometry){var s=i.index,c=i.attributes.position.array;if(null!==s)for(var l=s.array,h=0,u=l.length;h<u;h++){var d=l[h];Bh.fromArray(c,3*d),Oh(Bh,d,a,n,e,t,this)}else{h=0;for(var p=c.length/3;h<p;h++)Bh.fromArray(c,3*h),Oh(Bh,h,a,n,e,t,this)}}else{var f=i.vertices;for(h=0,p=f.length;h<p;h++)Oh(f[h],h,a,n,e,t,this)}}},updateMorphTargets:function(){var e,t,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)i=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Nh.prototype=Object.assign(Object.create(jr.prototype),{constructor:Nh,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),kh.prototype=Object.create(jr.prototype),kh.prototype.constructor=kh,kh.prototype.isCompressedTexture=!0,Fh.prototype=Object.create(jr.prototype),Fh.prototype.constructor=Fh,Fh.prototype.isCanvasTexture=!0,Vh.prototype=Object.create(jr.prototype),Vh.prototype.constructor=Vh,Vh.prototype.isDepthTexture=!0,zh.prototype=Object.create(Ga.prototype),zh.prototype.constructor=zh,Hh.prototype=Object.create(fs.prototype),Hh.prototype.constructor=Hh,Uh.prototype=Object.create(Ga.prototype),Uh.prototype.constructor=Uh,Gh.prototype=Object.create(fs.prototype),Gh.prototype.constructor=Gh,jh.prototype=Object.create(Ga.prototype),jh.prototype.constructor=jh,Qh.prototype=Object.create(fs.prototype),Qh.prototype.constructor=Qh,Wh.prototype=Object.create(jh.prototype),Wh.prototype.constructor=Wh,qh.prototype=Object.create(fs.prototype),qh.prototype.constructor=qh,Kh.prototype=Object.create(jh.prototype),Kh.prototype.constructor=Kh,Xh.prototype=Object.create(fs.prototype),Xh.prototype.constructor=Xh,Yh.prototype=Object.create(jh.prototype),Yh.prototype.constructor=Yh,Zh.prototype=Object.create(fs.prototype),Zh.prototype.constructor=Zh,Jh.prototype=Object.create(jh.prototype),Jh.prototype.constructor=Jh,$h.prototype=Object.create(fs.prototype),$h.prototype.constructor=$h,eu.prototype=Object.create(Ga.prototype),eu.prototype.constructor=eu,eu.prototype.toJSON=function(){var e=Ga.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},tu.prototype=Object.create(fs.prototype),tu.prototype.constructor=tu,iu.prototype=Object.create(Ga.prototype),iu.prototype.constructor=iu,nu.prototype=Object.create(fs.prototype),nu.prototype.constructor=nu,ru.prototype=Object.create(Ga.prototype),ru.prototype.constructor=ru;var ou=function(e,t,i){i=i||2;var n,r,o,a,s,c,l,h=t&&t.length,u=h?t[0]*i:e.length,d=au(e,0,u,i,!0),p=[];if(!d||d.next===d.prev)return p;if(h&&(d=function(e,t,i,n){var r,o,a,s=[];for(r=0,o=t.length;r<o;r++)(a=au(e,t[r]*n,r<o-1?t[r+1]*n:e.length,n,!1))===a.next&&(a.steiner=!0),s.push(vu(a));for(s.sort(pu),r=0;r<s.length;r++)fu(s[r],i),i=su(i,i.next);return i}(e,t,d,i)),e.length>80*i){n=o=e[0],r=a=e[1];for(var f=i;f<u;f+=i)(s=e[f])<n&&(n=s),(c=e[f+1])<r&&(r=c),s>o&&(o=s),c>a&&(a=c);l=0!==(l=Math.max(o-n,a-r))?1/l:0}return cu(d,p,i,n,r,l),p};function au(e,t,i,n,r){var o,a;if(r===function(e,t,i,n){for(var r=0,o=t,a=i-n;o<i;o+=n)r+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return r}(e,t,i,n)>0)for(o=t;o<i;o+=n)a=Tu(o,e[o],e[o+1],a);else for(o=i-n;o>=t;o-=n)a=Tu(o,e[o],e[o+1],a);return a&&bu(a,a.next)&&(Cu(a),a=a.next),a}function su(e,t){if(!e)return e;t||(t=e);var i,n=e;do{if(i=!1,n.steiner||!bu(n,n.next)&&0!==xu(n.prev,n,n.next))n=n.next;else{if(Cu(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function cu(e,t,i,n,r,o,a){if(e){!a&&o&&function(e,t,i,n){var r=e;do{null===r.z&&(r.z=gu(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,n,r,o,a,s,c,l=1;do{for(i=e,e=null,o=null,a=0;i;){for(a++,n=i,s=0,t=0;t<l&&(s++,n=n.nextZ);t++);for(c=l;s>0||c>0&&n;)0!==s&&(0===c||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,c--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=n}o.nextZ=null,l*=2}while(a>1)}(r)}(e,n,r,o);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?hu(e,n,r,o):lu(e))t.push(s.i/i),t.push(e.i/i),t.push(c.i/i),Cu(e),e=c.next,l=c.next;else if((e=c)===l){a?1===a?cu(e=uu(su(e),t,i),t,i,n,r,o,2):2===a&&du(e,t,i,n,r,o):cu(su(e),t,i,n,r,o,1);break}}}function lu(e){var t=e.prev,i=e,n=e.next;if(xu(t,i,n)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(yu(t.x,t.y,i.x,i.y,n.x,n.y,r.x,r.y)&&xu(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function hu(e,t,i,n){var r=e.prev,o=e,a=e.next;if(xu(r,o,a)>=0)return!1;for(var s=r.x<o.x?r.x<a.x?r.x:a.x:o.x<a.x?o.x:a.x,c=r.y<o.y?r.y<a.y?r.y:a.y:o.y<a.y?o.y:a.y,l=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=gu(s,c,t,i,n),d=gu(l,h,t,i,n),p=e.prevZ,f=e.nextZ;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&yu(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&xu(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&yu(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&xu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&yu(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&xu(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&yu(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&xu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function uu(e,t,i){var n=e;do{var r=n.prev,o=n.next.next;!bu(r,o)&&wu(r,n,n.next,o)&&Su(r,o)&&Su(o,r)&&(t.push(r.i/i),t.push(n.i/i),t.push(o.i/i),Cu(n),Cu(n.next),n=e=o),n=n.next}while(n!==e);return su(n)}function du(e,t,i,n,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Au(a,s)){var c=_u(a,s);return a=su(a,a.next),c=su(c,c.next),cu(a,t,i,n,r,o),void cu(c,t,i,n,r,o)}s=s.next}a=a.next}while(a!==e)}function pu(e,t){return e.x-t.x}function fu(e,t){if(t=function(e,t){var i,n=t,r=e.x,o=e.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!i)return null;if(r===a)return i;var c,l=i,h=i.x,u=i.y,d=1/0;n=i;do{r>=n.x&&n.x>=h&&r!==n.x&&yu(o<u?r:a,o,h,u,o<u?a:r,o,n.x,n.y)&&(c=Math.abs(o-n.y)/(r-n.x),Su(n,e)&&(c<d||c===d&&(n.x>i.x||n.x===i.x&&mu(i,n)))&&(i=n,d=c)),n=n.next}while(n!==l);return i}(e,t)){var i=_u(t,e);su(t,t.next),su(i,i.next)}}function mu(e,t){return xu(e.prev,e,t.prev)<0&&xu(t.next,e,e.next)<0}function gu(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function vu(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function yu(e,t,i,n,r,o,a,s){return(r-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(n-s)-(i-a)*(t-s)>=0&&(i-a)*(o-s)-(r-a)*(n-s)>=0}function Au(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&wu(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Su(e,t)&&Su(t,e)&&function(e,t){var i=e,n=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(xu(e.prev,e,t.prev)||xu(e,t.prev,t))||bu(e,t)&&xu(e.prev,e,e.next)>0&&xu(t.prev,t,t.next)>0)}function xu(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function bu(e,t){return e.x===t.x&&e.y===t.y}function wu(e,t,i,n){var r=Eu(xu(e,t,i)),o=Eu(xu(e,t,n)),a=Eu(xu(i,n,e)),s=Eu(xu(i,n,t));return r!==o&&a!==s||(!(0!==r||!Mu(e,i,t))||(!(0!==o||!Mu(e,n,t))||(!(0!==a||!Mu(i,e,n))||!(0!==s||!Mu(i,t,n)))))}function Mu(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Eu(e){return e>0?1:e<0?-1:0}function Su(e,t){return xu(e.prev,e,e.next)<0?xu(e,t,e.next)>=0&&xu(e,e.prev,t)>=0:xu(e,t,e.prev)<0||xu(e,e.next,t)<0}function _u(e,t){var i=new Iu(e.i,e.x,e.y),n=new Iu(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function Tu(e,t,i,n){var r=new Iu(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Cu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Iu(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Pu={area:function(e){for(var t=e.length,i=0,n=t-1,r=0;r<t;n=r++)i+=e[n].x*e[r].y-e[r].x*e[n].y;return.5*i},isClockWise:function(e){return Pu.area(e)<0},triangulateShape:function(e,t){var i=[],n=[],r=[];Ru(e),Lu(i,e);var o=e.length;t.forEach(Ru);for(var a=0;a<t.length;a++)n.push(o),o+=t[a].length,Lu(i,t[a]);var s=ou(i,n);for(a=0;a<s.length;a+=3)r.push(s.slice(a,a+3));return r}};function Ru(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Lu(e,t){for(var i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}function Bu(e,t){fs.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Du(e,t)),this.mergeVertices()}function Du(e,t){Ga.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var i=this,n=[],r=[],o=0,a=e.length;o<a;o++){s(e[o])}function s(e){var o=[],a=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,c=void 0!==t.depth?t.depth:100,l=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:6,u=void 0!==t.bevelSize?t.bevelSize:h-2,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:Ou;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);var g,v,y,A,x,b,w,M,E=!1;f&&(g=f.getSpacedPoints(s),E=!0,l=!1,v=f.computeFrenetFrames(s,!1),y=new Zr,A=new Zr,x=new Zr),l||(p=0,h=0,u=0,d=0);var S=e.extractPoints(a),_=S.shape,T=S.holes;if(!Pu.isClockWise(_))for(_=_.reverse(),w=0,M=T.length;w<M;w++)b=T[w],Pu.isClockWise(b)&&(T[w]=b.reverse());var C=Pu.triangulateShape(_,T),I=_;for(w=0,M=T.length;w<M;w++)b=T[w],_=_.concat(b);function P(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}var R,L,B,D,O,N,k=_.length,F=C.length;function V(e,t,i){var n,r,o,a=e.x-t.x,s=e.y-t.y,c=i.x-e.x,l=i.y-e.y,h=a*a+s*s,u=a*l-s*c;if(Math.abs(u)>Number.EPSILON){var d=Math.sqrt(h),p=Math.sqrt(c*c+l*l),f=t.x-s/d,m=t.y+a/d,g=((i.x-l/p-f)*l-(i.y+c/p-m)*c)/(a*l-s*c),v=(n=f+a*g-e.x)*n+(r=m+s*g-e.y)*r;if(v<=2)return new zr(n,r);o=Math.sqrt(v/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(n=-s,r=a,o=Math.sqrt(h)):(n=a,r=s,o=Math.sqrt(h/2))}return new zr(n/o,r/o)}for(var z=[],H=0,U=I.length,G=U-1,j=H+1;H<U;H++,G++,j++)G===U&&(G=0),j===U&&(j=0),z[H]=V(I[H],I[G],I[j]);var Q,W,q=[],K=z.concat();for(w=0,M=T.length;w<M;w++){for(b=T[w],Q=[],H=0,G=(U=b.length)-1,j=H+1;H<U;H++,G++,j++)G===U&&(G=0),j===U&&(j=0),Q[H]=V(b[H],b[G],b[j]);q.push(Q),K=K.concat(Q)}for(R=0;R<p;R++){for(B=R/p,D=h*Math.cos(B*Math.PI/2),L=u*Math.sin(B*Math.PI/2)+d,H=0,U=I.length;H<U;H++)Y((O=P(I[H],z[H],L)).x,O.y,-D);for(w=0,M=T.length;w<M;w++)for(b=T[w],Q=q[w],H=0,U=b.length;H<U;H++)Y((O=P(b[H],Q[H],L)).x,O.y,-D)}for(L=u+d,H=0;H<k;H++)O=l?P(_[H],K[H],L):_[H],E?(A.copy(v.normals[0]).multiplyScalar(O.x),y.copy(v.binormals[0]).multiplyScalar(O.y),x.copy(g[0]).add(A).add(y),Y(x.x,x.y,x.z)):Y(O.x,O.y,0);for(W=1;W<=s;W++)for(H=0;H<k;H++)O=l?P(_[H],K[H],L):_[H],E?(A.copy(v.normals[W]).multiplyScalar(O.x),y.copy(v.binormals[W]).multiplyScalar(O.y),x.copy(g[W]).add(A).add(y),Y(x.x,x.y,x.z)):Y(O.x,O.y,c/s*W);for(R=p-1;R>=0;R--){for(B=R/p,D=h*Math.cos(B*Math.PI/2),L=u*Math.sin(B*Math.PI/2)+d,H=0,U=I.length;H<U;H++)Y((O=P(I[H],z[H],L)).x,O.y,c+D);for(w=0,M=T.length;w<M;w++)for(b=T[w],Q=q[w],H=0,U=b.length;H<U;H++)O=P(b[H],Q[H],L),E?Y(O.x,O.y+g[s-1].y,g[s-1].x+D):Y(O.x,O.y,c+D)}function X(e,t){var i,n;for(H=e.length;--H>=0;){i=H,(n=H-1)<0&&(n=e.length-1);var r=0,o=s+2*p;for(r=0;r<o;r++){var a=k*r,c=k*(r+1);J(t+i+a,t+n+a,t+n+c,t+i+c)}}}function Y(e,t,i){o.push(e),o.push(t),o.push(i)}function Z(e,t,r){$(e),$(t),$(r);var o=n.length/3,a=m.generateTopUV(i,n,o-3,o-2,o-1);ee(a[0]),ee(a[1]),ee(a[2])}function J(e,t,r,o){$(e),$(t),$(o),$(t),$(r),$(o);var a=n.length/3,s=m.generateSideWallUV(i,n,a-6,a-3,a-2,a-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){n.push(o[3*e+0]),n.push(o[3*e+1]),n.push(o[3*e+2])}function ee(e){r.push(e.x),r.push(e.y)}!function(){var e=n.length/3;if(l){var t=0,r=k*t;for(H=0;H<F;H++)Z((N=C[H])[2]+r,N[1]+r,N[0]+r);for(r=k*(t=s+2*p),H=0;H<F;H++)Z((N=C[H])[0]+r,N[1]+r,N[2]+r)}else{for(H=0;H<F;H++)Z((N=C[H])[2],N[1],N[0]);for(H=0;H<F;H++)Z((N=C[H])[0]+k*s,N[1]+k*s,N[2]+k*s)}i.addGroup(e,n.length/3-e,0)}(),function(){var e=n.length/3,t=0;for(X(I,t),t+=I.length,w=0,M=T.length;w<M;w++)X(b=T[w],t),t+=b.length;i.addGroup(e,n.length/3-e,1)}()}this.setAttribute("position",new La(n,3)),this.setAttribute("uv",new La(r,2)),this.computeVertexNormals()}Bu.prototype=Object.create(fs.prototype),Bu.prototype.constructor=Bu,Bu.prototype.toJSON=function(){var e=fs.prototype.toJSON.call(this);return Nu(this.parameters.shapes,this.parameters.options,e)},Du.prototype=Object.create(Ga.prototype),Du.prototype.constructor=Du,Du.prototype.toJSON=function(){var e=Ga.prototype.toJSON.call(this);return Nu(this.parameters.shapes,this.parameters.options,e)};var Ou={generateTopUV:function(e,t,i,n,r){var o=t[3*i],a=t[3*i+1],s=t[3*n],c=t[3*n+1],l=t[3*r],h=t[3*r+1];return[new zr(o,a),new zr(s,c),new zr(l,h)]},generateSideWallUV:function(e,t,i,n,r,o){var a=t[3*i],s=t[3*i+1],c=t[3*i+2],l=t[3*n],h=t[3*n+1],u=t[3*n+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*o],g=t[3*o+1],v=t[3*o+2];return Math.abs(s-h)<.01?[new zr(a,1-c),new zr(l,1-u),new zr(d,1-f),new zr(m,1-v)]:[new zr(s,1-c),new zr(h,1-u),new zr(p,1-f),new zr(g,1-v)]}};function Nu(e,t,i){if(i.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var o=e[n];i.shapes.push(o.uuid)}else i.shapes.push(e.uuid);return void 0!==t.extrudePath&&(i.options.extrudePath=t.extrudePath.toJSON()),i}function ku(e,t){fs.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Fu(e,t)),this.mergeVertices()}function Fu(e,t){var i=(t=t||{}).font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new fs;var n=i.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Du.call(this,n,t),this.type="TextBufferGeometry"}function Vu(e,t,i,n,r,o,a){fs.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new zu(e,t,i,n,r,o,a)),this.mergeVertices()}function zu(e,t,i,n,r,o,a){Ga.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},e=e||1,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,c,l=Math.min(o+a,Math.PI),h=0,u=[],d=new Zr,p=new Zr,f=[],m=[],g=[],v=[];for(c=0;c<=i;c++){var y=[],A=c/i,x=0;for(0==c&&0==o?x=.5/t:c==i&&l==Math.PI&&(x=-.5/t),s=0;s<=t;s++){var b=s/t;d.x=-e*Math.cos(n+b*r)*Math.sin(o+A*a),d.y=e*Math.cos(o+A*a),d.z=e*Math.sin(n+b*r)*Math.sin(o+A*a),m.push(d.x,d.y,d.z),p.copy(d).normalize(),g.push(p.x,p.y,p.z),v.push(b+x,1-A),y.push(h++)}u.push(y)}for(c=0;c<i;c++)for(s=0;s<t;s++){var w=u[c][s+1],M=u[c][s],E=u[c+1][s],S=u[c+1][s+1];(0!==c||o>0)&&f.push(w,M,S),(c!==i-1||l<Math.PI)&&f.push(M,E,S)}this.setIndex(f),this.setAttribute("position",new La(m,3)),this.setAttribute("normal",new La(g,3)),this.setAttribute("uv",new La(v,2))}function Hu(e,t,i,n,r,o){fs.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new Uu(e,t,i,n,r,o)),this.mergeVertices()}function Uu(e,t,i,n,r,o){Ga.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},e=e||.5,t=t||1,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var a,s,c,l=[],h=[],u=[],d=[],p=e,f=(t-e)/(n=void 0!==n?Math.max(1,n):1),m=new Zr,g=new zr;for(s=0;s<=n;s++){for(c=0;c<=i;c++)a=r+c/i*o,m.x=p*Math.cos(a),m.y=p*Math.sin(a),h.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,d.push(g.x,g.y);p+=f}for(s=0;s<n;s++){var v=s*(i+1);for(c=0;c<i;c++){var y=a=c+v,A=a+i+1,x=a+i+2,b=a+1;l.push(y,A,b),l.push(A,x,b)}}this.setIndex(l),this.setAttribute("position",new La(h,3)),this.setAttribute("normal",new La(u,3)),this.setAttribute("uv",new La(d,2))}function Gu(e,t,i,n){fs.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},this.fromBufferGeometry(new ju(e,t,i,n)),this.mergeVertices()}function ju(e,t,i,n){Ga.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},t=Math.floor(t)||12,i=i||0,n=n||2*Math.PI,n=Vr.clamp(n,0,2*Math.PI);var r,o,a,s=[],c=[],l=[],h=1/t,u=new Zr,d=new zr;for(o=0;o<=t;o++){var p=i+o*h*n,f=Math.sin(p),m=Math.cos(p);for(a=0;a<=e.length-1;a++)u.x=e[a].x*f,u.y=e[a].y,u.z=e[a].x*m,c.push(u.x,u.y,u.z),d.x=o/t,d.y=a/(e.length-1),l.push(d.x,d.y)}for(o=0;o<t;o++)for(a=0;a<e.length-1;a++){var g=r=a+o*e.length,v=r+e.length,y=r+e.length+1,A=r+1;s.push(g,v,A),s.push(v,y,A)}if(this.setIndex(s),this.setAttribute("position",new La(c,3)),this.setAttribute("uv",new La(l,2)),this.computeVertexNormals(),n===2*Math.PI){var x=this.attributes.normal.array,b=new Zr,w=new Zr,M=new Zr;for(r=t*e.length*3,o=0,a=0;o<e.length;o++,a+=3)b.x=x[a+0],b.y=x[a+1],b.z=x[a+2],w.x=x[r+a+0],w.y=x[r+a+1],w.z=x[r+a+2],M.addVectors(b,w).normalize(),x[a+0]=x[r+a+0]=M.x,x[a+1]=x[r+a+1]=M.y,x[a+2]=x[r+a+2]=M.z}}function Qu(e,t){fs.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Wu(e,t)),this.mergeVertices()}function Wu(e,t){Ga.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var i=[],n=[],r=[],o=[],a=0,s=0;if(!1===Array.isArray(e))l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(a,s,c),a+=s,s=0;function l(e){var a,c,l,h=n.length/3,u=e.extractPoints(t),d=u.shape,p=u.holes;for(!1===Pu.isClockWise(d)&&(d=d.reverse()),a=0,c=p.length;a<c;a++)l=p[a],!0===Pu.isClockWise(l)&&(p[a]=l.reverse());var f=Pu.triangulateShape(d,p);for(a=0,c=p.length;a<c;a++)l=p[a],d=d.concat(l);for(a=0,c=d.length;a<c;a++){var m=d[a];n.push(m.x,m.y,0),r.push(0,0,1),o.push(m.x,m.y)}for(a=0,c=f.length;a<c;a++){var g=f[a],v=g[0]+h,y=g[1]+h,A=g[2]+h;i.push(v,y,A),s+=3}}this.setIndex(i),this.setAttribute("position",new La(n,3)),this.setAttribute("normal",new La(r,3)),this.setAttribute("uv",new La(o,2))}function qu(e,t){if(t.shapes=[],Array.isArray(e))for(var i=0,n=e.length;i<n;i++){var r=e[i];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Ku(e,t){Ga.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var i,n,r,o,a=[],s=Math.cos(Vr.DEG2RAD*t),c=[0,0],l={},h=["a","b","c"];e.isBufferGeometry?(o=new fs).fromBufferGeometry(e):o=e.clone(),o.mergeVertices(),o.computeFaceNormals();for(var u=o.vertices,d=o.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)i=m[h[g]],n=m[h[(g+1)%3]],c[0]=Math.min(i,n),c[1]=Math.max(i,n),void 0===l[r=c[0]+","+c[1]]?l[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[r].face2=p;for(r in l){var v=l[r];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=u[v.index1];a.push(y.x,y.y,y.z),y=u[v.index2],a.push(y.x,y.y,y.z)}}this.setAttribute("position",new La(a,3))}function Xu(e,t,i,n,r,o,a,s){fs.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Yu(e,t,i,n,r,o,a,s)),this.mergeVertices()}function Yu(e,t,i,n,r,o,a,s){Ga.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s};var c=this;e=void 0!==e?e:1,t=void 0!==t?t:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var l=[],h=[],u=[],d=[],p=0,f=[],m=i/2,g=0;function v(i){var r,o,f,v=new zr,y=new Zr,A=0,x=!0===i?e:t,b=!0===i?1:-1;for(o=p,r=1;r<=n;r++)h.push(0,m*b,0),u.push(0,b,0),d.push(.5,.5),p++;for(f=p,r=0;r<=n;r++){var w=r/n*s+a,M=Math.cos(w),E=Math.sin(w);y.x=x*E,y.y=m*b,y.z=x*M,h.push(y.x,y.y,y.z),u.push(0,b,0),v.x=.5*M+.5,v.y=.5*E*b+.5,d.push(v.x,v.y),p++}for(r=0;r<n;r++){var S=o+r,_=f+r;!0===i?l.push(_,_+1,S):l.push(_+1,_,S),A+=3}c.addGroup(g,A,!0===i?1:2),g+=A}!function(){var o,v,y=new Zr,A=new Zr,x=0,b=(t-e)/i;for(v=0;v<=r;v++){var w=[],M=v/r,E=M*(t-e)+e;for(o=0;o<=n;o++){var S=o/n,_=S*s+a,T=Math.sin(_),C=Math.cos(_);A.x=E*T,A.y=-M*i+m,A.z=E*C,h.push(A.x,A.y,A.z),y.set(T,b,C).normalize(),u.push(y.x,y.y,y.z),d.push(S,1-M),w.push(p++)}f.push(w)}for(o=0;o<n;o++)for(v=0;v<r;v++){var I=f[v][o],P=f[v+1][o],R=f[v+1][o+1],L=f[v][o+1];l.push(I,P,L),l.push(P,R,L),x+=6}c.addGroup(g,x,0),g+=x}(),!1===o&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new La(h,3)),this.setAttribute("normal",new La(u,3)),this.setAttribute("uv",new La(d,2))}function Zu(e,t,i,n,r,o,a){Xu.call(this,0,e,t,i,n,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a}}function Ju(e,t,i,n,r,o,a){Yu.call(this,0,e,t,i,n,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a}}function $u(e,t,i,n){fs.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new ed(e,t,i,n)),this.mergeVertices()}function ed(e,t,i,n){Ga.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},e=e||1,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,o,a=[],s=[],c=[],l=[],h=new Zr,u=new zr;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),o=0,r=3;o<=t;o++,r+=3){var d=i+o/t*n;h.x=e*Math.cos(d),h.y=e*Math.sin(d),s.push(h.x,h.y,h.z),c.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,l.push(u.x,u.y)}for(r=1;r<=t;r++)a.push(r,r+1,0);this.setIndex(a),this.setAttribute("position",new La(s,3)),this.setAttribute("normal",new La(c,3)),this.setAttribute("uv",new La(l,2))}ku.prototype=Object.create(fs.prototype),ku.prototype.constructor=ku,Fu.prototype=Object.create(Du.prototype),Fu.prototype.constructor=Fu,Vu.prototype=Object.create(fs.prototype),Vu.prototype.constructor=Vu,zu.prototype=Object.create(Ga.prototype),zu.prototype.constructor=zu,Hu.prototype=Object.create(fs.prototype),Hu.prototype.constructor=Hu,Uu.prototype=Object.create(Ga.prototype),Uu.prototype.constructor=Uu,Gu.prototype=Object.create(fs.prototype),Gu.prototype.constructor=Gu,ju.prototype=Object.create(Ga.prototype),ju.prototype.constructor=ju,Qu.prototype=Object.create(fs.prototype),Qu.prototype.constructor=Qu,Qu.prototype.toJSON=function(){var e=fs.prototype.toJSON.call(this);return qu(this.parameters.shapes,e)},Wu.prototype=Object.create(Ga.prototype),Wu.prototype.constructor=Wu,Wu.prototype.toJSON=function(){var e=Ga.prototype.toJSON.call(this);return qu(this.parameters.shapes,e)},Ku.prototype=Object.create(Ga.prototype),Ku.prototype.constructor=Ku,Xu.prototype=Object.create(fs.prototype),Xu.prototype.constructor=Xu,Yu.prototype=Object.create(Ga.prototype),Yu.prototype.constructor=Yu,Zu.prototype=Object.create(Xu.prototype),Zu.prototype.constructor=Zu,Ju.prototype=Object.create(Yu.prototype),Ju.prototype.constructor=Ju,$u.prototype=Object.create(fs.prototype),$u.prototype.constructor=$u,ed.prototype=Object.create(Ga.prototype),ed.prototype.constructor=ed;var td=Object.freeze({__proto__:null,WireframeGeometry:zh,ParametricGeometry:Hh,ParametricBufferGeometry:Uh,TetrahedronGeometry:Qh,TetrahedronBufferGeometry:Wh,OctahedronGeometry:qh,OctahedronBufferGeometry:Kh,IcosahedronGeometry:Xh,IcosahedronBufferGeometry:Yh,DodecahedronGeometry:Zh,DodecahedronBufferGeometry:Jh,PolyhedronGeometry:Gh,PolyhedronBufferGeometry:jh,TubeGeometry:$h,TubeBufferGeometry:eu,TorusKnotGeometry:tu,TorusKnotBufferGeometry:iu,TorusGeometry:nu,TorusBufferGeometry:ru,TextGeometry:ku,TextBufferGeometry:Fu,SphereGeometry:Vu,SphereBufferGeometry:zu,RingGeometry:Hu,RingBufferGeometry:Uu,PlaneGeometry:Rs,PlaneBufferGeometry:Ls,LatheGeometry:Gu,LatheBufferGeometry:ju,ShapeGeometry:Qu,ShapeBufferGeometry:Wu,ExtrudeGeometry:Bu,ExtrudeBufferGeometry:Du,EdgesGeometry:Ku,ConeGeometry:Zu,ConeBufferGeometry:Ju,CylinderGeometry:Xu,CylinderBufferGeometry:Yu,CircleGeometry:$u,CircleBufferGeometry:ed,BoxGeometry:class extends fs{constructor(e,t,i,n,r,o){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new ms(e,t,i,n,r,o)),this.mergeVertices()}},BoxBufferGeometry:ms});function id(e){ba.call(this),this.type="ShadowMaterial",this.color=new ma(0),this.transparent=!0,this.setValues(e)}function nd(e){As.call(this,e),this.type="RawShaderMaterial"}function rd(e){ba.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ma(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ma(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function od(e){rd.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new zr(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function ad(e){ba.call(this),this.type="MeshPhongMaterial",this.color=new ma(16777215),this.specular=new ma(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ma(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function sd(e){ba.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ma(16777215),this.specular=new ma(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ma(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function cd(e){ba.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ld(e){ba.call(this),this.type="MeshLambertMaterial",this.color=new ma(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ma(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function hd(e){ba.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ma(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ud(e){yh.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}id.prototype=Object.create(ba.prototype),id.prototype.constructor=id,id.prototype.isShadowMaterial=!0,id.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this},nd.prototype=Object.create(As.prototype),nd.prototype.constructor=nd,nd.prototype.isRawShaderMaterial=!0,rd.prototype=Object.create(ba.prototype),rd.prototype.constructor=rd,rd.prototype.isMeshStandardMaterial=!0,rd.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},od.prototype=Object.create(rd.prototype),od.prototype.constructor=od,od.prototype.isMeshPhysicalMaterial=!0,od.prototype.copy=function(e){return rd.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new ma).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},ad.prototype=Object.create(ba.prototype),ad.prototype.constructor=ad,ad.prototype.isMeshPhongMaterial=!0,ad.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},sd.prototype=Object.create(ba.prototype),sd.prototype.constructor=sd,sd.prototype.isMeshToonMaterial=!0,sd.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},cd.prototype=Object.create(ba.prototype),cd.prototype.constructor=cd,cd.prototype.isMeshNormalMaterial=!0,cd.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ld.prototype=Object.create(ba.prototype),ld.prototype.constructor=ld,ld.prototype.isMeshLambertMaterial=!0,ld.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},hd.prototype=Object.create(ba.prototype),hd.prototype.constructor=hd,hd.prototype.isMeshMatcapMaterial=!0,hd.prototype.copy=function(e){return ba.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ud.prototype=Object.create(yh.prototype),ud.prototype.constructor=ud,ud.prototype.isLineDashedMaterial=!0,ud.prototype.copy=function(e){return yh.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var dd=Object.freeze({__proto__:null,ShadowMaterial:id,SpriteMaterial:Vl,RawShaderMaterial:nd,ShaderMaterial:As,PointsMaterial:Ih,MeshPhysicalMaterial:od,MeshStandardMaterial:rd,MeshPhongMaterial:ad,MeshToonMaterial:sd,MeshNormalMaterial:cd,MeshLambertMaterial:ld,MeshDepthMaterial:bl,MeshDistanceMaterial:wl,MeshBasicMaterial:wa,MeshMatcapMaterial:hd,LineDashedMaterial:ud,LineBasicMaterial:yh,Material:ba}),pd={arraySlice:function(e,t,i){return pd.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,i=new Array(t),n=0;n!==t;++n)i[n]=n;return i.sort((function(t,i){return e[t]-e[i]})),i},sortedArray:function(e,t,i){for(var n=e.length,r=new e.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*t,c=0;c!==t;++c)r[a++]=e[s+c];return r},flattenJSON:function(e,t,i,n){for(var r=1,o=e[0];void 0!==o&&void 0===o[n];)o=e[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[n])&&(t.push(o.time),i.push.apply(i,a)),o=e[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[n])&&(t.push(o.time),a.toArray(i,i.length)),o=e[r++]}while(void 0!==o);else do{void 0!==(a=o[n])&&(t.push(o.time),i.push(a)),o=e[r++]}while(void 0!==o)}},subclip:function(e,t,i,n,r){r=r||30;var o=e.clone();o.name=t;for(var a=[],s=0;s<o.tracks.length;++s){for(var c=o.tracks[s],l=c.getValueSize(),h=[],u=[],d=0;d<c.times.length;++d){var p=c.times[d]*r;if(!(p<i||p>=n)){h.push(c.times[d]);for(var f=0;f<l;++f)u.push(c.values[d*l+f])}}0!==h.length&&(c.times=pd.convertArray(h,c.times.constructor),c.values=pd.convertArray(u,c.values.constructor),a.push(c))}o.tracks=a;var m=1/0;for(s=0;s<o.tracks.length;++s)m>o.tracks[s].times[0]&&(m=o.tracks[s].times[0]);for(s=0;s<o.tracks.length;++s)o.tracks[s].shift(-1*m);return o.resetDuration(),o},makeClipAdditive:function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=e),(void 0===n||n<=0)&&(n=30);for(var r=e.tracks.length,o=t/n,a=0;a<r;++a){var s=i.tracks[a],c=s.ValueTypeName;if("bool"!==c&&"string"!==c){var l=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===c}));if(void 0!==l){var h,u=s.getValueSize(),d=s.times.length-1;if(o<=s.times[0])h=pd.arraySlice(s.values,0,s.valueSize);else if(o>=s.times[d]){var p=d*u;h=pd.arraySlice(s.values,p)}else{var f=s.createInterpolant();f.evaluate(o),h=f.resultBuffer}if("quaternion"===c)new Kr(h[0],h[1],h[2],h[3]).normalize().conjugate().toArray(h);for(var m=l.times.length,g=0;g<m;++g){var v=g*u;if("quaternion"===c)Kr.multiplyQuaternionsFlat(l.values,v,h,0,l.values,v);else for(var y=0;y<u;++y)l.values[v+y]-=h[y]}}}}return e.blendMode=2501,e}};function fd(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i}function md(e,t,i,n){fd.call(this,e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function gd(e,t,i,n){fd.call(this,e,t,i,n)}function vd(e,t,i,n){fd.call(this,e,t,i,n)}function yd(e,t,i,n){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=pd.convertArray(t,this.TimeBufferType),this.values=pd.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function Ad(e,t,i){yd.call(this,e,t,i)}function xd(e,t,i,n){yd.call(this,e,t,i,n)}function bd(e,t,i,n){yd.call(this,e,t,i,n)}function wd(e,t,i,n){fd.call(this,e,t,i,n)}function Md(e,t,i,n){yd.call(this,e,t,i,n)}function Ed(e,t,i,n){yd.call(this,e,t,i,n)}function Sd(e,t,i,n){yd.call(this,e,t,i,n)}function _d(e,t,i,n){this.name=e,this.tracks=i,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==n?n:2500,this.uuid=Vr.generateUUID(),this.duration<0&&this.resetDuration()}function Td(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return bd;case"vector":case"vector2":case"vector3":case"vector4":return Sd;case"color":return xd;case"quaternion":return Md;case"bool":case"boolean":return Ad;case"string":return Ed}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var i=[],n=[];pd.flattenJSON(e.keys,i,n,"value"),e.times=i,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(fd.prototype,{evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{var o;i:{n:if(!(e<n)){for(var a=i+2;;){if(void 0===n){if(e<r)break n;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,r)}if(i===a)break;if(r=n,e<(n=t[++i]))break t}o=t.length;break i}if(e>=r)break e;var s=t[1];e<s&&(i=2,r=s);for(a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(i===a)break;if(n=r,e>=(r=t[--i-1]))break t}o=i,i=0}for(;i<o;){var c=i+o>>>1;e<t[c]?o=c:i=c+1}if(n=t[i],void 0===(r=t[i-1]))return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,r,e)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n,o=0;o!==n;++o)t[o]=i[r+o];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(fd.prototype,{beforeStart_:fd.prototype.copySampleValue_,afterEnd_:fd.prototype.copySampleValue_}),md.prototype=Object.assign(Object.create(fd.prototype),{constructor:md,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,i){var n=this.parameterPositions,r=e-2,o=e+1,a=n[r],s=n[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=e,a=2*t-i;break;case 2402:a=t+n[r=n.length-2]-n[r+1];break;default:r=e,a=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=e,s=2*i-t;break;case 2402:o=1,s=i+n[1]-n[0];break;default:o=e-1,s=t}var c=.5*(i-t),l=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(s-i),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,A=d*m-d*f,x=0;x!==a;++x)r[x]=g*o[l+x]+v*o[c+x]+y*o[s+x]+A*o[h+x];return r}}),gd.prototype=Object.assign(Object.create(fd.prototype),{constructor:gd,interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,l=(i-t)/(n-t),h=1-l,u=0;u!==a;++u)r[u]=o[c+u]*h+o[s+u]*l;return r}}),vd.prototype=Object.assign(Object.create(fd.prototype),{constructor:vd,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(yd,{toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:pd.convertArray(e.times,Array),values:pd.convertArray(e.values,Array)};var n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t}}),Object.assign(yd.prototype,{constructor:yd,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new vd(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new gd(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new md(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,n=t.length;i!==n;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,n=t.length;i!==n;++i)t[i]*=e;return this},trim:function(e,t){for(var i=this.times,n=i.length,r=0,o=n-1;r!==n&&i[r]<e;)++r;for(;-1!==o&&i[o]>t;)--o;if(++o,0!==r||o!==n){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=pd.arraySlice(i,r,o),this.values=pd.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==r;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==n&&pd.isTypedArray(n)){a=0;for(var c=n.length;a!==c;++a){var l=n[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}}return e},optimize:function(){for(var e=pd.arraySlice(this.times),t=pd.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,o=e.length-1,a=1;a<o;++a){var s=!1,c=e[a];if(c!==e[a+1]&&(1!==a||c!==c[0]))if(n)s=!0;else for(var l=a*i,h=l-i,u=l+i,d=0;d!==i;++d){var p=t[l+d];if(p!==t[h+d]||p!==t[u+d]){s=!0;break}}if(s){if(a!==r){e[r]=e[a];var f=a*i,m=r*i;for(d=0;d!==i;++d)t[m+d]=t[f+d]}++r}}if(o>0){e[r]=e[o];for(f=o*i,m=r*i,d=0;d!==i;++d)t[m+d]=t[f+d];++r}return r!==e.length?(this.times=pd.arraySlice(e,0,r),this.values=pd.arraySlice(t,0,r*i)):(this.times=e,this.values=t),this},clone:function(){var e=pd.arraySlice(this.times,0),t=pd.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}),Ad.prototype=Object.assign(Object.create(yd.prototype),{constructor:Ad,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),xd.prototype=Object.assign(Object.create(yd.prototype),{constructor:xd,ValueTypeName:"color"}),bd.prototype=Object.assign(Object.create(yd.prototype),{constructor:bd,ValueTypeName:"number"}),wd.prototype=Object.assign(Object.create(fd.prototype),{constructor:wd,interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=(i-t)/(n-t),l=s+a;s!==l;s+=4)Kr.slerpFlat(r,0,o,s-a,o,s,c);return r}}),Md.prototype=Object.assign(Object.create(yd.prototype),{constructor:Md,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new wd(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Ed.prototype=Object.assign(Object.create(yd.prototype),{constructor:Ed,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Sd.prototype=Object.assign(Object.create(yd.prototype),{constructor:Sd,ValueTypeName:"vector"}),Object.assign(_d,{parse:function(e){for(var t=[],i=e.tracks,n=1/(e.fps||1),r=0,o=i.length;r!==o;++r)t.push(Td(i[r]).scale(n));return new _d(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,o=i.length;r!==o;++r)t.push(yd.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(e,t,i,n){for(var r=t.length,o=[],a=0;a<r;a++){var s=[],c=[];s.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);var l=pd.getKeyframeOrder(s);s=pd.sortedArray(s,1,l),c=pd.sortedArray(c,1,l),n||0!==s[0]||(s.push(r),c.push(c[0])),o.push(new bd(".morphTargetInfluences["+t[a].name+"]",s,c).scale(1/i))}return new _d(e,-1,o)},findByName:function(e,t){var i=e;if(!Array.isArray(e)){var n=e;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;o<a;o++){var s=e[o],c=s.name.match(r);if(c&&c.length>1){var l=n[u=c[1]];l||(n[u]=l=[]),l.push(s)}}var h=[];for(var u in n)h.push(_d.CreateFromMorphTargetSequence(u,n[u],t,i));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(e,t,i,n,r){if(0!==i.length){var o=[],a=[];pd.flattenJSON(i,o,a,n),0!==o.length&&r.push(new e(t,o,a))}},n=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var h=c[l].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},d=0;d<h.length;d++)if(h[d].morphTargets)for(var p=0;p<h[d].morphTargets.length;p++)u[h[d].morphTargets[p]]=-1;for(var f in u){var m=[],g=[];for(p=0;p!==h[d].morphTargets.length;++p){var v=h[d];m.push(v.time),g.push(v.morphTarget===f?1:0)}n.push(new bd(".morphTargetInfluence["+f+"]",m,g))}o=u.length*(a||1)}else{var y=".bones["+t[l].name+"]";i(Sd,y+".position",h,"pos",n),i(Md,y+".quaternion",h,"rot",n),i(Sd,y+".scale",h,"scl",n)}}return 0===n.length?null:new _d(r,o,n,s)}}),Object.assign(_d.prototype,{resetDuration:function(){for(var e=0,t=0,i=this.tracks.length;t!==i;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new _d(this.name,this.duration,e,this.blendMode)}});var Cd={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Id(e,t,i){var n=this,r=!1,o=0,a=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){a++,!1===r&&void 0!==n.onStart&&n.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==n.onProgress&&n.onProgress(e,o,a),o===a&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,i=c.length;t<i;t+=2){var n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null}}var Pd=new Id;function Rd(e){this.manager=void 0!==e?e:Pd,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Rd.prototype,{load:function(){},loadAsync:function(e,t){var i=this;return new Promise((function(n,r){i.load(e,n,t,r)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var Ld={};function Bd(e){Rd.call(this,e)}function Dd(e){Rd.call(this,e)}function Od(e){Rd.call(this,e)}function Nd(e){Rd.call(this,e)}function kd(e){Rd.call(this,e)}function Fd(e){Rd.call(this,e)}function Vd(e){Rd.call(this,e)}function zd(){this.type="Curve",this.arcLengthDivisions=200}function Hd(e,t,i,n,r,o,a,s){zd.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=i||1,this.yRadius=n||1,this.aStartAngle=r||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function Ud(e,t,i,n,r,o){Hd.call(this,e,t,i,i,n,r,o),this.type="ArcCurve"}function Gd(){var e=0,t=0,i=0,n=0;function r(r,o,a,s){e=r,t=a,i=-3*r+3*o-2*a-s,n=2*r-2*o+a+s}return{initCatmullRom:function(e,t,i,n,o){r(t,i,o*(i-e),o*(n-t))},initNonuniformCatmullRom:function(e,t,i,n,o,a,s){var c=(t-e)/o-(i-e)/(o+a)+(i-t)/a,l=(i-t)/a-(n-t)/(a+s)+(n-i)/s;r(t,i,c*=a,l*=a)},calc:function(r){var o=r*r;return e+t*r+i*o+n*(o*r)}}}Bd.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Bd,load:function(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,o=Cd.get(e);if(void 0!==o)return r.manager.itemStart(e),setTimeout((function(){t&&t(o),r.manager.itemEnd(e)}),0),o;if(void 0===Ld[e]){var a=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var s=a[1],c=!!a[2],l=a[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);h="blob"===u?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(l,s);break;case"json":h=JSON.parse(l);break;default:h=l}setTimeout((function(){t&&t(h),r.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)}),0)}}else{Ld[e]=[],Ld[e].push({onLoad:t,onProgress:i,onError:n});var m=new XMLHttpRequest;for(var g in m.open("GET",e,!0),m.addEventListener("load",(function(t){var i=this.response,n=Ld[e];if(delete Ld[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Cd.add(e,i);for(var o=0,a=n.length;o<a;o++){(s=n[o]).onLoad&&s.onLoad(i)}r.manager.itemEnd(e)}else{for(o=0,a=n.length;o<a;o++){var s;(s=n[o]).onError&&s.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var i=Ld[e],n=0,r=i.length;n<r;n++){var o=i[n];o.onProgress&&o.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var i=Ld[e];delete Ld[e];for(var n=0,o=i.length;n<o;n++){var a=i[n];a.onError&&a.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var i=Ld[e];delete Ld[e];for(var n=0,o=i.length;n<o;n++){var a=i[n];a.onError&&a.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(e),m}Ld[e].push({onLoad:t,onProgress:i,onError:n})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Dd.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Dd,load:function(e,t,i,n){var r=this,o=new Bd(r.manager);o.setPath(r.path),o.load(e,(function(i){try{t(r.parse(JSON.parse(i)))}catch(t){n?n(t):console.error(t),r.manager.itemError(e)}}),i,n)},parse:function(e){for(var t=[],i=0;i<e.length;i++){var n=_d.parse(e[i]);t.push(n)}return t}}),Od.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Od,load:function(e,t,i,n){var r=this,o=[],a=new kh;a.image=o;var s=new Bd(this.manager);function c(c){s.load(e[c],(function(e){var i=r.parse(e,!0);o[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},6===(l+=1)&&(1===i.mipmapCount&&(a.minFilter=1006),a.format=i.format,a.needsUpdate=!0,t&&t(a))}),i,n)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,h=0,u=e.length;h<u;++h)c(h);else s.load(e,(function(e){var i=r.parse(e,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,s=0;s<n;s++){o[s]={mipmaps:[]};for(var c=0;c<i.mipmapCount;c++)o[s].mipmaps.push(i.mipmaps[s*i.mipmapCount+c]),o[s].format=i.format,o[s].width=i.width,o[s].height=i.height}else a.image.width=i.width,a.image.height=i.height,a.mipmaps=i.mipmaps;1===i.mipmapCount&&(a.minFilter=1006),a.format=i.format,a.needsUpdate=!0,t&&t(a)}),i,n);return a}}),Nd.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Nd,load:function(e,t,i,n){var r=this,o=new Es,a=new Bd(this.manager);return a.setResponseType("arraybuffer"),a.setPath(this.path),a.load(e,(function(e){var i=r.parse(e);i&&(void 0!==i.image?o.image=i.image:void 0!==i.data&&(o.image.width=i.width,o.image.height=i.height,o.image.data=i.data),o.wrapS=void 0!==i.wrapS?i.wrapS:1001,o.wrapT=void 0!==i.wrapT?i.wrapT:1001,o.magFilter=void 0!==i.magFilter?i.magFilter:1006,o.minFilter=void 0!==i.minFilter?i.minFilter:1006,o.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(o.format=i.format),void 0!==i.type&&(o.type=i.type),void 0!==i.mipmaps&&(o.mipmaps=i.mipmaps,o.minFilter=1008),1===i.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,t&&t(o,i))}),i,n),o}}),kd.prototype=Object.assign(Object.create(Rd.prototype),{constructor:kd,load:function(e,t,i,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,o=Cd.get(e);if(void 0!==o)return r.manager.itemStart(e),setTimeout((function(){t&&t(o),r.manager.itemEnd(e)}),0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){a.removeEventListener("load",s,!1),a.removeEventListener("error",c,!1),Cd.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(t){a.removeEventListener("load",s,!1),a.removeEventListener("error",c,!1),n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)}return a.addEventListener("load",s,!1),a.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}),Fd.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Fd,load:function(e,t,i,n){var r=new Ws,o=new kd(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;function s(i){o.load(e[i],(function(e){r.images[i]=e,6===++a&&(r.needsUpdate=!0,t&&t(r))}),void 0,n)}for(var c=0;c<e.length;++c)s(c);return r}}),Vd.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Vd,load:function(e,t,i,n){var r=new jr,o=new kd(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,(function(i){r.image=i;var n=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==t&&t(r)}),i,n),r}}),Object.assign(zd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var i=this.getUtoTmapping(e);return this.getPoint(i,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,n=[],r=this.getPoint(0),o=0;for(n.push(0),i=1;i<=e;i++)o+=(t=this.getPoint(i/e)).distanceTo(r),n.push(o),r=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,n=this.getLengths(),r=0,o=n.length;i=t||e*n[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=n[r=Math.floor(s+(c-s)/2)]-i)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(n[r=c]===i)return r/(o-1);var l=n[r];return(r+(i-l)/(n[r+1]-l))/(o-1)},getTangent:function(e,t){var i=1e-4,n=e-i,r=e+i;n<0&&(n=0),r>1&&(r=1);var o=this.getPoint(n),a=this.getPoint(r),s=t||(o.isVector2?new zr:new Zr);return s.copy(a).sub(o).normalize(),s},getTangentAt:function(e,t){var i=this.getUtoTmapping(e);return this.getTangent(i,t)},computeFrenetFrames:function(e,t){var i,n,r,o=new Zr,a=[],s=[],c=[],l=new Zr,h=new oo;for(i=0;i<=e;i++)n=i/e,a[i]=this.getTangentAt(n,new Zr),a[i].normalize();s[0]=new Zr,c[0]=new Zr;var u=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=u&&(u=d,o.set(1,0,0)),p<=u&&(u=p,o.set(0,1,0)),f<=u&&o.set(0,0,1),l.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],l),c[0].crossVectors(a[0],s[0]),i=1;i<=e;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),l.crossVectors(a[i-1],a[i]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(Vr.clamp(a[i-1].dot(a[i]),-1,1)),s[i].applyMatrix4(h.makeRotationAxis(l,r))),c[i].crossVectors(a[i],s[i]);if(!0===t)for(r=Math.acos(Vr.clamp(s[0].dot(s[e]),-1,1)),r/=e,a[0].dot(l.crossVectors(s[0],s[e]))>0&&(r=-r),i=1;i<=e;i++)s[i].applyMatrix4(h.makeRotationAxis(a[i],r*i)),c[i].crossVectors(a[i],s[i]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Hd.prototype=Object.create(zd.prototype),Hd.prototype.constructor=Hd,Hd.prototype.isEllipseCurve=!0,Hd.prototype.getPoint=function(e,t){for(var i=t||new zr,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)<Number.EPSILON;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=o?0:n),!0!==this.aClockwise||o||(r===n?r=-n:r-=n);var a=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var l=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,d=c-this.aY;s=u*l-d*h+this.aX,c=u*h+d*l+this.aY}return i.set(s,c)},Hd.prototype.copy=function(e){return zd.prototype.copy.call(this,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},Hd.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);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},Hd.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,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},Ud.prototype=Object.create(Hd.prototype),Ud.prototype.constructor=Ud,Ud.prototype.isArcCurve=!0;var jd=new Zr,Qd=new Gd,Wd=new Gd,qd=new Gd;function Kd(e,t,i,n){zd.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=i||"centripetal",this.tension=n||.5}function Xd(e,t,i,n,r){var o=.5*(n-t),a=.5*(r-i),s=e*e;return(2*i-2*n+o+a)*(e*s)+(-3*i+3*n-2*o-a)*s+o*e+i}function Yd(e,t,i,n){return function(e,t){var i=1-e;return i*i*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,i)+function(e,t){return e*e*t}(e,n)}function Zd(e,t,i,n,r){return function(e,t){var i=1-e;return i*i*i*t}(e,t)+function(e,t){var i=1-e;return 3*i*i*e*t}(e,i)+function(e,t){return 3*(1-e)*e*e*t}(e,n)+function(e,t){return e*e*e*t}(e,r)}function Jd(e,t,i,n){zd.call(this),this.type="CubicBezierCurve",this.v0=e||new zr,this.v1=t||new zr,this.v2=i||new zr,this.v3=n||new zr}function $d(e,t,i,n){zd.call(this),this.type="CubicBezierCurve3",this.v0=e||new Zr,this.v1=t||new Zr,this.v2=i||new Zr,this.v3=n||new Zr}function ep(e,t){zd.call(this),this.type="LineCurve",this.v1=e||new zr,this.v2=t||new zr}function tp(e,t){zd.call(this),this.type="LineCurve3",this.v1=e||new Zr,this.v2=t||new Zr}function ip(e,t,i){zd.call(this),this.type="QuadraticBezierCurve",this.v0=e||new zr,this.v1=t||new zr,this.v2=i||new zr}function np(e,t,i){zd.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Zr,this.v1=t||new Zr,this.v2=i||new Zr}function rp(e){zd.call(this),this.type="SplineCurve",this.points=e||[]}Kd.prototype=Object.create(zd.prototype),Kd.prototype.constructor=Kd,Kd.prototype.isCatmullRomCurve3=!0,Kd.prototype.getPoint=function(e,t){var i,n,r,o,a=t||new Zr,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,h=Math.floor(l),u=l-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/c)+1)*c:0===u&&h===c-1&&(h=c-2,u=1),this.closed||h>0?i=s[(h-1)%c]:(jd.subVectors(s[0],s[1]).add(s[0]),i=jd),n=s[h%c],r=s[(h+1)%c],this.closed||h+2<c?o=s[(h+2)%c]:(jd.subVectors(s[c-1],s[c-2]).add(s[c-1]),o=jd),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(i.distanceToSquared(n),d),f=Math.pow(n.distanceToSquared(r),d),m=Math.pow(r.distanceToSquared(o),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Qd.initNonuniformCatmullRom(i.x,n.x,r.x,o.x,p,f,m),Wd.initNonuniformCatmullRom(i.y,n.y,r.y,o.y,p,f,m),qd.initNonuniformCatmullRom(i.z,n.z,r.z,o.z,p,f,m)}else"catmullrom"===this.curveType&&(Qd.initCatmullRom(i.x,n.x,r.x,o.x,this.tension),Wd.initCatmullRom(i.y,n.y,r.y,o.y,this.tension),qd.initCatmullRom(i.z,n.z,r.z,o.z,this.tension));return a.set(Qd.calc(u),Wd.calc(u),qd.calc(u)),a},Kd.prototype.copy=function(e){zd.prototype.copy.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Kd.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Kd.prototype.fromJSON=function(e){zd.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var n=e.points[t];this.points.push((new Zr).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Jd.prototype=Object.create(zd.prototype),Jd.prototype.constructor=Jd,Jd.prototype.isCubicBezierCurve=!0,Jd.prototype.getPoint=function(e,t){var i=t||new zr,n=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(Zd(e,n.x,r.x,o.x,a.x),Zd(e,n.y,r.y,o.y,a.y)),i},Jd.prototype.copy=function(e){return zd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Jd.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Jd.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},$d.prototype=Object.create(zd.prototype),$d.prototype.constructor=$d,$d.prototype.isCubicBezierCurve3=!0,$d.prototype.getPoint=function(e,t){var i=t||new Zr,n=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(Zd(e,n.x,r.x,o.x,a.x),Zd(e,n.y,r.y,o.y,a.y),Zd(e,n.z,r.z,o.z,a.z)),i},$d.prototype.copy=function(e){return zd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},$d.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},$d.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},ep.prototype=Object.create(zd.prototype),ep.prototype.constructor=ep,ep.prototype.isLineCurve=!0,ep.prototype.getPoint=function(e,t){var i=t||new zr;return 1===e?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i},ep.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ep.prototype.getTangent=function(e,t){return(t||new zr).copy(this.v2).sub(this.v1).normalize()},ep.prototype.copy=function(e){return zd.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ep.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ep.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},tp.prototype=Object.create(zd.prototype),tp.prototype.constructor=tp,tp.prototype.isLineCurve3=!0,tp.prototype.getPoint=function(e,t){var i=t||new Zr;return 1===e?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i},tp.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},tp.prototype.copy=function(e){return zd.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},tp.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},tp.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ip.prototype=Object.create(zd.prototype),ip.prototype.constructor=ip,ip.prototype.isQuadraticBezierCurve=!0,ip.prototype.getPoint=function(e,t){var i=t||new zr,n=this.v0,r=this.v1,o=this.v2;return i.set(Yd(e,n.x,r.x,o.x),Yd(e,n.y,r.y,o.y)),i},ip.prototype.copy=function(e){return zd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ip.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ip.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},np.prototype=Object.create(zd.prototype),np.prototype.constructor=np,np.prototype.isQuadraticBezierCurve3=!0,np.prototype.getPoint=function(e,t){var i=t||new Zr,n=this.v0,r=this.v1,o=this.v2;return i.set(Yd(e,n.x,r.x,o.x),Yd(e,n.y,r.y,o.y),Yd(e,n.z,r.z,o.z)),i},np.prototype.copy=function(e){return zd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},np.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},np.prototype.fromJSON=function(e){return zd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},rp.prototype=Object.create(zd.prototype),rp.prototype.constructor=rp,rp.prototype.isSplineCurve=!0,rp.prototype.getPoint=function(e,t){var i=t||new zr,n=this.points,r=(n.length-1)*e,o=Math.floor(r),a=r-o,s=n[0===o?o:o-1],c=n[o],l=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return i.set(Xd(a,s.x,c.x,l.x,h.x),Xd(a,s.y,c.y,l.y,h.y)),i},rp.prototype.copy=function(e){zd.prototype.copy.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var n=e.points[t];this.points.push(n.clone())}return this},rp.prototype.toJSON=function(){var e=zd.prototype.toJSON.call(this);e.points=[];for(var t=0,i=this.points.length;t<i;t++){var n=this.points[t];e.points.push(n.toArray())}return e},rp.prototype.fromJSON=function(e){zd.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,i=e.points.length;t<i;t++){var n=e.points[t];this.points.push((new zr).fromArray(n))}return this};var op=Object.freeze({__proto__:null,ArcCurve:Ud,CatmullRomCurve3:Kd,CubicBezierCurve:Jd,CubicBezierCurve3:$d,EllipseCurve:Hd,LineCurve:ep,LineCurve3:tp,QuadraticBezierCurve:ip,QuadraticBezierCurve3:np,SplineCurve:rp});function ap(){zd.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function sp(e){ap.call(this),this.type="Path",this.currentPoint=new zr,e&&this.setFromPoints(e)}function cp(e){sp.call(this,e),this.uuid=Vr.generateUUID(),this.type="Shape",this.holes=[]}function lp(e,t){Eo.call(this),this.type="Light",this.color=new ma(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function hp(e,t,i){lp.call(this,e,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Eo.DefaultUp),this.updateMatrix(),this.groundColor=new ma(t)}function up(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new zr(512,512),this.map=null,this.mapPass=null,this.matrix=new oo,this._frustum=new Ts,this._frameExtents=new zr(1,1),this._viewportCount=1,this._viewports=[new Qr(0,0,1,1)]}function dp(){up.call(this,new bs(50,1,.5,500))}function pp(e,t,i,n,r,o){lp.call(this,e,t),this.type="SpotLight",this.position.copy(Eo.DefaultUp),this.updateMatrix(),this.target=new Eo,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new dp}function fp(){up.call(this,new bs(90,1,.5,500)),this._frameExtents=new zr(4,2),this._viewportCount=6,this._viewports=[new Qr(2,1,1,1),new Qr(0,1,1,1),new Qr(3,1,1,1),new Qr(1,1,1,1),new Qr(3,0,1,1),new Qr(1,0,1,1)],this._cubeDirections=[new Zr(1,0,0),new Zr(-1,0,0),new Zr(0,0,1),new Zr(0,0,-1),new Zr(0,1,0),new Zr(0,-1,0)],this._cubeUps=[new Zr(0,1,0),new Zr(0,1,0),new Zr(0,1,0),new Zr(0,1,0),new Zr(0,0,1),new Zr(0,0,-1)]}function mp(e,t,i,n){lp.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new fp}function gp(e,t,i,n,r,o){xs.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==i?i:1,this.bottom=void 0!==n?n:-1,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function vp(){up.call(this,new gp(-5,5,5,-5,.5,500))}function yp(e,t){lp.call(this,e,t),this.type="DirectionalLight",this.position.copy(Eo.DefaultUp),this.updateMatrix(),this.target=new Eo,this.shadow=new vp}function Ap(e,t){lp.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function xp(e,t,i,n){lp.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}function bp(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new Zr)}function wp(e,t){lp.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new bp}function Mp(e){Rd.call(this,e),this.textures={}}ap.prototype=Object.assign(Object.create(zd.prototype),{constructor:ap,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ep(t,e))},getPoint:function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=t){var r=i[n]-t,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,n=this.curves.length;i<n;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,i=[],n=0,r=this.curves;n<r.length;n++)for(var o=r[n],a=o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,s=o.getPoints(a),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(i.push(l),t=l)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(e){zd.prototype.copy.call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=zd.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,i=this.curves.length;t<i;t++){var n=this.curves[t];e.curves.push(n.toJSON())}return e},fromJSON:function(e){zd.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,i=e.curves.length;t<i;t++){var n=e.curves[t];this.curves.push((new op[n.type]).fromJSON(n))}return this}}),sp.prototype=Object.assign(Object.create(ap.prototype),{constructor:sp,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var i=new ep(this.currentPoint.clone(),new zr(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,i,n){var r=new ip(this.currentPoint.clone(),new zr(e,t),new zr(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this},bezierCurveTo:function(e,t,i,n,r,o){var a=new Jd(this.currentPoint.clone(),new zr(e,t),new zr(i,n),new zr(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this},splineThru:function(e){var t=new rp([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,i,n,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+a,t+s,i,n,r,o),this},absarc:function(e,t,i,n,r,o){return this.absellipse(e,t,i,i,n,r,o),this},ellipse:function(e,t,i,n,r,o,a,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,i,n,r,o,a,s),this},absellipse:function(e,t,i,n,r,o,a,s){var c=new Hd(e,t,i,n,r,o,a,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return ap.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=ap.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return ap.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),cp.prototype=Object.assign(Object.create(sp.prototype),{constructor:cp,getPointsHoles:function(e){for(var t=[],i=0,n=this.holes.length;i<n;i++)t[i]=this.holes[i].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){sp.prototype.copy.call(this,e),this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var n=e.holes[t];this.holes.push(n.clone())}return this},toJSON:function(){var e=sp.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,i=this.holes.length;t<i;t++){var n=this.holes[t];e.holes.push(n.toJSON())}return e},fromJSON:function(e){sp.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,i=e.holes.length;t<i;t++){var n=e.holes[t];this.holes.push((new sp).fromJSON(n))}return this}}),lp.prototype=Object.assign(Object.create(Eo.prototype),{constructor:lp,isLight:!0,copy:function(e){return Eo.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Eo.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),hp.prototype=Object.assign(Object.create(lp.prototype),{constructor:hp,isHemisphereLight:!0,copy:function(e){return lp.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(up.prototype,{_projScreenMatrix:new oo,_lightPositionWorld:new Zr,_lookTarget:new Zr,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,i=this.matrix,n=this._projScreenMatrix,r=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(e.matrixWorld),t.position.copy(o),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(n),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),dp.prototype=Object.assign(Object.create(up.prototype),{constructor:dp,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,i=2*Vr.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;i===t.fov&&n===t.aspect&&r===t.far||(t.fov=i,t.aspect=n,t.far=r,t.updateProjectionMatrix()),up.prototype.updateMatrices.call(this,e)}}),pp.prototype=Object.assign(Object.create(lp.prototype),{constructor:pp,isSpotLight:!0,copy:function(e){return lp.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),fp.prototype=Object.assign(Object.create(up.prototype),{constructor:fp,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var i=this.camera,n=this.matrix,r=this._lightPositionWorld,o=this._lookTarget,a=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),i.position.copy(r),o.copy(i.position),o.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(o),i.updateMatrixWorld(),n.makeTranslation(-r.x,-r.y,-r.z),a.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a)}}),mp.prototype=Object.assign(Object.create(lp.prototype),{constructor:mp,isPointLight:!0,copy:function(e){return lp.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),gp.prototype=Object.assign(Object.create(xs.prototype),{constructor:gp,isOrthographicCamera:!0,copy:function(e,t){return xs.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,i,n,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,o=i+e,a=n+t,s=n-t;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o=(r+=c*this.view.offsetX)+c*this.view.width,s=(a-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Eo.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),vp.prototype=Object.assign(Object.create(up.prototype),{constructor:vp,isDirectionalLightShadow:!0,updateMatrices:function(e){up.prototype.updateMatrices.call(this,e)}}),yp.prototype=Object.assign(Object.create(lp.prototype),{constructor:yp,isDirectionalLight:!0,copy:function(e){return lp.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ap.prototype=Object.assign(Object.create(lp.prototype),{constructor:Ap,isAmbientLight:!0}),xp.prototype=Object.assign(Object.create(lp.prototype),{constructor:xp,isRectAreaLight:!0,copy:function(e){return lp.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=lp.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(bp.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var i=e.x,n=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],i*n*1.092548),t.addScaledVector(o[5],n*r*1.092548),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],i*r*1.092548),t.addScaledVector(o[8],.546274*(i*i-n*n)),t},getIrradianceAt:function(e,t){var i=e.x,n=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*n),t.addScaledVector(o[2],1.023328*r),t.addScaledVector(o[3],1.023328*i),t.addScaledVector(o[4],.858086*i*n),t.addScaledVector(o[5],.858086*n*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],.858086*i*r),t.addScaledVector(o[8],.429043*(i*i-n*n)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var i=this.coefficients,n=0;n<9;n++)i[n].fromArray(e,t+3*n);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var i=this.coefficients,n=0;n<9;n++)i[n].toArray(e,t+3*n);return e}}),Object.assign(bp,{getBasisAt:function(e,t){var i=e.x,n=e.y,r=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*r,t[3]=.488603*i,t[4]=1.092548*i*n,t[5]=1.092548*n*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*i*r,t[8]=.546274*(i*i-n*n)}}),wp.prototype=Object.assign(Object.create(lp.prototype),{constructor:wp,isLightProbe:!0,copy:function(e){return lp.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=lp.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),Mp.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Mp,load:function(e,t,i,n){var r=this,o=new Bd(r.manager);o.setPath(r.path),o.load(e,(function(i){try{t(r.parse(JSON.parse(i)))}catch(t){n?n(t):console.error(t),r.manager.itemError(e)}}),i,n)},parse:function(e){var t=this.textures;function i(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var n=new dd[e.type];if(void 0!==e.uuid&&(n.uuid=e.uuid),void 0!==e.name&&(n.name=e.name),void 0!==e.color&&n.color.setHex(e.color),void 0!==e.roughness&&(n.roughness=e.roughness),void 0!==e.metalness&&(n.metalness=e.metalness),void 0!==e.sheen&&(n.sheen=(new ma).setHex(e.sheen)),void 0!==e.emissive&&n.emissive.setHex(e.emissive),void 0!==e.specular&&n.specular.setHex(e.specular),void 0!==e.shininess&&(n.shininess=e.shininess),void 0!==e.clearcoat&&(n.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(n.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(n.fog=e.fog),void 0!==e.flatShading&&(n.flatShading=e.flatShading),void 0!==e.blending&&(n.blending=e.blending),void 0!==e.combine&&(n.combine=e.combine),void 0!==e.side&&(n.side=e.side),void 0!==e.opacity&&(n.opacity=e.opacity),void 0!==e.transparent&&(n.transparent=e.transparent),void 0!==e.alphaTest&&(n.alphaTest=e.alphaTest),void 0!==e.depthTest&&(n.depthTest=e.depthTest),void 0!==e.depthWrite&&(n.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(n.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(n.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(n.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(n.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(n.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(n.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(n.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(n.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(n.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(n.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(n.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(n.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(n.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(n.rotation=e.rotation),1!==e.linewidth&&(n.linewidth=e.linewidth),void 0!==e.dashSize&&(n.dashSize=e.dashSize),void 0!==e.gapSize&&(n.gapSize=e.gapSize),void 0!==e.scale&&(n.scale=e.scale),void 0!==e.polygonOffset&&(n.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(n.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(n.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(n.skinning=e.skinning),void 0!==e.morphTargets&&(n.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(n.morphNormals=e.morphNormals),void 0!==e.dithering&&(n.dithering=e.dithering),void 0!==e.vertexTangents&&(n.vertexTangents=e.vertexTangents),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.toneMapped&&(n.toneMapped=e.toneMapped),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?n.vertexColors=e.vertexColors>0:n.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var o=e.uniforms[r];switch(n.uniforms[r]={},o.type){case"t":n.uniforms[r].value=i(o.value);break;case"c":n.uniforms[r].value=(new ma).setHex(o.value);break;case"v2":n.uniforms[r].value=(new zr).fromArray(o.value);break;case"v3":n.uniforms[r].value=(new Zr).fromArray(o.value);break;case"v4":n.uniforms[r].value=(new Qr).fromArray(o.value);break;case"m3":n.uniforms[r].value=(new Hr).fromArray(o.value);case"m4":n.uniforms[r].value=(new oo).fromArray(o.value);break;default:n.uniforms[r].value=o.value}}if(void 0!==e.defines&&(n.defines=e.defines),void 0!==e.vertexShader&&(n.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(n.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var a in e.extensions)n.extensions[a]=e.extensions[a];if(void 0!==e.shading&&(n.flatShading=1===e.shading),void 0!==e.size&&(n.size=e.size),void 0!==e.sizeAttenuation&&(n.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(n.map=i(e.map)),void 0!==e.matcap&&(n.matcap=i(e.matcap)),void 0!==e.alphaMap&&(n.alphaMap=i(e.alphaMap)),void 0!==e.bumpMap&&(n.bumpMap=i(e.bumpMap)),void 0!==e.bumpScale&&(n.bumpScale=e.bumpScale),void 0!==e.normalMap&&(n.normalMap=i(e.normalMap)),void 0!==e.normalMapType&&(n.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new zr).fromArray(s)}return void 0!==e.displacementMap&&(n.displacementMap=i(e.displacementMap)),void 0!==e.displacementScale&&(n.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(n.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(n.roughnessMap=i(e.roughnessMap)),void 0!==e.metalnessMap&&(n.metalnessMap=i(e.metalnessMap)),void 0!==e.emissiveMap&&(n.emissiveMap=i(e.emissiveMap)),void 0!==e.emissiveIntensity&&(n.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(n.specularMap=i(e.specularMap)),void 0!==e.envMap&&(n.envMap=i(e.envMap)),void 0!==e.envMapIntensity&&(n.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(n.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(n.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(n.lightMap=i(e.lightMap)),void 0!==e.lightMapIntensity&&(n.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(n.aoMap=i(e.aoMap)),void 0!==e.aoMapIntensity&&(n.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(n.gradientMap=i(e.gradientMap)),void 0!==e.clearcoatMap&&(n.clearcoatMap=i(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(n.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(n.clearcoatNormalMap=i(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(n.clearcoatNormalScale=(new zr).fromArray(e.clearcoatNormalScale)),n},setTextures:function(e){return this.textures=e,this}});var Ep=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0,n=e.length;i<n;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch(e){return t}},Sp=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};function _p(){Ga.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Tp(e,t,i,n){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Ea.call(this,e,t,i),this.meshPerAttribute=n||1}function Cp(e){Rd.call(this,e)}_p.prototype=Object.assign(Object.create(Ga.prototype),{constructor:_p,isInstancedBufferGeometry:!0,copy:function(e){return Ga.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Ga.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),Tp.prototype=Object.assign(Object.create(Ea.prototype),{constructor:Tp,isInstancedBufferAttribute:!0,copy:function(e){return Ea.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=Ea.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Cp.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Cp,load:function(e,t,i,n){var r=this,o=new Bd(r.manager);o.setPath(r.path),o.load(e,(function(i){try{t(r.parse(JSON.parse(i)))}catch(t){n?n(t):console.error(t),r.manager.itemError(e)}}),i,n)},parse:function(e){var t=e.isInstancedBufferGeometry?new _p:new Ga,i=e.data.index;if(void 0!==i){var n=new Ip[i.type](i.array);t.setIndex(new Ea(n,1))}var r=e.data.attributes;for(var o in r){var a=r[o],s=(n=new Ip[a.type](a.array),new(a.isInstancedBufferAttribute?Tp:Ea)(n,a.itemSize,a.normalized));void 0!==a.name&&(s.name=a.name),t.setAttribute(o,s)}var c=e.data.morphAttributes;if(c)for(var o in c){for(var l=c[o],h=[],u=0,d=l.length;u<d;u++){a=l[u],s=new Ea(n=new Ip[a.type](a.array),a.itemSize,a.normalized);void 0!==a.name&&(s.name=a.name),h.push(s)}t.morphAttributes[o]=h}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==p){u=0;for(var f=p.length;u!==f;++u){var m=p[u];t.addGroup(m.start,m.count,m.materialIndex)}}var g=e.data.boundingSphere;if(void 0!==g){var v=new Zr;void 0!==g.center&&v.fromArray(g.center),t.boundingSphere=new Uo(v,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Ip={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Pp(e){Rd.call(this,e)}Pp.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Pp,load:function(e,t,i,n){var r=this,o=""===this.path?Sp(e):this.path;this.resourcePath=this.resourcePath||o;var a=new Bd(r.manager);a.setPath(this.path),a.load(e,(function(i){var o=null;try{o=JSON.parse(i)}catch(t){return void 0!==n&&n(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e)}),i,n)},parse:function(e,t){var i=this.parseShape(e.shapes),n=this.parseGeometries(e.geometries,i),r=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,n,a);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var i=0,n=e.length;i<n;i++){var r=(new cp).fromJSON(e[i]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var i={};if(void 0!==e)for(var n=new Cp,r=0,o=e.length;r<o;r++){var a,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new td[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new td[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new td[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new td[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new td[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new td[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":a=new td[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new td[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new td[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new td[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":a=new td[s.type]((new op[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":a=new td[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":a=new td[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,h=s.shapes.length;l<h;l++){var u=t[s.shapes[l]];c.push(u)}a=new td[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,h=s.shapes.length;l<h;l++){u=t[s.shapes[l]];c.push(u)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new op[d.type]).fromJSON(d)),a=new td[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":a=n.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),!0===a.isBufferGeometry&&void 0!==s.userData&&(a.userData=s.userData),i[s.uuid]=a}return i},parseMaterials:function(e,t){var i={},n={};if(void 0!==e){var r=new Mp;r.setTextures(t);for(var o=0,a=e.length;o<a;o++){var s=e[o];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var h=s.materials[l];void 0===i[h.uuid]&&(i[h.uuid]=r.parse(h)),c.push(i[h.uuid])}n[s.uuid]=c}else void 0===i[s.uuid]&&(i[s.uuid]=r.parse(s)),n[s.uuid]=i[s.uuid]}}return n},parseAnimations:function(e){for(var t=[],i=0;i<e.length;i++){var n=e[i],r=_d.parse(n);void 0!==n.uuid&&(r.uuid=n.uuid),t.push(r)}return t},parseImages:function(e,t){var i=this,n={};function r(e){return i.manager.itemStart(e),o.load(e,(function(){i.manager.itemEnd(e)}),void 0,(function(){i.manager.itemError(e),i.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var o=new kd(new Id(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a<s;a++){var c=e[a],l=c.url;if(Array.isArray(l)){n[c.uuid]=[];for(var h=0,u=l.length;h<u;h++){var d=l[h],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:i.resourcePath+d;n[c.uuid].push(r(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.resourcePath+c.url;n[c.uuid]=r(p)}}}return n},parseTextures:function(e,t){function i(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var n={};if(void 0!==e)for(var r=0,o=e.length;r<o;r++){var a,s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(a=Array.isArray(t[s.image])?new Ws(t[s.image]):new jr(t[s.image])).needsUpdate=!0,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=i(s.mapping,Lp)),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=i(s.wrap[0],Bp),a.wrapT=i(s.wrap[1],Bp)),void 0!==s.format&&(a.format=s.format),void 0!==s.type&&(a.type=s.type),void 0!==s.encoding&&(a.encoding=s.encoding),void 0!==s.minFilter&&(a.minFilter=i(s.minFilter,Dp)),void 0!==s.magFilter&&(a.magFilter=i(s.magFilter,Dp)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(a.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(a.unpackAlignment=s.unpackAlignment),n[s.uuid]=a}return n},parseObject:function(e,t,i){var n;function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function o(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];void 0===i[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),t.push(i[o])}return t}return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]}}switch(e.type){case"Scene":n=new So,void 0!==e.background&&Number.isInteger(e.background)&&(n.background=new ma(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?n.fog=new Dl(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(n.fog=new Bl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":n=new bs(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(n.focus=e.focus),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.filmGauge&&(n.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(n.filmOffset=e.filmOffset),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"OrthographicCamera":n=new gp(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"AmbientLight":n=new Ap(e.color,e.intensity);break;case"DirectionalLight":n=new yp(e.color,e.intensity);break;case"PointLight":n=new mp(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":n=new xp(e.color,e.intensity,e.width,e.height);break;case"SpotLight":n=new pp(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":n=new hp(e.color,e.groundColor,e.intensity);break;case"LightProbe":n=(new wp).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":n=new ss(a=r(e.geometry),s=o(e.material));break;case"InstancedMesh":var a=r(e.geometry),s=o(e.material),c=e.count,l=e.instanceMatrix;(n=new vh(a,s,c)).instanceMatrix=new Ea(new Float32Array(l.array),16);break;case"LOD":n=new sh;break;case"Line":n=new Eh(r(e.geometry),o(e.material),e.mode);break;case"LineLoop":n=new Ch(r(e.geometry),o(e.material));break;case"LineSegments":n=new Th(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":n=new Dh(r(e.geometry),o(e.material));break;case"Sprite":n=new Jl(o(e.material));break;case"Group":n=new Cl;break;default:n=new Eo}if(n.uuid=e.uuid,void 0!==e.name&&(n.name=e.name),void 0!==e.matrix?(n.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==e.position&&n.position.fromArray(e.position),void 0!==e.rotation&&n.rotation.fromArray(e.rotation),void 0!==e.quaternion&&n.quaternion.fromArray(e.quaternion),void 0!==e.scale&&n.scale.fromArray(e.scale)),void 0!==e.castShadow&&(n.castShadow=e.castShadow),void 0!==e.receiveShadow&&(n.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(n.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(n.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&n.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(n.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.frustumCulled&&(n.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(n.renderOrder=e.renderOrder),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.layers&&(n.layers.mask=e.layers),void 0!==e.children)for(var h=e.children,u=0;u<h.length;u++)n.add(this.parseObject(h[u],t,i));if("LOD"===e.type){void 0!==e.autoUpdate&&(n.autoUpdate=e.autoUpdate);for(var d=e.levels,p=0;p<d.length;p++){var f=d[p],m=n.getObjectByProperty("uuid",f.object);void 0!==m&&n.addLevel(m,f.distance)}}return n}});var Rp,Lp={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Bp={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Dp={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};function Op(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Rd.call(this,e),this.options=void 0}function Np(){this.type="ShapePath",this.color=new ma,this.subPaths=[],this.currentPath=null}function kp(e){this.type="Font",this.data=e}function Fp(e,t,i,n,r){var o=r.glyphs[e]||r.glyphs["?"];if(o){var a,s,c,l,h,u,d,p,f=new Np;if(o.o)for(var m=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),g=0,v=m.length;g<v;){switch(m[g++]){case"m":a=m[g++]*t+i,s=m[g++]*t+n,f.moveTo(a,s);break;case"l":a=m[g++]*t+i,s=m[g++]*t+n,f.lineTo(a,s);break;case"q":c=m[g++]*t+i,l=m[g++]*t+n,h=m[g++]*t+i,u=m[g++]*t+n,f.quadraticCurveTo(h,u,c,l);break;case"b":c=m[g++]*t+i,l=m[g++]*t+n,h=m[g++]*t+i,u=m[g++]*t+n,d=m[g++]*t+i,p=m[g++]*t+n,f.bezierCurveTo(h,u,d,p,c,l)}}return{offsetX:o.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function Vp(e){Rd.call(this,e)}Op.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Op,setOptions:function(e){return this.options=e,this},load:function(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,o=Cd.get(e);if(void 0!==o)return r.manager.itemStart(e),setTimeout((function(){t&&t(o),r.manager.itemEnd(e)}),0),o;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===r.options?createImageBitmap(e):createImageBitmap(e,r.options)})).then((function(i){Cd.add(e,i),t&&t(i),r.manager.itemEnd(e)})).catch((function(t){n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}),Object.assign(Np.prototype,{moveTo:function(e,t){return this.currentPath=new sp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,i,n){return this.currentPath.quadraticCurveTo(e,t,i,n),this},bezierCurveTo:function(e,t,i,n,r,o){return this.currentPath.bezierCurveTo(e,t,i,n,r,o),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function i(e){for(var t=[],i=0,n=e.length;i<n;i++){var r=e[i],o=new cp;o.curves=r.curves,t.push(o)}return t}function n(e,t){for(var i=t.length,n=!1,r=i-1,o=0;o<i;r=o++){var a=t[r],s=t[o],c=s.x-a.x,l=s.y-a.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(a=t[o],c=-c,s=t[r],l=-l),e.y<a.y||e.y>s.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var h=l*(e.x-a.x)-c*(e.y-a.y);if(0===h)return!0;if(h<0)continue;n=!n}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return n}var r=Pu.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return i(o);var a,s,c,l=[];if(1===o.length)return s=o[0],(c=new cp).curves=s.curves,l.push(c),l;var h=!r(o[0].getPoints());h=e?!h:h;var u,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v<y;v++)a=r(u=(s=o[v]).getPoints()),(a=e?!a:a)?(!h&&f[g]&&g++,f[g]={s:new cp,p:u},f[g].s.curves=s.curves,h&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return i(o);if(f.length>1){for(var A=!1,x=[],b=0,w=f.length;b<w;b++)p[b]=[];for(b=0,w=f.length;b<w;b++)for(var M=m[b],E=0;E<M.length;E++){for(var S=M[E],_=!0,T=0;T<f.length;T++)n(S.p,f[T].p)&&(b!==T&&x.push({froms:b,tos:T,hole:E}),_?(_=!1,p[T].push(S)):A=!0);_&&p[b].push(S)}x.length>0&&(A||(m=p))}v=0;for(var C=f.length;v<C;v++){c=f[v].s,l.push(c);for(var I=0,P=(d=m[v]).length;I<P;I++)c.holes.push(d[I].h)}return l}}),Object.assign(kp.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var i=[],n=function(e,t,i){for(var n=Array.from?Array.from(e):String(e).split(""),r=t/i.resolution,o=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,a=[],s=0,c=0,l=0;l<n.length;l++){var h=n[l];if("\n"===h)s=0,c-=o;else{var u=Fp(h,r,s,c,i);s+=u.offsetX,a.push(u.path)}}return a}(e,t,this.data),r=0,o=n.length;r<o;r++)Array.prototype.push.apply(i,n[r].toShapes());return i}}),Vp.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Vp,load:function(e,t,i,n){var r=this,o=new Bd(this.manager);o.setPath(this.path),o.load(e,(function(e){var i;try{i=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(e.substring(65,e.length-2))}var n=r.parse(i);t&&t(n)}),i,n)},parse:function(e){return new kp(e)}});var zp=function(){return void 0===Rp&&(Rp=new(window.AudioContext||window.webkitAudioContext)),Rp};function Hp(e){Rd.call(this,e)}function Up(e,t,i){wp.call(this,void 0,i);var n=(new ma).set(e),r=(new ma).set(t),o=new Zr(n.r,n.g,n.b),a=new Zr(r.r,r.g,r.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}function Gp(e,t){wp.call(this,void 0,t);var i=(new ma).set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}Hp.prototype=Object.assign(Object.create(Rd.prototype),{constructor:Hp,load:function(e,t,i,n){var r=this,o=new Bd(r.manager);o.setResponseType("arraybuffer"),o.setPath(r.path),o.load(e,(function(i){try{var o=i.slice(0);zp().decodeAudioData(o,(function(e){t(e)}))}catch(t){n?n(t):console.error(t),r.manager.itemError(e)}}),i,n)}}),Up.prototype=Object.assign(Object.create(wp.prototype),{constructor:Up,isHemisphereLightProbe:!0,copy:function(e){return wp.prototype.copy.call(this,e),this},toJSON:function(e){return wp.prototype.toJSON.call(this,e)}}),Gp.prototype=Object.assign(Object.create(wp.prototype),{constructor:Gp,isAmbientLightProbe:!0,copy:function(e){return wp.prototype.copy.call(this,e),this},toJSON:function(e){return wp.prototype.toJSON.call(this,e)}});var jp=new oo,Qp=new oo;function Wp(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new bs,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new bs,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var i,n,r=e.projectionMatrix.clone(),o=t.eyeSep/2,a=o*t.near/t.focus,s=t.near*Math.tan(Vr.DEG2RAD*t.fov*.5)/t.zoom;Qp.elements[12]=-o,jp.elements[12]=o,i=-s*t.aspect+a,n=s*t.aspect+a,r.elements[0]=2*t.near/(n-i),r.elements[8]=(n+i)/(n-i),this.cameraL.projectionMatrix.copy(r),i=-s*t.aspect-a,n=s*t.aspect-a,r.elements[0]=2*t.near/(n-i),r.elements[8]=(n+i)/(n-i),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Qp),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(jp)}}),Object.assign(Wp.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var qp=new Zr,Kp=new Kr,Xp=new Zr,Yp=new Zr;function Zp(){Eo.call(this),this.type="AudioListener",this.context=zp(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wp}function Jp(e){Eo.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}Zp.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Zp,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){Eo.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(qp,Kp,Xp),Yp.set(0,0,-1).applyQuaternion(Kp),t.positionX){var n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(qp.x,n),t.positionY.linearRampToValueAtTime(qp.y,n),t.positionZ.linearRampToValueAtTime(qp.z,n),t.forwardX.linearRampToValueAtTime(Yp.x,n),t.forwardY.linearRampToValueAtTime(Yp.y,n),t.forwardZ.linearRampToValueAtTime(Yp.z,n),t.upX.linearRampToValueAtTime(i.x,n),t.upY.linearRampToValueAtTime(i.y,n),t.upZ.linearRampToValueAtTime(i.z,n)}else t.setPosition(qp.x,qp.y,qp.z),t.setOrientation(Yp.x,Yp.y,Yp.z,i.x,i.y,i.z)}}),Jp.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Jp,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var $p=new Zr,ef=new Kr,tf=new Zr,nf=new Zr;function rf(e){Jp.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function of(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function af(e,t,i){var n,r,o;switch(this.binding=e,this.valueSize=i,t){case"quaternion":n=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}rf.prototype=Object.assign(Object.create(Jp.prototype),{constructor:rf,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this},updateMatrixWorld:function(e){if(Eo.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose($p,ef,tf),nf.set(0,0,1).applyQuaternion(ef);var t=this.panner;if(t.positionX){var i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime($p.x,i),t.positionY.linearRampToValueAtTime($p.y,i),t.positionZ.linearRampToValueAtTime($p.z,i),t.orientationX.linearRampToValueAtTime(nf.x,i),t.orientationY.linearRampToValueAtTime(nf.y,i),t.orientationZ.linearRampToValueAtTime(nf.z,i)}else t.setPosition($p.x,$p.y,$p.z),t.setOrientation(nf.x,nf.y,nf.z)}}}),Object.assign(of.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),i=0;i<t.length;i++)e+=t[i];return e/t.length}}),Object.assign(af.prototype,{accumulate:function(e,t){var i=this.buffer,n=this.valueSize,r=e*n+n,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==n;++a)i[r+a]=i[a];o=t}else{var s=t/(o+=t);this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=o},accumulateAdditive:function(e){var t=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,i),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,i=this.buffer,n=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(i,n,s,1-r,t)}o>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(i[c]!==i[c+t]){a.setValue(i,n);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,i=this.valueSize,n=i*this._origIndex;e.getValue(t,n);for(var r=i,o=n;r!==o;++r)t[r]=t[n+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,i=e;i<t;i++)this.buffer[i]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]},_select:function(e,t,i,n,r){if(n>=.5)for(var o=0;o!==r;++o)e[t+o]=e[i+o]},_slerp:function(e,t,i,n){Kr.slerpFlat(e,t,e,t,e,i,n)},_slerpAdditive:function(e,t,i,n,r){var o=this._workIndex*r;Kr.multiplyQuaternionsFlat(e,o,e,t,e,i),Kr.slerpFlat(e,t,e,t,e,o,n)},_lerp:function(e,t,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[i+a]*n}},_lerpAdditive:function(e,t,i,n,r){for(var o=0;o!==r;++o){var a=t+o;e[a]=e[a]+e[i+o]*n}}});var sf=new RegExp("[\\[\\]\\.:\\/]","g"),cf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",lf=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),hf=/(WCOD+)?/.source.replace("WCOD",cf),uf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),df=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),pf=new RegExp("^"+lf+hf+uf+df+"$"),ff=["material","materials","bones"];function mf(e,t,i){var n=i||gf.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}function gf(e,t,i){this.path=t,this.parsedPath=i||gf.parseTrackName(t),this.node=gf.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function vf(e,t,i,n){this._mixer=e,this._clip=t,this._localRoot=i||null,this.blendMode=n||t.blendMode;for(var r=t.tracks,o=r.length,a=new Array(o),s={endingStart:2400,endingEnd:2400},c=0;c!==o;++c){var l=r[c].createInterpolant(null);a[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function yf(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Af(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function xf(e,t,i){Ol.call(this,e,t),this.meshPerAttribute=i||1}function bf(e,t,i,n){this.ray=new Yo(e,t),this.near=i||0,this.far=n||1/0,this.camera=null,this.layers=new lo,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function wf(e,t){return e.distance-t.distance}function Mf(e,t,i,n){if(e.layers.test(t.layers)&&e.raycast(t,i),!0===n)for(var r=e.children,o=0,a=r.length;o<a;o++)Mf(r[o],t,i,!0)}Object.assign(mf.prototype,{getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}),Object.assign(gf,{Composite:mf,create:function(e,t,i){return e&&e.isAnimationObjectGroup?new gf.Composite(e,t,i):new gf(e,t,i)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(sf,"")},parseTrackName:function(e){var t=pf.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var r=i.nodeName.substring(n+1);-1!==ff.indexOf(r)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=r)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){var n=function(e){for(var i=0;i<e.length;i++){var r=e[i];if(r.name===t||r.uuid===t)return r;var o=n(r.children);if(o)return o}return null},r=n(e.children);if(r)return r}return null}}),Object.assign(gf.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)e[t++]=i[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++]},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=gf.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(i){var o=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var a=0;a<e.length;a++)if(e[a].name===o){o=a;break}break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==o){if(void 0===e[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[o]}}var s=e[n];if(void 0!==s){var c=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+n+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(gf.prototype,{_getValue_unbound:gf.prototype.getValue,_setValue_unbound:gf.prototype.setValue}),Object.assign(function(){this.uuid=Vr.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,i=arguments.length;t!==i;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,c=void 0,l=0,h=arguments.length;l!==h;++l){var u=arguments[l],d=u.uuid,p=n[d];if(void 0===p){p=t++,n[d]=p,e.push(u);for(var f=0,m=s;f!==m;++f)a[f].push(new gf(u,r[f],o[f]))}else if(p<i){c=e[p];var g=--i,v=e[g];n[v.uuid]=p,e[p]=v,n[d]=g,e[g]=u;for(f=0,m=s;f!==m;++f){var y=a[f],A=y[g],x=y[p];y[p]=A,void 0===x&&(x=new gf(u,r[f],o[f])),y[g]=x}}else e[p]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=i},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,r=n.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],c=s.uuid,l=i[c];if(void 0!==l&&l>=t){var h=t++,u=e[h];i[u.uuid]=l,e[l]=u,i[c]=h,e[h]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[h],g=f[l];f[l]=m,f[h]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,h=n[l];if(void 0!==h)if(delete n[l],h<i){var u=--i,d=e[u],p=e[y=--t];n[d.uuid]=h,e[h]=d,n[p.uuid]=u,e[u]=p,e.pop();for(var f=0,m=o;f!==m;++f){var g=(A=r[f])[u],v=A[y];A[h]=g,A[u]=v,A.pop()}}else{var y;n[(p=e[y=--t]).uuid]=h,e[h]=p,e.pop();for(f=0,m=o;f!==m;++f){var A;(A=r[f])[h]=A[y],A.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){var i=this._bindingsIndicesByPath,n=i[e],r=this._bindings;if(void 0!==n)return r[n];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);n=r.length,i[e]=n,o.push(e),a.push(t),r.push(h);for(var u=l,d=s.length;u!==d;++u){var p=s[u];h[u]=new gf(p,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){var n=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=i,o[i]=s,o.pop(),r[i]=r[a],r.pop(),n[i]=n[a],n.pop()}}}),Object.assign(vf.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){var n=this._clip.duration,r=e._clip.duration,o=r/n,a=n/r;e.warp(1,o,t),this.warp(a,1,t)}return this},crossFadeTo:function(e,t,i){return e.crossFadeFrom(this,t,i)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,i){var n=this._mixer,r=n.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=n._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=r,s[1]=r+i,c[0]=e/a,c[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,i,n){if(this.enabled){var r=this._startTime;if(null!==r){var o=(e-r)*i;if(o<0||0===i)return;this._startTime=null,t=i*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case 2501:for(var h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(s);break;case 2500:default:for(h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(n,s)}}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,i=this._clip.duration,n=this.loop,r=this._loopCount,o=2202===n;if(0===e)return-1===r?t:o&&1==(1&r)?i-t:t;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=i||t<0){var a=Math.floor(t/i);t-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=t;if(o&&1==(1&r))return i-t}return t},_setEndings:function(e,t,i){var n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=i,this}}),yf.prototype=Object.assign(Object.create(Or.prototype),{constructor:yf,_bindAction:function(e,t){var i=e._localRoot||this._root,n=e._clip.tracks,r=n.length,o=e._propertyBindings,a=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==r;++h){var u=n[h],d=u.name,p=l[d];if(void 0!==p)o[h]=p;else{if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(p=new af(gf.create(i,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[h]=p}a[h].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,n=this._actionsByClip[i];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,i,t)}for(var r=e._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,n=t.length;i!==n;++i){var r=t[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,i){var n=this._actions,r=this._actionsByClip,o=r[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{var a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),o.actionByRoot[i]=e},_removeInactiveAction:function(e){var t=this._actions,i=t[t.length-1],n=e._cacheIndex;i._cacheIndex=n,t[n]=i,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,o=this._actionsByClip,a=o[r],s=a.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null,delete a.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete o[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,i=0,n=t.length;i!==n;++i){var r=t[i];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_takeBackAction:function(e){var t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_addInactiveBinding:function(e,t,i){var n=this._bindingsByRootAndName,r=n[t],o=this._bindings;void 0===r&&(r={},n[t]=r),r[i]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,i=e.binding,n=i.rootNode.uuid,r=i.path,o=this._bindingsByRootAndName,a=o[n],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete a[r],0===Object.keys(a).length&&delete o[n]},_lendBinding:function(e){var t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_takeBackBinding:function(e){var t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&((i=new gd(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=i),i},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,i=e.__cacheIndex,n=--this._nActiveControlInterpolants,r=t[n];e.__cacheIndex=n,t[n]=e,r.__cacheIndex=i,t[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,i){var n=t||this._root,r=n.uuid,o="string"==typeof e?_d.findByName(n,e):e,a=null!==o?o.uuid:e,s=this._actionsByClip[a],c=null;if(void 0===i&&(i=null!==o?o.blendMode:2500),void 0!==s){var l=s.actionByRoot[r];if(void 0!==l&&l.blendMode===i)return l;c=s.knownActions[0],null===o&&(o=c._clip)}if(null===o)return null;var h=new vf(this,o,t,i);return this._bindAction(h,c),this._addInactiveAction(h,a,r),h},existingAction:function(e,t){var i=t||this._root,n=i.uuid,r="string"==typeof e?_d.findByName(i,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[n]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,n=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1,a=0;a!==i;++a){t[a]._update(n,e,r,o)}var s=this._bindings,c=this._nActiveBindings;for(a=0;a!==c;++a)s[a].apply(o);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,i=e.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var l=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=l,t[l]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName[t];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Af.prototype.clone=function(){return new Af(void 0===this.value.clone?this.value:this.value.clone())},xf.prototype=Object.assign(Object.create(Ol.prototype),{constructor:xf,isInstancedInterleavedBuffer:!0,copy:function(e){return Ol.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(bf.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,i){var n=i||[];return Mf(e,this,n,t),n.sort(wf),n},intersectObjects:function(e,t,i){var n=i||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var r=0,o=e.length;r<o;r++)Mf(e[r],this,n,t);return n.sort(wf),n}}),Object.assign(function(e,t,i){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==i?i:0,this}.prototype,{set:function(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Vr.clamp(t/this.radius,-1,1))),this}}),Object.assign(function(e,t,i){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==i?i:0,this}.prototype,{set:function(e,t,i){return this.radius=e,this.theta=t,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}});var Ef=new zr;function Sf(e,t){this.min=void 0!==e?e:new zr(1/0,1/0),this.max=void 0!==t?t:new zr(-1/0,-1/0)}Object.assign(Sf.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var i=Ef.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new zr),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new zr),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new zr),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new zr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Ef.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var _f=new Zr,Tf=new Zr;function Cf(e,t){this.start=void 0!==e?e:new Zr,this.end=void 0!==t?t:new Zr}function If(e){Eo.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Object.assign(Cf.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Zr),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Zr),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Zr),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){_f.subVectors(e,this.start),Tf.subVectors(this.end,this.start);var i=Tf.dot(Tf),n=Tf.dot(_f)/i;return t&&(n=Vr.clamp(n,0,1)),n},closestPointToPoint:function(e,t,i){var n=this.closestPointToPointParameter(e,t);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new Zr),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),If.prototype=Object.create(Eo.prototype),If.prototype.constructor=If,If.prototype.isImmediateRenderObject=!0;var Pf=new Zr;function Rf(e,t){Eo.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var i=new Ga,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,o=1;r<32;r++,o++){var a=r/32*Math.PI*2,s=o/32*Math.PI*2;n.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}i.setAttribute("position",new La(n,3));var c=new yh({fog:!1,toneMapped:!1});this.cone=new Th(i,c),this.add(this.cone),this.update()}Rf.prototype=Object.create(Eo.prototype),Rf.prototype.constructor=Rf,Rf.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Rf.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Pf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Pf),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Lf=new Zr,Bf=new oo,Df=new oo;function Of(e){var t=[];e&&e.isBone&&t.push(e);for(var i=0;i<e.children.length;i++)t.push.apply(t,Of(e.children[i]));return t}function Nf(e){for(var t=Of(e),i=new Ga,n=[],r=[],o=new ma(0,0,1),a=new ma(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}i.setAttribute("position",new La(n,3)),i.setAttribute("color",new La(r,3));var l=new yh({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Th.call(this,i,l),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function kf(e,t,i){this.light=e,this.light.updateMatrixWorld(),this.color=i;var n=new zu(t,4,2),r=new wa({wireframe:!0,fog:!1,toneMapped:!1});ss.call(this,n,r),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Nf.prototype=Object.create(Th.prototype),Nf.prototype.constructor=Nf,Nf.prototype.isSkeletonHelper=!0,Nf.prototype.updateMatrixWorld=function(e){var t=this.bones,i=this.geometry,n=i.getAttribute("position");Df.getInverse(this.root.matrixWorld);for(var r=0,o=0;r<t.length;r++){var a=t[r];a.parent&&a.parent.isBone&&(Bf.multiplyMatrices(Df,a.matrixWorld),Lf.setFromMatrixPosition(Bf),n.setXYZ(o,Lf.x,Lf.y,Lf.z),Bf.multiplyMatrices(Df,a.parent.matrixWorld),Lf.setFromMatrixPosition(Bf),n.setXYZ(o+1,Lf.x,Lf.y,Lf.z),o+=2)}i.getAttribute("position").needsUpdate=!0,Eo.prototype.updateMatrixWorld.call(this,e)},kf.prototype=Object.create(ss.prototype),kf.prototype.constructor=kf,kf.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},kf.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var Ff=new Zr,Vf=new ma,zf=new ma;function Hf(e,t,i){Eo.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;var n=new Kh(t);n.rotateY(.5*Math.PI),this.material=new wa({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var r=n.getAttribute("position"),o=new Float32Array(3*r.count);n.setAttribute("color",new Ea(o,3)),this.add(new ss(n,this.material)),this.update()}function Uf(e,t,i,n){e=e||10,t=t||10,i=new ma(void 0!==i?i:4473924),n=new ma(void 0!==n?n:8947848);for(var r=t/2,o=e/t,a=e/2,s=[],c=[],l=0,h=0,u=-a;l<=t;l++,u+=o){s.push(-a,0,u,a,0,u),s.push(u,0,-a,u,0,a);var d=l===r?i:n;d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3}var p=new Ga;p.setAttribute("position",new La(s,3)),p.setAttribute("color",new La(c,3));var f=new yh({vertexColors:!0,toneMapped:!1});Th.call(this,p,f),this.type="GridHelper"}function Gf(e,t,i,n,r,o){e=e||10,t=t||16,i=i||8,n=n||64,r=new ma(void 0!==r?r:4473924),o=new ma(void 0!==o?o:8947848);var a,s,c,l,h,u,d,p=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),a=Math.sin(c)*e,s=Math.cos(c)*e,p.push(0,0,0),p.push(a,0,s),d=1&l?r:o,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=i;l++)for(d=1&l?r:o,u=e-e/i*l,h=0;h<n;h++)c=h/n*(2*Math.PI),a=Math.sin(c)*u,s=Math.cos(c)*u,p.push(a,0,s),f.push(d.r,d.g,d.b),c=(h+1)/n*(2*Math.PI),a=Math.sin(c)*u,s=Math.cos(c)*u,p.push(a,0,s),f.push(d.r,d.g,d.b);var m=new Ga;m.setAttribute("position",new La(p,3)),m.setAttribute("color",new La(f,3));var g=new yh({vertexColors:!0,toneMapped:!1});Th.call(this,m,g),this.type="PolarGridHelper"}Hf.prototype=Object.create(Eo.prototype),Hf.prototype.constructor=Hf,Hf.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Hf.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Vf.copy(this.light.color),zf.copy(this.light.groundColor);for(var i=0,n=t.count;i<n;i++){var r=i<n/2?Vf:zf;t.setXYZ(i,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(Ff.setFromMatrixPosition(this.light.matrixWorld).negate())},Uf.prototype=Object.assign(Object.create(Th.prototype),{constructor:Uf,copy:function(e){return Th.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Gf.prototype=Object.create(Th.prototype),Gf.prototype.constructor=Gf;var jf=new Zr,Qf=new Zr,Wf=new Zr;function qf(e,t,i){Eo.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,void 0===t&&(t=1);var n=new Ga;n.setAttribute("position",new La([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new yh({fog:!1,toneMapped:!1});this.lightPlane=new Eh(n,r),this.add(this.lightPlane),(n=new Ga).setAttribute("position",new La([0,0,0,0,0,1],3)),this.targetLine=new Eh(n,r),this.add(this.targetLine),this.update()}qf.prototype=Object.create(Eo.prototype),qf.prototype.constructor=qf,qf.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},qf.prototype.update=function(){jf.setFromMatrixPosition(this.light.matrixWorld),Qf.setFromMatrixPosition(this.light.target.matrixWorld),Wf.subVectors(Qf,jf),this.lightPlane.lookAt(Qf),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Qf),this.targetLine.scale.z=Wf.length()};var Kf=new Zr,Xf=new xs;function Yf(e){var t=new Ga,i=new yh({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],o={},a=new ma(16755200),s=new ma(16711680),c=new ma(43775),l=new ma(16777215),h=new ma(3355443);function u(e,t,i){d(e,i),d(t,i)}function d(e,t){n.push(0,0,0),r.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(n.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",l),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new La(n,3)),t.setAttribute("color",new La(r,3)),Th.call(this,t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}function Zf(e,t,i,n,r,o,a){Kf.set(r,o,a).unproject(n);var s=t[e];if(void 0!==s)for(var c=i.getAttribute("position"),l=0,h=s.length;l<h;l++)c.setXYZ(s[l],Kf.x,Kf.y,Kf.z)}Yf.prototype=Object.create(Th.prototype),Yf.prototype.constructor=Yf,Yf.prototype.update=function(){var e=this.geometry,t=this.pointMap;Xf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Zf("c",t,e,Xf,0,0,-1),Zf("t",t,e,Xf,0,0,1),Zf("n1",t,e,Xf,-1,-1,-1),Zf("n2",t,e,Xf,1,-1,-1),Zf("n3",t,e,Xf,-1,1,-1),Zf("n4",t,e,Xf,1,1,-1),Zf("f1",t,e,Xf,-1,-1,1),Zf("f2",t,e,Xf,1,-1,1),Zf("f3",t,e,Xf,-1,1,1),Zf("f4",t,e,Xf,1,1,1),Zf("u1",t,e,Xf,.7,1.1,-1),Zf("u2",t,e,Xf,-.7,1.1,-1),Zf("u3",t,e,Xf,0,2,-1),Zf("cf1",t,e,Xf,-1,0,1),Zf("cf2",t,e,Xf,1,0,1),Zf("cf3",t,e,Xf,0,-1,1),Zf("cf4",t,e,Xf,0,1,1),Zf("cn1",t,e,Xf,-1,0,-1),Zf("cn2",t,e,Xf,1,0,-1),Zf("cn3",t,e,Xf,0,-1,-1),Zf("cn4",t,e,Xf,0,1,-1),e.getAttribute("position").needsUpdate=!0};var Jf=new Vo;function $f(e,t){this.object=e,void 0===t&&(t=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new Ga;r.setIndex(new Ea(i,1)),r.setAttribute("position",new Ea(n,3)),Th.call(this,r,new yh({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function em(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Ga;n.setIndex(new Ea(i,1)),n.setAttribute("position",new La([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),Th.call(this,n,new yh({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function tm(e,t,i){this.plane=e,this.size=void 0===t?1:t;var n=void 0!==i?i:16776960,r=new Ga;r.setAttribute("position",new La([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,0,1,0,0,0],3)),r.computeBoundingSphere(),Eh.call(this,r,new yh({color:n,toneMapped:!1})),this.type="PlaneHelper";var o=new Ga;o.setAttribute("position",new La([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new ss(o,new wa({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}$f.prototype=Object.create(Th.prototype),$f.prototype.constructor=$f,$f.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Jf.setFromObject(this.object),!Jf.isEmpty()){var t=Jf.min,i=Jf.max,n=this.geometry.attributes.position,r=n.array;r[0]=i.x,r[1]=i.y,r[2]=i.z,r[3]=t.x,r[4]=i.y,r[5]=i.z,r[6]=t.x,r[7]=t.y,r[8]=i.z,r[9]=i.x,r[10]=t.y,r[11]=i.z,r[12]=i.x,r[13]=i.y,r[14]=t.z,r[15]=t.x,r[16]=i.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=i.x,r[22]=t.y,r[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}},$f.prototype.setFromObject=function(e){return this.object=e,this.update(),this},$f.prototype.copy=function(e){return Th.prototype.copy.call(this,e),this.object=e.object,this},$f.prototype.clone=function(){return(new this.constructor).copy(this)},em.prototype=Object.create(Th.prototype),em.prototype.constructor=em,em.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Eo.prototype.updateMatrixWorld.call(this,e))},tm.prototype=Object.create(Eh.prototype),tm.prototype.constructor=tm,tm.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),Eo.prototype.updateMatrixWorld.call(this,e)};var im,nm,rm=new Zr;function om(e,t,i,n,r,o){Eo.call(this),this.type="ArrowHelper",void 0===e&&(e=new Zr(0,0,1)),void 0===t&&(t=new Zr(0,0,0)),void 0===i&&(i=1),void 0===n&&(n=16776960),void 0===r&&(r=.2*i),void 0===o&&(o=.2*r),void 0===im&&((im=new Ga).setAttribute("position",new La([0,0,0,0,1,0],3)),(nm=new Yu(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Eh(im,new yh({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ss(nm,new wa({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,r,o)}function am(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=new Ga;i.setAttribute("position",new La(t,3)),i.setAttribute("color",new La([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new yh({vertexColors:!0,toneMapped:!1});Th.call(this,i,n),this.type="AxesHelper"}om.prototype=Object.create(Eo.prototype),om.prototype.constructor=om,om.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{rm.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(rm,t)}},om.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},om.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},om.prototype.copy=function(e){return Eo.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},om.prototype.clone=function(){return(new this.constructor).copy(this)},am.prototype=Object.create(Th.prototype),am.prototype.constructor=am;var sm=[.125,.215,.35,.446,.526,.582],cm=5+sm.length;new gp,function(){for(var e=[],t=[],i=[],n=8,r=0;r<cm;r++){var o=Math.pow(2,n);t.push(o);var a=1/o;r>4?a=sm[r-8+4-1]:0==r&&(a=0),i.push(a);for(var s=1/(o-1),c=-s/2,l=1+s/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,g=f>2?0:-1,v=[m,g,0,m+2/3,g,0,m+2/3,g+1,0,m,g,0,m+2/3,g+1,0,m,g+1,0];u.set(v,18*f),d.set(h,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var A=new Ga;A.setAttribute("position",new Ea(u,3)),A.setAttribute("uv",new Ea(d,2)),A.setAttribute("faceIndex",new Ea(p,1)),e.push(A),n>4&&n--}}();var lm=(1+Math.sqrt(5))/2,hm=1/lm;function um(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Kd.call(this,e),this.type="catmullrom"}new Zr(1,1,1),new Zr(-1,1,1),new Zr(1,1,-1),new Zr(-1,1,-1),new Zr(0,lm,hm),new Zr(0,lm,-hm),new Zr(hm,0,lm),new Zr(-hm,0,lm),new Zr(lm,hm,0),new Zr(-lm,hm,0),zd.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(zd.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(ap.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new fs,i=0,n=e.length;i<n;i++){var r=e[i];t.vertices.push(new Zr(r.x,r.y,r.z||0))}return t}}),Object.assign(sp.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),um.prototype=Object.create(Kd.prototype),Object.assign(um.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Nf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Rd.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Sp(e)}}),Rd.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(Pp.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Sf.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Vo.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Uo.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Ts.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Cf.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Vr,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Vr.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Vr.ceilPowerOfTwo(e)}}),Object.assign(Hr.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(oo.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Zr).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,i,n,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,n,i,r,o)}}),ea.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Kr.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Yo.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(ua.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(ua,{barycoordFromPoint:function(e,t,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ua.getBarycoord(e,t,i,n,r)},normal:function(e,t,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ua.getNormal(e,t,i,n)}}),Object.assign(cp.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Bu(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Qu(this,e)}}),Object.assign(zr.prototype,{fromAttribute:function(e,t,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Zr.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Qr.prototype,{fromAttribute:function(e,t,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(fs.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(Eo.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Eo.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(ss.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(ss.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(sh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(uh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),ch.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(zd.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),bs.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(lp.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Ea.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Object.assign(Ea.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Ga.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Ea(arguments[1],arguments[2])))},addDrawCall:function(e,t,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Ga.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(_p.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(bf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(Ol.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(Ol.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Du.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(Af.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(ba.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new ma}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(ad.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(As.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Ll.prototype,{clearTarget:function(e,t,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,i,n)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(Ll.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?3001:3e3}}}),Object.defineProperties(Ml.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Wr.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Jp.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Hp).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),of.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ws.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Ur.crossOrigin=void 0,Ur.loadTexture=function(e,t,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Vd;r.setCrossOrigin(this.crossOrigin);var o=r.load(e,i,void 0,n);return t&&(o.mapping=t),o},Ur.loadTextureCube=function(e,t,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Fd;r.setCrossOrigin(this.crossOrigin);var o=r.load(e,i,void 0,n);return t&&(o.mapping=t),o},Ur.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ur.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"117"}}));var dm=new(function(){function e(e){Rd.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(Rd.prototype),{constructor:e,load:function(e,t,i,n){var r,o=this;r=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:Sp(e),o.manager.itemStart(e);var a=function(t){n?n(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},s=new Bd(o.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&s.setWithCredentials(!0),s.load(e,(function(i){try{o.parse(i,r,(function(i){t(i),o.manager.itemEnd(e)}),a)}catch(e){a(e)}}),i,a)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,c,l){var p,g={};if("string"==typeof e)p=e;else if(Ep(new Uint8Array(e,0,4))===s){try{g[i.KHR_BINARY_GLTF]=new h(e)}catch(e){return void(l&&l(e))}p=g[i.KHR_BINARY_GLTF].content}else p=Ep(new Uint8Array(e));var v=JSON.parse(p);if(void 0===v.asset||v.asset.version[0]<2)l&&l(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(v.extensionsUsed)for(var y=0;y<v.extensionsUsed.length;++y){var A=v.extensionsUsed[y],x=v.extensionsRequired||[];switch(A){case i.KHR_LIGHTS_PUNCTUAL:g[A]=new r(v);break;case i.KHR_MATERIALS_CLEARCOAT:g[A]=new a;break;case i.KHR_MATERIALS_UNLIT:g[A]=new o;break;case i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:g[A]=new f;break;case i.KHR_DRACO_MESH_COMPRESSION:g[A]=new u(v,this.dracoLoader);break;case i.MSFT_TEXTURE_DDS:g[A]=new n(this.ddsLoader);break;case i.KHR_TEXTURE_TRANSFORM:g[A]=new d;break;case i.KHR_MESH_QUANTIZATION:g[A]=new m;break;default:x.indexOf(A)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+A+'".')}}var b=new z(v,g,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});b.fileLoader.setRequestHeader(this.requestHeader),b.parse(c,l)}}});var i={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=i.MSFT_TEXTURE_DDS,this.ddsLoader=e}function r(e){this.name=i.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[i.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function o(){this.name=i.KHR_MATERIALS_UNLIT}function a(){this.name=i.KHR_MATERIALS_CLEARCOAT}r.prototype.loadLight=function(e){var t,i=this.lightDefs[e],n=new ma(16777215);void 0!==i.color&&n.fromArray(i.color);var r=void 0!==i.range?i.range:0;switch(i.type){case"directional":(t=new yp(n)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new mp(n)).distance=r;break;case"spot":(t=new pp(n)).distance=r,i.spot=i.spot||{},i.spot.innerConeAngle=void 0!==i.spot.innerConeAngle?i.spot.innerConeAngle:0,i.spot.outerConeAngle=void 0!==i.spot.outerConeAngle?i.spot.outerConeAngle:Math.PI/4,t.angle=i.spot.outerConeAngle,t.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+i.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==i.intensity&&(t.intensity=i.intensity),t.name=i.name||"light_"+e,Promise.resolve(t)},o.prototype.getMaterialType=function(){return wa},o.prototype.extendParams=function(e,t,i){var n=[];e.color=new ma(1,1,1),e.opacity=1;var r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var o=r.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(n)},a.prototype.getMaterialType=function(){return od},a.prototype.extendParams=function(e,t,i){var n=[],r=t.extensions[this.name];if(void 0!==r.clearcoatFactor&&(e.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&n.push(i.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&n.push(i.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(n.push(i.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale)){var o=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new zr(o,o)}return Promise.all(n)};var s="glTF",c=1313821514,l=5130562;function h(e){this.name=i.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:Ep(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==s)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(e,12),r=0;r<n.byteLength;){var o=n.getUint32(r,!0);r+=4;var a=n.getUint32(r,!0);if(r+=4,a===c){var h=new Uint8Array(e,12+r,o);this.content=Ep(h)}else if(a===l){var u=12+r;this.body=e.slice(u,u+o)}r+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function u(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=i.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function d(){this.name=i.KHR_TEXTURE_TRANSFORM}function p(e){rd.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),i=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),r=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),a={specular:{value:(new ma).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(e){for(var s in a)e.uniforms[s]=a[s];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",t),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(e){a.specular.value=e}},specularMap:{get:function(){return a.specularMap.value},set:function(e){a.specularMap.value=e}},glossiness:{get:function(){return a.glossiness.value},set:function(e){a.glossiness.value=e}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(e){a.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function f(){return{name:i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return p},extendParams:function(e,t,i){var n=t.extensions[this.name];e.color=new ma(1,1,1),e.opacity=1;var r=[];if(Array.isArray(n.diffuseFactor)){var o=n.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==n.diffuseTexture&&r.push(i.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new ma(0,0,0),e.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,e.specular=new ma(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var a=n.specularGlossinessTexture;r.push(i.assignTexture(e,"glossinessMap",a)),r.push(i.assignTexture(e,"specularMap",a))}return Promise.all(r)},createMaterial:function(e){var t=new p(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function m(){this.name=i.KHR_MESH_QUANTIZATION}function g(e,t,i,n){fd.call(this,e,t,i,n)}u.prototype.decodePrimitive=function(e,t){var i=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},s={},c={};for(var l in o){var h=C[l]||l.toLowerCase();a[h]=o[l]}for(l in e.attributes){h=C[l]||l.toLowerCase();if(void 0!==o[l]){var u=i.accessors[e.attributes[l]],d=E[u.componentType];c[h]=d,s[h]=!0===u.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){n.decodeDracoFile(e,(function(e){for(var i in e.attributes){var n=e.attributes[i],r=s[i];void 0!==r&&(n.normalized=r)}t(e)}),a,c)}))}))},d.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},p.prototype=Object.create(rd.prototype),p.prototype.constructor=p,p.prototype.copy=function(e){return rd.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},g.prototype=Object.create(fd.prototype),g.prototype.constructor=g,g.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n*3+n,o=0;o!==n;o++)t[o]=i[r+o];return t},g.prototype.beforeStart_=g.prototype.copySampleValue_,g.prototype.afterEnd_=g.prototype.copySampleValue_,g.prototype.interpolate_=function(e,t,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,c=3*a,l=n-t,h=(i-t)/l,u=h*h,d=u*h,p=e*c,f=p-c,m=-2*d+3*u,g=d-u,v=1-m,y=g-u+h,A=0;A!==a;A++){var x=o[f+A+a],b=o[f+A+s]*l,w=o[p+A+a],M=o[p+A]*l;r[A]=v*x+y*b+m*w+g*M}return r};var v=0,y=1,A=2,x=3,b=4,w=5,M=6,E={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},S={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},_={33071:1001,33648:1002,10497:1e3},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},C={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},P={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300},R="OPAQUE",L="MASK",B="BLEND",D={"image/png":1023,"image/jpeg":1022};function O(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function N(e,t,i){for(var n in i.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=i.extensions[n])}function k(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function F(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var i=0,n=t.weights.length;i<n;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){var r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(i=0,n=r.length;i<n;i++)e.morphTargetDictionary[r[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function V(e){for(var t="",i=Object.keys(e).sort(),n=0,r=i.length;n<r;n++)t+=i[n]+":"+e[i[n]]+";";return t}function z(e,i,n){this.json=e||{},this.extensions=i||{},this.options=n||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.textureLoader=new Vd(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new Bd(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function H(e,t,i){var n=t.attributes,r=[];function o(t,n){return i.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}for(var a in n){var s=C[a]||a.toLowerCase();s in e.attributes||r.push(o(n[a],s))}if(void 0!==t.indices&&!e.index){var c=i.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(c)}return k(e,t),function(e,t,i){var n=t.attributes,r=new Vo;if(void 0!==n.POSITION){var o=(d=i.json.accessors[n.POSITION]).min,a=d.max;if(void 0!==o&&void 0!==a){r.set(new Zr(o[0],o[1],o[2]),new Zr(a[0],a[1],a[2]));var s=t.targets;if(void 0!==s){for(var c=new Zr,l=new Zr,h=0,u=s.length;h<u;h++){var d,p=s[h];if(void 0!==p.POSITION)o=(d=i.json.accessors[p.POSITION]).min,a=d.max,void 0!==o&&void 0!==a?(l.setX(Math.max(Math.abs(o[0]),Math.abs(a[0]))),l.setY(Math.max(Math.abs(o[1]),Math.abs(a[1]))),l.setZ(Math.max(Math.abs(o[2]),Math.abs(a[2]))),c.max(l)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}r.expandByVector(c)}e.boundingBox=r;var f=new Uo;r.getCenter(f.center),f.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,i),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,i){for(var n=!1,r=!1,o=0,a=t.length;o<a&&(void 0!==(l=t[o]).POSITION&&(n=!0),void 0!==l.NORMAL&&(r=!0),!n||!r);o++);if(!n&&!r)return Promise.resolve(e);var s=[],c=[];for(o=0,a=t.length;o<a;o++){var l=t[o];if(n){var h=void 0!==l.POSITION?i.getDependency("accessor",l.POSITION):e.attributes.position;s.push(h)}r&&(h=void 0!==l.NORMAL?i.getDependency("accessor",l.NORMAL):e.attributes.normal,c.push(h))}return Promise.all([Promise.all(s),Promise.all(c)]).then((function(t){var i=t[0],o=t[1];return n&&(e.morphAttributes.position=i),r&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(e,t.targets,i):e}))}function U(e,t){var i=e.getIndex();if(null===i){var n=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<r.count;o++)n.push(o);e.setIndex(n),i=e.getIndex()}var a=i.count-2,s=[];if(2===t)for(o=1;o<=a;o++)s.push(i.getX(0)),s.push(i.getX(o)),s.push(i.getX(o+1));else for(o=0;o<a;o++)o%2==0?(s.push(i.getX(o)),s.push(i.getX(o+1)),s.push(i.getX(o+2))):(s.push(i.getX(o+2)),s.push(i.getX(o+1)),s.push(i.getX(o)));s.length/3!==a&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(s),c}return z.prototype.parse=function(e,t){var i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:i,userData:{}};N(r,o,n),k(o,n),e(o)})).catch(t)},z.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[],n={},r={},o=0,a=t.length;o<a;o++)for(var s=t[o].joints,c=0,l=s.length;c<l;c++)e[s[c]].isBone=!0;for(var h=0,u=e.length;h<u;h++){var d=e[h];void 0!==d.mesh&&(void 0===n[d.mesh]&&(n[d.mesh]=r[d.mesh]=0),n[d.mesh]++,void 0!==d.skin&&(i[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=n,this.json.meshUses=r},z.prototype.getDependency=function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this.loadMesh(t);break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this.loadBufferView(t);break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this.loadMaterial(t);break;case"texture":r=this.loadTexture(t);break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;case"light":r=this.extensions[i.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r},z.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var i=this,n=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(n.map((function(t,n){return i.getDependency(e,n)}))),this.cache.add(e,t)}return t},z.prototype.loadBuffer=function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[i.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,i){n.load(O(t.uri,r.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},z.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var i=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+i)}))},z.prototype.loadAccessor=function(e){var t=this,i=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var r=[];return void 0!==n.bufferView?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),void 0!==n.sparse&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then((function(e){var r,o=e[0],a=T[n.type],s=E[n.componentType],c=s.BYTES_PER_ELEMENT,l=c*a,h=n.byteOffset||0,u=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;if(u&&u!==l){var p=Math.floor(h/u),f="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+p+":"+n.count,m=t.cache.get(f);m||(m=new Ol(new s(o,p*u,n.count*u/c),u/c),t.cache.add(f,m)),r=new Fl(m,a,h%u/c,d)}else r=new Ea(null===o?new s(n.count*a):new s(o,h,n.count*a),a,d);if(void 0!==n.sparse){var g=T.SCALAR,v=E[n.sparse.indices.componentType],y=n.sparse.indices.byteOffset||0,A=n.sparse.values.byteOffset||0,x=new v(e[1],y,n.sparse.count*g),b=new s(e[2],A,n.sparse.count*a);null!==o&&(r=new Ea(r.array.slice(),r.itemSize,r.normalized));for(var w=0,M=x.length;w<M;w++){var S=x[w];if(r.setX(S,b[w*a]),a>=2&&r.setY(S,b[w*a+1]),a>=3&&r.setZ(S,b[w*a+2]),a>=4&&r.setW(S,b[w*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r}))},z.prototype.loadTexture=function(e){var t,n=this,r=this.json,o=this.options,a=this.textureLoader,s=self.URL||self.webkitURL,c=r.textures[e],l=c.extensions||{},h=(t=l[i.MSFT_TEXTURE_DDS]?r.images[l[i.MSFT_TEXTURE_DDS].source]:r.images[c.source]).uri,u=!1;return void 0!==t.bufferView&&(h=n.getDependency("bufferView",t.bufferView).then((function(e){u=!0;var i=new Blob([e],{type:t.mimeType});return h=s.createObjectURL(i)}))),Promise.resolve(h).then((function(e){var t=o.manager.getHandler(e);return t||(t=l[i.MSFT_TEXTURE_DDS]?n.extensions[i.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise((function(i,n){t.load(O(e,o.path),i,void 0,n)}))})).then((function(i){!0===u&&s.revokeObjectURL(h),i.flipY=!1,c.name&&(i.name=c.name),t.mimeType in D&&(i.format=D[t.mimeType]);var o=(r.samplers||{})[c.sampler]||{};return i.magFilter=S[o.magFilter]||1006,i.minFilter=S[o.minFilter]||1008,i.wrapS=_[o.wrapS]||1e3,i.wrapT=_[o.wrapT]||1e3,n.associations.set(i,{type:"textures",index:e}),i}))},z.prototype.assignTexture=function(e,t,n){var r=this;return this.getDependency("texture",n.index).then((function(o){if(!o.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=1022}if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),r.extensions[i.KHR_TEXTURE_TRANSFORM]){var a=void 0!==n.extensions?n.extensions[i.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var s=r.associations.get(o);o=r.extensions[i.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,s)}}e[t]=o}))},z.prototype.assignFinalMaterial=function(e){var t=e.geometry,i=e.material,n=void 0!==t.attributes.tangent,r=void 0!==t.attributes.color,o=void 0===t.attributes.normal,a=!0===e.isSkinnedMesh,s=Object.keys(t.morphAttributes).length>0,c=s&&void 0!==t.morphAttributes.normal;if(e.isPoints){var l="PointsMaterial:"+i.uuid,h=this.cache.get(l);h||(h=new Ih,ba.prototype.copy.call(h,i),h.color.copy(i.color),h.map=i.map,h.sizeAttenuation=!1,this.cache.add(l,h)),i=h}else if(e.isLine){l="LineBasicMaterial:"+i.uuid;var u=this.cache.get(l);u||(u=new yh,ba.prototype.copy.call(u,i),u.color.copy(i.color),this.cache.add(l,u)),i=u}if(n||r||o||a||s){l="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(l+="specular-glossiness:"),a&&(l+="skinning:"),n&&(l+="vertex-tangents:"),r&&(l+="vertex-colors:"),o&&(l+="flat-shading:"),s&&(l+="morph-targets:"),c&&(l+="morph-normals:");var d=this.cache.get(l);d||(d=i.clone(),a&&(d.skinning=!0),n&&(d.vertexTangents=!0),r&&(d.vertexColors=!0),o&&(d.flatShading=!0),s&&(d.morphTargets=!0),c&&(d.morphNormals=!0),this.cache.add(l,d),this.associations.set(d,this.associations.get(i))),i=d}i.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),i.normalScale&&!n&&(i.normalScale.y=-i.normalScale.y),i.clearcoatNormalScale&&!n&&(i.clearcoatNormalScale.y=-i.clearcoatNormalScale.y),e.material=i},z.prototype.loadMaterial=function(e){var t,n=this,r=this.json,o=this.extensions,a=r.materials[e],s={},c=a.extensions||{},l=[];if(c[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=o[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=h.getMaterialType(),l.push(h.extendParams(s,a,n))}else if(c[i.KHR_MATERIALS_UNLIT]){var u=o[i.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),l.push(u.extendParams(s,a,n))}else{t=rd;var d=a.pbrMetallicRoughness||{};if(s.color=new ma(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var f=d.baseColorFactor;s.color.fromArray(f),s.opacity=f[3]}void 0!==d.baseColorTexture&&l.push(n.assignTexture(s,"map",d.baseColorTexture)),s.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,s.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture)))}!0===a.doubleSided&&(s.side=2);var m=a.alphaMode||R;if(m===B?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,m===L&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==wa&&(l.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new zr(1,1),void 0!==a.normalTexture.scale&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==wa&&(l.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==wa&&(s.emissive=(new ma).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==wa&&l.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture)),c[i.KHR_MATERIALS_CLEARCOAT]){var g=o[i.KHR_MATERIALS_CLEARCOAT];t=g.getMaterialType(),l.push(g.extendParams(s,{extensions:c},n))}return Promise.all(l).then((function(){var r;return r=t===p?o[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s),a.name&&(r.name=a.name),r.map&&(r.map.encoding=3001),r.emissiveMap&&(r.emissiveMap.encoding=3001),k(r,a),n.associations.set(r,{type:"materials",index:e}),a.extensions&&N(o,r,a),r}))},z.prototype.loadGeometries=function(e){var t=this,n=this.extensions,r=this.primitiveCache;function o(e){return n[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(i){return H(i,e,t)}))}for(var a,s,c=[],l=0,h=e.length;l<h;l++){var u,d=e[l],p=(s=void 0,(s=(a=d).extensions&&a.extensions[i.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+V(s.attributes):a.indices+":"+V(a.attributes)+":"+a.mode),f=r[p];if(f)c.push(f.promise);else u=d.extensions&&d.extensions[i.KHR_DRACO_MESH_COMPRESSION]?o(d):H(new Ga,d,t),r[p]={primitive:d,promise:u},c.push(u)}return Promise.all(c)},z.prototype.loadMesh=function(e){for(var t,i=this,n=this.json.meshes[e],r=n.primitives,o=[],a=0,s=r.length;a<s;a++){var c=void 0===r[a].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new rd({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),t.DefaultMaterial):this.getDependency("material",r[a].material);o.push(c)}return o.push(i.loadGeometries(r)),Promise.all(o).then((function(t){for(var o=t.slice(0,t.length-1),a=t[t.length-1],s=[],c=0,l=a.length;c<l;c++){var h,u=a[c],d=r[c],p=o[c];if(d.mode===b||d.mode===w||d.mode===M||void 0===d.mode)!0!==(h=!0===n.isSkinnedMesh?new ch(u,p):new ss(u,p)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),d.mode===w?h.geometry=U(h.geometry,1):d.mode===M&&(h.geometry=U(h.geometry,2));else if(d.mode===y)h=new Th(u,p);else if(d.mode===x)h=new Eh(u,p);else if(d.mode===A)h=new Ch(u,p);else{if(d.mode!==v)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);h=new Dh(u,p)}Object.keys(h.geometry.morphAttributes).length>0&&F(h,n),h.name=n.name||"mesh_"+e,a.length>1&&(h.name+="_"+c),k(h,n),i.assignFinalMaterial(h),s.push(h)}if(1===s.length)return s[0];var f=new Cl;for(c=0,l=s.length;c<l;c++)f.add(s[c]);return f}))},z.prototype.loadCamera=function(e){var t,i=this.json.cameras[e],n=i[i.type];if(n)return"perspective"===i.type?t=new bs(Vr.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(t=new gp(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(t.name=i.name),k(t,i),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},z.prototype.loadSkin=function(e){var t=this.json.skins[e],i={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return i.inverseBindMatrices=e,i}))},z.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],i=[],n=[],r=[],o=[],a=[],s=0,c=t.channels.length;s<c;s++){var l=t.channels[s],h=t.samplers[l.sampler],u=l.target,d=void 0!==u.node?u.node:u.id,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;i.push(this.getDependency("node",d)),n.push(this.getDependency("accessor",p)),r.push(this.getDependency("accessor",f)),o.push(h),a.push(u)}return Promise.all([Promise.all(i),Promise.all(n),Promise.all(r),Promise.all(o),Promise.all(a)]).then((function(i){for(var n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],c=[],l=0,h=n.length;l<h;l++){var u=n[l],d=r[l],p=o[l],f=a[l],m=s[l];if(void 0!==u){var v;switch(u.updateMatrix(),u.matrixAutoUpdate=!0,I[m.path]){case I.weights:v=bd;break;case I.rotation:v=Md;break;case I.position:case I.scale:default:v=Sd}var y=u.name?u.name:u.uuid,A=void 0!==f.interpolation?P[f.interpolation]:2301,x=[];I[m.path]===I.weights?u.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(y);var b=p.array;if(p.normalized){var w;if(b.constructor===Int8Array)w=1/127;else if(b.constructor===Uint8Array)w=1/255;else if(b.constructor==Int16Array)w=1/32767;else{if(b.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");w=1/65535}for(var M=new Float32Array(b.length),E=0,S=b.length;E<S;E++)M[E]=b[E]*w;b=M}for(E=0,S=x.length;E<S;E++){var _=new v(x[E]+"."+I[m.path],d.array,b,A);"CUBICSPLINE"===f.interpolation&&(_.createInterpolant=function(e){return new g(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(_)}}}return new _d(t.name?t.name:"animation_"+e,void 0,c)}))},z.prototype.loadNode=function(e){var t,n=this.json,r=this.extensions,o=this,a=n.meshReferences,s=n.meshUses,c=n.nodes[e];return(t=[],void 0!==c.mesh&&t.push(o.getDependency("mesh",c.mesh).then((function(e){var t;if(a[c.mesh]>1){var i=s[c.mesh]++;(t=e.clone()).name+="_instance_"+i}else t=e;return void 0!==c.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,i=c.weights.length;t<i;t++)e.morphTargetInfluences[t]=c.weights[t]})),t}))),void 0!==c.camera&&t.push(o.getDependency("camera",c.camera)),c.extensions&&c.extensions[i.KHR_LIGHTS_PUNCTUAL]&&void 0!==c.extensions[i.KHR_LIGHTS_PUNCTUAL].light&&t.push(o.getDependency("light",c.extensions[i.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(t)).then((function(t){var i;if((i=!0===c.isBone?new dh:t.length>1?new Cl:1===t.length?t[0]:new Eo)!==t[0])for(var n=0,a=t.length;n<a;n++)i.add(t[n]);if(c.name&&(i.userData.name=c.name,i.name=gf.sanitizeNodeName(c.name)),k(i,c),c.extensions&&N(r,i,c),void 0!==c.matrix){var s=new oo;s.fromArray(c.matrix),i.applyMatrix4(s)}else void 0!==c.translation&&i.position.fromArray(c.translation),void 0!==c.rotation&&i.quaternion.fromArray(c.rotation),void 0!==c.scale&&i.scale.fromArray(c.scale);return o.associations.set(i,{type:"nodes",index:e}),i}))},z.prototype.loadScene=function(){function e(t,i,n,r){var o=n.nodes[t];return r.getDependency("node",t).then((function(e){return void 0===o.skin?e:r.getDependency("skin",o.skin).then((function(e){for(var i=[],n=0,o=(t=e).joints.length;n<o;n++)i.push(r.getDependency("node",t.joints[n]));return Promise.all(i)})).then((function(i){return e.traverse((function(e){if(e.isMesh){for(var n=[],r=[],o=0,a=i.length;o<a;o++){var s=i[o];if(s){n.push(s);var c=new oo;void 0!==t.inverseBindMatrices&&c.fromArray(t.inverseBindMatrices.array,16*o),r.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new uh(n,r),e.matrixWorld)}})),e}));var t})).then((function(t){i.add(t);var a=[];if(o.children)for(var s=o.children,c=0,l=s.length;c<l;c++){var h=s[c];a.push(e(h,t,n,r))}return Promise.all(a)}))}return function(t){var i=this.json,n=this.extensions,r=this.json.scenes[t],o=new Cl;r.name&&(o.name=r.name),k(o,r),r.extensions&&N(n,o,r);for(var a=r.nodes||[],s=[],c=0,l=a.length;c<l;c++)s.push(e(a[c],o,i,this));return Promise.all(s).then((function(){return o}))}}(),e}()),pm=(new r.Matrix4).makeRotationAxis(new r.Vector3(1,0,0),Math.PI/2);function fm(e){function t(e){if(e.isMesh)return function(e){var t=new ot;t.geometry=e.geometry,t.geometry.computeVertexNormals(),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),t.geometry.addGroup(0,e.geometry.index.count,0);var i=new mt;return i.uniforms.map.value=e.material.map,i.uniforms.exposure.value=3.3,i.opacity=1,e.material.dispose(),t.material=[i],t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(t.position,t.quaternion,t.scale),t}(e);if(e.isGroup){for(var i=function(e){var t=new st;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(t.position,t.quaternion,t.scale),t}(e),n=0;n<e.children.length;n++){var r=t(e.children[n]);i.add(r)}return i}return new st}return new Promise((function(i,n){var o,a=(new r.Matrix4).fromArray(e.computedTransform);if("Z"!==(null===(o=e.tileset.asset)||void 0===o?void 0:o.gltfUpAxis)&&a.multiply(pm),e.content){var s=e.content.gltfArrayBuffer,c=e.contentUrl?e.contentUrl.slice(0,e.contentUrl.lastIndexOf("/")+1):"";dm.parse(s,c,(function(e){var n=e.scene,r=new st,o=t(n);o.applyMatrix4(a),r.add(o),i(r)}),(function(t){n(new Error("error parsing gltf in tile ".concat(e.id,": ").concat(t.message)))}))}else i(new st)}))}function mm(e){e.traverse((function(e){if(e instanceof ot){e.geometry.dispose();for(var t=0,i=e.material;t<i.length;t++){var n=i[t];n.uniforms.map&&n.uniforms.map.value&&(n.uniforms.map.value.dispose(),n.uniforms.map.value=null)}}}))}function gm(e){return(new r.Matrix4).fromArray([2*e[0],2*e[1],2*e[2],0,2*e[3],2*e[4],2*e[5],0,2*e[6],2*e[7],2*e[8],0,0,0,0,1])}function vm(e){return new vn(e.toArray())}function ym(e){var t=e.planes.map((function(e){return new xn(e.normal.toArray(),e.constant)}));return new Sn(t)}var Am=new r.EdgesGeometry(new r.BoxBufferGeometry(1,1,1)),xm=new r.LineBasicMaterial({color:new r.Color(1,1,0),transparent:!0});function bm(e){e.updateMatrix(),e.updateMatrixWorld(),e.matrixWorld.getInverse(e.matrixWorldInverse);var t=(new r.Matrix4).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);return(new r.Frustum).setFromProjectionMatrix(t)}var wm={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxScreenSpaceError:8,maxMemoryUsage:32,viewDistanceScale:.2,onNodeCreated:function(){}},Mm=function(e){function i(i){void 0===i&&(i={});var n=e.call(this)||this;return n.options=t.__assign(t.__assign({},wm),i),n.clock=new r.Clock,n.timer=0,n.unloadTileQueue=[],n.nodes={},n.boundings={},n.nodeGroup=new r.Group,n.boundingGroup=new r.Group,n.add(n.nodeGroup),n.sseDenominator=null,n.lastCameraTransform=new r.Matrix4,n.lastCameraAspect=1,n.lastCameraFov=null,n.lastCamera=null,n.lastRenderer=null,n.enabled=!1,n}return t.__extends(i,e),Object.defineProperty(i.prototype,"enable",{get:function(){return this.enabled},set:function(e){this.enabled!==e&&(this.enabled=e,!1===this.enabled?this.reset():(this.timer=0,this.clock.getDelta()))},enumerable:!1,configurable:!0}),i.prototype.load=function(e){var t=this,i=e.tileset_url;e.tileset_url_md5;var n=e.b3md_mappings_url;e.b3md_mappings_url_md5;var o={modelMatrix:vm((new r.Matrix4).fromArray([1,0,0,0,0,-1,0,1e9,0,0,-1,0,0,0,0,1])),maxMemoryUsage:this.options.maxMemoryUsage,maxScreenSpaceError:this.options.maxScreenSpaceError,viewDistanceScale:this.options.viewDistanceScale,throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests,contentLoader:function(e){var i=function(e){var t=e.boundingVolume,i=new r.LineSegments(Am,xm);return i.applyMatrix4(gm(t.halfAxes)),i.position.set(t.center[0],t.center[1],t.center[2]),i}(e);return i.visible=!1,t.boundings[e.id]=i,t.boundingGroup.add(i),i.updateMatrixWorld(!0),"SCENEGRAPH"===e.type||"MESH"===e.type?fm(e).then((function(i){void 0===t.tileset?mm(i):(i.visible=!1,t.nodes[e.id]=i,t.nodeGroup.add(i),t.options.onNodeCreated(i),i.updateMatrixWorld(!0))})):Promise.resolve()},onTileLoad:function(){t.enabled&&t.tileset&&t.lastRenderer&&t.lastCamera&&(t.tileset.frameNumber++,t.tilesetUpdate(t.tileset,t.lastRenderer,t.lastCamera)),t.enabled||t.reset()},onTileUnload:function(e){t.unloadTileQueue.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)},onTraversalComplete:function(e){return e},allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy,maxDepth:this.options.maxDepth},a=i.split("/").slice(0,-1).join("/"),s=qe(i,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)})).then((function(e){return Dr(e,a)})),c=qe(n,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(e){return JSON.parse(e.body)}));Promise.all([s,c]).then((function(e){var i=e[0],n=e[1];i.b3dmMapping=n;var a=t.tileset=new Pr(i,o),s=new r.Matrix4;if(a.root&&a.root.boundingVolume){var c=a.root.boundingVolume,l=c.halfAxes,h=c.center;s.extractRotation(gm(l)),s.setPosition(h[0],h[1],h[2])}a.modelMatrix.copy(vm((new r.Matrix4).getInverse(s)))}))},i.prototype.update=function(e,t){this.lastCamera=t,this.lastRenderer=e,!1!==this.enabled&&(this.timer+=this.clock.getDelta(),this.tileset&&this.timer>=this.options.updateInterval&&(t.matrixWorld.equals(this.lastCameraTransform)&&t.aspect===this.lastCameraAspect&&t.fov===this.lastCameraFov||(this.timer=0,this.tileset.frameNumber++,this.lastCameraTransform.copy(t.matrixWorld),this.tilesetUpdate(this.tileset,e,t))))},i.prototype.tilesetUpdate=function(e,t,i){this.sseDenominator&&i.aspect===this.lastCameraAspect&&i.fov===this.lastCameraFov||(this.sseDenominator=function(e){var t=e.aspect,i=e.fov/180*Math.PI,n=e.aspect<=1?i:2*Math.atan(Math.tan(.5*i)/t);return 2*Math.tan(.5*n)}(i),this.lastCameraAspect=i.aspect,this.lastCameraFov=i.fov);var n,o={camera:{position:i.getWorldPosition(new r.Vector3).toArray(),direction:i.getWorldDirection(new r.Vector3).toArray(),up:i.up.toArray()},height:t.getSize(new r.Vector2).height,frameNumber:e.frameNumber,sseDenominator:this.sseDenominator,cullingVolume:ym(bm(i))};e.cache.reset(),e.traverser.traverse(e.root,o);for(var a=0,s=e.tiles;a<s.length;a++){var c=s[a],l=c.selected,h=c.id;this.nodes[h]&&this.nodes[h].visible!==l&&(this.nodes[h].visible=l,l&&(this.nodes[h].needsRender=!0)),this.boundings[h]&&this.boundings[h].visible!==l&&(this.boundings[h].visible=l)}for(;n=this.unloadTileQueue.pop();){h=n.id;if(this.nodes[h]){var u=this.nodes[h];this.nodeGroup.remove(u),mm(u),delete this.nodes[h]}if(this.boundings[h]){u=this.boundings[h];this.boundingGroup.remove(u),delete this.boundings[h]}}},i.prototype.reset=function(){if(this.tileset){this.tileset.reset();for(var e=void 0;e=this.unloadTileQueue.pop();)if("UNLOADED"!==e.contentState){var t=e.id;if(this.nodes[t]){var i=this.nodes[t];this.nodeGroup.remove(i),mm(i),delete this.nodes[t]}if(this.boundings[t]){i=this.boundings[t];this.boundingGroup.remove(i),delete this.boundings[t]}}for(var n=0,r=Object.keys(this.nodes);n<r.length;n++){t=r[n];var o=this.nodes[t];this.nodeGroup.remove(o),mm(o),delete this.nodes[t]}for(var a=0,s=Object.keys(this.boundings);a<s.length;a++){t=s[a],o=this.boundings[t];this.boundingGroup.remove(o),delete this.boundings[t]}}},i}(at);function Em(e){return null==e}var Sm=function(e,t){void 0===t&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var i={},n=e.getIndex(),o=e.getAttribute("position"),a=n?n.count:o.count,s=0,c=Object.keys(e.attributes),l={},h={},u=[],d=["getX","getY","getZ","getW"],p=0,f=c.length;p<f;p++){l[x=c[p]]=[],(E=e.morphAttributes[x])&&(h[x]=new Array(E.length).fill().map((function(){return[]})))}var m=Math.log10(1/t),g=Math.pow(10,m);for(p=0;p<a;p++){var v=n?n.getX(p):p,y="",A=0;for(f=c.length;A<f;A++)for(var x=c[A],b=(M=e.getAttribute(x)).itemSize,w=0;w<b;w++)y+="".concat(~~(M[d[w]](v)*g),",");if(y in i)u.push(i[y]);else{for(A=0,f=c.length;A<f;A++){x=c[A];var M=e.getAttribute(x),E=e.morphAttributes[x],S=(b=M.itemSize,l[x]),_=h[x];for(w=0;w<b;w++){var T=d[w];if(S.push(M[T](v)),E)for(var C=0,I=E.length;C<I;C++)_[C].push(E[C][T](v))}}i[y]=s,u.push(s),s++}}var P=e.clone();for(p=0,f=c.length;p<f;p++){x=c[p];var R=e.getAttribute(x),L=new R.array.constructor(l[x]);M=new r.BufferAttribute(L,R.itemSize,R.normalized);if(P.setAttribute(x,M),x in h)for(A=0;A<h[x].length;A++){var B=e.morphAttributes[x][A],D=(L=new B.array.constructor(h[x][A]),new r.BufferAttribute(L,B.itemSize,B.normalized));P.morphAttributes[x][A]=D}}return P.setIndex(u),P};function _m(e){var i;return new((i=r.Triangle).bind.apply(i,t.__spreadArray([void 0],e.map((function(e){return new r.Vector3(e.x,e.y,e.z)})),!1)))}var Tm={at3d:function(e,t){for(var i=Ei(t.textureOptions,e.textures.length),n={},r=0,o=e.textures;r<o.length;r++){var a=o[r];n[a]=wi(a,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return qe(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Wt(e.body)})).then((function(e){return kt((function(){for(var t,i={chunks:[]},n=0,r=e;n<r.length;n++){var o=r[n],a=xi.decode(o);a.chunks.length&&(t=i.chunks).push.apply(t,a.chunks)}return i}))})).then((function(r){return kt((function(){return Mi(r,e.textureBase,e.textures.slice(),i,n,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},pbm:function(e,t){for(var i=Ei(t.textureOptions,e.textures.length),n={},r=0,o=e.textures;r<o.length;r++){var a=o[r];n[a]=wi(a,i,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return qe(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return kt((function(){var t=new Uint8Array(e.body);return xi.decode(t)}))})).then((function(r){return kt((function(){return Mi(r,e.textureBase,e.textures.slice(),i,n,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}))},dome:function(e,t){return Promise.resolve().then((function(){return qe(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(i){return Di(new Uint8Array(i.body),e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))},domez:function(e,t){return Promise.resolve().then((function(){return qe(e.file,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return Wt(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(t),n=0;return e.forEach((function(e){i.set(e,n),n+=e.length})),i})).then((function(i){return Di(i,e.textureBase,t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)}))}},Cm=function(e){function i(t){void 0===t&&(t={});var i=e.call(this)||this;return i.empty=!0,i.name="model",i.loaded=!1,i.bvhs=Object.assign([],{loaded:!1}),i.bounding=new r.Box3,i.shownFloor=null,i.floorLength=0,i.requestProxy=t.requestProxy,i.networkSubscribe=t.networkSubscribe,i.allowHosts=t.allowHosts,i.renderOrder=-3,i}return t.__extends(i,e),Object.defineProperty(i.prototype,"shownfloor",{get:function(){return this.shownFloor},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"hasTiles",{get:function(){return void 0!==this.tiledModel},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableTiles",{get:function(){return!!this.tiledModel&&this.tiledModel.enable},set:function(e){this.tiledModel&&(this.tiledModel.enable=e)},enumerable:!1,configurable:!0}),i.prototype.getEdges=function(e){var t;if(void 0===e&&(e=30/180*Math.PI),!this.originModel)return[];for(var i=Math.cos(e),n=[],o=0,a=this.originModel.children;o<a.length;o++){var s=a[o];if(s instanceof ot){for(var c={},l=["a","b","c"],h=Sm(s.geometry),u=h.getAttribute("position").array,d=(null===(t=h.getIndex())||void 0===t?void 0:t.array)||[],p=[],f=[],m=0,g=u.length;m<g;m+=3)p.push(new r.Vector3(u[m],u[m+1],u[m+2]));for(m=0,g=d.length;m<g;m+=3){var v=d[m],y=d[m+1],A=d[m+2],x=(new r.Vector3).crossVectors(p[y].clone().sub(p[v]),p[A].clone().sub(p[v])).normalize();f.push({a:v,b:y,c:A,normal:x})}for(m=0,g=f.length;m<g;m++)for(var b=f[m],w=0;w<3;w++){var M=b[l[w]],E=b[l[(w+1)%3]],S=[Math.min(M,E),Math.max(M,E)];void 0===c[_=S[0]+"-"+S[1]]?c[_]={index1:S[0],index2:S[1],face1:m}:c[_].face2=m}for(var _ in c){var T=c[_];if(void 0===T.face2||f[T.face1].normal.dot(f[T.face2].normal)<=i){var C=p[T.index1],I=p[T.index2];n.push(new r.Line3(C,I))}}h.dispose(),p.length=0,f.length=0}}return n},i.prototype.hasFloors=function(){return this.hasFloors_()},i.prototype.hasFloors_=function(){var e=[];return this.traverse((function(t){t instanceof ot&&(e[t.floorIndex]=!0)})),e.length},i.prototype.show=function(){for(var e,t,i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var o=this.shownFloor,a=null,s=null!==(e=i[1])&&void 0!==e?e:.1,c=0!==i.length;this.shownFloor=a=c?i[0]:null,this.setMaterial({opacity:1,floorInfo:new r.Vector3(0,0,0)}),(null===(t=this.tiledModel)||void 0===t?void 0:t.enable)?this.b3dmShow(o,a):this.at3dShow(o,a,s)},i.prototype.at3dShow=function(e,t,i){this.traverse((function(e){e instanceof ot&&e.material.forEach((function(n){null===t||t===e.floorIndex?n.opacity=1*n.originOpacity:n.opacity=n.originOpacity*i}))})),e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0},i.prototype.b3dmShow=function(e,t){var i,n;if(null===(n=null===(i=this.tiledModel)||void 0===i?void 0:i.tileset)||void 0===n?void 0:n.floorInfo){if("number"==typeof t&&t>=0&&t<this.tiledModel.tileset.floorInfo.length){var o=this.tiledModel.tileset.floorInfo,a=-o[t].ground,s=o[t].height+a;this.setMaterial({opacity:1,floorInfo:new r.Vector3(a,s,0)})}else this.setMaterial({opacity:1,floorInfo:new r.Vector3(0,0,0)});e!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0}},i.prototype.intersectRaycaster=function(e,t){var i=e.ray,n=i.origin,o=i.direction;if(Em(t))if(Em(this.shownFloor)){var a=this.floorLength;t=[];for(var s=-1;s<a;s++)t.push(s)}else t=[this.shownFloor];var c=[],l=[];Array.isArray(t)?l.push.apply(l,t):l.push(t);for(var h=function(t){var i=u.bvhs&&u.bvhs[t];if(i){var a=new _t(n.x,n.y,n.z),s=new _t(o.x,o.y,o.z);(l=i.intersectRay(a,s,!0).map((function(e){var t=e.intersectionPoint,i=e.triangle,o=new r.Vector3(t.x,t.y,t.z);return{point:o,face:{normal:_m(i).getNormal(new r.Vector3)},distance:n.distanceTo(o)}}))).length&&c.push.apply(c,l)}else if(u.originModel){var l,h=[];u.originModel.traverse((function(e){e instanceof ot&&e.floorIndex===t&&h.push(e)})),(l=e.intersectObjects(h).map((function(e){return{face:e.face?{normal:e.face.normal}:void 0,point:e.point,distance:e.distance}}))).length&&c.push.apply(c,l)}},u=this,d=0,p=l;d<p.length;d++){h(p[d])}return c.filter((function(t){var i=t.distance;return i<=e.far&&i>=e.near})).sort((function(e,t){return e.distance-t.distance}))},i.prototype.buildBVH=function(){if(!this.bvhs.loaded&&this.originModel){var e=[];this.originModel.traverse((function(t){t instanceof ot&&(e[t.floorIndex]=e[t.floorIndex]||[],e[t.floorIndex].push(t.geometry))})),this.bvhs.length=0;for(var t=0,i=e;t<i.length;t++){var n=i[t],r=0;if(n){for(var o=0,a=n;o<a.length;o++){var s=0;s=(d=a[o]).index?d.index.array.length:d.attributes.position.array.length/3,r+=3*Math.floor(s/3)}for(var c=new Float32Array(3*r),l=0,h=0,u=n;h<u.length;h++){var d,p=(d=u[h]).attributes.position.array,f=d.index?d.index.array:null;if(f){for(var m=3*Math.floor(f.length/3),g=0,v=void 0,y=void 0;g<m;g++)v=3*(l+g),y=3*f[g],c[v]=p[y],c[v+1]=p[y+1],c[v+2]=p[y+2];l+=m}else{for(m=3*Math.floor(p.length/3/3),g=0,v=void 0,y=void 0;g<m;g++)y=3*g,c[v=3*(l+g)]=p[y],c[v+1]=p[y+1],c[v+2]=p[y+2];l+=m}}var A=(new Bt).create(c).splitNode(50);this.bvhs.push(A)}}this.bvhs.loaded=!0,this.emit("bvhLoaded")}},i.prototype.load=function(e,t){var i=this;if(void 0===t&&(t={}),!0===this.loaded)throw new Error("[MODEL LOAD ERROR]: model cannot load twice.");var n=function(e,t){if(void 0===t&&(t=[]),/^blob\:/.test(e))return"at3d";var i=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(!i)return"";for(var n=0,r=String(i[1]).trim().split(".").slice(1).reverse();n<r.length;n++){var o=r[n],a=t.indexOf(o);if(a>=0)return t[a]}return""}(e.file,Object.keys(Tm)),o=Tm[n];if(!o)throw new Error("[MODEL LOAD ERROR]: file type(".concat(n,") does not support."));return this.name=e.file,o(e,{textureOptions:t,allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}).then((function(t){var n=t.objects,o=t.texturePromise;i.bounding.makeEmpty();var a=i.originModel=new at;a.renderOrder=-3;for(var s=0,c=n;s<c.length;s++){(d=c[s]).traverse((function(e){if(e instanceof ot){var t=e.geometry;t.boundingBox||t.computeBoundingBox(),t.boundingSphere||t.computeBoundingSphere(),i.bounding.union(t.boundingBox)}})),a.add(d)}for(var l=i.bounding.getCenter(new r.Vector3),h=0,u=n;h<u.length;h++){var d;(d=u[h]).traverse((function(e){if(e instanceof ot)for(var t=0,i=e.material;t<i.length;t++){i[t].uniforms.modelCenter.value=l}}))}if(i.add(a),i.floorLength=i.hasFloors_(),i.empty=!1,i.loaded=!0,e.tiles&&e.tiles.tileset_url&&e.tiles.b3md_mappings_url){var p=i.tiledModel=new Mm({onNodeCreated:function(e){var t=a.getMaterial();t&&(e.setMaterial(t),e.renderOrder=-3),e.traverse((function(e){if(e instanceof ot)for(var t=0,i=e.material;t<i.length;t++){i[t].uniforms.modelCenter.value=l}}))},allowHosts:i.allowHosts,networkSubscribe:i.networkSubscribe,requestProxy:i.requestProxy});p.renderOrder=-3,i.add(p),p.load(e.tiles)}e.bvh&&i.buildBVH(),kt((function(){i.emit("geometryLoaded"),o.then((function(){i.emit("materialLoaded"),i.emit("loaded")}))}))})).catch((function(e){return i.name="",i.emit("error",e),Promise.reject(e)}))},i.prototype.update=function(e,t){if(this.originModel){var i=this.originModel.visible;if(this.tiledModel&&this.tiledModel.enable&&this.tiledModel.tileset){this.tiledModel.update(e,t);var n=this.tiledModel.tileset.root;n.content&&"READY"===n.contentState&&!1!==i&&(this.setTransparent(!1),this.shownFloor&&this.show(this.shownFloor),this.originModel.visible=!1,this.originModel.needsRender=!0)}else!0!==i&&(this.originModel.visible=!0,this.originModel.needsRender=!0)}},i.prototype.dispose=function(){this.off();var e=this.originModel,t=this.tiledModel;if(t&&(t.enable=!1,t.reset()),e)for(e.disposeGeometry(),e.disposeMaterial();e.children.length;)e.remove(e.children[0]);this.bvhs.length=0,this.bvhs.loaded=!1},i}(at);Object.assign(Cm.prototype,{on:Ie.prototype.on,once:Ie.prototype.once,off:Ie.prototype.off,emit:Ie.prototype.emit,hasListener:Ie.prototype.hasListener});function Im(e,t,i){return e<t?t:e>i?i:e}function Pm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=[];e=e.map((function(e){return(null!=e?e:"").trim()})).filter((function(e){return e.length>0&&!/^\/+$/.test(e)}));for(var n=0;n<e.length;n++){var r=0===n,o=n===e.length-1,a=e[n];r||(a=a.replace(/^\/+/,"")),o||(a=a.replace(/\/+$/,"")),i.push(a)}return i.join("/")}function Rm(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var i,n,r;if(Array.isArray(e)){if((i=e.length)!=t.length)return!1;for(n=i;0!=n--;)if(!Rm(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((i=(r=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,r[n]))return!1;for(n=i;0!=n--;){var o=r[n];if(!Rm(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function Lm(e){return"number"==typeof e}function Bm(e){return 0==(e&e-1)&&0!==e}var Dm=function(){return new Error("Invalid input.")},Om=function(){return new Error("Invalid certificate.")},Nm=function(){return new Error("Invalid signature.")};function km(e,t){void 0===t&&(t=!1);var i=typeof e;if("string"===i)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",r=e.length-1,o=0;o<r;o++)n+=km(e[o],!1)+",";return r>-1&&(n+=km(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return km(e.toJSON(),t);var a=Object.keys(e).sort(),s=a.length;for(n="",o=0;o<s;){var c=a[o],l=km(e[c],!0);void 0!==l&&(o&&""!==n&&(n+=","),n+=JSON.stringify(c)+":"+l),o++}return"{"+n+"}"}switch(i){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function Fm(e){return String(km(e,!1))}function Vm(e){var t,i,n;if(Array.isArray(e)){var r,o,a=void 0;if(e.length<=0)return Dm();for(var s=function(t){var i=Vm(e[t]);if(i instanceof Error)return{value:i};if(a){if(a!==i.issuer)return{value:Om()}}else a=i.issuer;r?i.expire.getTime()<r.getTime()&&(r=i.expire):r=i.expire,o=o?o.filter((function(e){return-1!==i.allowHosts.indexOf(e)})):i.allowHosts},c=0;c<e.length;c++){var l=s(c);if("object"==typeof l)return l.value}return Be({issuer:a,expire:r,allowHosts:o})}var h=JSON.parse(e),u="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof h)return Dm();var p=new Date("string"==typeof h.expire_at&&/^\d+$/.test(h.expire_at)?Number(h.expire_at):h.expire_at),f=Array.isArray(h.allow_hosts)?h.allow_hosts:[];if(0===u.length||Oe(u)||Fe.filter((function(e){return Ne(e,u)})).length>0){var m=String(null!==(t=h.certificate)&&void 0!==t?t:"");if(m){var g=new xe;return g.readCertPEM(m),Be({issuer:g.getSubjectString(),expire:p,allowHosts:f})}return Be({issuer:"none",expire:p,allowHosts:f})}var v=String(null!==(i=h.certificate)&&void 0!==i?i:"");if(!v)return Om();var y=new xe;y.readCertPEM(v);var A=String(null!==(n=h._signature)&&void 0!==n?n:"");return A?!1===function(e,t,i){var n=new xe;if("string"==typeof i?n.readCertPEM(i):n.readCertHex(i.hex),!1===Se(n))return!1;var r=new X;return r.readCertPubKeyHex(n.hex,6),!!r.verify(e,O(t))}(Fm(function(e,t){for(var i={},n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];-1===t.indexOf(o)&&(i[o]=e[o])}return i}(h,["_signature"])),A,y)?Nm():d<p.getTime()?0===f.filter((function(e){return Ne(e,u)})).length?function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))}(u):Be({issuer:y.getSubjectString(),expire:p,allowHosts:f}):function(e){return new Error("date(".concat(e.toString(),") expired."))}(p):Nm()}var zm=new WeakMap,Hm=function(){function e(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:"Panorama",latitude:0,longitude:0,panoIndex:0,fov:80},this.observers=[],this.issuer="none",this.raw={works:[""],options:""}}return e.prototype.toJSON=function(){return this.raw.works},e.parse=Qm,e}();function Um(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function Gm(e,t){var i=Um(e),n=Um(t);if("null"===n)return e;if("value"===n)return t;if(n!==i)return JSON.parse(JSON.stringify(t));if("array"===n)for(var r=0;r<t.length;r++)e[r]=Gm(e[r],t[r]);else if("dict"===n)for(var o in t)e[o]=Gm(e[o],t[o]);return e}function jm(e,t,i){for(var n,o=JSON.stringify(t),a=[],s=0,c=[].concat(e);s<c.length;s++){var l=c[s];l instanceof Hm?a.push.apply(a,l.raw.works):"string"==typeof l?a.push(l):a.push(JSON.stringify(l))}var h=Vm(a);if(h instanceof Error)return h;t=JSON.parse(o),e=a.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return Gm(e,t)}));var u=new Hm;if(h instanceof Error)return h;u.issuer=h.issuer,u.expire=h.expire,u.allowHosts=h.allowHosts,u.raw={works:a,options:o};var d=null!==(n=e.base_url)&&void 0!==n?n:"";d&&"/"!==d[d.length-1]&&(d+="/");var p=function(e,t){return 0===e.indexOf(t)},f=function(e,n){var r,o=e;if(!0===t.jsonp){o=e.replace(/([\?\#].*)?$/i,"");var a=be("".concat(o)).slice(0,7);o="".concat(o,".").concat(a,".jsonp")}if(!0===t.shortPath){var s=o.replace(d,"").split("."),c=null!==(r=s.shift())&&void 0!==r?r:"",l=s.join(".");o=Pm(d,be(c))+(l?"."+l:"")}var h=o.replace(d,"");return t.baseURL&&(o=Pm(t.baseURL,h)),i&&i(e,o,h,n),o},m=function(t,i){var n,r,o,a,s,c,l=t;if(!Si(t)){var h=null!==(c=null!==(a=null!==(r=null===(n=e.panorama)||void 0===n?void 0:n.pano_high_cube_base_url)&&void 0!==r?r:null===(o=e.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==a?a:null===(s=e.panorama)||void 0===s?void 0:s.base_url)&&void 0!==c?c:"";h&&(h=Pm(h,String(i))),l=Pm(h,l)}return Si(l)||(l=Pm(d,l)),p(l,d)||console.warn("".concat(l," is not start with base_url(").concat(d,").")),f(l,"panorama")},g=function(e){var t=e;return Si(t)||(t=Pm(d,e)),p(t,d)||console.warn("".concat(t," is not start with base_url(").concat(d,").")),f(t,"model")},v=function(e,t){void 0===t&&(t="");var i=e;return Si(i)||(i=Pm(t,i)),Si(i)||(i=Pm(d,i)),p(i,d)||console.warn("".concat(i," is not start with base_url(").concat(d,").")),f(i,"texture")};if(h instanceof Error)return h;if(u.workCode=String(e.work_code||e.code||e.vr_code||e.workCode),u.name=String(e.name),h instanceof Error)return h;if(e.model){var y={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof t.modelBvh?y.bvh=t.modelBvh:"boolean"==typeof e.model.bvh?y.bvh=e.model.bvh:"boolean"==typeof e.bvh&&(y.bvh=e.bvh),e.model.file?y.file=g(e.model.file):e.model.file_url&&(y.file=g(e.model.file_url)),e.model.textureBase?y.textureBase=e.model.textureBase:e.model.material_base_url&&(y.textureBase=e.model.material_base_url),Array.isArray(e.model.textures)?y.textures=e.model.textures.map((function(e){return v(e,y.textureBase)})):Array.isArray(e.model.material_textures)&&(y.textures=e.model.material_textures.map((function(e){return v(e,y.textureBase)}))),e.model.tiles&&(y.tiles=e.model.tiles),y.file&&(u.model=y)}if(h instanceof Error)return h;if(e.observers&&Array.isArray(e.observers)){var A=[];e.panorama&&(Array.isArray(e.panorama)?A=e.panorama:Array.isArray(e.panorama.list)?A=e.panorama.list:Array.isArray(e.panorama.info)&&(A=e.panorama.info));for(var x=0;x<e.observers.length;x++){var b={},w=e.observers[x];if(!w)break;var M=A[x];if(!M)break;w=Object.assign({},w,M,{active:!1!==w.active&&!1!==M.active}),b.panoIndex=x,b.active=!1!==w.active,b.loadable=!0===w.loadable,b.images={up:m(w.images?w.images.up:w.up,x),down:m(w.images?w.images.down:w.down,x),right:m(w.images?w.images.right:w.right,x),left:m(w.images?w.images.left:w.left,x),front:m(w.images?w.images.front:w.front,x),back:m(w.images?w.images.back:w.back,x)};var E=w.images?w.images.depth:w.depth;E&&(b.images.depth=m(E,x));var S=w.images?w.images.luminance:w.luminance;S&&(b.images.luminance={up:m(S.up,x),down:m(S.down,x),right:m(S.right,x),left:m(S.left,x),front:m(S.front,x),back:m(S.back,x)});var _=w.images?w.images.tiles:w.tiles;if(_){for(var T=[],C=function(e){var t=e.match(/\/cube_(\d+)\//);if(t){var i=Number(t[1]);if(Bm(i))return i}return!1},I=function(e,t){return e.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(t,"/")}))},P=0,R=_;P<R.length;P++){var L=R[P];if("number"==typeof L){var B=L,D=C(b.images.front);if(!1===D)continue;if((H=Math.max(D,512*Math.pow(2,B)))>2048){var O=I(b.images.up,H),N=I(b.images.down,H),k=I(b.images.right,H),F=I(b.images.left,H),V=I(b.images.front,H),z=I(b.images.back,H);T.push({level:B,size:H,up:O,down:N,right:k,left:F,front:V,back:z})}else{O=b.images.up,N=b.images.down,k=b.images.right,F=b.images.left,V=b.images.front,z=b.images.back;T.push({level:B,size:H,up:O,down:N,right:k,left:F,front:V,back:z})}}else{var H;if("number"!=typeof(B=L.level))continue;if("number"!=typeof(H=L.size))continue;O=m(L.up,x),N=m(L.down,x),k=m(L.right,x),F=m(L.left,x),V=m(L.front,x),z=m(L.back,x);T.push({level:B,size:H,up:O,down:N,right:k,left:F,front:V,back:z})}}T.sort((function(e,t){return e.level-t.level})),b.images.tiles=T}if(w.position instanceof r.Vector3)b.position=w.position.clone();else{if(!Array.isArray(w.position))break;b.position=(new r.Vector3).fromArray(w.position)}if(w.standingPosition instanceof r.Vector3)b.standingPosition=w.standingPosition.clone();else if(Array.isArray(w.standingPosition))b.standingPosition=(new r.Vector3).fromArray(w.standingPosition);else if(w.standing_position instanceof r.Vector3)b.standingPosition=w.standing_position.clone();else{if(!Array.isArray(w.standing_position))break;b.standingPosition=(new r.Vector3).fromArray(w.standing_position)}if(w.quaternion instanceof r.Quaternion)b.quaternion=w.quaternion.clone();else if(Array.isArray(w.quaternion))b.quaternion=(new r.Quaternion).fromArray(w.quaternion);else{if(!w.quaternion)break;var U=w.quaternion,G=U.x,j=U.y,Q=U.z,W=U.w;b.quaternion=new r.Quaternion(G,j,Q,W)}if(Array.isArray(w.accessibleNodes)?b.accessibleNodes=w.accessibleNodes.slice():Array.isArray(w.accessible_nodes)&&(b.accessibleNodes=w.accessible_nodes.slice()),Array.isArray(w.visibleNodes)?b.visibleNodes=w.visibleNodes.slice():Array.isArray(w.visible_nodes)&&(b.visibleNodes=w.visible_nodes.slice()),Lm(w.floorIndex)?b.floorIndex=w.floorIndex:Lm(w.floor_index)?b.floorIndex=w.floor_index:b.floorIndex=0,w.video){var q={};"string"==typeof w.video.source&&(q.source=w.video.source),w.video.matrix instanceof r.Matrix4?q.matrix=w.video.matrix.clone():Array.isArray(w.video.matrix)&&(q.matrix=(new r.Matrix4).fromArray(w.video.matrix)),w.video.size instanceof r.Vector2?q.size=w.video.size.clone():Array.isArray(w.video.size)&&(q.size=(new r.Vector2).fromArray(w.video.size)),q.source&&q.matrix&&q.size&&(b.video=q)}u.observers[x]=b}}if(h instanceof Error)return h;for(var K=0,X=u.observers;K<X.length;K++){if((b=X[K]).accessibleNodes)b.accessibleNodes=b.accessibleNodes.filter((function(e){return e<u.observers.length}));else{b.accessibleNodes=[];for(var Y=0;Y<u.observers.length;Y++)u.observers[Y]!==b&&b.accessibleNodes.push(Y)}if(b.visibleNodes)b.visibleNodes=b.visibleNodes.filter((function(e){return e<u.observers.length}));else{b.visibleNodes=[];for(Y=0;Y<u.observers.length;Y++)u.observers[Y]!==b&&b.visibleNodes.push(Y)}}if(h instanceof Error)return h;if(e.initial)if("Floorplan"!==e.initial.mode&&"Topview"!==e.initial.mode&&"Panorama"!==e.initial.mode&&"VRPanorama"!==e.initial.mode&&"Model"!==e.initial.mode&&"DepthPanorama"!==e.initial.mode||(u.initial.mode=e.initial.mode),Lm(e.initial.latitude)&&(u.initial.latitude=e.initial.latitude),Lm(e.initial.longitude)?u.initial.longitude=e.initial.longitude:Lm(e.initial.heading)&&(u.initial.longitude=-(360*(e.initial.heading-.25)+90)/180*Math.PI),Lm(e.initial.fov)&&(u.initial.fov=e.initial.fov),Lm(e.initial.panoIndex)){var Z=u.observers.length>0?u.observers.length-1:0;u.initial.panoIndex=Im(e.initial.panoIndex,0,Z)}else if(Lm(e.initial.pano_index)){Z=u.observers.length>0?u.observers.length-1:0;u.initial.panoIndex=Im(e.initial.pano_index,0,Z)}else if(Lm(e.initial.pano)){Z=u.observers.length>0?u.observers.length-1:0;u.initial.panoIndex=Im(e.initial.pano,0,Z)}if(h instanceof Error)return h;var J=Be(u);return zm.set(J,{works:a,options:o}),J}function Qm(e,t,i){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var n=zm.get(e);if(n){if(t&&!Rm(JSON.parse(n.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}var r=jm(e,null!=t?t:{},i);if(r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message);return r}function Wm(e,t,i){return e+(t-e)*i}function qm(e,t){var i=t[1]-t[0];return e<t[0]?qm(e+i,t):e>=t[1]?qm(e-i,t):e}function Km(e,t,i,n){return n?function(e,t,i,n){var r=n[1]-n[0];return e=qm(e,n),Wm((t=qm(t,n))-e>r/2?e+r:e-t>r/2?e-r:e,t,i)}(e,t,i,n):Wm(e,t,i)}var Xm=function(){function e(e){for(var i in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=Le(),this.startVelocity=0,this.duration=0,this.keyframes=[],e){var n=e[i];"number"==typeof n?(this.value[i]=n,this.config[i]={circle:!1}):(this.value[i]=n.value,this.config[i]={circle:n.circle})}this.keyframes=[{progress:0,value:t.__assign({},this.value)},{progress:1,value:t.__assign({},this.value)}]}return e.prototype.getProgress=function(e){var t=e-this.startTime;return t<0?0:t>=this.duration?1:1-function(e,t,i,n){var r=(t*i+2*e)/Math.pow(i,3),o=-(2*t*i+3*e)/Math.pow(i,2),a=t,s=e;return r*Math.pow(n,3)+o*Math.pow(n,2)+a*n+s}(1,this.startVelocity,this.duration,t)},e.prototype.getValue=function(e){for(var i=1;i<this.keyframes.length;i++)if(this.keyframes[i].progress>e){var n=this.keyframes[i-1],r=this.keyframes[i],o={};for(var a in this.config){var s=(e-n.progress)/(r.progress-n.progress);o[a]=Km(n.value[a],r.value[a],s,this.config[a].circle)}return o}return t.__assign({},this.keyframes[this.keyframes.length-1].value)},e.prototype.getProgressVelocity=function(e){var t=e-this.startTime;return t>=this.duration?0:function(e,t,i,n){var r=(t*i+2*e)/Math.pow(i,3),o=-(2*t*i+3*e)/Math.pow(i,2),a=t;return 3*r*Math.pow(n,2)+2*o*n+a}(1,this.startVelocity,this.duration,t)},e.prototype.update=function(e){return!!this.ended||(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},e.prototype.getKeyFrameSegment=function(e){for(var t=this.getProgress(e),i=1;i<this.keyframes.length;i++)if(this.keyframes[i].progress>t)return[this.keyframes[i-1],this.keyframes[i]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},e.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},e.prototype.set=function(e,t,i,n){var r;void 0===i&&(i=0),isNaN(t)&&(t=0),isNaN(i)&&(i=0),n=null!=n?n:Le();var o=this.getProgress(n),a=this.getValue(o),s={};for(var c in this.config)s[c]=null!==(r=e[c])&&void 0!==r?r:a[c];var l=[{progress:0,value:a},{progress:1,value:s}];return this.setKeyframes(l,t,i,n)},e.prototype.setKeyframes=function(e,i,n,r){var o=this;if(void 0===n&&(n=0),e.length<2)throw new Error("keyframes invalid.");return isNaN(i)&&(i=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise((function(a,s){r=null!=r?r:Le(),o.progress=0,o.ended=!1,o.startTime=r,o.startVelocity=n,o.keyframes=e,o.duration=i,0===i?(o.progress=1,o.value=t.__assign({},e[e.length-1].value)):o.value=t.__assign({},e[0].value),o.callbacks=[a,s]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),Ym=ht(),Zm=new r.Texture(Ym);Ym.onload=function(){return Zm.needsUpdate=!0},Ym.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC";var Jm=new r.RingBufferGeometry(.06,.07,32).rotateX(-Math.PI/2),$m=new r.MeshBasicMaterial({map:Zm,transparent:!0}),eg=new r.SphereBufferGeometry(.12,16,16),tg=new r.MeshBasicMaterial({color:16777215,opacity:0,transparent:!0});function ig(){if("undefined"==typeof document){var e=new r.Texture;return Object.assign(e,{draw:function(e){},retain:!1,pool:!1})}var t=document.createElement("canvas"),i=512,n=256,o=190;t.setAttribute("width",String(i)),t.setAttribute("height",String(i));var a=new r.Texture(t),s=t.getContext("2d");if(!s)throw Error("cannot create canvas context");var c=s.createRadialGradient(n,n,150,n,n,0);function l(){var e=Math.PI/12,t=2*Math.PI/3;s&&(s.beginPath(),s.arc(n,n,o,0*t,1*t-e),s.stroke(),s.beginPath(),s.arc(n,n,o,1*t,2*t-e),s.stroke(),s.beginPath(),s.arc(n,n,o,2*t,3*t-e),s.stroke())}function h(e){s&&(s.clearRect(0,0,i,i),s.lineWidth=20,-1!==e&&(s.globalCompositeOperation="source-over",s.strokeStyle="rgba(255, 255, 255, 1)",l(),s.globalCompositeOperation="source-in",s.beginPath(),s.arc(n,n,o,0,2*Math.PI*e),s.strokeStyle="rgba(255, 255, 255, 1)",s.stroke(),s.globalCompositeOperation="source-over",s.strokeStyle="rgba(255, 255, 255, "+(e?.5:1)+")",l()),s.beginPath(),s.arc(n,n,150,0,2*Math.PI),s.closePath(),s.fillStyle=c,s.fill(),s.fillStyle="rgba(255, 255, 255, 0.01)",s.fillRect(0,0,i,i),a.needsUpdate=!0)}return c.addColorStop(0,"rgba(255, 255, 255, 1)"),c.addColorStop(.15,"rgba(255, 255, 255, 1)"),c.addColorStop(.15,"rgba(255, 255, 255, 0.5)"),c.addColorStop(.4,"rgba(255, 255, 255, 0.0)"),c.addColorStop(1,"rgba(255, 255, 255, 0.0)"),h(0),Object.assign(a,{draw:h,retain:!1,pool:!1})}var ng=[];var rg=ig();rg.draw(0);var og=ig();og.draw(1);var ag=ig();ag.draw(-1);var sg=new r.CircleBufferGeometry(.12,32).rotateX(-Math.PI/2);function cg(){return new r.Mesh(sg,new r.MeshBasicMaterial({map:rg,transparent:!0}))}function lg(e,t){var i=e.map;0===t||1===t?(!0===i.pool&&(i.retain=!1),0===t&&(e.map=rg),1===t&&(e.map=og)):(!0!==i.pool&&(e.map=function(){for(var e=0,t=ng;e<t.length;e++){var i=t[e];if(!1===i.retain)return i}var n=ig();return n.pool=!0,n.retain=!0,ng.push(n),n}()),e.map.draw(t))}var hg=function(e){function i(){var t=e.call(this)||this;return t.loading=!1,t.disabled=!1,t.current=!1,t.progress=0,t.opacity=0,t.hitTestMesh=new r.Mesh(eg,tg),t.add(t.hitTestMesh),t.centerMesh=cg(),t.centerMesh.position.y+=.01,t.add(t.centerMesh),t.loadingMesh=new r.Mesh(Jm,$m),t.loadingMesh.position.y+=.011,t.progressMotion=new Xm({progress:t.progress}),t.opacityMotion=new Xm({opacity:t.opacity}),t.needsRender=!0,t.renderOrder=-2,t}return t.__extends(i,e),i.prototype.setLoading=function(e){var t=this;this.loading=e,this.stopInterval&&this.stopInterval(),e?(this.add(this.loadingMesh),this.stopInterval=Je.shared.add((function(){t.loadingMesh.rotateOnAxis(new r.Vector3(0,1,0),.1),t.needsRender=!0}))):this.remove(this.loadingMesh),this.needsRender=!0},i.prototype.setDisabled=function(e){this.disabled=e,function(e,t){var i=e.map;!0===i.pool&&(i.retain=!1),e.map=t?ag:rg}(this.centerMesh.material,e),this.needsRender=!0},i.prototype.setProgress=function(e){this.setLoading(!1),this.setDisabled(!1),this.progress=e=Im(e,0,1),e!==this.progressMotion.getTargetKeyframe().value.progress&&this.progressMotion.set({progress:e},120).catch(Pe)},i.prototype.setOpacity=function(e){this.opacity=e=Im(e,0,1),this.current&&(e=1),e!==this.opacityMotion.getTargetKeyframe().value.opacity&&this.opacityMotion.set({opacity:e},500).catch(Pe)},i.prototype.setCurrent=function(e){this.current!==e&&(this.current=e,this.setOpacity(this.opacity))},i.prototype.updateTime=function(e,t){this.opacityMotion.ended||(this.opacityMotion.update(e),this.centerMesh.material.opacity=this.opacityMotion.value.opacity,this.needsRender=!0),this.progressMotion.ended||(this.progressMotion.update(e),lg(this.centerMesh.material,this.progressMotion.value.progress),this.needsRender=!0)},i.prototype.dispose=function(){this.setLoading(!1),this.remove(this.hitTestMesh),this.remove(this.centerMesh),this.remove(this.loadingMesh),this.centerMesh.material.dispose()},i}(r.Object3D),ug=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),dg=new Float32Array([0,1,1,1,0,0,1,0]),pg=new Uint8Array([0,2,1,2,3,1]),fg=new r.BufferGeometry;fg.setAttribute("position",new r.BufferAttribute(ug,3)),fg.setAttribute("uv",new r.BufferAttribute(dg,2)),fg.setIndex(new r.BufferAttribute(pg,1));var mg,gg,vg=(mg=ht(),gg=new r.Texture,mg.onload=function(){if("undefined"!=typeof document){var e=256,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){i.drawImage(mg,0,0,e,e),i.globalCompositeOperation="source-out";var n=128;i.beginPath(),i.lineWidth=29.952,i.arc(n,n,84.48,0,2*Math.PI),i.strokeStyle="rgba(255, 255, 255, 0.5)",i.closePath(),i.stroke(),gg.image=t,gg.needsUpdate=!0}}},mg.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",gg),yg=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256,n=199.68;return t.beginPath(),t.arc(i,i,n,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.1)",t.closePath(),t.fill(),t.save(),t.beginPath(),t.arc(i,i,n,0,2*Math.PI),t.strokeStyle="rgba(255, 255, 255, 0.5)",t.lineWidth=10.24,t.closePath(),t.stroke(),new r.CanvasTexture(e)}}return null}(),Ag=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256,n=138.24,o=t.createLinearGradient(i-Math.cos(Math.PI/4)*n,i-Math.sin(Math.PI/4)*n,i+Math.cos(Math.PI/4)*n,i+Math.sin(Math.PI/4)*n);return o.addColorStop(0,"rgba(255, 255, 255, 1)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.6)"),o.addColorStop(1,"rgba(255, 255, 255, 1)"),t.beginPath(),t.lineWidth=33.28,t.arc(i,i,n,0,2*Math.PI),t.strokeStyle=o,t.shadowBlur=38.4,t.shadowColor="rgba(0, 0, 0, 0.3)",t.closePath(),t.stroke(),new r.CanvasTexture(e)}}return null}(),xg=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256,n=199.68,o=t.createLinearGradient(i+Math.cos(Math.PI/4)*n,i-Math.sin(Math.PI/4)*n,i-Math.cos(Math.PI/4)*n,i+Math.sin(Math.PI/4)*n);return o.addColorStop(0,"rgba(255, 255, 255, 0.5)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.1)"),o.addColorStop(1,"rgba(255, 255, 255, 0.5)"),t.beginPath(),t.lineWidth=15.36,t.arc(i,i,n,0,2*Math.PI),t.strokeStyle=o,t.shadowBlur=25.6,t.shadowColor="rgba(0, 0, 0, 0.5)",t.closePath(),t.stroke(),new r.CanvasTexture(e)}}return null}(),bg=function(e,t){var i=128;e.clearRect(0,0,256,256),e.beginPath(),e.lineWidth=29.44,e.arc(i,i,84.48,0,2*Math.PI*t),e.strokeStyle="rgba(255, 255, 255, 0.2)",e.stroke()},wg=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(256)),e.setAttribute("height",String(256));var t=e.getContext("2d");t&&bg(t,2*Math.PI);var i=new r.CanvasTexture(e);return Object.assign(i,{setProgress:function(e){t&&(bg(t,e),i.needsUpdate=!0)}})}return null},Mg=[],Eg=wg(),Sg=function(e){function i(){var i=e.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.ringRotateMotion=new Xm({angle:0}),i.tapMotion=new Xm({scale:1,opacity:1}),i.progressMotion=new Xm({progress:0}),i.progressOpacityMotion=new Xm({opacity:0}),i.opacityMotion=new Xm({opacity:0});var n={blending:r.CustomBlending,blendSrc:r.SrcAlphaFactor,blendDst:r.OneMinusSrcAlphaFactor,blendSrcAlpha:r.OneFactor,blendDstAlpha:r.OneMinusSrcAlphaFactor,depthWrite:!1};return i.centerMesh=new r.Mesh(fg,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:Ag,opacity:0}))),i.ringMesh=new r.Mesh(fg,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:xg,opacity:0}))),i.loadingMesh=new r.Mesh(fg,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:vg,opacity:.5}))),i.disableMesh=new r.Mesh(fg,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:yg,opacity:0}))),i.progressMesh=new r.Mesh(fg,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:Eg,opacity:0}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.ringMesh.position.y=.003,i.disableMesh.position.y=.002,i.centerMesh.position.y=.002,i.loadingMesh.position.y=.005,i.progressMesh.position.y=.004,i.centerMesh.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.progressMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.renderOrder=-2,i.add(i.centerMesh),i.add(i.ringMesh),i.add(i.progressMesh),i.add(i.loadingMesh),i.add(i.disableMesh),i.needsRender=!0,i}return t.__extends(i,e),i.prototype.setProgress=function(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Im(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(Pe),0===e?(this.progressOpacityMotion.set({opacity:0},300).catch(Pe),this.progressMotion.set({progress:Im(1.2*e,0,1)},0).catch(Pe)):this.progressMotion.set({progress:Im(1.2*e,0,1)},100).catch(Pe)),this.progress=e)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Im(e,0,1),this.opacityMotion.set({opacity:e},500).catch(Pe))},i.prototype.setCurrent=function(e){if(this.current!==e){if(!0===e&&this.ringRotateMotion.ended){var t=[{progress:0,value:{angle:0}},{progress:1,value:{angle:2*Math.PI}}];this.ringRotateMotion.setKeyframes(t,5e3).catch(Pe)}this.current=e}},i.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=e,this.needsRender=!0)},i.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.ringMesh.visible=!e,this.centerMesh.visible=!e,this.needsRender=!0)},i.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(Pe),this.progressMotion.set({progress:0},0).catch(Pe),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(Pe),e.progressMotion.set({progress:e.progress},120).catch(Pe)})).catch(Pe)},i.prototype.updateTime=function(e,t){var i;if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==Eg&&(Mg.push(this.progressMesh.material.map),this.progressMesh.material.map=Eg);else if(1===n)this.progressMesh.material.map!==Eg&&(Mg.push(this.progressMesh.material.map),this.progressMesh.material.map=Eg);else{if(this.progressMesh.material.map===Eg){var o=Mg.pop()||wg();this.progressMesh.material.map=o}null===(i=this.progressMesh.material.map)||void 0===i||i.setProgress(n)}this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var a=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=a,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);a=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=a,this.ringMesh.material.opacity=a,this.disableMesh.material.opacity=a,this.loadingMesh.material.opacity=a,this.needsRender=!0}if(!0===this.loadingMesh.visible&&(this.loadingMesh.rotateY(-t/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(e);var s=this.tapMotion.value.scale;this.centerMesh.scale.set(s,s,s),this.ringMesh.scale.set(s,s,s),this.progressMesh.scale.set(s,s,s);a=this.opacityMotion.value.opacity*this.tapMotion.value.opacity;this.centerMesh.material.opacity=a,this.ringMesh.material.opacity=a,this.disableMesh.material.opacity=a,this.loadingMesh.material.opacity=a,this.needsRender=!0}this.ringRotateMotion.ended||(this.ringRotateMotion.update(e),this.ringMesh.quaternion.setFromEuler(new r.Euler(0,this.ringRotateMotion.value.angle,0)),this.needsRender=!0)},i.prototype.dispose=function(){this.ringRotateMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.progressMesh.material.map!==Eg&&(Mg.push(this.progressMesh.material.map),this.progressMesh.material.map=null),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.loadingMesh.material.dispose(),this.progressMesh.material.dispose()},i}(r.Object3D),_g=new r.CircleBufferGeometry(.1,16),Tg=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var n=256,o=192,a=76.8;i.lineWidth=a,i.arc(n,n,o,0,2*Math.PI),i.strokeStyle="rgba(147, 162, 255, 0.3)",i.shadowBlur=12.8,i.shadowColor="rgba(255, 255, 255, 0.6)",i.stroke(),i.lineWidth=a,i.arc(n,n,o,0,2*Math.PI);var s=i.createRadialGradient(n,n,153.6,n,n,230.4);s.addColorStop(0,"rgba(255, 255, 255, 0.3)"),s.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),s.addColorStop(1,"rgba(255, 255, 255, 0.3)"),i.strokeStyle=s,i.stroke(),i.beginPath(),i.lineWidth=4.8,i.arc(n,n,228,0,2*Math.PI);var c=i.createLinearGradient(0,0,e,0);return c.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),c.addColorStop(.08,"rgba(255, 255, 255, 0.0)"),c.addColorStop(.92,"rgba(255, 255, 255, 0.0)"),c.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=c,i.stroke(),new r.CanvasTexture(t)}}return null}(),Cg=new r.MeshBasicMaterial({map:Tg,transparent:!0}),Ig=function(e){function i(){var t=e.call(this)||this;return t.ringMesh=new r.Mesh(_g,Cg),t.ringMesh.renderOrder=-3,t.add(t.ringMesh),t}return t.__extends(i,e),i.prototype.dispose=function(){this.remove(this.ringMesh)},i}(r.Object3D);function Pg(e,t,i){var n=Math.abs(e-t);return n<.001||void 0!==i&&Math.abs(i-n)<.001}function Rg(e,t,i){return!Pg(e,t,i)}function Lg(e,t){return e.distanceTo(t)<.001}function Bg(e,t){return!Lg(e,t)}var Dg=new r.Vector3(0,0,0),Og=function(e){function i(t,i){void 0===i&&(i=Dg);var n=e.call(this)||this,o=new r.BoxBufferGeometry(t.max.x-t.min.x+2*i.x,t.max.y-t.min.y+2*i.y,t.max.z-t.min.z+2*i.z,1,1);o.groups.length=0,o.groups.push({start:0,count:36,materialIndex:0}),o.applyMatrix4((new r.Matrix4).makeScale(-1,1,1));var a=new mt;a.defines.USE_MAP=!1,a.defines.USE_UV=!1,a.uniforms.diffuse.value=new r.Color(16777215);var s=new ot(o,[a]);return s.floorIndex=-1,s.position.copy(t.getCenter(new r.Vector3)),s.frustumCulled=!1,n.renderOrder=-3,n.add(s),n.boundingBox=new r.Box3,n.computeBoundingBox(),n}return t.__extends(i,e),i.prototype.computeBoundingBox=function(){this.boundingBox.setFromObject(this)},i.prototype.dispose=function(){this.disposeMaterial(),this.disposeGeometry()},i}(st);function Ng(e,t){return void 0===t&&(t=Dg),new Og(e,t)}function kg(e){var t=e.getError();if(t===e.NO_ERROR)return null;switch(t){case e.INVALID_ENUM:return new Error("webgl error: INVALID_ENUM");case e.INVALID_VALUE:return new Error("webgl error: INVALID_VALUE");case e.INVALID_OPERATION:return new Error("webgl error: INVALID_OPERATION");case e.INVALID_FRAMEBUFFER_OPERATION:return new Error("webgl error: INVALID_FRAMEBUFFER_OPERATION");case e.OUT_OF_MEMORY:return new Error("webgl error: OUT_OF_MEMORY");case e.CONTEXT_LOST_WEBGL:return new Error("webgl error: CONTEXT_LOST_WEBGL");default:return null}}var Fg=2*Math.PI;function Vg(e){return e>=0&&e<Fg?e:(e%Fg+Fg)%Fg}var zg=Math.PI,Hg=2*zg;function Ug(e,t,i){if(e===t)return t;var n=t-e;return Math.abs(n)<=i?t:e+(n>0?1:-1)*i}!function(){try{var e=document.createElement("canvas");!window.WebGLRenderingContext||!e.getContext("webgl")&&e.getContext("experimental-webgl")}catch(e){return!1}}();var Gg=function(){var e="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"node";return/android/i.test(e)||/webos/i.test(e)||/ipad|iphone|ipod/i.test(e)||/iemobile/i.test(e)||/opera mini/i.test(e)||/blackberry/i.test(e)||/windows phone/i.test(e)};function jg(e,t){e.mode=t.mode,e.panoIndex=t.panoIndex,e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.offset.copy(t.offset)}function Qg(e,t){return e.panoIndex===t.panoIndex&&e.mode===t.mode&&Pg(e.longitude,t.longitude,2*Math.PI)&&Pg(e.latitude,t.latitude)&&Pg(e.fov,t.fov)&&Lg(e.offset,t.offset)}var Wg=function(e){return Number(e)};function qg(e,t,i){var n;void 0===t&&(t=Wg),void 0===i&&(i=!1);for(var r,o=1/0,a=0,s=e;a<s.length;a++){var c=s[a],l=t(c);l<=o&&(r=(n=[c,l])[0],o=n[1])}return i?[r,o]:r}function Kg(e){for(var t in e)return!1;return!0}function Xg(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}
|
|
368
|
+
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
369
|
+
* http://hammerjs.github.io/
|
|
370
|
+
*
|
|
371
|
+
* Copyright (c) 2016 Jorik Tangelder;
|
|
372
|
+
* Licensed under the MIT license */var Yg=function(e,t,i,n){var r,o=["","webkit","Moz","MS","ms","o"],a=t.createElement?t.createElement("div"):n,s=Math.round,c=Math.abs,l=Date.now;function h(e,t,i){return setTimeout(v(e,i),t)}function u(e,t,i){return!!Array.isArray(e)&&(d(e,i[t],i),!0)}function d(e,t,i){var r;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==n)for(r=0;r<e.length;)t.call(i,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(i,e[r],r,e)}function p(t,i,n){var r="DEPRECATED METHOD: "+i+"\n"+n+" AT \n";return function(){var i=new Error("get-stack-trace"),n=i&&i.stack?i.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,n),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===n||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(r!==n&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=p((function(e,t,i){for(var r=Object.keys(t),o=0;o<r.length;)(!i||i&&e[r[o]]===n)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),m=p((function(e,t){return f(e,t,!0)}),"merge","Use `assign`.");function g(e,t,i){var n,o=t.prototype;(n=e.prototype=Object.create(o)).constructor=e,n._super=o,i&&r(n,i)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return"function"==typeof e?e.apply(t&&t[0]||n,t):e}function A(e,t){return e===n?t:e}function x(e,t,i){d(E(t),(function(t){e.addEventListener(t,i,!1)}))}function b(e,t,i){d(E(t),(function(t){e.removeEventListener(t,i,!1)}))}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function M(e,t){return e.indexOf(t)>-1}function E(e){return e.trim().split(/\s+/g)}function S(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var n=0;n<e.length;){if(i&&e[n][i]==t||!i&&e[n]===t)return n;n++}return-1}function _(e){return Array.prototype.slice.call(e,0)}function T(e,t,i){for(var n=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];S(r,a)<0&&n.push(e[o]),r[o]=a,o++}return i&&(n=t?n.sort((function(e,i){return e[t]>i[t]})):n.sort()),n}function C(e,t){for(var i,r,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((r=(i=o[s])?i+a:t)in e)return r;s++}return n}var I=1;function P(t){var i=t.ownerDocument||t;return i.defaultView||i.parentWindow||e}var R="ontouchstart"in e,L=C(e,"PointerEvent")!==n,B=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),D="touch",O="mouse",N=24,k=["x","y"],F=["clientX","clientY"];function V(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&i.handler(t)},this.init()}function z(e,t,i){var r=i.pointers.length,o=i.changedPointers.length,a=1&t&&r-o==0,s=12&t&&r-o==0;i.isFirst=!!a,i.isFinal=!!s,a&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,r=t.pointers,o=r.length;i.firstInput||(i.firstInput=H(t));o>1&&!i.firstMultiple?i.firstMultiple=H(t):1===o&&(i.firstMultiple=!1);var a=i.firstInput,s=i.firstMultiple,h=s?s.center:a.center,u=t.center=U(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=W(h,u),t.distance=Q(h,u),function(e,t){var i=t.center,n=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=e.offsetDelta={x:i.x,y:i.y});t.deltaX=r.x+(i.x-n.x),t.deltaY=r.y+(i.y-n.y)}(i,t),t.offsetDirection=j(t.deltaX,t.deltaY);var d=G(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=s?function(e,t){return Q(t[0],t[1],F)/Q(e[0],e[1],F)}(s.pointers,r):1,t.rotation=s?function(e,t){return W(t[1],t[0],F)+W(e[1],e[0],F)}(s.pointers,r):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,function(e,t){var i,r,o,a,s=e.lastInterval||t,l=t.timeStamp-s.timeStamp;if(8!=t.eventType&&(l>25||s.velocity===n)){var h=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,d=G(l,h,u);r=d.x,o=d.y,i=c(d.x)>c(d.y)?d.x:d.y,a=j(h,u),e.lastInterval=t}else i=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=i,t.velocityX=r,t.velocityY=o,t.direction=a}(i,t);var p=e.element;w(t.srcEvent.target,p)&&(p=t.srcEvent.target);t.target=p}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function H(e){for(var t=[],i=0;i<e.pointers.length;)t[i]={clientX:s(e.pointers[i].clientX),clientY:s(e.pointers[i].clientY)},i++;return{timeStamp:l(),pointers:t,center:U(t),deltaX:e.deltaX,deltaY:e.deltaY}}function U(e){var t=e.length;if(1===t)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var i=0,n=0,r=0;r<t;)i+=e[r].clientX,n+=e[r].clientY,r++;return{x:s(i/t),y:s(n/t)}}function G(e,t,i){return{x:t/e||0,y:i/e||0}}function j(e,t){return e===t?1:c(e)>=c(t)?e<0?2:4:t<0?8:16}function Q(e,t,i){i||(i=k);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return Math.sqrt(n*n+r*r)}function W(e,t,i){i||(i=k);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return 180*Math.atan2(r,n)/Math.PI}V.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(P(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(P(this.element),this.evWin,this.domHandler)}};var q={mousedown:1,mousemove:2,mouseup:4},K="mousedown",X="mousemove mouseup";function Y(){this.evEl=K,this.evWin=X,this.pressed=!1,V.apply(this,arguments)}g(Y,V,{handler:function(e){var t=q[e.type];1&t&&(0===e.button||2===e.button)&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:O,srcEvent:e}))}});var Z={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:D,3:"pen",4:O,5:"kinect"},$="pointerdown",ee="pointermove pointerup pointercancel";function te(){this.evEl=$,this.evWin=ee,V.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&($="MSPointerDown",ee="MSPointerMove MSPointerUp MSPointerCancel"),g(te,V,{handler:function(e){var t=this.store,i=!1,n=!1,r=e.type.toLowerCase().replace("ms",""),o=Z[r],a=J[e.pointerType]||e.pointerType,s=a==D,c=S(t,e.pointerId,"pointerId");1&o&&(0===e.button||2===e.button||s)?c<0&&(t.push(e),c=t.length-1):12&o?i=!0:s||0!==e.buttons||(i=!0,n=!0,o=Z.pointerup),c<0||(n||(t[c]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[c]}),i&&t.splice(c,1))}});var ie={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ne="touchstart",re="touchstart touchmove touchend touchcancel";function oe(){this.evTarget=ne,this.evWin=re,this.started=!1,V.apply(this,arguments)}function ae(e,t){var i=_(e.touches),n=_(e.changedTouches);return 12&t&&(i=T(i.concat(n),"identifier",!0)),[i,n]}g(oe,V,{handler:function(e){var t=ie[e.type];if(1===t&&(this.started=!0),this.started){var i=ae.call(this,e,t);12&t&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:e})}}});var se={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ce="touchstart touchmove touchend touchcancel";function le(){this.evTarget=ce,this.targetIds={},V.apply(this,arguments)}function he(e,t){var i=_(e.touches),n=this.targetIds;if(3&t&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,o,a=_(e.changedTouches),s=[],c=this.target;if(o=i.filter((function(e){return w(e.target,c)})),1===t)for(r=0;r<o.length;)n[o[r].identifier]=!0,r++;for(r=0;r<a.length;)n[a[r].identifier]&&s.push(a[r]),12&t&&delete n[a[r].identifier],r++;return s.length?[T(o.concat(s),"identifier",!0),s]:void 0}g(le,V,{handler:function(e){var t=se[e.type],i=he.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:e})}});function ue(){V.apply(this,arguments);var e=v(this.handler,this);this.touch=new le(this.manager,e),this.mouse=new Y(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function de(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,pe.call(this,t)):12&e&&pe.call(this,t)}function pe(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var e=n.indexOf(i);e>-1&&n.splice(e,1)}),2500)}}function fe(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],o=Math.abs(t-r.x),a=Math.abs(i-r.y);if(o<=25&&a<=25)return!0}return!1}g(ue,V,{handler:function(e,t,i){var n=i.pointerType==D,r=i.pointerType==O;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)de.call(this,t,i);else if(r&&fe.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var me=a?C(a.style,"touchAction"):n,ge=me!==n,ve="compute",ye="auto",Ae="manipulation",xe="none",be="pan-x",we="pan-y",Me=function(){if(!ge)return!1;var t={},i=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){t[n]=!i||e.CSS.supports("touch-action",n)})),t}();function Ee(e,t){this.manager=e,this.set(t)}Ee.prototype={set:function(e){e==ve&&(e=this.compute()),ge&&this.manager.element.style&&Me[e]&&(this.manager.element.style[me]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,(function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(M(e,xe))return xe;var t=M(e,be),i=M(e,we);if(t&&i)return xe;if(t||i)return t?be:we;if(M(e,Ae))return Ae;return ye}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var n=this.actions,r=M(n,xe)&&!Me.none,o=M(n,we)&&!Me["pan-y"],a=M(n,be)&&!Me["pan-x"];if(r){var s=1===e.pointers.length,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!a||!o)return r||o&&6&i||a&&i&N?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Se=32;function _e(e){this.options=r({},this.defaults,e||{}),this.id=I++,this.manager=null,this.options.enable=A(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Te(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Ce(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Ie(e,t){var i=t.manager;return i?i.get(e):e}function Pe(){_e.apply(this,arguments)}function Re(){Pe.apply(this,arguments),this.pX=null,this.pY=null}function Le(){Pe.apply(this,arguments)}function Be(){_e.apply(this,arguments),this._timer=null,this._input=null}function De(){Pe.apply(this,arguments)}function Oe(){Pe.apply(this,arguments)}function Ne(){_e.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ke(e,t){return(t=t||{}).recognizers=A(t.recognizers,ke.defaults.preset),new Fe(e,t)}_e.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(u(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ie(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return u(e,"dropRecognizeWith",this)||(e=Ie(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(u(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Ie(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(u(e,"dropRequireFailure",this))return this;e=Ie(e,this);var t=S(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,i=this.state;function n(i){t.manager.emit(i,e)}i<8&&n(t.options.event+Te(i)),n(t.options.event),e.additionalEvent&&n(e.additionalEvent),i>=8&&n(t.options.event+Te(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Se},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!y(this.options.enable,[this,t]))return this.reset(),void(this.state=Se);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},g(Pe,_e,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,i=e.eventType,n=6&t,r=this.attrTest(e);return n&&(8&i||!r)?16|t:n||r?4&i?8|t:2&t?4|t:2:Se}}),g(Re,Pe,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(we),e&N&&t.push(be),t},directionTest:function(e){var t=this.options,i=!0,n=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(6&t.direction?(r=0===o?1:o<0?2:4,i=o!=this.pX,n=Math.abs(e.deltaX)):(r=0===a?1:a<0?8:16,i=a!=this.pY,n=Math.abs(e.deltaY))),e.direction=r,i&&n>t.threshold&&r&t.direction},attrTest:function(e){return Pe.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ce(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(Le,Pe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),g(Be,_e,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ye]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!n||!i||12&e.eventType&&!r)this.reset();else if(1&e.eventType)this.reset(),this._timer=h((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Se},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),g(De,Pe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),g(Oe,Pe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Re.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return 30&i?t=e.overallVelocity:6&i?t=e.overallVelocityX:i&N&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Ce(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Ne,_e,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ae]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(n&&r&&i){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||Q(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=h((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Se},failTimeout:function(){return this._timer=h((function(){this.state=Se}),this.options.interval,this),Se},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ke.VERSION="2.0.7",ke.defaults={domEvents:!1,touchAction:ve,enable:!0,inputTarget:null,inputClass:null,preset:[[De,{enable:!1}],[Le,{enable:!1},["rotate"]],[Oe,{direction:6}],[Re,{direction:6},["swipe"]],[Ne],[Ne,{event:"doubletap",taps:2},["tap"]],[Be]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Fe(e,t){var i;this.options=r({},ke.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((i=this).options.inputClass||(L?te:B?le:R?ue:Y))(i,z),this.touchAction=new Ee(this,this.options.touchAction),Ve(this,!0),d(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function Ve(e,t){var i,n=e.element;n.style&&(d(e.options.cssProps,(function(r,o){i=C(n.style,o),t?(e.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}return Fe.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var i;this.touchAction.preventDefaults(e);var n=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],2===t.stopped||r&&i!=r&&!i.canRecognizeWith(r)?i.reset():i.recognize(e),!r&&14&i.state&&(r=t.curRecognizer=i),o++}},get:function(e){if(e instanceof _e)return e;for(var t=this.recognizers,i=0;i<t.length;i++)if(t[i].options.event==e)return t[i];return null},add:function(e){if(u(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(u(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,i=S(t,e);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this},on:function(e,t){if(e!==n&&t!==n){var i=this.handlers;return d(E(e),(function(e){i[e]=i[e]||[],i[e].push(t)})),this}},off:function(e,t){if(e!==n){var i=this.handlers;return d(E(e),(function(e){t?i[e]&&i[e].splice(S(i[e],t),1):delete i[e]})),this}},emit:function(e,i){this.options.domEvents&&function(e,i){var n=t.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}(e,i);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){i.type=e,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](i),r++}},destroy:function(){this.element&&Ve(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(ke,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Se,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:N,DIRECTION_ALL:30,Manager:Fe,Input:V,TouchAction:Ee,TouchInput:le,MouseInput:Y,PointerEventInput:te,TouchMouseInput:ue,SingleTouchInput:oe,Recognizer:_e,AttrRecognizer:Pe,Tap:Ne,Pan:Re,Swipe:Oe,Pinch:Le,Rotate:De,Press:Be,on:x,off:b,each:d,merge:m,extend:f,assign:r,inherit:g,bindFn:v,prefixed:C}),ke}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});function Zg(e,t,i){var n=t.offsetWidth,o=t.offsetHeight,a=t.getBoundingClientRect(),s=a.top,c=a.left;return i&&(c+=n*i.left,s+=o*(1-i.bottom-i.height),n*=i.width,o*=i.height),new r.Vector2((e.x-c)/n*2-1,-(e.y-s)/o*2+1)}var Jg=new r.OrthographicCamera(-1,1,1,-1,0,1),$g=new r.BufferGeometry;$g.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),$g.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));var ev=new r.Mesh($g),tv=new r.Scene;tv.add(ev);var iv=function(){function e(e,t){var i;this.renderer=e,this.material=new r.ShaderMaterial({vertexShader:null!==(i=t.vertex)&&void 0!==i?i:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:t.fragment,uniforms:Object.assign({inputBuffer:new r.Uniform(null)},t.uniforms),defines:Object.assign({},t.defines),blending:r.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),n=ev.material;this.material.uniforms.inputBuffer.value=e.texture,ev.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(tv,Jg),this.renderer.setRenderTarget(i),ev.material=n},e.prototype.dispose=function(){this.material.dispose()},e}(),nv=function(){function e(e){this.renderer=e,this.material=new r.ShaderMaterial({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform vec3 inputValue;\nvoid main() {\n gl_FragColor = vec4(inputValue, 1.0);\n}\n",uniforms:Object.assign({inputValue:new r.Uniform(new r.Vector3)}),blending:r.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var i=this.renderer.getRenderTarget(),n=ev.material;this.material.uniforms.inputValue.value.copy(e),ev.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(tv,Jg),this.renderer.setRenderTarget(i),ev.material=n},e.prototype.dispose=function(){this.material.dispose()},e}(),rv=function(e){function i(t){return e.call(this,t,{fragment:"\nuniform sampler2D inputBuffer;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(inputBuffer, vUv);\n}\n"})||this}return t.__extends(i,e),i}(iv),ov=function(){function e(e){this.enable=!0,this.renderer=e,this.copyPass=new rv(this.renderer)}return e.prototype.render=function(e,t){this.copyPass.render(e,t)},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),av=function(e){function i(t){var n,r=this;r=e.call(this)||this;var o=i.parseArgs(t);return r.pending=!0,r.userAction=o.initial[3],r.destroyed=!1,r.ident=o.ident,r.scene=o.scene,r.helper=o.helper,r.camera=o.camera,r.renderer=o.renderer,r.scissor=o.scissor,r.element=o.element,r.model=o.model,r.enableIOSEDR=null!==(n=o.enableIOSEDR)&&void 0!==n&&n,r.work=o.work,r.imageOptions=o.imageOptions,r.videoTexture=o.videoTexture,r.networkSubscribe=o.networkSubscribe,r.requestProxy=o.requestProxy,r.needsRender=!0,r.maxFov=120,r.minFov=40,r.maxLatitude=+Math.PI/2,r.minLatitude=-Math.PI/2,r.cameraMotion=new Xm({longitude:{value:r.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:r.camera.pose.latitude,fov:r.camera.pose.fov}),r.eventUnbinds=[o.element].concat(o.extraElements||[]).map((function(e){return r.bindEvents(e)})),Je.shared.add((function(){return r.initAnimation.apply(r,o.initial)}),!0),r}return t.__extends(i,e),i.parseArgs=function(e){return t.__assign({},e)},i.initAnimationEndState=function(e){var t=this.parseArgs(e);return{longitude:t.camera.pose.longitude,latitude:t.camera.pose.latitude,fov:t.camera.pose.fov,offset:t.camera.pose.offset.clone(),distance:t.camera.pose.distance}},i.prototype.destroy=function(){var e;this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var t=0,i=this.eventUnbinds;t<i.length;t++){(0,i[t])()}this.effect&&(this.effect.dispose(),delete this.effect),delete this.panState,null===(e=this.pressState)||void 0===e||e.stop(),delete this.pressState},i.prototype.isReady=function(){return!1===this.pending&&!0===this.cameraMotion.ended},i.prototype.bindExtraElement=function(e){for(var t=0,i=this.eventUnbinds;t<i.length;t++){if(i[t].element===e)return}this.eventUnbinds.push(this.bindEvents(e))},i.prototype.unbindExtraElement=function(e){for(var t=[],i=0,n=this.eventUnbinds;i<n.length;i++){var r=n[i];r.element===e?r():t.push(r)}this.eventUnbinds=t},i.prototype.updateRenderSize=function(){this.needsRender=!0},i.prototype.updateModel=function(e){this.model=e,this.needsRender=!0},i.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.userAction=r,!1},i.prototype.updateTime=function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];if(!this.destroyed){var r={};this.cameraMotion.ended&&(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),Kg(r)&&this.setCamera(r)}},i.prototype.render=function(){this.renderer.render(this.scene,this.camera)},i.prototype.postProcessing=function(e,t){this.destroyed||(this.effect||(this.effect=new ov(this.renderer)),this.effect.render(e,t))},i.prototype.updateCamera=function(e,t,i){return this.userAction=i,this.cameraMotion.set(e,t)},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Le())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}},i.prototype.moveToPano=function(e,t,i){void 0===t&&(t={}),this.userAction=i;var n={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};t.moveStartCallback&&t.moveStartCallback(e,n),this.emit("moveToPano",e,this.userAction),this.emit("panoWillArrive",e,n,this.userAction),this.emit("panoArrived",e,n,this.userAction),t.moveEndCallback&&t.moveEndCallback(e,n)},i.prototype.initAnimation=function(e,t,i,n){this.pending=!1,this.userAction=n},i.prototype.setCamera=function(e){var t,i,n,r,o;void 0===e&&(e={});var a=null!==(t=e.longitude)&&void 0!==t?t:this.camera.pose.longitude,s=null!==(i=e.latitude)&&void 0!==i?i:this.camera.pose.latitude,c=null!==(n=e.fov)&&void 0!==n?n:this.camera.pose.fov,l=null!==(r=e.distance)&&void 0!==r?r:this.camera.pose.distance,h=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,u=this.camera.position.clone(),d=Rg(a,this.camera.pose.longitude,2*Math.PI)||Rg(s,this.camera.pose.latitude),p=Rg(c,this.camera.pose.fov),f=Rg(l,this.camera.pose.distance),m=Bg(h,this.camera.pose.offset);this.camera.setFromPose({longitude:a,latitude:s,fov:c,distance:l,offset:h});var g=Bg(u,this.camera.position);p&&this.emit("cameraFovUpdate",c,this.userAction),d&&this.emit("cameraDirectionUpdate",{longitude:a,latitude:s},this.userAction),g&&this.emit("cameraPositionUpdate",this.camera.position.clone(),this.userAction),(p||d||m||f)&&this.emit("cameraUpdate",{longitude:a,latitude:s,fov:c,offset:h,distance:l},this.userAction),this.needsRender=!0},i.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return qt(e,["x","y"])}));this.emit("wantsGesture","pan",n,e.isFinal)||this.emit("gesture","pan",n,e.isFinal)}},i.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return qt(e,["x","y"])}));this.emit("wantsGesture","tap",t,!0)||this.emit("gesture","tap",t,!0)},i.prototype.onPressGesture=function(e,t){var i,n=[e];if(this.emit("wantsGesture","press",n,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;this.emit("gesture","press",n,t)},i.prototype.onPinchGesture=function(e){var t=e.pointers.map((function(e){return qt(e,["x","y"])}));this.emit("wantsGesture","pinch",t,e.isFinal)||this.emit("gesture","pinch",t,e.isFinal)},i.prototype.onMouseWheel=function(e){var t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,i=[{x:e.clientX,y:e.clientY,delta:t}];this.emit("wantsGesture","mouseWheel",i,!1)||this.emit("gesture","mouseWheel",i,!1)},i.prototype.onMouseMove=function(e){},i.prototype.onMouseOut=function(){},i.prototype.relativeClientPosition=function(e){return Zg(e,this.element,this.scissor)},i.prototype.bindEvents=function(e){var t=this,i=function(e){var i=Zg(e,t.element,t.scissor);return!(Math.abs(i.x)>1||Math.abs(i.y)>1)},n=new Yg.Manager(e),r=function(e){return e.session.firstInput||null};n.add(new Yg.Pan({threshold:10,pointers:0})),n.add(new Yg.Tap({interval:410})),n.add(new Yg.Pinch({threshold:0,pointers:2})),n.on("panstart pan",(function(e){var o=r(n);o&&!i(o.center)||(t.onPanGesture(e),f())})),n.on("tap",(function(e){if("mouse"!==e.pointerType||0===e.srcEvent.button){var o=r(n);o&&!i(o.center)||(t.onTapGesture(e),f())}})),n.on("pinchstart pinch pinchend",(function(e){var o=r(n);o&&!i(o.center)||(t.onPinchGesture(e),f())}));var o=null,a=null,s=function(e,t,i){var n="pinchend"===e?t:t-i.deltaY/280;return{type:e,target:i.target,pointerType:"mouse",srcEvent:i,pointers:[{x:i.clientX,y:i.clientY}],isFirst:"pinchstart"===e,isFinal:"pinchend"===e,scale:Im(n,.1,10),center:{x:i.clientX,y:i.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},c=function(e){var n,r={x:e.clientX,y:e.clientY};if(i(r)){if(e.preventDefault(),e.ctrlKey){var c=null!==(n=null==o?void 0:o.prevInput.scale)&&void 0!==n?n:1,l=s(o?"pinch":"pinchstart",c,e);null===o?o={firstInput:l,prevInput:l}:o.prevInput=l,t.onPinchGesture(l),null!==a&&window.clearTimeout(a),a=window.setTimeout((function(){var i;a=null;var n=null!==(i=null==o?void 0:o.prevInput.scale)&&void 0!==i?i:1,r=s("pinchend",n,e);o=null,t.onPinchGesture(r)}),200)}else t.onMouseWheel(e);f()}},l=function(e){if(!Gg()){var n={x:e.clientX,y:e.clientY};i(n)?(t.onMouseMove(e),t.pressState&&Math.abs(e.clientX-t.pressState.x)>10&&Math.abs(e.clientY-t.pressState.y)>10&&f()):t.onMouseOut()}},h=function(){t.onMouseOut(),f()},u=function(e,n){if(i(e)){t.pressState={x:e.x,y:e.y,time:t.pressState?t.pressState.time:n,stop:Pe};var r=n-t.pressState.time;t.onPressGesture({x:e.x,y:e.y,delta:r},!1),t.pressState&&(t.pressState.stop=Je.shared.add((function(t){return u({x:e.x,y:e.y},t)}),!0,1))}else f()},d=function(e){f(),e.touches.length>1||e.changedTouches.length<=0||u({x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},Le())},p=function(e){f(),u({x:e.clientX,y:e.clientY},Le())},f=function(){var e;if(t.pressState){var i=Le()-t.pressState.time;t.onPressGesture({x:t.pressState.x,y:t.pressState.y,delta:i},!0),null===(e=t.pressState)||void 0===e||e.stop(),delete t.pressState}},m=null,g=function(e){var t,i="pinch",n=!1,r=!1;switch(e.type){case"gesturestart":i="pinchstart",n=!0;break;case"gestureend":i="pinchend",r=!0}return{type:i,target:e.target,pointerType:"mouse",srcEvent:e,pointers:[{x:e.clientX,y:e.clientY}],isFirst:n,isFinal:r,scale:null!==(t=e.scale)&&void 0!==t?t:1,center:{x:e.clientX,y:e.clientY},velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0}},v=function(e){if(e.preventDefault(),!Gg()){var n=g(e),r=(m={firstInput:n}).firstInput;r&&!i(r.center)||t.onPinchGesture(n)}},y=function(e){if(e.preventDefault(),!Gg()&&m){var n=g(e),r=m.firstInput;r&&!i(r.center)||t.onPinchGesture(n)}},A=function(e){if(e.preventDefault(),!Gg()&&m){var n=g(e),r=m.firstInput;m=null,r&&!i(r.center)||t.onPinchGesture(n)}},x=function(t){if(t&&"function"==typeof t.preventDefault&&t.currentTarget===e&&t.preventDefault(),"function"==typeof getSelection){var i=getSelection();i&&i.focusNode&&(i.removeAllRanges&&i.removeAllRanges(),i.empty&&i.empty())}};e.addEventListener("wheel",c,{passive:!1}),e.addEventListener("mousemove",l,!1),e.addEventListener("mouseout",h,!1),e.addEventListener("touchstart",d,!1),e.addEventListener("touchend",f,!1),e.addEventListener("touchcancel",f,!1),e.addEventListener("mousedown",p,!1),e.addEventListener("mouseup",f,!1),e.addEventListener("gesturestart",v,{passive:!1}),e.addEventListener("gesturechange",y,{passive:!1}),e.addEventListener("gestureend",A,{passive:!1}),e.addEventListener("touchstart",x,!1),e.addEventListener("contextmenu",x,!1);return Object.assign((function(){n.destroy(),e.removeEventListener("wheel",c,!1),e.removeEventListener("mousemove",l,!1),e.removeEventListener("mouseout",h,!1),e.removeEventListener("touchstart",d,!1),e.removeEventListener("touchend",f,!1),e.removeEventListener("touchcancel",f,!1),e.removeEventListener("mousedown",p,!1),e.removeEventListener("mouseup",f,!1),e.removeEventListener("gesturestart",v,!1),e.removeEventListener("gesturechange",y,!1),e.removeEventListener("gestureend",A,!1),e.removeEventListener("touchstart",x,!1),e.removeEventListener("contextmenu",x,!1)}),{element:e})},i}(Ie),sv=function(e){function i(t){var n,r,o,a,s=this,c=i.parseArgs(t);return(s=e.call(this,c)||this).defaultLongitude=c.defaultLongitude,s.defaultLatitude=c.defaultLatitude,s.defaultFov=c.defaultFov,s.maxFov=c.maxFov,s.minFov=c.minFov,s.maxLatitude=c.maxLatitude,s.minLatitude=c.minLatitude,s.locationMotion=new Xm({x:s.camera.pose.offset.x,y:s.camera.pose.offset.y,z:s.camera.pose.offset.z,distance:s.camera.pose.distance,modelAlpha:null!==(r=null===(n=s.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:null!==(a=null===(o=s.model.getMaterial())||void 0===o?void 0:o.perspToOrtho)&&void 0!==a?a:0}),s}return t.__extends(i,e),i.distanceFromModel=function(e,t,i){var n=e.bounding,r=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=r/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?r:o},i.parseArgs=function(i){var n,r,o,a,s,c,l,h=e.parseArgs.call(this,i);return t.__assign(t.__assign({},h),{defaultLongitude:null!==(n=i.defaultLongitude)&&void 0!==n?n:Math.PI/4,defaultLatitude:null!==(r=i.defaultLatitude)&&void 0!==r?r:Math.PI/4,defaultFov:null!==(o=i.defaultFov)&&void 0!==o?o:80,maxFov:null!==(a=i.maxFov)&&void 0!==a?a:120,minFov:null!==(s=i.minFov)&&void 0!==s?s:40,maxLatitude:null!==(c=i.maxLatitude)&&void 0!==c?c:+Math.PI/2,minLatitude:null!==(l=i.minLatitude)&&void 0!==l?l:-Math.PI/2})},i.initAnimationEndPose=function(e){var t,n,o,a=this.parseArgs(e),s=e.initial[1];return{longitude:null!==(t=s.longitude)&&void 0!==t?t:a.defaultLongitude,latitude:Im(null!==(n=s.latitude)&&void 0!==n?n:a.defaultLatitude,a.minLatitude,a.maxLatitude),fov:null!==(o=s.fov)&&void 0!==o?o:a.defaultFov,offset:e.model.bounding.getCenter(new r.Vector3),distance:i.distanceFromModel(a.model,a.defaultFov,a.camera.aspect)}},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.panState},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.updateCamera(i,null!=n?n:0,r),!0},i.prototype.updateModel=function(t){e.prototype.updateModel.call(this,t);var n=t.bounding.getCenter(new r.Vector3),o=i.distanceFromModel(t,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:n.x,y:n.y,z:n.z,distance:o},0).catch(Pe)},i.prototype.updateTime=function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];if(!this.destroyed){var o={},a={};this.locationMotion.ended||(this.locationMotion.update(e),o.modelAlpha=this.locationMotion.value.modelAlpha,o.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),a.distance=this.locationMotion.value.distance,a.offset=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),Kg(o)||this.model.setMaterial(o),Kg(a)||this.setCamera(a)}},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Le())[1],t=this.locationMotion.getKeyFrameSegment(Le())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new r.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance}},i.prototype.initAnimation=function(e,t,n,o){var a,s,c,l=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var h={longitude:null!==(a=t.longitude)&&void 0!==a?a:this.defaultLongitude,latitude:Im(null!==(s=t.latitude)&&void 0!==s?s:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Im(null!==(c=t.fov)&&void 0!==c?c:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new r.Vector3),distance:i.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},u=qt(h,["longitude","latitude","fov"]),d={x:h.offset.x,y:h.offset.y,z:h.offset.z,distance:h.distance,modelAlpha:1,perspToOrtho:0};this.emit("initAnimationWillStart",e,h,this.userAction),this.cameraMotion.set(u,n).catch(Pe),this.locationMotion.set(d,n).then((function(){l.emit("initAnimationEnded",e,h,l.userAction)}),(function(t){var i=Xg(l.camera.pose);l.emit("initAnimationEnded",e,i,l.userAction)}))}},i.prototype.updateRenderSize=function(){this.locationMotion.set({distance:i.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0)},i.prototype.getForwardPanoIndexOrNot=function(e){var t=this.work.observers.filter((function(e){return e.active})),i=this.model.intersectRaycaster(e)[0];if(!i)return null;var n=qg(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},i.prototype.coordinatesForOffset=function(e){var t=this.renderer.getSize(new r.Vector2);return{longitude:2*e.x/(t.x*this.scissor.width),latitude:2*e.y/(t.y*this.scissor.height)}},i.prototype.requestInteriaMovement=function(e,i){var n=this;if(!1!==this.interiaMovement){for(var r=t.__assign({},e),o={longitude:0,latitude:0},a=0;a<i;a++)r.longitude*=.996,r.latitude*=.994008,o.longitude+=r.longitude,o.latitude+=r.latitude;var s=Vg(this.cameraMotion.value.longitude+o.longitude),c=Im(this.cameraMotion.value.latitude+o.latitude,this.minLatitude,this.maxLatitude),l={longitude:s,latitude:c,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};this.cameraMotion.set({longitude:s,latitude:c},0).catch(Pe);var h=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!h),h?Je.shared.add((function(e,t){n.requestInteriaMovement(r,0|t)}),!0,1):this.interiaMovement=!1}},i.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var r={x:e.center.x-t.x,y:e.center.y-t.y},o=this.relativeClientPosition(e.center),a=this.camera.pose.latitude<Math.PI/6||o.y<0?-1:1;r.x*=a;var s=this.coordinatesForOffset(r),c=Vg(this.cameraMotion.value.longitude+s.longitude),l=Im(this.cameraMotion.value.latitude+s.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(l=this.cameraMotion.value.latitude);var h={longitude:c,latitude:l,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",h,e.isFinal))if(this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",h,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({longitude:h.longitude,latitude:h.latitude},0).catch(Pe),e.isFinal)if(!this.emit("wantsInteriaPan",h)){this.interiaMovement=!0;var u=e.velocityX*a,d=e.velocityY;this.requestInteriaMovement(this.coordinatesForOffset({x:u,y:d}),0)}}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.panState,delete this.pinchState),void 0!==i){var r=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Im(i/e.scale,this.minFov,this.maxFov);this.emit("wantsPinchGesture",e.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",e.scale,o,n),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:o},0).catch(Pe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=this.minFov,o=this.maxFov,a=Im(this.camera.fov-i,r,o);this.emit("wantsMouseWheel",i,a,!1)||this.emit("wantsChangeCameraFov",a)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,a,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:a},0).catch(Pe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,a,!0)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,a,!0))}),200)})}},i.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),n=new r.Raycaster;if(n.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",n,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",n,i,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(n);if(!Em(o)){this.emit("panoSelected",o);var a={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,a,!0)}}}},i.prototype.onPressGesture=function(e,t){var i,n,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var a=this.relativeClientPosition(e),s=new r.Raycaster;if(s.setFromCamera(a,this.camera),this.emit("wantsPressGesture",s,a,e.delta,t))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",s,a,e.delta,t)},i}(av);var cv=function(e){function i(t){var n=i.parseArgs(t);return e.call(this,n)||this}return t.__extends(i,e),i.parseArgs=function(i){var n=[i.initial[0],t.__assign(t.__assign({},i.initial[1]),{longitude:0,latitude:Math.PI/2}),i.initial[2],i.initial[3]],r=t.__assign(t.__assign({},i),{initial:n,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return e.parseArgs.call(this,r)},i.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},i.prototype.updateModel=function(e){this.model=e,this.needsRender=!0;var t=e.bounding.getCenter(new r.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:sv.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},0).catch(Pe)},i.prototype.initAnimation=function(e,t,i,n){var o,a=this;if(!this.destroyed){this.pending=!1,this.userAction=n;var s={longitude:0,latitude:Math.PI/2,fov:Im(null!==(o=t.fov)&&void 0!==o?o:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new r.Vector3),distance:sv.distanceFromModel(this.model,this.defaultFov,this.camera.aspect)},c=qt(s,["longitude","latitude","fov"]),l={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,modelAlpha:1,perspToOrtho:1};this.cameraMotion.set(c,i).catch(Pe),this.locationMotion.set(l,i).then((function(){a.emit("initAnimationEnded",e,s,a.userAction)}),(function(t){var i=Xg(a.camera.pose);a.emit("initAnimationEnded",e,i,a.userAction)}))}},i.prototype.getZoomOffsetFromFov=function(e,t,i){var n=new r.Vector3(0,-1,0),o=Math.tan(i/2*Math.PI/180),a=Math.tan(t.fov/2*Math.PI/180),s=(a-o)/a,c=new r.Raycaster;c.setFromCamera(e,t);var l=c.ray.direction,h=l.angleTo(n),u=sv.distanceFromModel(this.model,this.defaultFov,this.camera.aspect),d=u*Math.tan(h),p=l.clone().setLength(u*Math.cos(h)).projectOnPlane(n),f=p.length(),m=s/f*p.x*d,g=s/f*p.z*d;return new r.Vector3(m,0,g)},i.prototype.requestInteriaMovement=function(e,t){},i.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var o=e.center.x-t.x,a=e.center.y-t.y,s=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),c=this.model.bounding,l=c.getCenter(new r.Vector3),h=(c.max.x-c.min.x)/this.defaultFov*this.cameraMotion.value.fov,u=(c.max.y,c.min.y,this.defaultFov,this.cameraMotion.value.fov,(c.max.z-c.min.z)/this.defaultFov*this.cameraMotion.value.fov),d=(this.camera.position.y-c.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),p=this.renderer.getSize(new r.Vector2);s.add(function(e,t){var i=new r.Vector3;return i.setFromMatrixColumn(t,0),i.multiplyScalar(-e),i}(2*o*d/p.y,this.camera.matrix)),s.add(function(e,t,i){var n=new r.Vector3;return n.setFromMatrixColumn(i,0),n.crossVectors(t,n),n.multiplyScalar(e),n}(2*a*d/p.y,this.camera.up,this.camera.matrix)),s.x=Im(s.x,l.x-h,l.x+h),s.z=Im(s.z,l.z-u,l.z+u),s.y=l.y;var f={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:s,distance:this.locationMotion.value.distance};this.emit("wantsPanGesture",f,e.isFinal)||(this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",f,e.isFinal),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(Pe))}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.pinchState),void 0!==i){var r=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Im(i/e.scale,this.minFov,this.maxFov),a=this.relativeClientPosition({x:e.center.x,y:e.center.y}),s=this.getZoomOffsetFromFov(a,this.camera,o),c=this.camera.pose.offset.clone().add(s);this.emit("wantsPinchGesture",e.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",e.scale,o,n),this.userAction=!0,this.locationMotion.set({x:c.x,y:c.y,z:c.z},0).catch(Pe),this.cameraMotion.set({longitude:0,latitude:Math.PI/2,fov:o},0).catch(Pe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Im(this.cameraMotion.value.fov-i,this.minFov,this.maxFov),o=this.relativeClientPosition({x:e.clientX,y:e.clientY}),a=this.getZoomOffsetFromFov(o,this.camera,r),s=this.camera.pose.offset.clone().add(a);this.emit("wantsMouseWheel",i,r,!1)||this.emit("wantsChangeCameraFov",r)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,r,!1),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(Pe),this.cameraMotion.set({longitude:0,latitude:Math.PI/2,fov:r},0).catch(Pe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,r,!0)||t.emit("wantsChangeCameraFov",r)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,r,!0))}),200)})}},i}(sv);function lv(e,t){void 0===t&&(t=!1);var i=typeof e;if("string"===i)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",r=e.length-1,o=0;o<r;o++)n+=lv(e[o],!1)+",";return r>-1&&(n+=lv(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return lv(e.toJSON(),t);var a=Object.keys(e).sort(),s=a.length;for(n="",o=0;o<s;){var c=a[o],l=lv(e[c],!0);void 0!==l&&(o&&""!==n&&(n+=","),n+=JSON.stringify(c)+":"+l),o++}return"{"+n+"}"}switch(i){case"function":case"undefined":return t?void 0:null;case"number":return e;default:return isFinite(e)?e:null}}function hv(e){return be(String(lv(e,!1)))}var uv,dv=function(e){function i(t){var n=this,r=i.parseArgs(t);return(n=e.call(this,r)||this).defaultLongitude=r.defaultLongitude,n.defaultLatitude=r.defaultLongitude,n.defaultFov=r.defaultFov,n.maxFov=r.maxFov,n.minFov=r.minFov,n.maxLatitude=r.maxLatitude,n.minLatitude=r.minLatitude,n.moveSpeed=r.moveSpeed,n.intersectMeshCreator=r.intersectMeshCreator,n.interiaMovement=!1,n.intersectMesh=n.intersectMeshCreator(),n.intersectMesh.name="intersect",n.intersectMesh.visible=!1,n.helper.add(n.intersectMesh),n}return t.__extends(i,e),i.parseArgs=function(i){var n,r,o,a,s,c,l,h,u,d=e.parseArgs.call(this,i);return t.__assign(t.__assign({},d),{defaultLongitude:null!==(n=i.defaultLongitude)&&void 0!==n?n:0,defaultLatitude:null!==(r=i.defaultLatitude)&&void 0!==r?r:0,defaultFov:null!==(o=i.defaultFov)&&void 0!==o?o:90,maxFov:null!==(a=i.maxFov)&&void 0!==a?a:120,minFov:null!==(s=i.minFov)&&void 0!==s?s:40,maxLatitude:null!==(c=i.maxLatitude)&&void 0!==c?c:+Math.PI/2,minLatitude:null!==(l=i.minLatitude)&&void 0!==l?l:-Math.PI/2,moveSpeed:null!==(h=i.moveSpeed)&&void 0!==h?h:3.2,intersectMeshCreator:null!==(u=i.intersectMeshCreator)&&void 0!==u?u:function(){return new Ig}})},i.initAnimationEndPose=function(e){var t,i,n,r=this.parseArgs(e),o=e.initial,a=o[0],s=o[1];return{longitude:null!==(t=s.longitude)&&void 0!==t?t:r.defaultLongitude,latitude:Im(null!==(i=s.latitude)&&void 0!==i?i:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:Im(null!==(n=s.fov)&&void 0!==n?n:r.defaultFov,r.minFov,r.maxFov),offset:r.work.observers[a].position.clone(),distance:0}},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.interiaMovement=!1,this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.mouseMoveState,delete this.panState},i.prototype.isReady=function(){return!this.interiaMovement&&(!this.panState&&(!this.pinchState&&(!this.mouseWheelState&&e.prototype.isReady.call(this))))},i.prototype.calculateMovingDuration=function(e,t){switch(typeof e){case"function":return e(t,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return Im(t,1,3)/this.moveSpeed*1e3}},i.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},i.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,i=this.camera.aspect,n=this.renderer.getSize(new r.Vector2);return{longitude:2*e.x/(n.x*this.scissor.width)*t/95*i,latitude:-2*e.y/(n.y*this.scissor.height)*t/95}},i.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,i=e.latitude,n=e.fov,r=[{progress:0,value:{longitude:t,latitude:i,fov:n}},{progress:.5,value:{longitude:t,latitude:i,fov:.98*n}},{progress:1,value:{longitude:t,latitude:i,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(Pe)},i.prototype.requestInteriaMovement=function(e,i){var n=this;if(!1!==this.interiaMovement){for(var r=t.__assign({},e),o={longitude:0,latitude:0},a=0;a<i;a++)r.longitude*=.996,r.latitude*=.98604,o.longitude+=r.longitude,o.latitude+=r.latitude;var s=Vg(this.cameraMotion.value.longitude+o.longitude),c=Im(this.cameraMotion.value.latitude+o.latitude,this.minLatitude,this.maxLatitude),l={longitude:s,latitude:c,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};this.cameraMotion.set({longitude:s,latitude:c},0).catch(Pe);var h=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!h),h?Je.shared.add((function(e,t){n.requestInteriaMovement(r,0|t)}),!0,1):this.interiaMovement=!1}},i.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal)){var r={x:e.center.x-t.x,y:e.center.y-t.y},o=this.coordinatesForOffset(r),a=Vg(this.cameraMotion.value.longitude+o.longitude),s=Im(this.cameraMotion.value.latitude+o.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(s=this.cameraMotion.value.latitude);var c={longitude:a,latitude:s,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};if(!this.emit("wantsPanGesture",c,e.isFinal)){this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",c,e.isFinal),this.userAction=!0,this.interiaMovement=!1,this.hideIntersectMesh();var l={longitude:c.longitude,latitude:c.latitude,fov:c.fov};if(this.cameraMotion.set(l,0).catch(Pe),e.isFinal)if(!this.emit("wantsInteriaPan",c)){this.interiaMovement=!0;var h=e.velocityX,u=.6*e.velocityY;Math.abs(u)>.5&&Math.abs(h)<.5&&(h=0),this.requestInteriaMovement(this.coordinatesForOffset({x:h,y:u}),0)}}}}},i.prototype.onPinchGesture=function(e){var t,i=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=e.scale,r=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(r=!0,delete this.pinchState),void 0!==i){var o=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",o,r)){var a=Im(i/n,this.minFov,this.maxFov);this.emit("wantsPinchGesture",n,a,r)||this.emit("wantsChangeCameraFov",a)||(this.emit("gesture","pinch",o,r),this.emit("pinchGesture",n,a,r),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:a},0).catch(Pe),this.onPanGesture(e))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Im(this.cameraMotion.value.fov-i,this.minFov,this.maxFov);this.emit("wantsMouseWheel",i,r,!1)||this.emit("wantsChangeCameraFov",r)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,r,!1),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:r},0).catch(Pe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,r,!0)||t.emit("wantsChangeCameraFov",r)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,r,!0))}),200)})}},i.prototype.onMouseMove=function(e){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var t=this.relativeClientPosition({x:e.clientX,y:e.clientY}),i=new r.Raycaster;if(i.setFromCamera(t,this.camera),this.emit("wantsShowIntersectionOnModel",i))this.hideIntersectMesh();else{var n=this.model.intersectRaycaster(i)[0];if(n&&n.face){var o=n.face.normal,a=o.clone().multiplyScalar(.05),s=n.point.clone().add(a);this.intersectMesh.position.copy(s);var c=s.clone().add(a);if(this.intersectMesh.lookAt(c),Math.abs(o.y)>.99){var l=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(l.z,l.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",n,this.intersectMesh)}else this.hideIntersectMesh();this.mouseMoveState={clientX:e.clientX,clientY:e.clientY}}}},i.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},i.prototype.onPressGesture=function(e,t){var i,n,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var a=this.relativeClientPosition(e),s=new r.Raycaster;if(s.setFromCamera(a,this.camera),this.emit("wantsPressGesture",s,a,e.delta,t))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",s,a,e.delta,t)},i}(av);function pv(){return uv||(uv=new Promise((function(e){var t,i=document.createElement("video");i.muted=!0,i.src="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",i.addEventListener("timeupdate",(function n(){i.removeEventListener("timeupdate",n,!1),clearTimeout(t);var r=document.createElement("canvas");r.width=r.height=1;var o=r.getContext("2d");o?(o.drawImage(i,0,0,1,1),o.getImageData(0,0,1,1).data[3]>10?e(!0):e(!1)):e(!1)}),!1),i.addEventListener("canplay",(function e(){i.removeEventListener("canplay",e,!1),i.play()}),!1),t=window.setTimeout((function(){return e(!1)}),1e3)})))}var fv,mv=function(e){function i(t,i){return void 0===i&&(i=.5),e.call(this,t,{uniforms:{inputBuffer:new r.Uniform(null),scale:new r.Uniform(i)},fragment:"\n#include <common>\nuniform sampler2D inputBuffer;\nuniform float scale;\nvarying vec2 vUv;\n\nvoid main() {\n float u = (vUv.x - 0.5) * scale + 0.5;\n float v = (vUv.y - 0.5) * scale + 0.5;\n vec3 rgb = texture2D(inputBuffer, vec2(u, v)).rgb;\n float luminance = clamp(linearToRelativeLuminance(rgb), 0.1, 0.9);\n gl_FragColor = vec4(luminance);\n}\n"})||this}return t.__extends(i,e),i}(iv),gv=function(e){function i(t,i){void 0===i&&(i=.002);var n=e.call(this,t,{uniforms:{targetBuffer:new r.Uniform(null),inputBuffer:new r.Uniform(null),step:new r.Uniform(i)},fragment:"\n uniform sampler2D targetBuffer;\n uniform sampler2D inputBuffer;\n uniform float step;\n varying vec2 vUv;\n void main() {\n\n #ifdef GL_EXT_shader_texture_lod\n #if __VERSION__ < 300\n float target = texture2DLodEXT(targetBuffer, vUv, 5.0).r;\n #else\n float target = textureLod(targetBuffer, vUv, 5.0).r;\n #endif\n #else\n float target = texture2D(targetBuffer, vUv).r;\n #endif\n float current = texture2D(inputBuffer, vUv).r;\n\n float result;\n if (abs(target - current) < step) {\n result = target;\n } else if (target - current > 0.0) {\n result = current + step;\n } else {\n result = current - step;\n }\n gl_FragColor = vec4(result, result, result, 1.0);\n }\n "})||this;return n.material.extensions.shaderTextureLOD=!0,n}return t.__extends(i,e),Object.defineProperty(i.prototype,"targetBuffer",{get:function(){return this.material.uniforms.targetBuffer.value},set:function(e){this.material.uniforms.targetBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),i}(iv),vv=function(e){function i(t){var i=e.call(this,t,{uniforms:{inputBuffer:new r.Uniform(null),luminanceAdaptiveBuffer:new r.Uniform(null),progress:new r.Uniform(0)},fragment:"\n #include <common>\n uniform sampler2D inputBuffer;\n uniform sampler2D luminanceAdaptiveBuffer;\n uniform float progress;\n varying vec2 vUv;\n\n void main() {\n float middleGrey = 1.5;\n float whitePoint = 13.0;\n float exposure = 1.4;\n vec4 inputColor = texture2D(inputBuffer, vUv);\n vec3 rgb = inputColor.rgb * exposure;\n float alpha = inputColor.a;\n float luminance = linearToRelativeLuminance(rgb);\n float lumAvg = texture2D(luminanceAdaptiveBuffer, vec2(0.5)).r;\n float lumScaled = (luminance * middleGrey) / max(lumAvg, 1e-6);\n float lumCompressed = lumScaled * (1.0 + lumScaled / (whitePoint * whitePoint));\n lumCompressed /= (1.0 + lumScaled);\n rgb = clamp(lumCompressed * rgb, 0.0, 1.0);\n gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);\n }\n "})||this;return i.material.transparent=!0,i}return t.__extends(i,e),Object.defineProperty(i.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),i}(iv),yv=function(e){function i(t){var i=e.call(this,t)||this;return i.enableTime=Le(),i.renderer=t,i.valuePass=new nv(i.renderer),i.luminancePass=new mv(i.renderer,Math.sqrt(1/3)),i.nextStepPass=new gv(i.renderer,.01),i.luminanceAdaptivePass=new vv(i.renderer),i}return t.__extends(i,e),i.prototype.render=function(e,t){if(!this.enable)return this.enableTime=null,void this.copyPass.render(e);null===this.enableTime&&(this.enableTime=Le()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new r.WebGLRenderTarget(128,128,{minFilter:r.LinearMipmapLinearFilter,magFilter:r.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:r.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e,this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new r.WebGLRenderTarget(1,1,{minFilter:r.NearestFilter,magFilter:r.NearestFilter,type:r.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new r.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new r.WebGLRenderTarget(1,1,{minFilter:r.NearestFilter,magFilter:r.NearestFilter,type:r.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new r.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((Le()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e,t)},i.prototype.dispose=function(){var e,t,i;null===(e=this.luminanceTargetBuffer)||void 0===e||e.dispose(),null===(t=this.luminancePrevBuffer)||void 0===t||t.dispose(),null===(i=this.luminanceNextBuffer)||void 0===i||i.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},i}(ov),Av=["up","down","left","right","front","back"],xv=null!==(fv=Math.SQRT1_2)&&void 0!==fv?fv:Math.sqrt(2),bv={up:new r.Quaternion(xv,0,0,xv),down:new r.Quaternion(-xv,0,0,xv),left:new r.Quaternion(0,xv,0,xv),right:new r.Quaternion(0,-xv,0,xv),front:new r.Quaternion(0,0,0,1),back:new r.Quaternion(0,1,0,0)},wv=(new r.Quaternion).setFromAxisAngle(new r.Vector3(0,1,0),Math.PI),Mv=new r.PerspectiveCamera,Ev=new r.Frustum,Sv=new r.Matrix4,_v=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Tv=new Float32Array([0,0,1,0,0,1,1,1]),Cv=new Uint8Array([0,1,2,1,3,2]),Iv=new r.BufferGeometry;Iv.setAttribute("position",new r.BufferAttribute(_v,3)),Iv.setAttribute("uv",new r.BufferAttribute(Tv,2)),Iv.setIndex(new r.BufferAttribute(Cv,1));var Pv=function(e){function i(){var t=e.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n#if defined(USE_LUMINANCE)\nuniform sampler2D luminanceMap;\n#endif\nuniform sampler2D map;\nvarying vec2 vUv;\n\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n #if defined(USE_LUMINANCE)\n gl_FragColor.a = 1.0 - texture2D(luminanceMap, vUv).r;\n #endif\n}\n"})||this;return t.depthTest=!1,t.depthWrite=!1,t.blending=r.NoBlending,t.map=t.uniforms.map.value,t.luminanceMap=t.uniforms.luminanceMap.value,Object.defineProperties(t,{map:{get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(e){this.uniforms.luminanceMap.value=e,this.defines.USE_LUMINANCE=null!==e,this.needsUpdate=!0}}}),t}return t.__extends(i,e),i}(r.ShaderMaterial),Rv=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.level=0,t.sideCount=0,t.col=0,t.row=0,t.index=0,t.type="up",t}return t.__extends(i,e),i}(r.Box3),Lv=function(e){function i(t,i){var n=this,o=new Pv;return o.visible=!1,(n=e.call(this,Iv,o)||this).position.copy(t.getCenter(new r.Vector3)),n.quaternion.copy(bv[t.type]),n.scale.setScalar(1/Math.pow(2,t.level)),n.name="tile-box",n.level=t.level,n.activeTime=-1,n.disposed=!1,n.needsRender=!1,n.frustumCulled=!1,i.then((function(e){var t=e[0],i=e[1];n.disposed?(t.dispose(),null==i||i.dispose()):(n.material.map=t,n.material.luminanceMap=i,n.material.needsUpdate=!0,n.material.visible=!0)})).catch(Pe),n}return t.__extends(i,e),i.getBox=function(e,t,i){var n=new Rv,r=Math.pow(2,e),o=1/r,a=i%r,s=Math.floor(i/r);switch(n.level=e,n.index=i,n.sideCount=r,n.row=s,n.col=a,n.type=t,t){case"up":n.min.y=.5,n.max.y=.5,n.min.x=+a*o-.5,n.max.x=+a*o-.5+o,n.min.z=-s*o+.5-o,n.max.z=-s*o+.5;break;case"down":n.min.y=-.5,n.max.y=-.5,n.min.x=+a*o-.5,n.max.x=+a*o-.5+o,n.min.z=+s*o-.5,n.max.z=+s*o-.5+o;break;case"left":n.min.x=-.5,n.max.x=-.5,n.min.z=-a*o+.5-o,n.max.z=-a*o+.5,n.min.y=-s*o+.5-o,n.max.y=-s*o+.5;break;case"right":n.min.x=.5,n.max.x=.5,n.min.z=+a*o-.5,n.max.z=+a*o-.5+o,n.min.y=-s*o+.5-o,n.max.y=-s*o+.5;break;case"front":n.min.z=-.5,n.max.z=-.5,n.min.x=+a*o-.5,n.max.x=+a*o-.5+o,n.min.y=-s*o+.5-o,n.max.y=-s*o+.5;break;case"back":n.min.z=.5,n.max.z=.5,n.min.x=-a*o+.5-o,n.max.x=-a*o+.5,n.min.y=-s*o+.5-o,n.max.y=-s*o+.5}return n},i.prototype.updateTime=function(e){},i.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),null===(e=this.material.luminanceMap)||void 0===e||e.dispose()),this.material.dispose()},i}(r.Mesh),Bv=function(e){function i(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return t.__extends(i,e),i}(r.Group),Dv=function(){function e(e,t){this.disposed=!1,this.textureLoader=new gi(e),this.level=0,this.panoIndex=0,this.pedding=0,this.tiles=[],this.resource=[],this.luminance=null,this.imageOptions=t,this.object=new Bv}return e.prototype.setAllowHosts=function(e){this.textureLoader.setAllowHosts(e)},e.prototype.setRequestProxy=function(e){this.textureLoader.setRequestProxy(e)},e.prototype.setNetworkSubscribe=function(e){this.textureLoader.setNetworkSubscribe(e)},e.prototype.cleanup=function(){for(var e=0;e<this.tiles.length;e++)if(this.tiles[e]){var t=this.tiles[e],i="level-group:"+e,n=this.object.getObjectByName(i);for(var r in t){var o=t[r];o.dispose(),n.remove(o),delete t[r],this.object.needsRender=!0}}},e.prototype.setRotation=function(e){if(!this.disposed){var t=(new r.Quaternion).multiplyQuaternions(e,wv);this.object.quaternion.equals(t)||(this.object.quaternion.copy(t),this.object.needsRender=!0)}},e.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},e.prototype.setResource=function(e){if(!this.disposed&&this.resource!==e){this.cleanup(),this.resource=e;for(var t=0;t<e.length;t++){var i=e[t].level;this.tiles[i]={};var n="level-group:"+i,o=this.object.getObjectByName(n);o||((o=new r.Group).name=n,o.renderOrder=-2),this.object.add(o)}this.object.needsRender=!0}},e.prototype.setLuminance=function(e){this.luminance=e},e.prototype.getTileResources=function(e){for(var t,i=null!==(t=this.imageOptions.size)&&void 0!==t?t:2048,n=[],r=this.resource.length-1;r>=0;r--)this.resource[r].level<=e&&512*Math.pow(2,this.resource[r].level)>i&&n.unshift(this.resource[r]);return n},e.prototype.update=function(e,i,n){var o=this;if(!this.disposed){this.level=i;var a=Mv.copy(e);a.position.set(0,0,0),a.quaternion.premultiply(this.object.quaternion.clone().inverse()),a.updateMatrixWorld(!0),a.updateProjectionMatrix();for(var s=a.getWorldDirection(new r.Vector3),c=Ev.setFromProjectionMatrix(Sv.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse)),l=this.getTileResources(i),h=function(e){if(e){for(var i=[],a=e.level,l=Math.pow(2,a),h=l*l,d=u.object.getObjectByName("level-group:"+a),p=0,f=Av;p<f.length;p++)for(var m=f[p],g=0;g<h;g++){var v=Lv.getBox(a,m,g);c.intersectsBox(v)&&i.push(v)}var y=new r.Vector3;i.sort((function(e,t){return e.getCenter(y).angleTo(s)-t.getCenter(y).angleTo(s)}));for(var A=[],x=0,b=i;x<b.length;x++){var w=(v=b[x]).sideCount,M=v.row,E=v.col,S=(m=v.type,"tile-level:".concat(a,"-face:").concat(m,"-row:").concat(M,"-col:").concat(E));if(!u.tiles[a][S]){var _=e[m],T=e.size,C=T/w,I=[C*E,C*M,C,C],P=t.__assign({key:"pano_tile.".concat(u.panoIndex,".").concat(m,".").concat(a,".").concat(M,".").concat(E),basisLoaderInitialized:fi.isInitialized(),cut:I},qt(u.imageOptions,["format","mappings"]));a<=1&&("jpg"===P.format||/\.jpg$/.test(_))?(1024!==C&&(P.size=1024),P.quality=70):512!==C&&(P.size=512);var R=u.imageOptions.transform?u.imageOptions.transform(_,P):it(_,P),L=u.textureLoader.load(R,{preInit:!0}).then((function(e){return e.body})),B=null;if(u.luminance){var D=u.luminance[m],O=D.match(/\/cube_(\d+)\//),N=!!O&&Number(O[1]);if(!1!==N){var k=T/N,F=t.__assign(t.__assign({},P),{size:256,cut:[I[0]/k,I[1]/k,I[2]/k,I[3]/k],key:"pano_tile_luminance.".concat(u.panoIndex,".").concat(m,".").concat(a,".").concat(M,".").concat(E)}),V=u.imageOptions.transform?u.imageOptions.transform(D,F):it(D,F);B=u.textureLoader.load(V,{format:r.LuminanceFormat,preInit:!0}).then((function(e){return e.body})).catch((function(){return null}))}}u.pedding++;var z=Promise.all([L,B]).then((function(e){return o.pedding--,e}),(function(e){return o.pedding--,Promise.reject(e)}));(G=u.tiles[a][S]=new Lv(v,z)).name=S,G.renderOrder=a,d.add(G)}u.tiles[a][S].activeTime=n,A.push(S)}for(var H=0,U=Object.keys(u.tiles[a]).sort((function(e,t){return o.tiles[a][t].activeTime-o.tiles[a][e].activeTime})).slice(Math.max(24,A.length));H<U.length;H++){S=U[H];var G=u.tiles[a][S];d.remove(G),G.dispose(),delete u.tiles[a][S],u.object.needsRender=!0}}},u=this,d=0,p=l;d<p.length;d++){h(p[d])}for(var f=0;f<this.tiles.length;f++)if(this.tiles[f]){var m=l.length>0&&f<=l[l.length-1].level;for(var g in this.tiles[f])this.tiles[f][g].visible!==m&&(this.tiles[f][g].visible=m,this.tiles[f][g].needsRender=!0),this.tiles[f][g].updateTime(n)}}},e.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},e}(),Ov=new Float32Array([-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1]),Nv=new Uint8Array([0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21]),kv=new r.BufferGeometry;kv.setAttribute("position",new r.BufferAttribute(Ov,3)),kv.setIndex(new r.BufferAttribute(Nv,1));var Fv=function(){function e(){this.material=new r.ShaderMaterial({vertexShader:"\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n #if defined(USE_PANO_VIDEO)\n worldPosition = (modelMatrix * transformed).xyz;\n #endif\n gl_Position = projectionMatrix * modelViewMatrix * transformed;\n}\n",fragmentShader:"\nuniform vec2 size;\nuniform mat4 matrix;\nuniform float alpha;\nuniform sampler2D map;\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\n#include <common>\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n #if defined(USE_PANO_VIDEO)\n vec3 cameraToVertex = worldPosition - cameraPosition;\n vec4 mapCoods = vec4(cameraToVertex, 1.0) * matrix;\n vec2 uv = vec2(\n 0.5 + mapCoods.x / mapCoods.z / size.x,\n 0.5 - mapCoods.y / mapCoods.z / size.y\n );\n vec4 videoColor = texture2D(map, uv);\n float match = (1.0 - step(0.0, mapCoods.z)) * (1.0 - step(0.5, abs(uv.x - 0.5))) * (1.0 - step(0.5, abs(uv.y - 0.5)));\n float blendAlpha = clamp(0.0, 1.0, 5.0 * (1.0 - clamp(distance(uv, vec2(0.5, 0.5)) / 0.55 , 0.0, 1.0)));\n gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);\n #endif\n}\n",uniforms:{size:new r.Uniform(null),matrix:new r.Uniform(null),alpha:new r.Uniform(null),map:new r.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:r.CustomBlending,blendSrc:r.SrcAlphaFactor,blendDst:r.OneMinusSrcAlphaFactor,blendSrcAlpha:r.OneFactor,blendDstAlpha:r.OneMinusSrcAlphaFactor}),this.object=new r.Mesh(kv,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.alphaMotion=new Xm({alpha:0})}return e.prototype.setMaterial=function(e){e?(this.material.uniforms.size.value=e.size,this.material.uniforms.matrix.value=e.matrix,this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(Pe),this.material.uniforms.alpha.value=e.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(Pe));var t=null!==e;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=null!==e)},e.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},e.prototype.dispose=function(){this.material.dispose()},e}(),Vv=(new r.Matrix4).makeRotationAxis(new r.Vector3(0,1,0),Math.PI),zv=new r.Vector3(-1,1,1),Hv=function(e){function i(t){var n,r,o,a,s,c,l,h=this,u=i.parseArgs(t);(h=e.call(this,u)||this).initAnimationed=!1,h.currentPanoIndex=u.initial[0],h.maxAccessibleDistance=u.maxAccessibleDistance,h.panoTapTriggerRadius=u.panoTapTriggerRadius,h.panoCircleMeshCreator=u.panoCircleMeshCreator,h.tileLevelForFov=u.tileLevelForFov;var d=h.model.getMaterial()||{},p=d.pano0,f=d.pano1;p&&(null==f?void 0:f.map)!==p.map&&(h.model.setMaterial({pano0:f}),p.map.dispose(),null===(n=p.luminanceMap)||void 0===n||n.dispose()),h.boundingMesh=h.generateBoundingMesh(),h.boundingMesh.setMaterial(h.model.getMaterial()||{}),h.boundingMesh.visible=!1,h.scene.add(h.boundingMesh),h.panoMeshes=[],h.updatePanoMeshes(),h.locationMotion=new Xm({count:0,distance:h.camera.pose.distance,modelAlpha:null!==(o=null===(r=h.model.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==o?o:0,perspToOrtho:null!==(s=null===(a=h.model.getMaterial())||void 0===a?void 0:a.perspToOrtho)&&void 0!==s?s:0}),h.panoResources={},h.panoResources[h.locationMotion.keyframes[0].key=h.locationMotion.keyframes[1].key=Lr()]={panoIndex:h.currentPanoIndex,workCode:h.work.workCode,panoPicture:null!==(l=null===(c=h.model.getMaterial())||void 0===c?void 0:c.pano1)&&void 0!==l?l:null,position:h.camera.pose.offset.clone(),effect:"fly"};var m={allowHosts:h.work.allowHosts,requestProxy:h.requestProxy,networkSubscribe:h.networkSubscribe};return h.textureLoader=new gi(m),h.tiling=new Dv(m,h.imageOptions),h.scene.add(h.tiling.object),h.panoVideo=new Fv,h.scene.add(h.panoVideo.object),h}return t.__extends(i,e),i.parseArgs=function(i){var n,r,o,a,s=e.parseArgs.call(this,i);return t.__assign(t.__assign({},s),{maxAccessibleDistance:null!==(n=i.maxAccessibleDistance)&&void 0!==n?n:5,panoTapTriggerRadius:null!==(r=i.panoTapTriggerRadius)&&void 0!==r?r:.5,panoCircleMeshCreator:null!==(o=i.panoCircleMeshCreator)&&void 0!==o?o:function(){return new Sg},tileLevelForFov:null!==(a=i.tileLevelForFov)&&void 0!==a?a:function(e,t){var i=2*Math.atan(Math.tan(e/180*Math.PI/2)*(t.width/t.height))/Math.PI*180,n=Math.max(t.width/i,t.height/e);return n>80?4:n>48?3:n>24?2:n>12?1:0}})},i.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var t,i,n=this;e.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),delete this.pendingTextureTask,this.boundingMesh&&(this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.panoMeshes&&(this.panoMeshes.forEach((function(e){n.helper.remove(e),e.dispose()})),this.panoMeshes.length=0),this.interiaMovement=!1;var r=this.videoTexture.image;r.pause(),r.oncanplay=function(){},r.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var o=null!==(t=this.model.getMaterial())&&void 0!==t?t:{},a=o.pano0,s=o.pano1,c=0,l=Object.keys(this.panoResources);c<l.length;c++){var h=l[c],u=this.panoResources[h];if(u.panoPicture){var d=u.panoPicture.map;d&&d!==(null==a?void 0:a.map)&&d!==(null==s?void 0:s.map)&&(d.dispose(),null===(i=u.panoPicture.luminanceMap)||void 0===i||i.dispose(),u.panoPicture=null)}delete this.panoResources[h]}},i.prototype.isReady=function(){return!0===this.locationMotion.ended&&e.prototype.isReady.call(this)},i.prototype.isTileReady=function(){return this.initAnimationed&&this.tiling.pedding<=0},i.prototype.updateWork=function(e,t,i,n,r){var o=this;this.userAction=r,this.work=e,this.currentPanoIndex=t,this.textureLoader.setAllowHosts(this.work.allowHosts),this.tiling.setAllowHosts(this.work.allowHosts),this.tiling.cleanup(),this.initAnimationed=!1;var a={},s=!0;this.boundingMesh&&(a=this.boundingMesh.getMaterial()||{},s=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(!0),this.boundingMesh.visible=s,this.boundingMesh.setMaterial(a),this.scene.add(this.boundingMesh),this.hideIntersectMesh(),this.updatePanoMeshes();for(var c=0,l=this.panoMeshes;c<l.length;c++){l[c].visible=!1}return this.moveToPano(t,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},r),!0},i.prototype.updateModel=function(e){this.model=e;var t={},i=!0;this.boundingMesh&&(t=this.boundingMesh.getMaterial()||{},i=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(),this.boundingMesh.visible=i,this.boundingMesh.name="bounding",this.boundingMesh.setMaterial(t),this.scene.add(this.boundingMesh),this.updatePanoMeshes()},i.prototype.updateTime=function(e,t){for(var i,n,o,a,s,c,l,h=[],u=2;u<arguments.length;u++)h[u-2]=arguments[u];if(!this.destroyed){var d={},p={},f=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var v=this.locationMotion.getKeyFrameSegment(e),y=v[0],A=v[1],x=this.panoResourceFromLocationMotionKeyframe(y),b=this.panoResourceFromLocationMotionKeyframe(A),w=(new r.Vector3).copy(x.position),M=(new r.Vector3).copy(b.position),E=this.locationMotion.value.count-A.value.count+1;d.progress=E,d.modelAlpha=this.locationMotion.value.modelAlpha,d.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),b.panoPicture&&(E<1?x.panoPicture&&(d.pano0=x.panoPicture):d.pano0=b.panoPicture,d.pano1=b.panoPicture),g=d.useBlackTransition="instant"===b.effect||"montage"===b.effect,"fade"!==b.effect&&"montage"!==b.effect||(d.pano0&&x.panoPicture&&(d.pano0={map:d.pano0.map,luminanceMap:d.pano0.luminanceMap,matrix:x.panoPicture.matrix.clone().setPosition(b.position)}),w.copy(M)),p.distance=this.locationMotion.value.distance,p.offset=new r.Vector3(w.x+(M.x-w.x)*E,w.y+(M.y-w.y)*E,w.z+(M.z-w.z)*E);for(var S=[],_=[],T=0,C=this.locationMotion.keyframes;T<C.length;T++){var I=C[T],P=I.key,R=I.progress;void 0!==P&&(S.push(P),R>=this.locationMotion.progress&&_.push(P))}for(var L=0,B=Object.keys(this.panoResources);L<B.length;L++){var D=B[L];if(!(_.indexOf(D)>=0)){var O=this.panoResources[D];if(O.panoPicture){var N=O.panoPicture.map;if(N){if(N===(null===(i=d.pano0)||void 0===i?void 0:i.map))continue;if(N===(null===(n=d.pano1)||void 0===n?void 0:n.map))continue;N.dispose(),null===(o=O.panoPicture.luminanceMap)||void 0===o||o.dispose(),O.panoPicture=null}}S.indexOf(D)>=0||delete this.panoResources[D]}}x.workCode===b.workCode?this.currentPanoIndex=E<.5?x.panoIndex:b.panoIndex:this.currentPanoIndex=b.panoIndex,this.emit("movingToPano",m.panoIndex,f.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),p.longitude=this.cameraMotion.value.longitude,p.latitude=this.cameraMotion.value.latitude,p.fov=this.cameraMotion.value.fov),!1===Kg(d)&&(this.model.setMaterial(d),this.boundingMesh.setMaterial(d)),!1===Kg(p)&&this.setCamera(p),this.camera.pose.distance>.1)for(var k=0;k<this.work.observers.length;k++){(H=this.panoMeshes[k])&&(H.visible=!1)}else{var F=this.work.observers[this.currentPanoIndex];if(F){var V=F.visibleNodes.concat(this.currentPanoIndex),z=this.getForwardPanoIndexOrNot();for(k=0;k<this.work.observers.length;k++){var H,U=this.work.observers[k];if(H=this.panoMeshes[k])if(U.loadable||U.active)if(-1!==V.indexOf(k))if(g)H.visible=!1,H.setOpacity(0);else{H.visible=!0;var G=H.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);H.setCurrent(z===k),H.setOpacity(G<.01?0:Im(1.4/G,.5,.7)),H.updateTime&&H.updateTime(e,t)}else H.visible=!1,H.setOpacity(0);else H.visible=!1,H.setOpacity(0)}}}this.boundingMesh.visible=Boolean(null===(a=this.boundingMesh.getMaterial())||void 0===a?void 0:a.pano0)&&this.boundingMesh.boundingBox.containsPoint(this.camera.position);var j=this.tiling.object.visible;if(!1!==this.tileLevelForFov&&this.initAnimationed){var Q=m.panoIndex,W=this.work.observers[Q];if(W)if(Lg(this.camera.position,W.position)&&this.locationMotion.ended){this.tiling.object.visible=!0,this.enableIOSEDR&&this.tiling.setLuminance(null!==(s=W.images.luminance)&&void 0!==s?s:null),this.tiling.panoIndex!==Q&&this.tiling.cleanup(),this.tiling.panoIndex=Q,this.tiling.setResource(null!==(l=null===(c=W.images)||void 0===c?void 0:c.tiles)&&void 0!==l?l:[]),this.tiling.setRotation(W.quaternion),this.tiling.setPosition(W.position);var q=this.renderer.getDrawingBufferSize(new r.Vector2);q.width*=this.scissor.width,q.height*=this.scissor.height;var K=this.imageOptions.size;if(void 0===K&&W){var X=W.images.up.match(/\/cube_(\d+)\//);X&&(K=Number(X[1]))}void 0===K&&(K=2048);var Y=0;K>=1024&&(Y=1),K>=2048&&(Y=2),K>=4096&&(Y=3),K>=8192&&(Y=4);var Z=this.tileLevelForFov(this.camera.fov,q),J=Z>Y?Z:0;this.tiling.update(this.camera,J,e)}else this.tiling.object.visible=!1;else this.tiling.object.visible=!1}else this.tiling.object.visible=!1;j!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},i.prototype.render=function(){var t=this.work.observers[this.currentPanoIndex];t&&t.video&&(this.needsRender=!0),e.prototype.render.call(this)},i.prototype.postProcessing=function(e,t){if(!this.destroyed)return this.effect||(this.effect=new yv(this.renderer)),this.effect.render(e,t)},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Le())[1],t=this.locationMotion.getKeyFrameSegment(Le())[1],i=this.panoResourceFromLocationMotionKeyframe(t),n=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},i.prototype.moveToPano=function(e,i,n){var o,a,s,c=this,l=this.work.observers[e],h=t.__assign({key:"pano.".concat(e),basisLoaderInitialized:fi.isInitialized()},qt(this.imageOptions,["format","size","quality","sharpen","mappings"])),u=null!==(o=this.imageOptions.transform)&&void 0!==o?o:it,d={right:u(l.images.right,t.__assign(t.__assign({},h),{key:"".concat(h.key,".right")})),left:u(l.images.left,t.__assign(t.__assign({},h),{key:"".concat(h.key,".left")})),up:u(l.images.up,t.__assign(t.__assign({},h),{key:"".concat(h.key,".up")})),down:u(l.images.down,t.__assign(t.__assign({},h),{key:"".concat(h.key,".down")})),front:u(l.images.front,t.__assign(t.__assign({},h),{key:"".concat(h.key,".front")})),back:u(l.images.back,t.__assign(t.__assign({},h),{key:"".concat(h.key,".back")}))},p={key:"pano_luminance.".concat(e),basisLoaderInitialized:fi.isInitialized(),size:h.size?h.size/2:1024},f=this.enableIOSEDR&&l.images.luminance?{right:u(l.images.luminance.right,t.__assign(t.__assign({},p),{key:"".concat(p.key,".right")})),left:u(l.images.luminance.left,t.__assign(t.__assign({},p),{key:"".concat(p.key,".left")})),up:u(l.images.luminance.up,t.__assign(t.__assign({},p),{key:"".concat(p.key,".up")})),down:u(l.images.luminance.down,t.__assign(t.__assign({},p),{key:"".concat(p.key,".down")})),front:u(l.images.luminance.front,t.__assign(t.__assign({},p),{key:"".concat(p.key,".front")})),back:u(l.images.luminance.back,t.__assign(t.__assign({},p),{key:"".concat(p.key,".back")}))}:null,m="pano:"+hv(d);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===m)return;var g=this.pendingTextureTask.panoIndex;null===(a=this.panoMeshes[g])||void 0===a||a.setProgress(0),this.emit("textureAbort",g,l),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0;var v,y=this.model.getMaterial()||{},A=y.pano0,x=y.pano1;if(A&&A.map.name===m&&null!==A.luminanceMap===this.enableIOSEDR?v=A:(null==x?void 0:x.map.name)===m&&null!==x.luminanceMap===this.enableIOSEDR&&(v=x),v){var b={panoIndex:e,workCode:this.work.workCode,effect:null!==(s=i.effect)&&void 0!==s?s:"fly",panoPicture:{map:v.map,luminanceMap:v.luminanceMap,matrix:(new r.Matrix4).compose(l.position,l.quaternion,zv)},position:l.position.clone()};Je.shared.add((function(){c.pending=!1,c.emit("panoLoaded",e),c.doMoveToPano(e,b,i,n)}),!0,1)}else{this.pendingTextureTask={panoIndex:e,hash:m,onLoad:function(t,o){var a,s;if(c.pending=!1,c.destroyed)t.body.dispose();else{t.body.name=m,c.emit("panoLoaded",e);var h={panoIndex:e,workCode:c.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fly",panoPicture:{map:t.body,luminanceMap:null!==(s=null==o?void 0:o.body)&&void 0!==s?s:null,matrix:(new r.Matrix4).compose(l.position,l.quaternion,zv)},position:l.position.clone()};c.doMoveToPano(e,h,i,n)}},onError:function(t){c.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),c.emit("panoLoadError",t,e),c.emit("moveToPanoCanceled",e)}};var w=this.panoMeshes[e];w&&w.tap&&w.tap(),Promise.all([this.textureLoader.loadCube(d,{format:r.RGBFormat,viaAjax:!0},void 0,void 0,(function(t){var i,n;c.emit("textureLoading",t,e,l),(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(n=c.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer),f?this.textureLoader.loadCube(f,{format:r.LuminanceFormat}).catch((function(){return null})):Promise.resolve(null)]).then((function(t){var i,n,r=t[0],o=t[1];(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m?(c.pendingTextureTask.onLoad(r,o),null===(n=c.panoMeshes[e])||void 0===n||n.setProgress(0),delete c.pendingTextureTask,c.emit("textureLoaded",e,l,r.meta)):(r.body.dispose(),null==o||o.body.dispose())})).catch((function(t){var i,n;(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(c.pendingTextureTask.onError(t),null===(n=c.panoMeshes[e])||void 0===n||n.setProgress(0),delete c.pendingTextureTask,c.emit("textureError",t,e,l),c.emit("error",t))})),this.emit("textureStartLoad",e,l)}},i.prototype.initAnimation=function(e,t,i,n){var r,o,a,s=this;if(!this.destroyed){var c=!1;this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Im(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Im(null!==(a=t.fov)&&void 0!==a?a:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){c=!0,s.emit("initAnimationWillStart",e,t,s.userAction)},moveEndCallback:function(e,t){s.emit("initAnimationEnded",e,t,s.userAction),s.initAnimationed=!0},moveCancelCallback:function(){var e={longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance};!1===c&&s.emit("initAnimationWillStart",s.currentPanoIndex,e,s.userAction),s.emit("initAnimationEnded",s.currentPanoIndex,e,s.userAction),s.initAnimationed=!0}},n)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=n.distanceTo(r)*(e[i].value.count-e[i-1].value.count)}return t},i.prototype.updatePanoMeshes=function(e){void 0===e&&(e=!0);for(var t={},i=0,n=this.panoMeshes;i<n.length;i++){t[(c=n[i]).name]=c}this.panoMeshes.length=0;for(var o=0;o<this.work.observers.length;o++){var a="panoCircle_".concat(this.work.workCode,"_").concat(o),s=this.work.observers[o],c=void 0;if(t[a]?(!0===(c=t[a]).loading&&!1===s.loadable&&c.setLoading(!1),delete t[a]):((c=this.panoCircleMeshCreator()).name=a,this.helper.add(c)),c.position.copy(s.standingPosition),e&&this.model.loaded&&this.model.bvhs.loaded){var l=new r.Vector3(0,-1,0),h=new r.Vector3(0,.1,0).add(c.position),u=new r.Raycaster(h,l,0,.2),d=this.model.intersectRaycaster(u)[0];d&&d.point.distanceTo(h)<.1&&c.position.copy(d.point)}this.panoMeshes[o]=c}for(var p=0,f=Object.keys(t);p<f.length;p++){var m=f[p];this.helper.remove(t[m]),t[m].dispose(),delete t[m]}},i.prototype.generateBoundingMesh=function(e){void 0===e&&(e=!1);for(var t=this.model.bounding.clone(),i=0,n=this.work.observers;i<n.length;i++){var o=n[i];t.expandByPoint(o.standingPosition),t.expandByPoint((new r.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}e&&t.expandByPoint(this.camera.position);var a=Ng(t,new r.Vector3(1,0,1));return a.name="panorama_bounding",a},i.prototype.doMoveToPano=function(e,i,n,o){var a,s,c,l=this;void 0===n&&(n={}),this.userAction=o;var h=Le(),u=Lr();this.tiling.cleanup(),this.panoResources[u]=i;var d,p,f;if(this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(h);m[0];var g=m[1],v=this.locationMotion.value,y=this.panoResourceFromLocationMotionKeyframe(g).position,A=i.position;d=Math.max(y.distanceTo(A),1),p=[{key:g.key,progress:0,value:t.__assign(t.__assign({},v),{count:0})},{key:u,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,count:1}}],f=0}else{var x=this.locationMotion.getKeyFrameSegment(h),b=x[0],w=(g=x[1],v=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),M=(y=this.panoResourceFromLocationMotionKeyframe(g).position,A=i.position,g.value.count-v.count),E=Math.max(w.distanceTo(y),1)*M;d=E+Math.max(y.distanceTo(A),1),p=[{key:b.key,progress:0,value:t.__assign({},v)},{key:g.key,progress:E/d,value:g.value},{key:u,progress:1,value:{count:g.value.count+1,distance:0,perspToOrtho:0,modelAlpha:0}}];var S=this.locationMotionKeyframesLength(this.locationMotion.keyframes),_=this.locationMotionKeyframesLength(p);f=0===S||0===S?0:this.locationMotion.getProgressVelocity(h)*S/_}var T=this.calculateMovingDuration(n.duration,"fade"===n.effect||"montage"===n.effect?0:d),C={longitude:n.longitude,latitude:n.latitude,fov:n.fov},I={longitude:null!==(a=C.longitude)&&void 0!==a?a:this.camera.pose.longitude,latitude:null!==(s=C.latitude)&&void 0!==s?s:this.camera.pose.latitude,fov:null!==(c=C.fov)&&void 0!==c?c:this.camera.pose.fov,offset:i.position.clone(),distance:this.camera.pose.distance};n.moveStartCallback&&n.moveStartCallback(e,I),this.emit("panoWillArrive",e,I,this.userAction),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=Pe,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(C,T).catch(Pe),this.locationMotion.setKeyframes(p,T,f).then((function(){var t,i,a,s={longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:l.camera.pose.distance};n.moveEndCallback&&n.moveEndCallback(e,s),l.emit("panoArrived",e,s,o);var c=l.work.observers[l.currentPanoIndex];if(c&&c.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var h=Vv.clone().multiply(null!==(a=null===(i=null===(t=l.model.getMaterial())||void 0===t?void 0:t.pano1)||void 0===i?void 0:i.matrix)&&void 0!==a?a:new r.Matrix4).multiply(c.video.matrix),u={map:l.videoTexture,size:c.video.size,matrix:h,alpha:1},d=Lr(),p=l.videoTexture.image;p.setAttribute("uuid",d),pv().then((function(e){e&&c.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=Pe,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=Pe,l.panoVideo.setMaterial(u))},p.src=c.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){n.moveCancelCallback&&n.moveCancelCallback(),l.emit("moveToPanoCanceled",e)}))},i.prototype.getForwardPanoIndexOrNot=function(e){var t=this,i=this.work.observers[this.currentPanoIndex];if(!i)return null;var n=null!=e?e:new r.Raycaster(this.camera.position.clone(),this.camera.getWorldDirection(new r.Vector3)),o=n.ray.origin.clone(),a=new r.Vector3,s=this.model.intersectRaycaster(new r.Raycaster(n.ray.origin,new r.Vector3(0,-1,0)))[0];s&&s.distance<=2?a.copy(s.point):a.copy(n.ray.origin).add(new r.Vector3(0,-1.5,0));var c=this.model.intersectRaycaster(n)[0],l=(c?c.point:n.ray.origin.clone().add(n.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(a).normalize();if(0===l.length())return null;for(var h=i.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e],n=i.standingPosition.clone().sub(o);return 0!==n.length()&&(!(n.angleTo(new r.Vector3(0,-1,0))<Math.PI/12)&&(i.loadable||i.active))})).slice().sort((function(e,i){return t.work.observers[e].standingPosition.clone().distanceTo(a)-t.work.observers[i].standingPosition.clone().distanceTo(a)})),u=0,d=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];u<d.length;u++)for(var p=d[u],f=0,m=h;f<m.length;f++){var g=m[f],v=this.work.observers[g].standingPosition.clone().sub(a);if(0!==v.length()&&l.angleTo(v)<p)return g}return null},i.prototype.onTapGesture=function(e){var i=this,n=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",n,!0)){var o=this.relativeClientPosition(e.center),a=new r.Raycaster;if(a.setFromCamera(o,this.camera),!this.emit("wantsTapGesture",a,o,!0)){this.emit("gesture","tap",n,!0),this.emit("tapGesture",a,o,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new r.Vector3).setY(0),c=null,l=this.work.observers[this.currentPanoIndex];if(l){var h=l.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e];return!(t.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(t.loadable||t.active)})),u=this.model.intersectRaycaster(a)[0];if(u){var d=qg(h,(function(e){var t=i.work.observers[e].standingPosition.clone();return t.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:t.distanceTo(u.point)}),!0),p=d[0];d[1]<this.panoTapTriggerRadius&&(c=p)}Em(c)&&(c=this.getForwardPanoIndexOrNot(a));for(var f=0,m=this.locationMotion.keyframes;f<m.length;f++){var g=m[f],v=this.panoResourceFromLocationMotionKeyframe(g);if(!(g.progress<this.locationMotion.progress)&&v.panoIndex===c){c=null;break}}if(this.emit("panoSelected",c),Em(c))!0===this.locationMotion.ended&&this.cameraBounce();else{var y=this.work.observers[c];if(y.active){for(var A={},x=Math.PI/6,b=Math.PI/12,w=y.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),M=[],E=0,S=y.accessibleNodes;E<S.length;E++){if((p=S[E])!==this.currentPanoIndex&&p!==c){var _=this.work.observers[p].position.clone().sub(y.position).setY(0);w.angleTo(_)<x&&M.push(_)}}var T=(M.length>0?M:t.__spreadArray(t.__spreadArray([],[],!0),[],!0)).slice().sort((function(e,t){return e.angleTo(w)-t.angleTo(w)}))[0];T&&T.angleTo(s)>b&&(A.longitude=Math.atan2(-T.x,-T.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Im(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(A.fov=this.defaultFov),this.emit("wantsMoveToPano",c,A,!0)}else this.panoMeshes[c]&&(this.panoMeshes[c].setDisabled(!1),this.panoMeshes[c].setLoading(!0))}}}}},i}(dv),Uv=Math.PI/180,Gv=180/Math.PI,jv=function(){var e="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),Qv=function(){var e="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),Wv=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),qv=function(){var e="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return function(){return t}}(),Kv=function(){var e=!1;if(65===qv()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var i=t[1].split(".");i[0],i[1];var n=i[2],r=i[3];e=3325===parseInt(n,10)&&parseInt(r,10)<148}}return function(){return e}}(),Xv=function(){var e=jv()&&Qv()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),Yv=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}();function Zv(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return Yv()?!e:e}var Jv,$v=(Jv={},function(e,t){void 0===Jv[e]&&(console.warn("cardboard: "+t),Jv[e]=!0)});function ey(e){var t,i=e.indexOf("://");t=-1!==i?i+3:0;var n=e.indexOf("/",t);return-1===n&&(n=e.length),e.substring(0,n)}var ty,iy=function(e,t,i){!function(e,t,i){var n=t?t[0]:0,r=t?t[1]:0,o=t?t[2]:0,a=t?t[3]:1,s=n+n,c=r+r,l=o+o,h=n*s,u=n*c,d=n*l,p=r*c,f=r*l,m=o*l,g=a*s,v=a*c,y=a*l;e[0]=1-(p+m),e[1]=u+y,e[2]=d-v,e[3]=0,e[4]=u-y,e[5]=1-(h+m),e[6]=f+g,e[7]=0,e[8]=d+v,e[9]=f-g,e[10]=1-(h+p),e[11]=0,e[12]=i?i[0]:0,e[13]=i?i[1]:0,e[14]=i?i[2]:0,e[15]=1}(e,t),i&&function(e,t,i){var n,r,o,a,s,c,l,h,u,d,p,f,m=i[0],g=i[1],v=i[2];t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],e[0]=n,e[1]=r,e[2]=o,e[3]=a,e[4]=s,e[5]=c,e[6]=l,e[7]=h,e[8]=u,e[9]=d,e[10]=p,e[11]=f,e[12]=n*m+s*g+u*v+t[12],e[13]=r*m+c*g+d*v+t[13],e[14]=o*m+l*g+p*v+t[14],e[15]=a*m+h*g+f*v+t[15])}(e,e,i),function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],c=t[6],l=t[7],h=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],y=i*s-n*a,A=i*c-r*a,x=i*l-o*a,b=n*c-r*s,w=n*l-o*s,M=r*l-o*c,E=h*m-u*f,S=h*g-d*f,_=h*v-p*f,T=u*g-d*m,C=u*v-p*m,I=d*v-p*g,P=y*I-A*C+x*T+b*_-w*S+M*E;P&&(P=1/P,e[0]=(s*I-c*C+l*T)*P,e[1]=(r*C-n*I-o*T)*P,e[2]=(m*M-g*w+v*b)*P,e[3]=(d*w-u*M-p*b)*P,e[4]=(c*_-a*I-l*S)*P,e[5]=(i*I-r*_+o*S)*P,e[6]=(g*x-f*M-v*A)*P,e[7]=(h*M-d*x+p*A)*P,e[8]=(a*C-s*_+l*E)*P,e[9]=(n*_-i*C-o*E)*P,e[10]=(f*w-m*x+v*y)*P,e[11]=(u*x-h*w-p*y)*P,e[12]=(s*S-a*T-c*E)*P,e[13]=(i*T-n*S+r*E)*P,e[14]=(m*A-f*b-g*y)*P,e[15]=(h*b-u*A+d*y)*P)}(e,e)},ny=function(){function e(e,t){void 0===e&&(e=new r.Vector3),void 0===t&&(t=0),this.sample=e,this.timestampS=t}return e.prototype.set=function(e,t){this.sample=e,this.timestampS=t},e.prototype.copy=function(e){this.set(e.sample,e.timestampS)},e}(),ry=function(){function e(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new ny,this.currentGyroMeasurement=new ny,this.previousGyroMeasurement=new ny,jv()?this.filterQ=new r.Quaternion(-1,0,0,1):this.filterQ=new r.Quaternion(1,0,0,1),this.previousFilterQ=new r.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new r.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new r.Vector3,this.measuredGravity=new r.Vector3,this.gyroIntegralQ=new r.Quaternion}return e.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},e.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var i,n=t-this.previousGyroMeasurement.timestampS;i=n,isNaN(i)||i<=.001||i>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},e.prototype.getOrientation=function(){return this.filterQ},e.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var i=new r.Quaternion;i.copy(this.filterQ),i.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(i),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var n,o=new r.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",Gv*((n=o).w>1?0:2*Math.acos(n.w)),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var a=new r.Quaternion;a.copy(this.filterQ),a.multiply(o),this.filterQ.slerp(a,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},e.prototype.accelToQuaternion_=function(e){var t=new r.Vector3;t.copy(e),t.normalize();var i=new r.Quaternion;return i.setFromUnitVectors(new r.Vector3(0,0,-1),t),i.inverse(),i},e.prototype.gyroToQuaternionDelta_=function(e,t){var i=new r.Quaternion,n=new r.Vector3;return n.copy(e),n.normalize(),i.setFromAxisAngle(n,e.length()*t),i},e}(),oy=function(){function e(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new r.Quaternion,this.previousTimestampS=null,this.deltaQ=new r.Quaternion,this.outQ=new r.Quaternion}return e.prototype.getPrediction=function(e,t,i){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=i,e;var n=new r.Vector3;n.copy(t),n.normalize();var o=t.length();if(o<20*Uv)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(Gv*o).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var a=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(n,a),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=i,this.outQ},e}(),ay=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,i=1,n=e-this.distort(t);Math.abs(i-t)>1e-4;){var r=e-this.distort(i),o=i-r*((i-t)/(r-n));t=i,i=o,n=r}return i},e.prototype.distort=function(e){for(var t=e*e,i=0,n=0;n<this.coefficients.length;n++)i=t*(i+this.coefficients[n]);return(i+1)*e},e}(),sy=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},cy=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},ly=function(){function e(e,t,i,n){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=i,this.accelerometer=new r.Vector3,this.gyroscope=new r.Vector3,this.filter=new ry(e,n),this.posePredictor=new oy(t,n),this.isFirefoxAndroid=Wv(),this.isIOS=jv();var o=qv();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=Kv()||Xv(),this.filterToWorldQ=new r.Quaternion,jv()?this.filterToWorldQ.setFromAxisAngle(new r.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new r.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new r.Quaternion,this.worldToScreenQ=new r.Quaternion,this.originalPoseAdjustQ=new r.Quaternion;var a="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new r.Vector3(0,0,1),a),this.setScreenTransform_(),Zv()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new r.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return e.prototype.getPosition=function(){return null},e.prototype.getOrientation=function(){var e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var e=(new r.Quaternion).setFromAxisAngle(new r.Vector3(0,0,-1),0),t=new r.Quaternion;return"undefined"!=typeof window&&-90===window.orientation?t.setFromAxisAngle(new r.Vector3(0,1,0),Math.PI/-2):t.setFromAxisAngle(new r.Vector3(0,1,0),Math.PI/2),e.multiply(t)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((i=new r.Quaternion).setFromAxisAngle(new r.Vector3(1,0,0),-Math.PI/2),i),e=this._deviceOrientationQ;var t=new r.Quaternion;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var i,n=this.filter.getOrientation();e=this.posePredictor.getPrediction(n,this.gyroscope,this.previousTimestampS);var o=new r.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(e),o.multiply(this.worldToScreenQ),this.yawOnly&&(o.x=0,o.z=0,o.normalize()),this.orientationOut_[0]=o.x,this.orientationOut_[1]=o.y,this.orientationOut_[2]=o.z,this.orientationOut_[3]=o.w,this.orientationOut_},e.prototype.getPose=function(){var e=new sy;return e.orientation=this.getOrientation(),e},e.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),Zv()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},e.prototype.getFrameData=function(e){var t=this.getOrientation(),i=this.getEyeOffset(),n=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(n.left),e.rightProjectionMatrix.set(n.right),iy(e.leftViewMatrix,t,i.left),iy(e.rightViewMatrix,t,i.right),e},e.prototype.start=function(){if("undefined"==typeof window)return function(){};var e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),i=this.onMessage_.bind(this),n=this.onDeviceOrientation_.bind(this);return jv()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=ey(document.referrer),i=ey(window.location.href);return e&&t!==i}()&&window.addEventListener("message",i),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",n):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",i)}},e.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},e.prototype.getEyeProjectionMatrix=function(){var e=this.getEyeFieldOfView(),t=this.depthNear,i=this.depthFar,n={left:[],right:[]},r=e.left.upDegrees*Uv,o=e.left.downDegrees*Uv,a=2/((c=e.left.leftDegrees*Uv)+(l=e.left.rightDegrees*Uv)),s=2/(r+o);n.left[0]=a,n.left[1]=0,n.left[2]=0,n.left[3]=0,n.left[4]=0,n.left[5]=s,n.left[6]=0,n.left[7]=0,n.left[8]=-(c-l)*a*.5,n.left[9]=(r-o)*s*.5,n.left[10]=i/(t-i),n.left[11]=-1,n.left[12]=0,n.left[13]=0,n.left[14]=i*t/(t-i),n.left[15]=0;var c,l;r=e.right.upDegrees*Uv,o=e.right.downDegrees*Uv,a=2/((c=e.right.leftDegrees*Uv)+(l=e.right.rightDegrees*Uv)),s=2/(r+o);return n.right[0]=a,n.right[1]=0,n.right[2]=0,n.right[3]=0,n.right[4]=0,n.right[5]=s,n.right[6]=0,n.right[7]=0,n.right[8]=-(c-l)*a*.5,n.right[9]=(r-o)*s*.5,n.right[10]=i/(t-i),n.right[11]=-1,n.right[12]=0,n.right[13]=0,n.right[14]=i*t/(t-i),n.right[15]=0,n},e.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,i=new ay(e.distortionCoefficients),n=e.screenLensDistance,r=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,a=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-a,c=Gv*Math.atan(i.distort(r/n)),l=Gv*Math.atan(i.distort(o/n)),h=Gv*Math.atan(i.distort(a/n)),u=Gv*Math.atan(i.distort(s/n)),d=new cy,p=new cy;return d.leftDegrees=Math.min(c,e.fov),d.rightDegrees=Math.min(l,e.fov),d.downDegrees=Math.min(h,e.fov),d.upDegrees=Math.min(u,e.fov),p.leftDegrees=d.rightDegrees,p.rightDegrees=d.leftDegrees,p.upDegrees=d.upDegrees,p.downDegrees=d.downDegrees,{left:d,right:p}},e.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new r.Quaternion;var t=e.alpha,i=e.beta,n=e.gamma;t=(t||0)*Math.PI/180,i=(i||0)*Math.PI/180,n=(n||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new r.Euler(t,i,-n,"YXZ"))},e.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},e.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,n=e.timeStamp/1e3,r=n-this.previousTimestampS;return r<0?($v("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=n)):r<=.001||r>1?($v("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=n)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),i&&(Yv()?this.gyroscope.set(-i.beta,i.alpha,i.gamma):this.gyroscope.set(i.alpha,i.beta,i.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,n)),this.filter.addAccelMeasurement(this.accelerometer,n)),void(this.previousTimestampS=n))},e.prototype.onOrientationChange_=function(){this.setScreenTransform_()},e.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&("devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent))},e.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),"undefined"!=typeof window?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new r.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new r.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},e}(),hy=[0,0,.5,1],uy=[.5,0,.5,1],dy=function(){function e(e){var t=this;this.renderer=e,this.sensor=new ly(.98,.04,!1,!1),this.scale=1,this.cameraL=new r.PerspectiveCamera,this.cameraR=new r.PerspectiveCamera;var i=this.sensor.start();this.dispose=function(){var e=t.renderer.getSize(new r.Vector2);t.renderer.setScissor(0,0,e.width,e.height),t.renderer.setViewport(0,0,e.width,e.height),t.renderer.setScissorTest(!1),i()}}return e.prototype.render=function(e,t){var i=this.renderer.getSize(new r.Vector2);if(i.width>i.height){var n=e.autoUpdate;n&&(e.updateMatrixWorld(),e.autoUpdate=!1);var o={x:Math.round(i.width*hy[0]),y:Math.round(i.height*hy[1]),width:Math.round(i.width*hy[2]),height:Math.round(i.height*hy[3])},a={x:Math.round(i.width*uy[0]),y:Math.round(i.height*uy[1]),width:Math.round(i.width*uy[2]),height:Math.round(i.height*uy[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),t.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var s=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new r.Vector3).fromArray(s.left),this.scale),this.cameraR.translateOnAxis((new r.Vector3).fromArray(s.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(e,this.cameraL),this.renderer.setViewport(a.x,a.y,a.width,a.height),this.renderer.setScissor(a.x,a.y,a.width,a.height),this.renderer.render(e,this.cameraR),this.renderer.setViewport(0,0,i.width,i.height),this.renderer.setScissor(0,0,i.width,i.height),this.renderer.setScissorTest(!1),n&&(e.autoUpdate=!0)}else this.renderer.render(e,t)},e.prototype.dispose=function(){},e}(),py={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},fy="undefined"!=typeof navigator&&null!==(ty=py[navigator.language.split("-")[0]])&&void 0!==ty?ty:py.zh,my="\n<style>\n.$id {\n all: initial;\n position: absolute;\n overflow: hidden;\n display: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n.$id-modal {\n width: 100%;\n height: 332px;\n position: absolute;\n bottom: -2px;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n will-change: transform;\n animation: $id-modal-fade-in 0.3s ease 1;\n}\n.$id-modal-bg {\n background: rgba(0, 0, 0, 0.75);\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n}\n.$id-modal-bg-line {\n height: 1px;\n background-image: linear-gradient(\n 85deg,\n rgba(162, 177, 255, 0.3) 1%,\n rgba(120, 126, 255, 0.8) 30%,\n rgba(147, 218, 255, 0.8) 66%,\n rgba(250, 255, 184, 0.3) 92%\n );\n}\n.$id-modal-bg-wave svg {\n width: 375px;\n height: 61px;\n display: block;\n}\n.$id-modal-content {\n color: #ffffff;\n padding: 0 14px;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n overflow: hidden;\n}\n.$id-modal-content-title {\n font-size: 17px;\n font-family: sans-serif;\n line-height: 18px;\n padding: 20px 0;\n font-weight: bold;\n}\n.$id-modal-content-hit {\n font-size: 14px;\n font-family: sans-serif;\n line-height: 24px;\n opacity: 0.85;\n}\n.$id-modal-content-guide {\n position: relative;\n width: 168px;\n height: 139px;\n margin: 36px auto 0;\n}\n.$id-modal-content-guide-cardboard {\n position: absolute;\n width: 100px;\n height: 82px;\n left: 68px;\n top: 57px;\n}\n.$id-modal-content-guide-cardboard-image {\n width: 100px;\n height: 82px;\n background-image: url(".concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq9vb1UVFRYWFhra2t+fn7t7e1RUVFOTk6Dg4OAgICCgoKKioqEhISIiIhqamqCgoKIiIiQkJCIiIiWlpawsLBmZmaAgICenp6Li4uBgYGTk5OMjIyVlZWFhYWCgoKvr6+Ojo59fX2SkpKvr6+Ojo6QkJCurq6BgYGxsbF8fHx4eHitra2enp6srKyJiYmurq54eHj5+fl+fn57e3v////5+fnS0tLAwMCVlZWwsLCurq5QUFCtra2EhISUlJSwsLCUlJSUlJSlpaWVlZW3t7diYmLAwMCFhYV3d3f///+tra3///9XV1eampqnp6d8fHz///////9VVVVlZWVtbW3+/v5SUlKcnJytra28vLzGxsbR0dHX19doaGiWlpafn5/Hx8ezs7Nzc3Nubm7AwMCIiIjj4+NTU1P29vZbW1vl5eVkZGTMzMxYWFjq6upfX1/k5OT////4+PjV1dWkpKRoaGj4+Pizs7Pm5ubAwMCfn5+vr6+urq4wMDCxsbG2tra5ubliYmIuLi6zs7NHR0empqY0NDRCQkKqqqo5OTmoqKg7OztfX19dXV1oaGikpKRkZGStra0hISE/Pz89PT0pKSlmZmZJSUlERERbW1s2NjZVVVUmJia7u7uEhIRXV1dZWVlLS0tOTk6srKxqamojIyNTU1MrKyuAgICCgoJRUVFra2ttbW13d3dxcXFvb299fX1zc3N2dnZ5eXl8fHyHh4eSkpKenp6Ojo6VlZWMjIyYmJihoaGcnJyJiYmamprZ2YdEAAAAunRSTlMAs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7P9s7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Oz+QSzswb9DiH3FyI57Jn1ajgu7uHYmIgr8OHHwqVOQybv6OZuUvTt3dHPrIeFSNVgLCAWD9/UqKebiH1iXVTczcvKvambhnBuY/vGrKqjlHlzVDj37s/Fw7+tpJGAeN7VzcWTgGJNQ8O9u7iko5aVjvbNsa+so1pd3mNGAAAqAElEQVR42uzZzWvTYBwH8DxNmvRlfVNr17Wl05a9dISyiugO4qVQ2g1pVyx2Q7QKCoIivgxF1HnTXbbDDnNDJ8iQHcQX8O3We1t6GnjJyYPSuTmdf4C/ZE260U5rl6bJ2g8Pu2zP5cvz++ZJhilOcOxcfPHq/NuFhVcftK8WXizeCGItFWKKX5x/23Zk3/6OPr1+j0mr1fkpkuxXv5luBbbZWPzevEWjMRja2iCrvXs3stJRFGRFEDhOT1xv5QWCkYvPPtosFg+XFZyrvSYdRUJEBA4Igg2LRuBhk+cVOndv3uWyWm0DlqMajWafXkcSNNrexA2sSQ1dvPK+86DruNUGWRn6dGoa/dvk9BjWbMLxZ7e7e3ogK5fVZtBTOKrew6Y6Xufu3Qm0d3f3dEJWGj1Fo/81dbU52isUf2T3etvZrHoG9vtxVKOJm9guF049ddrt3gBkdVCzh0DlWtO4YejT00OHnU44VwHXPgqJ4PV1bFeKDD8xH4Cs7PaAtY9AYpncfeUFSR0zc1l5B/Q4EhW9q+KCpHodXFYBjxZxWnFtk9SZrl4uK6/Hj+pmWvlxDQ2fMRq7eh0OSIpCW7Ti2iJ8/4zK7WazcloqJtUaxqLweFSl4rI6ZNOhylpxsUKpqFsF3EazS4ukNLmIKcuJpFHF6erUI8lNKeiaGrl7WcUxtu+nUUO8VsZLEDz8VBy33YCjxnko+1dsrtI5hz1q1GATcm76YCrpVnHMVgrJgWwfjCN3u1Sc3k4TkgtZNv3QcLHS3Wyly4ncqis8/qSYlFNDINl5IZ9ZDKaifFHZSCRLkzKZxZEkX1QHtUi+ZDCLQlEZ2/uQzDX2c0T4vjzuntWaatiVPiQU1YEBoahoRMNCNRBzv9zuqCNJo1BUdGU4jcOiqyDhfgmLvryoOnClkfRwhcehqDh2A4ErkGTNBa9+paLClUqSK2rkrnCjMhFK9mYMqy+4Jwhf8wjlIWcvjcYGGYbxxUZvmd6V93w9XmicHpJQmD0zifM+ZovYzFWsjMifiB0urVpRyMeJmI+pyBnCxBcaF8avQ60kL58nYkyJ78f3leUvXwqrP9e/MqzBCCaykWRp/NTKQT0fHfzN8L79WlteSm9S+MUdt2t16XR4+vVXTd2vhtVfRrL9cw9ijGB9rZDOgPRm+XxunQGnRD9Ubm8bqRgvZ0Z9woFaX81lNqQzW7MCKwy4IE5T8YfKbNWRSmG6FCtN3upSNpspKosKLBXY6jorxuPPyF+pSKWYezDIFP1YyWXYpLJlSeWFqNi0fFD7O235VFTFOWbVUjUiKRIWBaTZP5vgk/r2vZDOgkylAczD4tMCy5DW6R2V+vBlvqkohZhN8DX1dY09UkJW5b0uJMXJ/dzRIEaKpe5wmShlmEv4hOHLf84WlU8gEKLi5Zagtk5itTkR5f/trvNvj/JTsKr4Xf3366GnhKSy2WJWmZJKpypfDCoHVmHriZpu6hvzZ+zu0HH8kBj8+KvKfyfN/j/UnclvG1UcxxGnhGxKaVIIioBEosi9gVAaCSkHkFhFgAOrBEIgDixCnOAAAgmVG1cEZ7jxHzi2YzvYcWyP3cRNY6e1J2sdJ7bjbLXTLOL73rzFz88TGqip+cyLZ+kMJB++v988jwN0fSJMFb1JIFxxXXq3kq4wCIjWw/+gVT3G6+++/wOtP7wmMuUVooASqtmNQim/6djd36tUyuX9o930WnZrXagCJdwQnz3lc+JvrVb16MXW+/4P/PaRg3X0AstUUm1WRil7VIn5xzkeD74EU4fl3c0CVC0bG/iLvHi6rs7vf60ncR9E4kXbVvcbf724+a2VZpMUdCuhysgfHS5xR1KVR+dyZQdvrNdOdT9851X+IWnr/wDR0h15I2kmuSwK8eQetwG+dGP+4200rW9Oq+r8/a3NT9cPH/K3x+tRSJKx8haObvqvXx8fx8CLrokOLBp/7q69daq5An5BtrWL0trVitHFkcea4M9/FY2qGBGhQreKFNI3x68TdFXSGIaO3+P3e6a+vK1Uvc+ev7R1NT1i7pktxU3AVEU2HIee64JxDCy1lrgqrBVV3Ne7r/ztZMFq6w+NtHWdUeg604Vhu62f2/Dr277m8wQ0KqkqvnkMUSo2uWKFWKvKTxaMy1+c7Oq7Tuu9ctuZZucX/mnD5kbUpCSBkT6AG00VXNkJ0/BzYeCxk2L1Ki3AnjNtZzDaFGqPnXROw6//46vnHWmHNaMyhari/iS86EAThgYNVd0ZBM0V5U37mdXnZF51/kJbc9Mr5wmzTJSZjG7tuXVTateyK0U9WXR1oq0PHiaz9fa25kY0qp31ZIaHKn8LEYEOLDpSVI0w2dv5SvoS/F5/wkBcPYH/Is791WC3DcNuXz+3oddXzxMyXFUBmQJWZ1Kxb1oeeVPUVPF82dt6Ea4e7r+/iRnCPIG6Wit5M1zV+v6YNMDE6NiUIPmqh99aGPrs9OXH4GoY39KF+y9o4KB+XD8HNOz6vs9ek40qg4Vg7E5JUdZig83NUE7h9ZuhYLJ2vvUs6e0DfVVc6LtAwErsY9gepzTs+l8/WuPzhCQyRWPlzR6M12Bri/4Rhh6setGCKMXWz8/VzK/g6nxfczLE737ZQiQDiKpoibZ0NVeQYhcs20Kki4rfGsQY0G+JL6BhPdnX19vXS8BKbst9sVaQ5zTm+h9G0w5HGsvWbIZhzh45x+tio4pmyq4SdagqDI7br3zq+jYaVktv8/HHG8+z8ltPilBt36Sh0pNFZdzmNMvjnIzdPK5Ubh0fHsRik6oq4Fei9XP1nRBF+EDvWYXes70YyrZyTDt+56/HM2KaKtz95rkqY99pdWUdmyJURTljt/Y3C7ORqMB6ompsrZUP3doMntMpZX2L5zHtZ5uLDv5AYdswM4zk9oEw5dFUKcL0jjVWLpq5mXDIlUpM5PhDeWEMzkwzshlTmrxUNiUeMj/XiWCdBUNnhwTYwbDbVtaUO3s9OhXBkS1G55Eqind3TE636+pi9aZNGpbKxZxrenpl5Uo4HE75XC5XYC4TEb4iUpdZONBuh8DtFj3+A9Kx2sFQ+xAFGwLsYNhuC+7g9QiV1dS3Z2GKsVHxezgyWZov7Z4Y21kNTFNWgA+2Ai5CYAKf9AhhEalrR86zJO7Jl5msV3ErbG8aLrFnL1aosJD624kJUWypmyzZ6qm0qWwGgWKsEK4FwuGQJcsVMr0WoiKT1FaexkpNlt/dyaoQ84aB9uag47OXECmwbWTmCRkQP3J6JGp71xsXS9ZSOpqaBqqra1dC4USKuAKpjBdIXyRcNFtIFhC+3BjuGHsHTaqwg9De0Y5B14BuA2Xf7pw7cv2ljzBTgKxsKQJPzJWxJ+pP6lKipfs63JiBH10VcKEQ4YqSMr0CIouHa1/t7sgVhvUW8XU8Re5oAj57ic+pTOqJpqp4rImCKm5Kr0Ow5w1M18JcXQGkxwcYoSj9CF+my7KVPKhtWRjv8pb1YMfd5hKefZJUkTkVsGSZedGqVF+gfo937mZuMD+aKyaLdC3mKhWYicOVECYaVxx2PGq03JdfILLQsh7p6GjpaMGgawX1mN05//L6H0bp3S+dRagY6OrZSevGpCCCpatypxeuTduoYrkCrnAiHOC2Urk4gCvFlmkeacGy6vBlTN+7tR+QLjp25/2b61s+hSaSqq34vMBSRVuHrqtez/KXvSGIsXXFZd24weswRUC0KN64Yis6SaIlVRE+svp7Z8vdA/VnzRQ2kqurMlVrl627Ud0iBDVPPPeMYDi1cmKs4MqSFbLqMEUJRfHLRlXhYm3edCjJosKW8Hs13+PznJa7xXujaTpVwPSzSlXUAVUED1noi16JUtgtIxGGAKUEtdbOVIFAOBGCKiZrdRayLF1xflckn9M6FVtu0rbwbxN8jF/Uxrc92DKIYa0BVicfA+r26a8f/PQlqwC3IsSU7FVjXBXXpCNq8KAQ9LlCiitNFZCufIFEIsxzFQpdhSyqS9qihVjmomSLf4w+nnlq8C7QjfojqcpumKsyVfPm9pRf4lGalpYsZ3bB5fP5UgjWFRtXTJV05XNBFhEFVSA4q9mihVjA31h44k2LzhwGL14cvDhIwQaGsmaIff3c019/CQ+KHaz+qmNViklR9Lu1D5anEgn4XD7MMOHKZ+NKVQWxVFYCrhhhwzCYL2JLFuJYdRVSZQf33PMjHjngB+m+2E3BBoayBnxbX1NOe/17L1lPP0uov2pXxZt+BXE71J1NbgXhicpCEQbsVNWXNROStuIGELbkLbGi1iDwv0hldf+nkFYFWdmiSU0J4hV62wF/27PKpgv4YApFWL9haaq4K9fMTDAk8RrSFtNFu9amlMV9fUxkne/+7xjGVJ2kKrucWaWIiVXayfKu2tJ9TRUSSBRVhVdShDdOaFcM6coVDEpZ4VDUkLZEISJa62qwAKalnUTWMKV7uJuCDQxlDcS2ft5tX49WRVOFVqWqyuSnSNAxavDU+tozXdQUf4GrgH2srimqAFpclSxcnDQseLJ414q6hS0erd+JrMeH8X/UODeMcQ7IbbwAbVs/9zavHxh1ULZYq5IlaBy6qStVkx6tpe0gc4SBxSrCldtrV8AFAnNzc0wVkWUajNpoxVgFimjhcenDkHXuv+C9Uev9XzGphAqYu043hf9TlCgzh0NvgBcfXuiPXq8IV6avKa5uSFeE1NzcBI8VMJeXZbRmq6J1LBoW84UHD/fiffS5xvMTujppVeu8VUlbxZjbggdeLUEmy7+f8wFY4g2LBStVq2paUwVXMlihiYk5pgokMsvVtiCLt/g9tWWBnyFLJKvnXI8CDgiwg6GstXPsr/8UXR1kDThSSzATKbsFfvqlNS1weTtIJbHyoyvW3a+oroDqSlUVCIQhK8xVJSALCFmA1+GuejMEB1RWT2NhqnbisKS6ymQKU+5q1Dr0sNeYEWB5wop90X1tiqXfBVVXYObq1SBTJWQpXYvJyrJYyWjFGi5rBKpIr8p7V3PClZgv7ON7cApRdBG3RA+rxMOIiyCDhQFEsPRYAZtYgbmFhSCPFZivKwu2xERL6Joisp7uGRnpGenBoGsNebz+OSP214+QaRVk5SM57mpeulqOOYFbhaqSuioZmiQ2A1WGOndHt1Jc6d3K4ipkcVdqstRZ/DYVVc0SldU/Iugf6SdgpW4DrPTj9Jjd9f3szXIpmsvxUMkKNNc0VVrHKi8SR0wTT5XQhh9Zzt0VVbauUqGFxcUZ4WpmBrJAtay41eHzRJXa4oms8/2NgfWqUjIHVxzhKnqLqHLSFylLMVZegBjpCJvKfgrBkqki6K5UVZCVWFxcJKY0WUDp8HnpqfGyfnrGAdYKJlelPF7IrP/ppKI0xORhfwFCmCTmSN1nHcv+LsiQrvBoZm5x8SoTBVVclt60aLKsRZU1MDDQP9CPQdcCdV85DsQ1QL9+YDRNVBUzMCVKcFW62hyzTPFcqdECe0QVF0M3a/fJ5zQiVnbtClTFCiws5ia4KhA8QRa+Dz1ZDwzccf6i7Wx60zjCON5PEPVoq5WcRFGd+ugoN/fUSy9VT1UPTXuu1EPVr5B7T/02wAG0ZrFZMAjMshCVBRziXTCOncR2Xtqq/3nZfXZmdrdJtf15CsYiCvzyf56dmd3iH3msLv2kqvGCTnK9KcVAmNbfMf4e8xSRoor5GO29JlTlzq5UV028Ipu5EtiZyXIuKVP/r6zfWLd6Xg0ByQLUrqQo9mXqetep14D0wi3pj6m9K0dBmlw909uV2Ege4gUlVNm2nyWL9aw0Wbfv3r199zbGXUDfp9wDeh491v78Y97XF0qzwojOMw+OSgQKUWtZjXUfnVtEiVbNxuO6WOlAFLnKjFW86T5bLKZwJbFJljF3OIMqNihgJSGrWH5m3aoNU2Zj5639sKzI0nS9rD05aMJWnCQxKtpjUYVP02IFjKOgPD/Rx2sZkqocWa0zocpMVqH8FmAV2AoBqUq4Om+UFNQavOohLMzWQSV70hBPsqAqyxWeRLKEKWAh4mRKkaVPtDLLUHD/9n2M24T2c/qe7s3nRa7SGju46JZLZUOXFHbYEoUlL9GrKY7Ux/xYCFm5rurkittqLsaTKalieFClL6VlsjRKvAx37xcJjoNBNX2+AC5MVRiSPyrRKeQabFWAsn9Fj8EIT8ieiFY4SgWC5hCvwOaNPcbPkZWWrHtFuvpmJ4CrDFVwBUoYiitRi0dh4nQ7XByY+1fyMQOV+kw7h0qySBXVIGiGvh+qroZZyXLMZCmy9u7vcfANBr+X0GP6efpzfsZc9DyUpqgCJes5c0XZSs61dmqRKsCjpe9fyccCrO6eGCcGZQkKDFVN2/d9y04wHJIshiJLC1ZJytrb3t7b3vtg8Icw6J6BCdbzlKOgYNngwUrT1ZioV+ixHj8y9q8SJpC8FFdKCequmgvf8xVVubIUU/yGy9ouir3vMGtwVFOTCL+zXxaUjGRd1bUp03EFNvT9q0pEnbWskdKujlNjBejkxNBrtdzYFFylyBpklWFJytrcLoyvsHI25wsc33kHT13Zs9Sp1sUTc+9O1GEtMRLUR81+XTw5P1cHUhbfbve8ieLKlAXSZfHGymVtbCtsbG9g0L3AfGz+DMEKfNnYSRTwJ773ttyFKoZWhQ3e2RVXgO3sqftXMlR1puKg368oqgD5NHIF+pbXclxhKlZlWSmyqjkNHrKKAh1rrbgax678V1DVFclS29b1QeqqhS1nlKkoIBXNvl0zF86mKnLV8x1nbAukKbh6H1liBQuKlLX9eCc4pQv4FFX+ZVfUoJGtmxq19mRd8aZF+1cUKw7WdzWtBOk5HM1Vf4rFsStFkSur9T6yMNh/hSbr252dM2VuRa46h10AX1HTinj+xFBFsmj/KqIuwVTpmXJunlzRslkg9pDtllMdQ5USq3xZpCqRrE83dnc3djc4+AaD7kH69wT9mdOdYBD3dYnP8f7sCihYGGBtlqA0wGdaVIEUKw7e8zN1O4ZUyRIckSowgQDLpmYVkS+LhGEIWbvF8BjtfUKqkrL+mHNT+Ooq04e2VoLJsEhZZqwAzsGTLHPdzKBYgV4IAaGq6v2TVRIjlnVv9x5Gjgl6jvaYvkcVXgpVlCvBct6VtqJgiduqkiutXeNd1pOx4pAsqyYTyEjaVEtQbLdbeP9eXIGEazm5sshXXIb3igHHQlmFZIrjXXNXZYzIF6/DTnasuKxePVYFyBR84B3XUtqV2q+aUa7sFvZdrKEkocp1nZx5FonCbbGyNoOdoJUswUiVFyBYXJc6e1iqsyv9hHu/J2XVKVjSBpdVORbdioJl5Eqe7uotOp3BLBJFuMD51+VOKRL2n2Vt3tvEUH6EiUMwmcSpIledxnwOVaIQqRQv8nIFcMCrU2OnVAlZrjtiz8xuVwhVJGsKV75ZgS6YVvNk0RwrTtbDzQ8GogweYeJAswVy5b2BK6ji0Gzr1VNylXrdmU2yDFcHtus2a0oJGjPROFduZzCoWqqpmGr+Fk0JQ/giWUXwbbBzThUo8ECbu5pryXp7DFV5ripox5DFRgx1JHs6tckVSHfVA1Zn0B5MaWYF3FjXtJMnq0TJKlgWtkjbhilwI13FTYuxX08/DJKrOt4bTOnNSuro4cQyyapndHaosodVaAgVVZIpY5CzU0ozB5L1oBhZ2HHoKK6EreW8MQdQlZg/dMOnubkCIws9XK9AmmvikgW2GMpy1U+6OlkYzQqqhCxypcsSoZKmSNanRbDJtrLiXuVhCP5qxLLk/AGyXuS2q/hyxmSqaFrOmYZhP32PoZl0ZTvtk5NxiirhajY7yT4VBleA6yJZdwqR9SAIdjytBoFzCFGNuAzn3NWfx6kLHEVW33JtowRJlhWGrrp1BVRXYIj+vfRJFfUqwSxUZAE6yQpV0XGwcFmPg+DUFyQ/sveMqeLQEXHeI1dmu5IGcLzrGc2KsLETNKKjIKkiV7ZtdZbLZUtLFUxJUMqTrAk8ZJGqFFkPP32I8Z9l4XShVoEtjLeNhm6rfGLmSnMFrOm0KVxpoZJOwvHYUkrQdDVtL5erhCuJNDWdAT9TVkbPuvOwCLBL+tIHpIoFq81UUYfnvM09CkpXB3g/IzVWZIpJGWKtcJCUSapkv1qcLFcrzyhAyhXIWhqKnhVDsj5+8GFaHjx8gKF//10QvFRccU4bgFciNflQqCJZhivQw9shVXqsQD/0/YXZregw6EDVapKnCnSMCTzJolApsooAyXohRZErVOG8S1XIm/zrfzkMCqzZbGi4IlUwMsS/y1SLFR0GwxOoWoYZfV26ov5uXlN6SaqKl/UoCM6oswucKg8WG7Jn4Wb2Pq5GeCN9vQKpK3ErM/xFbl1tV1KVW12BgZsbq4z+LibwkAVSZN0pgkfsSj9SJbiAK64qttW9TlFlbqD3wzA8SDdFK+QJ/oaZ3q6gyvJWDD/jEEiEmS0LZaiKKmNA1lZxsmRjp9/e8gqqulKXtLXObVfSFZtGTXVXTXIltNg+/gq/py1w3NYKnHdm2jKQKlCCf492xvydl6FGGcnaKkjWt0FwQaakrOsGo5s4JM6beq5SN9DDxcJWelWTXAlTgNnCW5tY9GNrMmCmzpdjbXvBzBVceeSKggXgytNllVGGW1tbX3xcBNhUXsMUpQoMeKgYcSG+1qYMRqyYIj7lRBUarihV0ta4WsVmVdVf4N0vJk57xThf+i65Sq3BcBaCQWzK/L8zLzVT2AkXsu4U8IVkrePGLmWtSRRuOOdmripaCYLZYjxLqcB+BF3oOHUGoA3YDJSnaqCmapqeKuC1iYGy1mkZZVgWsm4VlCzIIleC5w2gHhCHWTUY5wr0sTttG65IlnJVaNhqA6wBIet8NfBmlkCqipuV4Wqiu1I+rOCFago3hx9t3br1ScGy6NcnvWkA0gX2kwvn9HYF3MlkYajSChAjwgonLQfv1PFDV18HZsQKjAe6q2SwvD+MYB19dKtAWeeaq+p1QpVo8jfHuisJ5Qp2sCtm6Y29T644NqGcj3+vZgX8DFcyWP6NMmtgXHNZXxTBT7jkT/t1i51GgjnP1lq7kkNr7YIptsWapCq9/kiVJHsfJkXVuKqp0j9fxb+OXTFZ7Ot7LiuFL2AQNwr5z2HJckgWY9VQmMNXKGXJvavU/fM+NsXcgxxZdhI9VUBVhaHLWjgkKuOTezrJboVb8IjLKoSfgmBFseK80GRhjPTODvQz7ljGTJLLQF1VzzBFqvKPgYJFa8AtER3jM6H8QG3vZfBDobLOhSoMwU5Dt3VE7SrzOlmbLfnSZ6HATutWZqqymxVUqXSUz8+SRei/k6IAbkC3/AuT9XkhsnByZ8XrD0NyYwTrylg3V8zLZFstv5k9tSJRdmZbp1QRslc5eqRErvRP/XvBTQlfksbXXJbGJ7CHG+NxPl/KMqwSfzc05qdQlZcr2Bni5VoyVn1KlV6Bw+liylWRK5dildHYJ06y8MSd+Zl/kNXaj0qQovX6I8j67PMCkLKqBF7B/uGhZuuEYpVx7WfPbzl+/mzBcs5ujso4nVC+Wrt5qlRXC6+ajBRhfvamfxNNGOQd6P4KWbBVmKwqgRfQNoLVmNQEGbGCnxCbYMMcV8OTqzK2MCP21yQrt7GPW51UqqSKXJ1Sa2eI0+i/C1kJPoc53KSS/xwui2KFsTxs6MlyyVVdm10JPxbCGZIqo1d1jqSpEh/gapYWK0LWn2mJ00n5BFz/MpqJ8iF9/UPdufy4FMVx/MYf4E9ghURELMQCEa/Em3gl4hWPeEYICfGKJREiQbARwULEwoYVG4nGdWk7DUHTpEbbSKudajvtdDpjiO9533POvUXNovOZ03tvaybRT76/X29Oz22HFzvOZLgaFfRk9YAqVBm+XofWIPODhVQvou9NV6pZ9Yl3XCBKbOKfIatdqlJJ4UShdNmfrVyBKAypiq0rQxU655GsUZaFVFH6XatnSVd2CQK68hNFGNrYS/rVwriRjRfVp/f0XoUpr0BMVfJTu4fUrAxTRcvQewhZmyYjW+P/CH4Jo92xkKW+nLnieUawmsKVWr6gvQmRwd9mQpoVSGWpKYrbHPn14znLl/tCr0BFKvn2z6JAVLarYlNkSgFXiTUOODt+FJCyVKzwwpx2abQwBC0RKztXdJoTf55sc2L16xkn0UrX6/VKJf+Lta5E7ItExeorXlgZ7TyBqKzAF0MsUloRYiSy1x2wdzRl+VX1fBjyzKbVCHcFW5/IH78SqmxXVeGqWahX4IrQ4k2sZKr6+jmp5tZszK+wIPTGBhNSk4AvsV7rEHaOoqzvSIbv+9EHPbMOK1IVMFcnvCITxF/0SSv/+XrG5a7ieRIrThOuSLz6NFOpXu2dEwzbEtkwkkRWD2JKMHQxV+4xh7ByPJhoMX7ieIx/eYzI0r93vwVVTJcwVtVipbl69+otWSXLVGGItq5s/XzGSdcr3FU+X5ma4E2s1StNiWVPXJhC1Jz5tTvF/qEfwhJumih62+pQFp+XrjrHkPWBEhuBKKZLUISsQFewk8RffOOuguasPgtXkYoEtvL8839wa5VTeFOILZeWvgA1YsD+4W2sXME3vBuz7eqknW5Ac5UDeNMaTVkfhKsPPzyKqxrXC7tdEZirWCxFVYXMhMqZy2FpqpIHaf+Viz9+9hejKeFLCdN0vYiVapX0UKvp6ZLIjeBTxVb9ZI84nOVE1jj8UHBggofsx+3fYbI+SFexGG9ZdMPola6YKVWD5I2WJDElZBmqECxBi5mSNOWZFycbHx78ma7U+2u1avk7KFf76pV8+ufgwPBIHIaC4ReNajXIxlFHsonI+m+kLOmq6HFcaetrmCvMXObeolUFpIrbasgLyYaoK6WL9zKurBNYm2I7lSn2Qgi2LHEkqxGtUZKlVElZvGlhgIxWgkIVrqyJ5YpRX6iMXIFMVs4vpVkBKnjP6VzYczp8mVLtCsQ3Oz7OTkS0JozDmEBRx9p9sQ8CD0tZMbgilDyOOjd9yVQZrf0bVBWTsGRXoJw37ucXdGKDUGmuCqKbdZoqtgU4Yqp4pNh2nUNQXQu2JvwvkFWWqkCu7ElcLuwVZL3mqHYFVcWUZsqeNI6TOqFPx9ViVSDEO1dFN2xIEmzw9cJ3HJ1j49HBR11WVakCLuG9cKVi9eVDEWTet3EFWz1EFQtAxG+K2po69B/Bko3KbuzAdAUWn8Xr4KjIinGw4CJX8wTy5PT1a721v3sZhalSz0tblRRF+cmvu8OI533AFEiPdGBJDtxUosSOxyp7xrFYdoVEa9qEaRLcwQg7Nh8TsqQrdKFcn67KxU7UIFf1qbdI+Bz0GkhVCVlf3OeAxWAEiiAJgzKVfL1mw+3Ektjo9ccjxWwddkK+cxu2/odF+XyZq6IUIcvQFddq8GMyR2P1UU5Z2Y2dU3quGC5I8ixXYPBfMqV2ovz08wXFRSeQ5ePAf8kSycpRW9DQ7wFN1483cpLhZaqnCEq5b/Y7p/ZbXAPi0js8tQGRLLqHK0qTS7BRZjD8Z1X22TobuCFTuN3a54SwGZWEaE2aNkmAQ3VfYf473wtZOaYK1D0D90dPNPWNLTorUlXFVFizAsrV1yxXRdi97ezeYzv2btq2gqWL2GqkG54qMrPo9DwxUdp8FdtiT1WJEjy0ywll1RVia1LHkDKkqopwRah4Js0ecXIPSqWeb6+Eq/bLPMp4BrL/yqeweMe2pdQXsdUYpI1a5gZH1n3ey7kms1OpMyuYIu1qsdOGlReQrM5tIVnVWIyqCpHljlBXOWYq9fIdxzZlXJk0wOqDPTH/c1i2aSnt9JDVGGalBrgZ677csKHBSlBxaL3TniVHaFl1LqsMVUJWqZiPeBFPo/UpQ+Yvk5+/fnylFqUZbd12lXETgL9SHTRex8+TUkQxNhpxJkKLkryv7TVFdKuRTRzc54Sigk1VTfcxafokjND76jGaLCJKuCoVInCly8LscQfrrGKsQJix7VZBjC/kQSHfiHBH8rRAv6+EAX+3Ms4Ysof2ifS2Z/kF4qoj0LOqyhUoQI/ua8CWFe4KprisRgIIYWcC/tPbWLrSEV909HNzw5DogapPgSwzddgswHCWXJ/+37JKjKmGKshqs35PmrKClYknfNx1Alh2diNk5ac2lSpgqbLbFDY8sbdObj91+OL6E84/sWrSnOlzMJgCHAB2v83jAGVYU65AOuIZXWuQuQqvwMBFoaVE1hetsG6y+ey2rSumYsGIhpkoYYjYOXhy+5RTZw5fPLdv/a7jRuH9Q7jmdALpWdSUkgU8U1bQREzblY6ZEchSvv5UJLsunpm7/eTBPZyDB08eOrR9+1xoOXP48F2Y2bd+/S5bTudsuD1n4ZyFFBxQcIBB90HgYVKGJSHrOwZk0aalhA3JVGmEqqKy8uJTIRgnnG5jyfWZC2diLMSYyVH3sQHiWOxJskrSFWa+GzRZRJiUxVWFL3S01+8Vhaosve1xupANt2f+I0hWjasCTJan6xoSrmxVGNyUvoI25mYpohK3O93Ikmv/KGs/GjxVpWSxaPnKMGx6L2z53reSuqiTHRx2uhOEawZl5oyZGHQPxLHYa7KUq3K5wWIl4wVZfzqzErK4qlRNXqkoivGc06UsucZU/R378/k+WoJKlkCWoW0K2C+BGETV57wLU9SWzNcup2vZcHvGX4Nk9clYwRVkCVHY0O2QPb1nNytAVJFPNiWuXP7DuOV0MSRc/5AsnyozWRiQZTWr4AtuMlDVOwBHTJfilNPVbJg9e8ZspgMHGHyvHuMcgCzlyp8ssqUHg393bdI38qEj0WEXJKgvDC6ta1uWDNfs9ihZ/T5V1XI6IvHYGNBOQkMueMO1g3D19he1BF3UlajE7jsltcL117KkKsiqTo1oQNeAOWllX5uUgSq46vmhXafIo9XtVcjDNWv2rNkYs+QeGI8dKBQgi4vCqBYMV16kpdefHSuooq5ycSFJ9i2ycdc7Y4ENj2f9CSSrXhZUQT5i4A0HTcT4U8VX7dcirglsjY1g0XBd+pOse5AlTYXI4t3KMsVVcVfpIFVgz3FnrLDq8R9lVZQqUImYNImq4NfAr0lxNciLlhvMky4+IbVYfGnerFnzZs3DCJRVKFSUqlqtVo/EDVnxb8SUfWUSQiWvyPoed4O5OXZyRVl5dV4495Gsalm4Av1wZZAMUIVQ+a5eS7NVgjZblzhjjYdtZeWlKmoLdgxfL4zP/mKhArwGY7+gCsMicsUZgyx7wNQsmLcAQ5rC4VMpq8aJWHxI4mMqpCryPr66eg1UInLJrs7lY87YZMPpBYE8giyVKtAXj5vJKiahpPcz/QrpqH71WjL6YdgD3JSWsN0rnbHKkkuhsmqQVeWq+oisiO6rytejv6XAEweuVKzUVRlc23hnLLPyKtUzf8F8DLbHEWT1iVBRWSMRostvq94LW/rVRzxXMcRKiBI/LFvNvc4Y5wb8mGASvi5l9YGBOGRp0Wr0MlvUl9whVr/bO3fdtmEoDPNJ0r1P0UW+oKC1GGjRJoCBdKinwB09B/DgIICHvELRIQ+RQYuHnqxdjI42ejMqVWpguUWPKNJHFKtKBZJBlD5YpucPh8c/aRLeeHSOK/vgFHzBak93bsgaY3ZIVUl+eQCgVdZPcTsE5RCJqs+/lSrSJUvrhFkBX+RkJdmBXCFr1bRA+drjpp52uS35fPPDWxYQnzFbuJo6zhPnIOt6g5s06QxEfN8PAPGytQUf0JbQRbK+x4YjlR9eDpg9dOdOFjEPv0hXiMgOoJXWe7rblnIbLuWms8mz+oX2kozqEOdrLC1hSpJWVjZB+HS1TSjbgDyWZALPmXXwhdNxOvhCWz20JVyluoIYQKiiyRhqNwG/RvLsiGdW18WI2chw2pEkpRWgLEUICk9V1zf6X56bMKMqz6s+s5QrpWuc2PIlQbBSogAO+XR1Ky6afvy0AuGKniXhPWIWI3U5vdRW4AcCkJArJN7d7SLtlx9VW8pXbdfN/6frfJPYUq58cqWivBpIlTrFRcJOObOe4SKx1Vsj20Cwjam01JODjiUpcbaE9jL4W9Hkla7tNgTI9XgxmtChiMie0F5G/930+vX6wOOsKvinKDlaFdrL4XOcipIACOpcxco820J7BfhsLH1F+jyUQxE2hvYqdEezo8lk8hQIavQFwiwN7ZV5Awa0+Mnh1nen/Z44BkLv9DljYHVorwbfgwGtf4iL2u+03weXYKJKi5pXE0J7FU5Bw8zz+N6Q0F4OD4EwvhWRJoX2UoZhUY9PZ2PYrNBewuAODLzDUMPjMQ8Kd6GIaMZaclxG8FfcIWsxGLkxGOzazl7AYKLn09idtd2qmP7ZiZsK24fHR20MLafPB6O2UTWAP1yGz7GpTmekAAAAAElFTkSuQmCC",");\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-content-guide-phone {\n position: absolute;\n width: 58px;\n height: 56px;\n left: 0;\n top: 0;\n}\n.$id-modal-content-guide-phone-move-x {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-x 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-move-y {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-y 4s cubic-bezier(0.42, 0, 0.23, 0.98) 0.5s infinite;\n}\n.$id-modal-content-guide-phone-blink {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n will-change: opacity;\n animation: $id-guide-blink 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-image {\n width: 58px;\n height: 56px;\n background-image: url(").concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK4AAAClCAMAAADyFTYfAAAC+lBMVEUAAABISEhKSkpGRkZERERCQkJOTk45OTlBQUFQUFBSUlJUVFQ7OztYWFg/Pz8/Pz9aWlpkZGQ3NzdcXFxeXl5MTExHR0dhYWFJSUk9PT1WVlZMTEygoKBERERFRUVmZmZQUFA9PT1LS0tra2tPT09ubm5SUlI2NjZXV1czMzOpqalTU1O3t7dVVVVoaGhaWlpqamq1tbWhoaGenp6lpaWurq6ysrJZWVmjo6OgoKBUVFRdXV1cXFyvr6+0tLSwsLCrq6ubm5syMjKbm5twcHCQkJCLi4uGhobLy8uCgoJ9fX1ycnLPz894eHizs7NxcXFgYGCVlZWYmJh7e3umpqa3t7fOzs7JycnFxcWvr6+JiYl0dHRra2uSkpKNjY2IiIi4uLiUlJSsrKx3d3fDw8OHh4eQkJB9fX2dnZ2UlJR/f3++vr6RkZFzc3ODg4OioqKcnJyUlJSCgoJ4eHirq6u4uLh4eHiBgYF2dnaLi4uMjIyjo6OZmZm1tbWwsLCcnJyxsbF6enqAgICwsLC9vb26urqjo6OKioqsrKyWlpaoqKhbW1u2traCgoJ6enqZmZmbm5t+fn6JiYmgoKC0tLS4uLhmZma0tLSYmJhxcXF1dXWlpaWfn5+IiIicnJyzs7Ofn5+xsbGampq7u7vAwMCMjIxgYGChoaGgoKCQkJCOjo5vb2+RkZG1tbWOjo6Hh4d6enq1tbV8fHzGxsZubm5mZmanp6eZmZmvr6+Hh4eTk5Ojo6NwcHCenp6mpqZ6enqlpaWWlpaJiYmlpaVjY2OcnJyKiop9fX1/f3+CgoKlpaV4eHiUlJSIiIixsbGqqqqGhoZxcXGPj4+ysrK1tbWurq63t7eBgYG2tra2tralpaV+fn6enp6tra2EhISZmZmVlZWGhoZycnKhoaHV1dXX19fW1tbZ2dmrq6upqamwsLDa2trU1NSzs7Ovr6+ysrKurq6tra3S0tLGxsa9vb3Q0NDDw8PNzc3BwcG/v7/IyMi6urq4uLi1tbVYe8d+AAAA5HRSTlMA4+Pj4+Dj4OPj4+Pg4+Pg4+Pg4+Pj4OPg4OPg7+Dg4+Dj4OPg4+Dg4ODM4Mzg4+DjzPDwzMzM4MzM4ODgzMzMzMzg7uPMzMz+zMzM/swD4+DNzMz0/vz8+fXNzerMzAr58dPN9fLs7MzMzPn05My3j1w/Lff07+7MLRH77+7u7uVbJfr39PPr6eno6Ofn59W7jl9ZVxAK+ffr6dXVuHNAQCYm/Prx6uff3NLNuaePjX9zc/vq6d/f3NbUyK6rqaeNjXMR6ufc2tG9vLynp4xzWUnn0ry8t6WZemFLNxrRyMjIxGrWwvApAAASsUlEQVR42uzW12tTYRjH8aMQvLDiJDa2aimigqiQ3NjLIjVpTQutrba2FkupthXqIA6caNUaxYUXDlTcWhUVB+LeCxXUGy8EFxlocoxohokJ+Hvfk9Pn4q1By/EYwe9f8OHhd4b0P40qmXfm6vuJV8/Mk/6BVp19XD2Rd+Lq8xIprVu88kY1sEnuCYCltK1k3tbi+kXV8HLsgzpHIuFwnpHSMowA2EXVi7j2wYzA9/j3eLyioiL7lZRuYQTFxcX19fDiuNVtju+sOLio9ayUTmEERZO4lk9hoyUYDALburBXd8ORhkSF/DmN7osRTJoELcJtHzgrgqx43V1TRkYPtOFDQrZI6RFGAKuqrX9RFY1GgV2yYEgGsEqDErKcDs8bRtBcVFTEucDeXxv9FkWBhp4ZiLwNstwu6Z04gkdFPK59uDT+jRXccaG3KYntOK8sl0t/tcXPXhY2N6vahy9aw+EwsI4FRhNL4aoZZPmzpH80gtOFhdA2K9r75V+/htH0w4N6m3h0XF4/WQ5If6tVtx8VshTtpRWHvqJw1FJj6I0ELrT6c2kET1usHdqHzu2xGNNWzcwEFQlTgFb369II3lmtLS2Fire9PGaLgXvwcC9+WOLy6Li6cmkEe6ysFu69lB222aANm2sMLOISVkeuOALrVCsP2NfO6ZGIDbXOzDIoqVjUCTfwUdIvjGDCVGCTt22vskWQ7VBdL4OaOAXSMq5+18UIJkzo4B5fe85ut0cisbXnB6vW1FtAAb24i+c+hRVazp16b3UoZEfbF2YNNhCXsDQF3a+LEZyq5VjluBerQl9CqLKu/5DByEDcVMdFAR22e+D2ydraWlXbvn7Kly/Q2sp3GocIWuG4+nIxgicFKKk9fvSQy8+00xtygOXaX1+uyNV6BLcKOBbhsheX+T0uv99/bukAI7BMK16X3mLicUcEPv457oG9J6cV8Bj28rrJbrfH5Qo5dmUa0U+PS1hEWoGr9QiapqnaguNHK71uaD2rG0YZFWzqKZg61Y74+Ee4JftuvS2FVvHWXpzv9jHtlPEDM3FZgUta8UkjLbj96LpajmBLaWlTUxK7eZ3dh7wux67cTGjVJbB+TUveGs25d7Y9KS0rZdwmaC8frfR5YfXNahvNsHRc1m+9FtAYM8ag7QjelJVBq1z32Hw3qF7fZEvfXI6l4xpTLFf8Lef1mWHWlIsR5JexuHbzcrvPizxVm7JykcKlKYjeVJ+IHmOcZgSuViO4lp+fr2DR+kovuysbQZagRZ1gSStuoRsuqxkXI5jTmM/jXIzAi3w2S98sxLW5xE35iQA4Q3gtmOrMKveTFiNQsQgj4FaMIAfWJJe0qlc4boop1CS12XTdro8gr7ERXN7m9ZU4LJrVNnLYMEFLxyUvaVniFvqhNlA1GEPJvptX8vIa85K35SNANsvQnGGIYclLWjou1YGl1wJ5l2pwXYxgdh6PH3f3crsbny6vHyMAlrTCcUmb+rjEXZHUgvupqyO4Pm5cUgssRuCGFiMYm4NScVP+OIpbIG62mbi/PQIVC+6xNR4vw9osY4bDqnrFKSjRcAVvZw8acbt23f0/SLV7n6aiMAzg8SMkSkwkaPz+SPwqbbHcXAVjpRJ1cFIGAjJqTB1IR+IiyiDRBRZhkYGYuDK4ECb/AAcd/IgObscGk8YAf4Hve96ePj19r+e28eEf+OXJc889bfn04cqlK47LI+CYyYXc+dPCTRpu+uXmiNWq5XrcPx1yl169v0RhLVt5BJypcuE8x3VLSeOqbvVywWUtuO2PIHtJtMxdmzZMpREM5HLQppTLadHWvYlaxz3O+aO4wRFks1mnXX46bq10EvTnOJ2UywmUK1Rwb3bc7tLi+yzFlfuyPoLn5eLV3NVcR+WeONnBFITLWOFutjOClY8jI9kGd21ORjARn+nv7xcutLpcSYArCXAxBs3VI/g6cjlb12YxgkeZfqu1QbsWeza4XEon5V7gdsENj2D1MqVe7vLLxklQzGQyrKVAaxMqFw8a0g73OLjBEQxftrHaphFkBIt29RY4Spv25QK4wF5or903775eHx4erne7PDNe/UV/NIJCRsJY4upyj6XfHBH1imgEXJIKd3PrnyMYHCStlPuAR1C1IxgdGhpq1oIrWJu0m6OHDX25wPG4m8kjKA2SVrgja3O1KoVGcK4wREG5BGZs6BSTBMoVbahccDeJq0fwpVQi7KCdwgMaQZWq3Z6cL1BYK162SrfeoYtyrdfDhk4xlOtryeu1q0YQRYS15V6nEZgqZ6rcY7EFaDngkla3i49oTpv+iVKV67Xrb/fnj1I+KpWEO7xOI+BMxHevFSTYArR6C4JFuekXR30Xg7avL5m79COfz0d1rh2BqRoaQfEatF656lgIXcvDXH2KwZvMXfkWRaSNSHt99mGVsKb6vHyKsNDiQRMt2gUXWmA7vy645frtbjW4i9SslPt5ZrtqKBNxpVgkrea65bZebrxDt4Obo+ai3L5E7ru6NhqcZmqVR8C5xlFab7rhKegHLV2L6frtbglXtJa7fpu1U+WLo0UbT4stoNxcMtfXYrr6Z6kwty9pDIsRdcvaWW52en501Gk5oi0ka9X7V50LwVMsrFVj2LBvBrYSuDRD2tsvCKu4arl40Nq6iqX/zqMvN4q7JdxVovKxwNq5AWC1ViLDtd4WrXih/a+LrmjBjYW7mJfM1kxtsoewvle/Ijih96+N1qaXq7U+d4O4d77lbbfr28ZMVyqVu3eLo6FycYgprTrE2rvcHAl0q8awwlgS3zPm3gJhKbco5zhJZ24GN0fRSgJclNvJp4hWbiztfs/bdulQ2J7ncimMRc5w/Cl45QIradGCm/r61VpwY+EuUbXc7rgxYwR1adIiA5RD2IJg4YXWRbCdlKu3cKPB3SDuCmO53NptbhZSaIGlXOSc4hwIfhUiVl2u/hQRKBftxjIG90J7yOVSdLO+V7CSHpfe0/61HN0GD139UwS0/2r3u32jfTamtkBQR9Va1yv9OS1yyOWs0oa2EFgutMKN69xV+0ajLbxVxXqRZrUUWs6BQwc4vb29x/zLjY+FNjQFcNHuF7uFGdoCtOAOuFyEVheLkFa8kv2cw+Rt99tyF48rWOHaM5enW4ZUtJ5XqGJVWkiBFa5kXz3OG/jPQbXcFi5Z6W/CmHmxetQzVKp+wMLaXq1FjnK6u7t9beLlRrTCjcG1BxmduhW9WnFKUC7ScMpm1Q5IStZWbrfN3nr8LahyKU+auXLRNcYkvRRgBRRBraBKudB6te7rdlyA9+zdw+nq6iKtOhaEGzvub+JGFFNzXEyWmYob3KyTIl6tVgoruOJ1OXiwhRs3ceViLu1Ci6fLST2tgkILbwPqsNA6qkS04FJ22uzYDe4zx40oNeImnwXt70CCdvVeEXAhVVzyco6PjY097rpx5PXGb+JGBC7RzRxYHLHQpjQLK6T7odVQaD2oSKHl9Nx/tGcXx223xGMAF3sNbdZz+lxILfRvc2f2clMUhvGNkzFucOPOrTtD4kJcupArc8oQURQyJZI5U5nKzI1ZQiFTpkLxDyhxZZ91bHPmsbzvWmftd6/1rGWT4zjP58Plr6ffftdwPptHyylI0Al7FVQOkxrczLjLuC+clRZMiI/ZPPCE4dNleX1ne0qCsBVKu4qRodCuKdahDIogY6sQz1iNC8L+iratNNvWa7bCyTKWgS/x6FHTxfrbGAElVMaFXg0pzoOu8Hh5sFYAkTZPjkq/Ca1pV1/oUruwLyiZBdArLLc+p8MLukocDQyqtKuvn2mZcOdskFbW2hzTpxVnXVrsVXARVXBz2o4dO2pc2y6vYUAbecBCT5eHK6hxXk3q4BZBg7hsrsFFUhOcXPS7MRZmgQ1qEFjAfFCkzUk5BpfL5UctZoHg4sYAcB1UjxaXMNAAaAG3r22XUAO8uIShBbCbhUEA5cooAFyXlH5Z3DZZtjQh2rzdAmV40EoKuEIbHVtC6k8EwQzj2nTr1q1zlvVPBjLuUG438nAFaIWzWC5uuFxaO2froEhrFZDhJbCUo1k2RXBjswAONeEhS9+wj/Hi4DKpZkVcgXVwF2XZhIRoPdzQydZDRVyeswaUvrv4tIWHS6wFUEb1abvl6Tg7y7Yl5uNfcvcPDgpdveATBr06xmK1MGQtrgDTk5bNTwZKuxo0RGtIi7wwDNwDo88ptIEFoQ19wehymrUubEgSXa7gFijNX9ADKBZPX3k8VtjGwJAVWMHtzem4lF0wuEM0buR+QzyAjUFeLgsLWxigrcdwurA4DDSt4FK5SycRLtMyrmxiJNE5i4fFPMFezbqAtUpwzhpS+sXpROY+SDSuaVeqRVzoVWhttbKCAS3H2xigr4Y155VejQq7s2xZYnCHcLsKaC0qDFrvrAiPWM4JHuDk4oSc9XCn09Z8JeNyt0aGHl6gWLjf8EB9WpPgZlY4Jb4Gkm5MeyPhmJ+5SVUqkE7gMiZ2pEFnXVx8xAqkdnSBB5zKbLodu5zoEK2RAZ+uQoC2ZDebc3q0QupW6wwDD/f2UqFNzA80kQxQbWgWdI01i7QOKEjroIoH0GyHTVzt03tJPUzLuEpooyeFAmVx0KKySItLwi8esJy348Tdb+inGJaeTXzcVHCjqy1IAL2GN97uoaZQqkMLzW6a/vTVK/qpgBOrkjxsLuGq1HRqElEWeONDNu4Bbr2DyrZftPTZM6LN7jpvHCJYIwM8XRYXDouS6GERcUMS4OgSCV4+o7zqf2A+QyJu6gorEgCtkCItYMITJmMLcEWCZy9f0z/9y07yyhDBNajIG7mMKXMWUIUWQE2sBNlLerPBy2cbtu1MMJp2GLkbmAX0HTvSeLi4L4gfaULWigT0NiTCXWckwGjaYeRuoNnwaiuBBQx79QetA+rhbjrycjTlxxuRAHE1r0pTC+ntEb1eQ6Or3IKKJDYLOs1YoF819eMOSBBqNw19XNfrF8XSd6zYdh6uR4q7rsr5/of0m7FAgiBuH3LXoS2bBbkHfKAJWOClSGtJhfbo7NHfGHb1FZAAwrTa3RLa6NE2uB5gsRoXeiUJFq/WL/L6fucMSoBhWi2DsMIuJnKm4V+5tYCKHuCeq7Jn3Zf3nFEgQSTaBZah0G35p0q4mUXa+AJW33QfnX3oC9PuAgni0bR9VKry5cs5gQGog/uLYv2LLju3RILX+j1e74+BBCW4xEsyWFq49o59DOrhuq0WyoViWYKl9GYswl1wCiT4dZiWZaB2cdDG14Tf23hTKrgvODrls36R1+Qt25M/Dbug2xUFOLEjjaMBbLhKlgTG7Tx98rt3THvsNEpQHi5XP2qOsBxZwkqPto6uYIGwVvaO+qpf5DUeJPgjXJUqBxeURVy53wiLgLPr9u6PGvZQVILyMC3jmnbLP60TWtxwSWBykQSHvn5l2o0swV/ipkoFL2PgIC6o3vwC0CJuu0UL9Hu8vu4iCf4qxGrc7QwiiAW61PiaAFPLlfZC/7H6RV6H97MEDcFN1W9/WifBy0NcwDofmTXiE9NqCRqDO0CpFM40MV6oFou1C1ibRatHjGDahVtJgkZE0w5QqXJoQVko1y3Wpc0lGPOBaceJBA1ql93NSfHyCD9Uil512j97HfnM7/Ea8Wn96UkNQpV2U6V0tUAaXW7jNwYswYxdL94y7VqSoKFhWiMDXnUBaHBwoQT9Prx4Szm3TyRodLupoMJHH5LyK+9es8+l/CKvDytukQQND8FSlFIOreGM0/omiATVapVo12xd0jhExKW5294RAc40RVoftY47cd2LKtMOFwkajzuAeVOlIhfJeKahLyiWJRhLr3Ai2BVzQYKG4lLYXfg8HCSI33a2nTH5OaVWmzYHJGhsdLmDuN2exAonBTzZIuzEUS+ec0ZMBQn+Ea5KlXNI4C/UAO/k6hKwBptJgn8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC",');\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-close {\n position: absolute;\n top: 20px;\n right: 14px;\n width: 14px;\n height: 14px;\n}\n.$id-modal-close svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n@keyframes $id-modal-fade-in {\n 0% { transform: translate3d(0, 100%, 0); opacity: 0.5; }\n 100% { transform: translate3d(0, 0, 0); opacity: 1; }\n}\n@keyframes $id-guide-blink {\n 0% { opacity: 0; }\n 7% { opacity: 0; }\n 12% { opacity: 1; }\n 29% { opacity: 1; }\n 34% { opacity: 0.3; }\n 39% { opacity: 1; }\n 44% { opacity: 0.3; }\n 49% { opacity: 1; }\n 80% { opacity: 1; }\n 100% { opacity: 0; }\n}\n@keyframes $id-guide-move-x {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(70px, 0, 0); }\n 100% { transform: translate3d(70px, 0, 0); }\n}\n@keyframes $id-guide-move-y {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(0, 58px, 0); }\n 100% { transform: translate3d(0, 58px, 0); }\n}\n@media screen and (orientation: portrait) {\n .$id {\n display: block;\n }\n}\n</style>\n<div class="$id-modal">\n <div class="$id-modal-bg">\n <div class="$id-modal-bg-line"></div>\n <div class="$id-modal-bg-wave">\n <svg width="375" height="61" viewBox="0 0 375 61" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="0" y1="0%" x2="0" y2="100%" id="$id-2y6_dj_hgp">\n <stop stop-color="#8598FF" stop-opacity="0.15" offset="0%"></stop>\n <stop stop-color="#000" stop-opacity="0" offset="100%"></stop>\n </linearGradient>\n </defs>\n <path transform="translate(187.5, 30.5) scale(-1, 1) translate(-187.5, -30.5)" fill="url(#$id-2y6_dj_hgp)" d="\nM0,1\nC83.001,1.706 140.146,4.164 171.435,8.374\nC218.369,14.688 253.467,26.308 273.002,33\nC292.536,39.691323.501,51 343.709,56\nC357.182,59.333 367.612,61 375,61\nL375,0\nL0,0\nL0,1\nZ\n"></path>\n </svg>\n </div>\n </div>\n <div class="$id-modal-content">\n <div class="$id-modal-content-title">').concat(fy.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(fy.HIT,'</div>\n <div class="$id-modal-content-guide">\n <div class="$id-modal-content-guide-phone">\n <div class="$id-modal-content-guide-phone-move-x">\n <div class="$id-modal-content-guide-phone-move-y">\n <div class="$id-modal-content-guide-phone-blink">\n <div class="$id-modal-content-guide-phone-image"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="$id-modal-content-guide-cardboard">\n <div class="$id-modal-content-guide-cardboard-image"></div>\n </div>\n </div>\n </div>\n <div class="$id-modal-close">\n <svg width="14" height="14" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="70%" id="$id-ho0itsc4p9">\n <stop stop-color="#FFF" stop-opacity="0.75" offset="0%"></stop>\n <stop stop-color="#FFF" stop-opacity="0.22" offset="100%"></stop>\n </radialGradient>\n </defs>\n <path transform="translate(-3, -3)" fill="url(#$id-ho0itsc4p9)" fill-rule="nonzero" d="\nM16.791,3.198\nC17.044,3.438 17.067,3.814 16.860,4.080\nL16.791,4.156\nL12.144,9.331\nC11.803,9.711 11.803,10.288 12.144,10.668\nL16.791,15.843\nC17.044,16.084 17.067,16.460 16.860,16.725\nL16.791,16.801\nC16.538,17.042 16.142,17.063 15.864,16.867\nL15.784,16.801\nL10.000,11.250\nL4.215,16.801\nL4.135,16.867\nC3.857,17.063 3.461,17.042 3.208,16.801\nL3.208,16.801\nL3.139,16.725\nC2.932,16.460 2.955,16.084 3.208,15.843\nL3.208,15.843\nL7.855,10.668\nC8.196,10.288 8.196,9.711 7.855,9.331\nL7.855,9.331\nL3.208,4.156\nL3.139,4.080\nC2.932,3.814 2.955,3.438 3.208,3.198\nC3.486,2.933 3.937,2.933 4.215,3.198\nL4.215,3.198 L9.999,8.749\nL15.784,3.198\nC16.062,2.933 16.513,2.933 16.791,3.198\nZ\n"></path>\n </svg>\n </div>\n</div>\n');function gy(e){for(var t=1,i=document.getElementsByTagName("meta"),n=0;n<i.length;n++){var r=i[n];if("viewport"===r.getAttribute("name")){var o=(r.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return my.replace(/\n/g," ").replace(/\ +/g," ").replace(/\$id/g,e).replace(/(\d+)px/g,(function(e,i){return function(e){return Math.floor(e*t)+"px"}(Number(i))}))}var vy=new r.CircleBufferGeometry(.12,16),yy=function(){var e=ht(),t=new r.Texture;return e.onload=function(){if("undefined"!=typeof document){var i=256,n=document.createElement("canvas");n.setAttribute("width",String(i)),n.setAttribute("height",String(i));var r=n.getContext("2d");if(r){r.drawImage(e,0,0,i,i),r.globalCompositeOperation="source-out";var o=128;r.beginPath(),r.lineWidth=6.4,r.arc(o,o,83.2,0,2*Math.PI),r.strokeStyle="rgba(255, 255, 255, 1.0)",r.closePath(),r.stroke(),t.image=n,t.needsUpdate=!0}}},e.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",t}(),Ay=function(){if("undefined"!=typeof document){var e=document.createElement("canvas");e.setAttribute("width",String(512)),e.setAttribute("height",String(512));var t=e.getContext("2d");if(t){var i=256;return t.beginPath(),t.arc(i,i,192,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.1)",t.closePath(),t.fill(),t.save(),t.beginPath(),t.arc(i,i,192,0,2*Math.PI),t.strokeStyle="rgba(255, 255, 255, 0.5)",t.lineWidth=10.24,t.closePath(),t.stroke(),new r.CanvasTexture(e)}}return null}(),xy=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var n=256;i.arc(n,n,192,0,2*Math.PI),i.fillStyle="rgba(85, 90, 255, 0.6)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.fill(),i.arc(n,n,192,0,2*Math.PI);var o=i.createRadialGradient(n,n,0,n,n,n);o.addColorStop(0,"rgba(255, 255, 255, 0.0)"),o.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),o.addColorStop(1,"rgba(255, 255, 255, 0.2)"),i.fillStyle=o,i.fill(),i.lineWidth=4.8,i.arc(n,n,187.2,0,2*Math.PI);var a=i.createLinearGradient(0,0,0,e);return a.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),a.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=a,i.stroke(),new r.CanvasTexture(t)}}return null}(),by=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var n=256,o=179.2;i.arc(n,n,o,0,2*Math.PI),i.fillStyle="rgba(255, 255, 255, 0.4)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.fill(),i.arc(n,n,o,0,2*Math.PI);var a=i.createRadialGradient(n,n,0,n,n,n);a.addColorStop(0,"rgba(255, 255, 255, 0.0)"),a.addColorStop(.5,"rgba(255, 255, 255, 0.0)"),a.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.fillStyle=a,i.fill(),i.lineWidth=4.8,i.arc(n,n,o-4.8,0,2*Math.PI);var s=i.createLinearGradient(0,0,0,e);return s.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),s.addColorStop(.2,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.8,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=s,i.stroke(),new r.CanvasTexture(t)}}return null}(),wy=function(){if("undefined"!=typeof document){var e=512,t=document.createElement("canvas");t.setAttribute("width",String(e)),t.setAttribute("height",String(e));var i=t.getContext("2d");if(i){var n=256,o=217.6,a=64;i.lineWidth=a,i.arc(n,n,o,0,2*Math.PI),i.strokeStyle="rgba(147, 162, 255, 0.3)",i.shadowBlur=25.6,i.shadowColor="rgba(255, 255, 255, 0.6)",i.stroke(),i.lineWidth=a,i.arc(n,n,o,0,2*Math.PI);var s=i.createRadialGradient(n,n,185.6,n,n,249.6);s.addColorStop(0,"rgba(255, 255, 255, 0.5)"),s.addColorStop(.3,"rgba(255, 255, 255, 0.0)"),s.addColorStop(.7,"rgba(255, 255, 255, 0.0)"),s.addColorStop(1,"rgba(255, 255, 255, 0.5)"),i.strokeStyle=s,i.stroke(),i.beginPath(),i.lineWidth=4,i.arc(n,n,245.6,0,2*Math.PI);var c=i.createLinearGradient(0,0,e,0);return c.addColorStop(.02,"rgba(255, 255, 255, 1.0)"),c.addColorStop(.1,"rgba(255, 255, 255, 0.0)"),c.addColorStop(.9,"rgba(255, 255, 255, 0.0)"),c.addColorStop(.98,"rgba(255, 255, 255, 1.0)"),i.strokeStyle=c,i.stroke(),new r.CanvasTexture(t)}}return null}(),My=function(e){function i(){var i=e.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.opacityMotion=new Xm({opacity:0}),i.loadingMotion=new Xm({opacity:0}),i.currentMotion=new Xm({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1});var n={blending:r.CustomBlending,blendSrc:r.SrcAlphaFactor,blendDst:r.OneMinusSrcAlphaFactor,blendSrcAlpha:r.OneFactor,blendDstAlpha:r.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return i.hitTestMesh=new r.Mesh(vy,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{color:0,opacity:0}))),i.hitTestMesh.scale.set(1.5,1.5,1.5),i.centerMesh=new r.Mesh(vy,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:xy,opacity:0}))),i.centerMesh2=new r.Mesh(vy,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:by,opacity:0}))),i.ringMesh=new r.Mesh(vy,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:wy,opacity:0}))),i.loadingMesh=new r.Mesh(vy,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:yy,opacity:.8}))),i.disableMesh=new r.Mesh(vy,new r.MeshBasicMaterial(t.__assign(t.__assign({},n),{map:Ay}))),i.loadingMesh.visible=!1,i.disableMesh.visible=!1,i.hitTestMesh.position.z=0,i.ringMesh.position.z=.003,i.disableMesh.position.z=.002,i.centerMesh.position.z=.002,i.centerMesh2.position.z=.002,i.loadingMesh.position.z=.005,i.hitTestMesh.frustumCulled=!1,i.centerMesh.frustumCulled=!1,i.centerMesh2.frustumCulled=!1,i.ringMesh.frustumCulled=!1,i.loadingMesh.frustumCulled=!1,i.disableMesh.frustumCulled=!1,i.add(i.hitTestMesh),i.add(i.centerMesh),i.add(i.centerMesh2),i.add(i.ringMesh),i.add(i.loadingMesh),i.add(i.disableMesh),i.renderOrder=1e4,i.needsRender=!0,i}return t.__extends(i,e),i.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},i.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Im(e,0,1),this.opacityMotion.set({opacity:e},30).catch(Pe))},i.prototype.setCurrent=function(e){if(this.current!==e){if(e){var i=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.5,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:1,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.3,circleScale:1.1}}];this.currentMotion.setKeyframes(i,1500).catch(Pe)}else{i=[{progress:0,value:t.__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}}];this.currentMotion.setKeyframes(i,200).catch(Pe)}this.current=e}},i.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500):this.loadingMotion.set({opacity:0},0),this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.needsRender=!0)},i.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=e,this.centerMesh.visible=!e,this.needsRender=!0)},i.prototype.tap=function(){return Promise.resolve()},i.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity,n=this.currentMotion.value,r=n.ringScale,o=n.ringOpacity,a=n.circleFade,s=n.circleOpacity,c=n.circleScale;if(this.ringMesh.scale.set(r,r,r),this.centerMesh.scale.set(c,c,c),this.centerMesh2.scale.set(c,c,c),this.ringMesh.material.opacity=o*i,this.centerMesh.material.opacity=(1-a)*i,this.centerMesh2.material.opacity=a*s*i,this.loadingMotion.value.opacity>0){this.loadingMesh.visible=!0,this.loadingMesh.material.opacity=this.loadingMotion.value.opacity,this.loadingMesh.rotateZ(-t/200);var l=this.opacityMotion.value.opacity,h=1.1;this.centerMesh.scale.set(h,h,h),this.centerMesh2.scale.set(h,h,h),this.centerMesh.material.opacity=0*l,this.centerMesh2.material.opacity=.2*l}else this.loadingMesh.visible=!1;this.needsRender=!0},i.prototype.dispose=function(){this.currentMotion.dispose(),this.opacityMotion.dispose(),this.loadingMotion.dispose(),this.ringMesh.material.dispose(),this.disableMesh.material.dispose(),this.centerMesh.material.dispose(),this.loadingMesh.material.dispose()},i}(r.Object3D),Ey=function(e){function i(t){var n=this,r=i.parseArgs(t);(n=e.call(this,r)||this).cardboard=new dy(n.renderer);var o,a,s,c=(o="five_vr_helper_"+Lr(),a=gy(o),(s=document.createElement("div")).className=o,s.innerHTML=a,s);n.helperElement=c;var l=new Yg(c);return n.element.parentNode&&(n.element.parentNode.insertBefore(c,n.element),n.setHelperElementSize(),l.on("tap",(function(){return n.emit("vrWantsToExit")}))),n.destroyHelper=function(){l.destroy(),c.parentNode&&c.parentNode.removeChild(c),delete n.helperElement},n.boundingMesh.visible=!0,n}return t.__extends(i,e),i.parseArgs=function(i){var n=t.__assign(t.__assign({},i),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,n)},i.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var t=0,i=this.panoMeshes;t<i.length;t++){var n=i[t];this.helper.remove(n),n.dispose()}this.panoMeshes.length=0},i.prototype.isReady=function(){return!1},i.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},i.prototype.updatePanoMeshes=function(){var e=this;this.panoMeshes.forEach((function(t){e.helper.remove(t),t.dispose()})),this.panoMeshes.length=0;for(var t=0;t<this.work.observers.length;t++){var i=this.work.observers[t],n=new My;n.name="panoSphere_".concat(this.work.workCode,"_").concat(t),n.position.copy(i.position),n.needsRender=!0,this.helper.add(n),this.panoMeshes[t]=n}},i.prototype.updateTime=function(e,t){for(var i,n,o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];if(!this.destroyed){this.needsRender=!0;var s={},c={};if(!1===this.locationMotion.ended){this.locationMotion.update(e);var l=this.locationMotion.getKeyFrameSegment(e),h=l[0],u=l[1],d=this.panoResourceFromLocationMotionKeyframe(h),p=this.panoResourceFromLocationMotionKeyframe(u),f=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=d.position,v=p.position,y=this.locationMotion.value.count-u.value.count+1;s.modelAlpha=this.locationMotion.value.modelAlpha,s.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),s.useBlackTransition="instant"===p.effect,p.panoPicture&&(y<1?d.panoPicture&&(s.pano0=d.panoPicture):s.pano0=p.panoPicture,s.pano1=p.panoPicture),"fade"===p.effect&&(s.pano0&&d.panoPicture&&(s.pano0={map:s.pano0.map,luminanceMap:s.pano0.luminanceMap,matrix:d.panoPicture.matrix.clone().setPosition(p.position)}),g.copy(v)),s.progress=y,c.distance=this.locationMotion.value.distance,c.offset=new r.Vector3(g.x+(v.x-g.x)*y,g.y+(v.y-g.y)*y,g.z+(v.z-g.z)*y);for(var A=[],x=[],b=0,w=this.locationMotion.keyframes;b<w.length;b++){var M=w[b],E=M.key,S=M.progress;void 0!==E&&(A.push(E),S>=this.locationMotion.progress&&x.push(E))}for(var _=0,T=Object.keys(this.panoResources);_<T.length;_++){var C=T[_];if(!(x.indexOf(C)>=0)){var I=this.panoResources[C];if(I.panoPicture){var P=I.panoPicture.map;if(P){if(P===(null===(i=s.pano0)||void 0===i?void 0:i.map))continue;if(P===(null===(n=s.pano1)||void 0===n?void 0:n.map))continue;P.dispose(),I.panoPicture=null}}A.indexOf(C)>=0||delete this.panoResources[C]}}this.currentPanoIndex=y<.5?d.panoIndex:p.panoIndex,this.emit("movingToPano",m.panoIndex,f.panoIndex,this.locationMotion.progress)}!1===Kg(s)&&(this.model.setMaterial(s),this.boundingMesh.setMaterial(s)),c.offset&&this.camera.position.copy(c.offset);var R=this.camera.pose.longitude,L=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();for(var B=this.work.observers[this.currentPanoIndex].visibleNodes.concat(this.currentPanoIndex),D=0;D<this.work.observers.length;D++){var O=this.work.observers[D];if((F=this.panoMeshes[D]).visible=!0,O.loadable||O.active){if(-1===B.indexOf(D))F.visible=!1;else{F.visible=!0;var N=F.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);N<.05?F.setOpacity(0):F.setOpacity(Im(1.5/N,0,1)),this.currentPanoIndex===D&&F.setOpacity(0)}F.lookAt(this.camera.position)}else F.visible=!0}var k=this.intersect(e);for(D=0;D<this.work.observers.length;D++){null==(F=this.panoMeshes[D])||F.setCurrent(F===k)}for(D=0;D<this.work.observers.length;D++){var F;(F=this.panoMeshes[D])&&F.updateTime&&F.updateTime(e,t)}R===this.camera.pose.longitude&&L===this.camera.pose.latitude||(this.cameraMotion.set(qt(this.camera.pose,["longitude","latitude"]),0).catch(Pe),this.emit("cameraDirectionUpdate",qt(this.camera.pose,["longitude","latitude"]),!0),this.emit("cameraUpdate",Xg(qt(this.camera.pose,["longitude","latitude","fov","offset","distance"])),!0))}},i.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},i.prototype.setCamera=function(e){},i.prototype.destroyHelper=function(){},i.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new r.Vector2(this.element.offsetWidth,this.element.offsetHeight),t=e.x*this.scissor.left,i=e.y*(1-this.scissor.bottom-this.scissor.height),n=e.x*this.scissor.width,o=e.y*this.scissor.height;this.helperElement.style.marginLeft=t+"px",this.helperElement.style.marginTop=i+"px",this.helperElement.style.width=n+"px",this.helperElement.style.height=o+"px"}},i.prototype.intersect=function(e){var t;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>1500){var i=this.activePanoMesh;return(l=this.panoMeshes.indexOf(i))>=0&&this.moveToPano(l,{},!0),delete this.activePanoMesh,delete this.activeTime,i}for(var n=this.camera.getWorldDirection(new r.Vector3),o=new r.Raycaster(this.camera.position,n),a=void 0,s=[],c=this.work.observers[this.currentPanoIndex].visibleNodes,l=0;l<this.work.observers.length;l++){var h=this.panoMeshes[l];if(-1!==c.indexOf(l)){var u=o.intersectObject(null!==(t=h.hitTestMesh)&&void 0!==t?t:h,!0)[0];u&&s.push({panoMesh:h,intersection:u})}}var d=s.sort((function(e,t){return e.intersection.distance-t.intersection.distance}))[0];if(d?(a=d.intersection,this.activePanoMesh!==d.panoMesh&&(this.activePanoMesh=d.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(d.panoMesh.position),this.intersectMesh.lookAt(this.camera.position),this.intersectMesh.visible=!1):(this.activePanoMesh=void 0,this.activeTime=void 0),!a)if((a=this.model.intersectRaycaster(o)[0])&&a.face){var p=a.face.normal,f=new r.Quaternion;f.setFromUnitVectors(new r.Vector3(0,0,1),p),this.intersectMesh.quaternion.copy(f);var m=p.clone().multiplyScalar(.05),g=a.point.clone().add(m);this.intersectMesh.position.copy(g),this.intersectMesh.visible=!0,this.emit("intersectionOnModelUpdate",a,this.intersectMesh)}else this.intersectMesh.visible=!1,this.emit("intersectionHidden");return null==d?void 0:d.panoMesh},i.prototype.onPanGesture=function(){},i.prototype.onTapGesture=function(){},i.prototype.onPinchGesture=function(){},i.prototype.onMouseMove=function(){},i.prototype.onMouseOut=function(){},i}(Hv),Sy=function(e){function i(t){var n,r,o,a,s=this,c=i.parseArgs(t);return(s=e.call(this,c)||this).currentPanoIndex=c.initial[0],s.locationMotion=new Xm({x:s.camera.pose.offset.x,y:s.camera.pose.offset.y,z:s.camera.pose.offset.z,distance:s.camera.pose.distance,modelAlpha:null!==(r=null===(n=s.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:null!==(a=null===(o=s.model.getMaterial())||void 0===o?void 0:o.perspToOrtho)&&void 0!==a?a:0}),s}return t.__extends(i,e),i.parseArgs=function(t){return e.parseArgs.call(this,t)},i.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose()},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,n,r){this.work=e,this.currentPanoIndex=t,this.hideIntersectMesh();var o={duration:0,longitude:i.longitude,latitude:i.latitude,fov:i.fov};return this.moveToPano(t,o,r),!0},i.prototype.updateTime=function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];if(!this.destroyed){var o={},a={};if(!this.locationMotion.ended){this.locationMotion.update(e),o.modelAlpha=this.locationMotion.value.modelAlpha,o.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),a.distance=this.locationMotion.value.distance,a.offset=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var s=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),c=qg(this.work.observers,(function(e){return e.position.distanceTo(s)}));this.currentPanoIndex=this.work.observers.indexOf(c)}this.cameraMotion.ended||(this.cameraMotion.update(e),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),Kg(o)||this.model.setMaterial(o),Kg(a)||this.setCamera(a)}},i.prototype.initAnimation=function(e,t,i,n){var r,o,a,s=this;this.destroyed||(this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Im(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Im(null!==(a=t.fov)&&void 0!==a?a:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){s.emit("initAnimationWillStart",e,t,s.userAction)},moveEndCallback:function(e,t){s.emit("initAnimationEnded",e,t,s.userAction)},moveCancelCallback:function(){var e=s.currentPanoIndex,t={longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance};s.emit("initAnimationEnded",e,t,s.userAction)}},n))},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Le())[1],t=this.locationMotion.getKeyFrameSegment(Le())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new r.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance}},i.prototype.moveToPano=function(e,t,i){void 0===t&&(t={});var n=this.work.observers[e];n&&this.moveToPosition(n.position,t,i)},i.prototype.moveToPosition=function(e,t,i){var n,o,a,s=this;void 0===t&&(t={}),this.userAction=i;for(var c=Le(),l=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z).distanceTo(e),h=this.locationMotion.getProgressVelocity(c),u=0,d=1;d<this.locationMotion.keyframes.length;d++){var p=this.locationMotion.keyframes[d-1].value,f=p.x,m=p.y,g=p.z,v=this.locationMotion.keyframes[d].value,y=v.x,A=v.y,x=v.z;u+=Math.sqrt(Math.pow(y-f,2)+Math.pow(A-m,2)+Math.pow(x-g,2))}var b=0===l?0:h*u/l,w=this.calculateMovingDuration(t.duration,l),M={x:e.x,y:e.y,z:e.z,distance:0,modelAlpha:1,perspToOrtho:0},E={longitude:t.longitude,latitude:t.latitude,fov:t.fov},S={longitude:null!==(n=E.longitude)&&void 0!==n?n:this.camera.pose.longitude,latitude:null!==(o=E.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(a=E.fov)&&void 0!==a?a:this.camera.pose.fov,offset:e.clone(),distance:0},_=qg(this.work.observers,(function(t){return t.position.distanceTo(e)})),T=this.work.observers.indexOf(_);this.emit("moveToPano",T,this.userAction),t.moveStartCallback&&t.moveStartCallback(T,S),this.emit("panoWillArrive",T,S,this.userAction),this.cameraMotion.set(E,w).catch(Pe),this.locationMotion.set(M,w,b).then((function(){var e=Xg(s.camera.pose);t.moveEndCallback&&t.moveEndCallback(T,e),s.emit("panoArrived",T,e,s.userAction)}),(function(){t.moveCancelCallback&&t.moveCancelCallback(),s.emit("moveToPanoCanceled",T)}))},i.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),n=new r.Raycaster;if(n.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",n,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",n,i,!0),this.interiaMovement=!1;var o=this.model.intersectRaycaster(n)[0];if(o&&o.face){var a=o.face.normal,s=o.point;if(new r.Vector3(0,1,0).angleTo(a)>Math.PI/3){var c=this.camera.position.clone().setY(s.y),l=s.clone().sub(c).setLength(.3),h=s.clone().sub(l);n.set(h,new r.Vector3(0,-1,0)),o=this.model.intersectRaycaster(n)[0]}}if(o){var u=o.point.clone(),d=qg(this.work.observers.filter((function(e){return Math.abs(e.standingPosition.y-u.y)<1})),(function(e){return e.standingPosition.distanceTo(u)}));if(d)return u.y=d.position.y,void this.moveToPosition(u,{},!0)}this.cameraBounce()}}},i}(dv),_y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}("{vs|z-rp@-}n{|]|vv|{H{vs|z-znA-}n{|ZnvH{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}H<<{vs|z-sy|n-pnyrHn\bv{t-rp@-}n{|d|yq]|vv|{H<<-n\bv{t-sy|n-vU|yrHp|{-sy|n-]V-J-@;>A>BF?CHp|{-sy|n-aNb-J-C;?E@>EB?Hp|{-sy|n-pnyr-J->@;>Hrp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5:rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--rpA-|yq]|vv|{-J-z|qryZnv-7-rpA5}|vv|{9->;=6H--}n{|d|yq]|vv|{-J-5rpA5|yq]|vv|{;\b\t9->;=6-7-}n{|Znv6;\b\tH--rp?-p||q-J-|P||q5}n{|d|yq]|vv|{6H--sy|n-qvn{pr-J-pnyrH--vs-5p||q;\b-I-=;>B6-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9-=;=6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5=;>B-:-p||q;\b66H----qvn{pr-J-pnyrH--\f-ryr-vs-5p||q;\b-KJ-=;>B-33-p||q;\b-IJ-=;EB6-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9-5p||q;\b-:-=;>B6-<-=;D6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----vs5-}n{|Qv}ynprzr{;-JJ-=;=6\n------qvn{pr-J-pnyrH----\fryr\n------qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----\f--\f-ryr-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9->;=6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5p||q;\b-:-=;EB66H----qvn{pr-J-pnyrH--\f--rpA-ry]|vv|{-J-rpA5}|vv|{-8-}n{|]|vv|{-8-{|znyv\tr5|yq]|vv|{;\b\t6-7-qvn{pr9->;=6H--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-ry]|vv|{H\f"),Ty=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(e){return e.charCodeAt(r)>n?e:String.fromCharCode((e.charCodeAt(r)+i)%n)})).join(o)}("{vs|z-sy|n-|}npv\bH{vs|z-nz}yrPor-}n{|Zn}H{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}Hn\bv{t-rp@-}n{|d|yq]|vv|{H|vq-znv{56-\n--rpA-}n{|P|y|-J-rrPor5}n{|Zn}9-}n{|d|yq]|vv|{;\b\t6H--tylSntP|y|-J-rpA5}n{|P|y|;to9-|}npv\b6H\f"),Cy=Object.assign({opacity:new r.Uniform(1),scale:new r.Uniform(13.1),panoMap:new r.Uniform(null),panoDisplacementMap:new r.Uniform(null),panoPosition:new r.Uniform(new r.Vector3),panoMatrix:new r.Uniform(new r.Matrix4)},{emissive:new r.Uniform(new r.Color(0)),emissiveMap:new r.Uniform(null),specular:new r.Uniform(new r.Color(1118481)),specularMap:new r.Uniform(null),normalMap:new r.Uniform(null),bumpMap:new r.Uniform(null),shininess:new r.Uniform(30)},r.UniformsLib.common,r.UniformsLib.lights),Iy=new r.SphereBufferGeometry(.01,128,128);var Py=function(){function e(e){void 0===e&&(e={}),this.textureLoader=new gi({allowHosts:this.allowHosts,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe}),this.allowHosts=e.allowHosts,this.requestProxy=e.requestProxy,this.networkSubscribe=e.networkSubscribe}return e.prototype.setAllowHosts=function(e){this.allowHosts=e,this.textureLoader.setAllowHosts(e)},e.prototype.setRequestProxy=function(e){this.requestProxy=e,this.textureLoader.setRequestProxy(e)},e.prototype.setNetworkSubscribe=function(e){this.networkSubscribe=e,this.textureLoader.setNetworkSubscribe(e)},e.prototype.load=function(e,i,n,o,a,s,c,l){var h=[0,0],u=function(e,t){h[t]=e,c(.8*h[0]+.2*h[1])},d=[this.textureLoader.load(e,{viaAjax:!0},void 0,void 0,(function(e){return u(e,1)}),l),this.textureLoader.loadCube(i,{viaAjax:!0},void 0,void 0,(function(e){return u(e,0)}),l)];return Promise.all(d).then((function(e){var i=e[0],s=e[1],c={body:function(e,t,i,n){var o=new r.ShaderMaterial({side:r.BackSide,vertexShader:_y,fragmentShader:Ty,transparent:!0,uniforms:r.UniformsUtils.clone(Cy)}),a=t;return a.needsUpdate=!0,a.minFilter=r.LinearFilter,a.magFilter=r.LinearFilter,e.needsUpdate=!0,e.minFilter=r.LinearFilter,e.magFilter=r.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=a,o.uniforms.panoDisplacementMap.value=e,o.uniforms.panoPosition.value=i,o.uniforms.panoMatrix.value=n,Object.assign(new r.Mesh(Iy,o),{frustumCulled:!1,dispose:function(){this.material instanceof r.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}(i.body,s.body,n,o),meta:t.__spreadArray([i.meta],s.meta,!0)};return a(c),c})).catch((function(e){for(var t=0,i=d;t<i.length;t++){i[t].then((function(e){return e.body.dispose()})).catch(Pe)}return s(e),Promise.reject(e)}))},e}(),Ry=new r.Vector3(-1,1,1),Ly=function(e){function i(t){var n,o,a,s,c,l,h,u=this,d=i.parseArgs(t);return(u=e.call(this,d)||this).currentPanoIndex=d.initial[0],u.maxAccessibleDistance=d.maxAccessibleDistance,u.panoTapTriggerRadius=d.panoTapTriggerRadius,u.panoCircleMeshCreator=d.panoCircleMeshCreator,u.boundingMesh=u.generateBoundingMesh(),u.boundingMesh.setMaterial(u.model.getMaterial()||{}),u.boundingMesh.visible=!1,u.scene.add(u.boundingMesh),u.panoModelGroup=new r.Group,u.panoModelGroup.name="panoModels",u.scene.add(u.panoModelGroup),u.panoMeshes=[],u.updatePanoMeshes(),u.helper.remove(u.intersectMesh),u.locationMotion=new Xm({count:0,distance:u.camera.pose.distance,modelAlpha:null!==(o=null===(n=u.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==o?o:0,perspToOrtho:null!==(s=null===(a=u.model.getMaterial())||void 0===a?void 0:a.perspToOrtho)&&void 0!==s?s:0}),u.panoResources={},u.panoResources[u.locationMotion.keyframes[0].key=u.locationMotion.keyframes[1].key=Lr()]={panoIndex:u.currentPanoIndex,workCode:u.work.workCode,matrix:null!==(h=null===(l=null===(c=u.model.getMaterial())||void 0===c?void 0:c.pano1)||void 0===l?void 0:l.matrix)&&void 0!==h?h:new r.Matrix4,position:u.camera.pose.offset.clone(),effect:"fly"},u.depthTextureLoader=new Py({allowHosts:u.work.allowHosts,requestProxy:u.requestProxy,networkSubscribe:u.networkSubscribe}),u}return t.__extends(i,e),i.parseArgs=function(i){var n,r,o,a=e.parseArgs.call(this,i);return t.__assign(t.__assign({},a),{maxAccessibleDistance:null!==(n=i.maxAccessibleDistance)&&void 0!==n?n:5,panoTapTriggerRadius:null!==(r=i.panoTapTriggerRadius)&&void 0!==r?r:1,panoCircleMeshCreator:null!==(o=i.panoCircleMeshCreator)&&void 0!==o?o:function(){return new Sg}})},i.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var t,i=this;if(e.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.model&&(this.model.visible=!0),this.panoModelGroup){for(var n=0,r=this.panoModelGroup.children;n<r.length;n++){var o=r[n];"function"==typeof o.dispose&&o.dispose()}this.scene.remove(this.panoModelGroup)}this.boundingMesh&&(this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.panoMeshes&&(this.panoMeshes.forEach((function(e){i.helper.remove(e),e.dispose()})),this.panoMeshes.length=0);for(var a=null!==(t=this.model.getMaterial())&&void 0!==t?t:{},s=a.pano0,c=a.pano1,l=0,h=Object.keys(this.panoResources);l<h.length;l++){var u=h[l],d=this.panoResources[u];d.panoModel&&d.panoModel.material.uniforms.panoMap.value!==(null==s?void 0:s.map)&&d.panoModel.material.uniforms.panoMap.value!==(null==c?void 0:c.map)&&(this.panoModelGroup.remove(d.panoModel),d.panoModel.material.uniforms.panoMap.value.dispose(),d.panoModel.dispose(),delete d.panoModel),delete this.panoResources[u]}this.interiaMovement=!1},i.prototype.isReady=function(){return!1===this.locationMotion.ended&&e.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,n,r){this.userAction=r,this.work=e,this.currentPanoIndex=t,this.depthTextureLoader.setAllowHosts(this.work.allowHosts);var o={},a=!0;this.boundingMesh&&(o=this.boundingMesh.getMaterial()||{},a=this.boundingMesh.visible,this.scene.remove(this.boundingMesh),this.boundingMesh.dispose()),this.boundingMesh=this.generateBoundingMesh(!0),this.boundingMesh.visible=a,this.boundingMesh.setMaterial(o),this.scene.add(this.boundingMesh),this.hideIntersectMesh(),this.updatePanoMeshes();for(var s=0,c=this.panoMeshes;s<c.length;s++){c[s].visible=!1}return this.moveToPano(t,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov},r),!0},i.prototype.updateTime=function(e,t){for(var i,n,o,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];if(!this.destroyed){var c={},l={},h=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),u=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),d=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(e);var p=this.locationMotion.getKeyFrameSegment(e),f=p[0],m=p[1],g=this.panoResourceFromLocationMotionKeyframe(f),v=this.panoResourceFromLocationMotionKeyframe(m),y=(new r.Vector3).copy(g.position),A=(new r.Vector3).copy(v.position),x=this.locationMotion.value.count-m.value.count+1;c.progress=x,c.modelAlpha=this.locationMotion.value.modelAlpha,c.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1);for(var b=0,w=this.panoModelGroup.children;b<w.length;b++){var M=w[b];M.visible=M===g.panoModel||M===v.panoModel}g.panoModel&&(g.panoModel.material.uniforms.opacity.value=1-x,g.panoModel.material.depthTest=0!==x),v.panoModel&&(v.panoModel.material.uniforms.opacity.value=x,v.panoModel.material.depthTest=1!==x),v.panoModel&&(x<1?g.panoModel&&(c.pano0={map:g.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:g.matrix}):c.pano0={map:v.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:v.matrix},c.pano1={map:v.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:v.matrix}),d=c.useBlackTransition="instant"===v.effect||"montage"===v.effect,"fade"!==v.effect&&"montage"!==v.effect||(c.pano0&&(c.pano0={map:c.pano0.map,luminanceMap:null,matrix:g.matrix.clone().setPosition(v.position)}),y.copy(A)),l.distance=this.locationMotion.value.distance,l.offset=new r.Vector3(y.x+(A.x-y.x)*x,y.y+(A.y-y.y)*x,y.z+(A.z-y.z)*x);for(var E=[],S=[],_=0,T=this.locationMotion.keyframes;_<T.length;_++){var C=T[_],I=C.key,P=C.progress;void 0!==I&&(E.push(I),P>=this.locationMotion.progress&&S.push(I))}for(var R=0,L=Object.keys(this.panoResources);R<L.length;R++){var B=L[R];if(!(S.indexOf(B)>=0)){var D=this.panoResources[B];if(D.panoModel){if(D.panoModel.material.uniforms.panoMap.value===(null===(i=c.pano0)||void 0===i?void 0:i.map))continue;if(D.panoModel.material.uniforms.panoMap.value===(null===(n=c.pano1)||void 0===n?void 0:n.map))continue;this.panoModelGroup.remove(D.panoModel),D.panoModel.material.uniforms.panoMap.value.dispose(),D.panoModel.dispose(),delete D.panoModel}E.indexOf(B)>=0||delete this.panoResources[B]}}g.workCode===v.workCode?this.currentPanoIndex=x<.5?g.panoIndex:v.panoIndex:this.currentPanoIndex=v.panoIndex,this.emit("movingToPano",u.panoIndex,h.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),l.longitude=this.cameraMotion.value.longitude,l.latitude=this.cameraMotion.value.latitude,l.fov=this.cameraMotion.value.fov),!1===Kg(c)&&(this.model.setMaterial(c),this.boundingMesh.setMaterial(c)),!1===Kg(l)&&this.setCamera(l),this.camera.pose.distance>.1)for(var O=0;O<this.work.observers.length;O++){(V=this.panoMeshes[O])&&(V.visible=!1)}else{var N=this.work.observers[this.currentPanoIndex];if(N){var k=N.visibleNodes.concat(this.currentPanoIndex),F=this.getForwardPanoIndexOrNot();for(O=0;O<this.work.observers.length;O++){var V,z=this.work.observers[O];if(V=this.panoMeshes[O])if(z.loadable||z.active)if(-1!==k.indexOf(O))if(d)V.visible=!1,V.setOpacity(0);else{V.visible=!0;var H=V.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);V.setCurrent(F===O),V.setOpacity(H<.01?0:Im(1.4/H,.5,.7)),V.updateTime&&V.updateTime(e,t)}else V.visible=!1,V.setOpacity(0);else V.visible=!1,V.setOpacity(0)}}}this.boundingMesh.visible=Boolean(null===(o=this.boundingMesh.getMaterial())||void 0===o?void 0:o.pano0)&&this.boundingMesh.boundingBox.containsPoint(this.camera.position)}},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Le())[1],t=this.locationMotion.getKeyFrameSegment(Le())[1],i=this.panoResourceFromLocationMotionKeyframe(t),n=this.work.observers[i.panoIndex];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:0}},i.prototype.moveToPano=function(e,i,n){var o,a,s=this;void 0===i&&(i={});var c=this.work.observers[e].images.depth,l=t.__assign({key:"pano.".concat(e),basisLoaderInitialized:fi.isInitialized()},qt(this.imageOptions,["format","size","quality","sharpen","mappings"])),h=null!==(o=this.imageOptions.transform)&&void 0!==o?o:it,u={right:h(this.work.observers[e].images.right,t.__assign(t.__assign({},l),{key:"pano.".concat(e,".right")})),left:h(this.work.observers[e].images.left,t.__assign(t.__assign({},l),{key:"pano.".concat(e,".left")})),up:h(this.work.observers[e].images.up,t.__assign(t.__assign({},l),{key:"pano.".concat(e,".up")})),down:h(this.work.observers[e].images.down,t.__assign(t.__assign({},l),{key:"pano.".concat(e,".down")})),front:h(this.work.observers[e].images.front,t.__assign(t.__assign({},l),{key:"pano.".concat(e,".front")})),back:h(this.work.observers[e].images.back,t.__assign(t.__assign({},l),{key:"pano.".concat(e,".back")}))},d=this.work.observers[e],p=d.position,f=d.quaternion,m=(new r.Matrix4).compose(p,f,new r.Vector3(-1,1,1)),g="pano:"+hv(u);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;var v=this.pendingTextureTask.panoIndex;null===(a=this.panoMeshes[v])||void 0===a||a.setProgress(0),this.emit("textureAbort",v,this.work.observers[v]),this.pendingTextureTask.onError(new Error("texture aborted"))}this.pending=!0,this.pendingTextureTask={panoIndex:e,hash:g,onLoad:function(t){s.pending=!1,s.destroyed?t.body.dispose():(t.body.name=g,s.emit("panoLoaded",e),s.doMoveToPano(e,t.body,i,n))},onError:function(t){s.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),s.emit("panoLoadError",t,e),s.emit("moveToPanoCanceled",e)}};var y=this.panoMeshes[e];y&&y.tap&&y.tap(),this.depthTextureLoader.load(c,u,p,m,(function(t){var i,n;(null===(i=s.pendingTextureTask)||void 0===i?void 0:i.hash)===g?(s.pendingTextureTask.onLoad(t),null===(n=s.panoMeshes[e])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("textureLoaded",e,s.work.observers[e],t.meta)):t.body.dispose()}),(function(t){var i,n;(null===(i=s.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(s.pendingTextureTask.onError(t),null===(n=s.panoMeshes[e])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("textureError",t,e,s.work.observers[e]),s.emit("error",t))}),(function(t){var i,n;s.emit("textureLoading",t,e,s.work.observers[e]),(null===(i=s.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(null===(n=s.panoMeshes[e])||void 0===n||n.setProgress(t))}),this.renderer),this.emit("textureStartLoad",e,this.work.observers[e])},i.prototype.initAnimation=function(e,t,i,n){var r,o,a,s=this;if(!this.destroyed){var c=!1;this.pending=!1,this.userAction=n,this.moveToPano(e,{longitude:null!==(r=t.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Im(null!==(o=t.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Im(null!==(a=t.fov)&&void 0!==a?a:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(e,t){c=!0,s.emit("initAnimationWillStart",e,t,s.userAction)},moveEndCallback:function(e,t){s.emit("initAnimationEnded",e,t,s.userAction)},moveCancelCallback:function(){var e=Xg(s.camera.pose);!1===c&&s.emit("initAnimationWillStart",s.currentPanoIndex,e,s.userAction),s.emit("initAnimationEnded",s.currentPanoIndex,e,s.userAction)}},n)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.locationMotionKeyframesLength=function(e){for(var t=0,i=1;i<e.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(e[i]).position;t+=n.distanceTo(r)*(e[i].value.count-e[i-1].value.count)}return t},i.prototype.updatePanoMeshes=function(){for(var e={},t=0,i=this.panoMeshes;t<i.length;t++){e[(a=i[t]).name]=a}this.panoMeshes.length=0;for(var n=0;n<this.work.observers.length;n++){var r="panoCircle_".concat(this.work.workCode,"_").concat(n),o=this.work.observers[n],a=void 0;e[r]?(a=e[r],delete e[r]):((a=this.panoCircleMeshCreator()).name=r,this.helper.add(a)),a.position.copy(o.standingPosition),this.panoMeshes[n]=a}for(var s=0,c=Object.keys(e);s<c.length;s++){var l=c[s];this.helper.remove(e[l]),e[l].dispose(),delete e[l]}},i.prototype.generateBoundingMesh=function(e){void 0===e&&(e=!1);for(var t=this.model.bounding.clone(),i=0,n=this.work.observers;i<n.length;i++){var o=n[i];t.expandByPoint(o.standingPosition),t.expandByPoint((new r.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}e&&t.expandByPoint(this.camera.position);var a=Ng(t,new r.Vector3(1,0,1));return a.name="panorama_bounding",a.frustumCulled=!1,a},i.prototype.doMoveToPano=function(e,i,n,o){var a,s,c,l,h=this;void 0===n&&(n={}),this.userAction=o;var u=Le(),d=Lr(),p=this.work.observers[e],f=this.panoResources[d]={panoIndex:e,workCode:this.work.workCode,effect:null!==(a=n.effect)&&void 0!==a?a:"fly",panoModel:i,matrix:(new r.Matrix4).compose(p.position,p.quaternion,Ry),position:p.position.clone()};i.visible=!1,i.renderOrder=-1,this.panoModelGroup.add(i);var m,g,v;if(this.locationMotion.ended){var y=this.locationMotion.getKeyFrameSegment(u);y[0];var A=y[1],x=this.locationMotion.value,b=this.panoResourceFromLocationMotionKeyframe(A).position,w=f.position;m=Math.max(b.distanceTo(w),1),g=[{key:A.key,progress:0,value:t.__assign(t.__assign({},x),{count:0})},{key:d,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,count:1}}],v=0}else{var M=this.locationMotion.getKeyFrameSegment(u),E=M[0],S=(A=M[1],x=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(E).position),_=(b=this.panoResourceFromLocationMotionKeyframe(A).position,w=f.position,A.value.count-x.count),T=Math.max(S.distanceTo(b),1)*_;m=T+Math.max(b.distanceTo(w),1),g=[{key:E.key,progress:0,value:t.__assign({},x)},{key:A.key,progress:T/m,value:A.value},{key:d,progress:1,value:{count:A.value.count+1,distance:0,perspToOrtho:0,modelAlpha:0}}];var C=this.locationMotionKeyframesLength(this.locationMotion.keyframes),I=this.locationMotionKeyframesLength(g);v=0===C||0===C?0:this.locationMotion.getProgressVelocity(u)*C/I}var P=this.calculateMovingDuration(n.duration,"fade"===n.effect||"montage"===n.effect?0:m),R={longitude:n.longitude,latitude:n.latitude,fov:n.fov},L={longitude:null!==(s=R.longitude)&&void 0!==s?s:this.camera.pose.longitude,latitude:null!==(c=R.latitude)&&void 0!==c?c:this.camera.pose.latitude,fov:null!==(l=R.fov)&&void 0!==l?l:this.camera.pose.fov,offset:p.position.clone(),distance:this.camera.pose.distance};n.moveStartCallback&&n.moveStartCallback(e,L),this.emit("panoWillArrive",e,L,this.userAction),this.cameraMotion.set(R,P).catch(Pe),this.locationMotion.setKeyframes(g,P,v).then((function(){var t={longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance};n.moveEndCallback&&n.moveEndCallback(e,t),h.emit("panoArrived",e,t,o)}),(function(){n.moveCancelCallback&&n.moveCancelCallback(),h.emit("moveToPanoCanceled",e)}))},i.prototype.getForwardPanoIndexOrNot=function(e){var t=this,i=this.camera.getWorldDirection(new r.Vector3),n=this.camera.position.clone(),o=this.work.observers[this.currentPanoIndex];if(!o)return null;var a=o.accessibleNodes.filter((function(e){if(e===t.currentPanoIndex)return!1;var i=t.work.observers[e],o=i.standingPosition.clone().sub(n);return 0!==o.length()&&(!(o.angleTo(new r.Vector3(0,-1,0))<Math.PI/12)&&(i.loadable||i.active))})),s=(e?e.ray.direction.clone():i.clone()).setY(0);if(0===s.length())return null;for(var c=a.slice().sort((function(e,i){var r=t.work.observers[e].position.clone().setY(n.y),o=t.work.observers[i].position.clone().setY(n.y);return r.distanceTo(n)-o.distanceTo(n)})),l=0,h=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];l<h.length;l++)for(var u=h[l],d=0,p=c;d<p.length;d++){var f=p[d],m=this.work.observers[f].position.clone().setY(n.y).sub(n);if(0!==m.length()&&s.angleTo(m)<u)return f}return null},i.prototype.onTapGesture=function(e){var i=this,n=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",n,!0)){var o=this.relativeClientPosition(e.center),a=new r.Raycaster;if(a.setFromCamera(o,this.camera),!this.emit("wantsTapGesture",a,o,!0)){this.emit("gesture","tap",n,!0),this.emit("tapGesture",a,o,!0),this.interiaMovement=!1;var s=this.camera.getWorldDirection(new r.Vector3).setY(0),c=null,l=this.work.observers[this.currentPanoIndex];if(l){var h=l.accessibleNodes.filter((function(e){if(e===i.currentPanoIndex)return!1;var t=i.work.observers[e];return!(t.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(t.loadable||t.active)})),u=a.intersectObject(this.boundingMesh,!0)[0];if(u){var d=qg(h,(function(e){var t=i.work.observers[e].standingPosition.clone();return t.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:t.distanceTo(u.point)}),!0),p=d[0];d[1]<this.panoTapTriggerRadius&&(c=p)}Em(c)&&(c=this.getForwardPanoIndexOrNot(a));for(var f=0,m=this.locationMotion.keyframes;f<m.length;f++){var g=m[f],v=this.panoResourceFromLocationMotionKeyframe(g);if(!(g.progress<this.locationMotion.progress)&&v.panoIndex===c){c=null;break}}if(this.emit("panoSelected",c),Em(c))!0===this.locationMotion.ended&&this.cameraBounce();else{var y=this.work.observers[c];if(y.active){for(var A={},x=Math.PI/6,b=Math.PI/12,w=new r.Vector3(0,1,0),M=y.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),E=M.clone().applyAxisAngle(w,x),S=M.clone().applyAxisAngle(w,-x),_=[],T=[],C=[],I=0,P=y.accessibleNodes;I<P.length;I++){if((p=P[I])!==this.currentPanoIndex&&p!==c){var R=this.work.observers[p].position.clone().sub(y.position).setY(0);M.angleTo(R)<x?C.push(R):E.angleTo(R)<x?_.push(R):S.angleTo(R)<x&&T.push(R)}}var L=(C.length>0?C:t.__spreadArray(t.__spreadArray([],_,!0),T,!0)).slice().sort((function(e,t){return e.angleTo(M)-t.angleTo(M)}))[0];L&&L.angleTo(s)>b&&(A.longitude=Math.atan2(-L.x,-L.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Im(0,this.minLatitude,this.maxLatitude)),this.emit("wantsMoveToPano",c,A,!0)}else this.panoMeshes[c]&&(this.panoMeshes[c].setDisabled(!1),this.panoMeshes[c].setLoading(!0))}}}}},i}(dv);function By(e,t){var i=new r.Vector3;return i.setFromMatrixColumn(t,0),i.multiplyScalar(-e),i}function Dy(e,t,i){var n=new r.Vector3;return n.setFromMatrixColumn(i,0),n.crossVectors(t,n),n.multiplyScalar(e),n}var Oy=function(e){function i(t){var n,r,o,a,s=this,c=i.parseArgs(t);return(s=e.call(this,c)||this).currentPanoIndex=c.initial[0],s.defaultLongitude=c.defaultLongitude,s.defaultLatitude=c.defaultLatitude,s.defaultDistance=c.defaultDistance,s.maxLatitude=c.maxLatitude,s.minLatitude=c.minLatitude,s.maxDistance=c.maxDistance,s.minDistance=c.minDistance,s.locationMotion=new Xm({x:s.camera.pose.offset.x,y:s.camera.pose.offset.y,z:s.camera.pose.offset.z,distance:s.camera.pose.distance,modelAlpha:null!==(r=null===(n=s.model.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==r?r:0,perspToOrtho:null!==(a=null===(o=s.model.getMaterial())||void 0===o?void 0:o.perspToOrtho)&&void 0!==a?a:0}),s}return t.__extends(i,e),i.parseArgs=function(i){var n,r,o,a,s,c,l,h=e.parseArgs.call(this,i);return t.__assign(t.__assign({},h),{defaultLongitude:null!==(n=i.defaultLongitude)&&void 0!==n?n:Math.PI/4,defaultLatitude:null!==(r=i.defaultLatitude)&&void 0!==r?r:Math.PI/4,defaultDistance:null!==(o=i.defaultDistance)&&void 0!==o?o:100,maxLatitude:null!==(a=i.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(s=i.minLatitude)&&void 0!==s?s:0,maxDistance:null!==(c=i.maxDistance)&&void 0!==c?c:100,minDistance:null!==(l=i.minDistance)&&void 0!==l?l:2})},i.distanceFromModel=function(e,t,i){var n=e.bounding,r=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=r/2/Math.tan(Math.PI*t/360);return i<1&&(o/=i),isNaN(o)?r:o},i.initAnimationEndPose=function(e){var t,n,r=this.parseArgs(e),o=e.initial[0],a=e.initial[1];return{longitude:null!==(t=a.longitude)&&void 0!==t?t:r.defaultLongitude,latitude:Im(null!==(n=a.latitude)&&void 0!==n?n:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:90,offset:r.work.observers[o].position.clone(),distance:i.distanceFromModel(r.model,90,r.camera.aspect)}},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.model.enableTiles=!1,this.locationMotion.dispose(),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),delete this.mouseWheelState,delete this.panState},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},i.prototype.updateWork=function(e,t,i,n,r){return this.work=e,this.updateCamera(i,n,r),!0},i.prototype.updateModel=function(t){e.prototype.updateModel.call(this,t);var i=t.bounding.getCenter(new r.Vector3);this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(Pe),this.model.enableTiles=!0},i.prototype.updateTime=function(e,t){if(!this.destroyed){var i={},n={};this.locationMotion.ended||(this.locationMotion.update(e),i.modelAlpha=this.locationMotion.value.modelAlpha,i.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),n.distance=this.locationMotion.value.distance,n.offset=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),Kg(i)||this.model.setMaterial(i),Kg(n)||this.setCamera(n)}},i.prototype.setCamera=function(t){e.prototype.setCamera.call(this,t);var i=this.camera.pose.offset.clone();if(this.model.bvhs.loaded){var n=new r.Raycaster(this.camera.getWorldPosition(new r.Vector3),this.camera.getWorldDirection(new r.Vector3)),o=this.model.intersectRaycaster(n)[0];o&&i.copy(o.point)}var a=qg(this.work.observers,(function(e){return e.position.distanceTo(i)})),s=this.work.observers.indexOf(a);s!==this.currentPanoIndex&&(this.emit("moveToPano",s,this.userAction),this.emit("panoWillArrive",s,Xg(this.camera.pose),this.userAction),this.currentPanoIndex=s,this.emit("panoArrived",s,Xg(this.camera.pose),this.userAction))},i.prototype.getTargetPose=function(){var e=this.cameraMotion.getKeyFrameSegment(Le())[1],t=this.locationMotion.getKeyFrameSegment(Le())[1];return{longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new r.Vector3(t.value.x,t.value.y,t.value.z)}},i.prototype.initAnimation=function(e,t,n,o){var a,s,c=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var l={longitude:null!==(a=t.longitude)&&void 0!==a?a:this.defaultLongitude,latitude:Im(null!==(s=t.latitude)&&void 0!==s?s:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:90,offset:this.model.bounding.getCenter(new r.Vector3),distance:i.distanceFromModel(this.model,90,this.camera.aspect)},h=qt(l,["longitude","latitude","fov"]),u={x:l.offset.x,y:l.offset.y,z:l.offset.z,distance:l.distance,modelAlpha:1,perspToOrtho:0};this.emit("initAnimationWillStart",e,l,this.userAction),this.cameraMotion.set(h,n).catch(Pe),this.locationMotion.set(u,n).then((function(){c.emit("initAnimationEnded",e,l,c.userAction)}),(function(t){var i=Xg(c.camera.pose);c.emit("initAnimationEnded",e,i,c.userAction)})).then((function(){c.model.enableTiles=!0}))}},i.prototype.getForwardPanoIndexOrNot=function(e){var t=this.work.observers.filter((function(e){return e.active})),i=this.model.intersectRaycaster(e)[0];if(!i)return null;var n=qg(t,(function(e){return e.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},i.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,i=this.camera.aspect,n=this.renderer.getSize(new r.Vector2);return{longitude:2*e.x/(n.x*this.scissor.width)*t/95*i,latitude:-2*e.y/(n.y*this.scissor.height)*t/95}},i.prototype.onPanGesture=function(e){var t=this.panState,i=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:i,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===i){var n=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pan",n,e.isFinal))if("mouse"===e.pointerType&&2===e.srcEvent.buttons){var o={x:e.center.x-t.x,y:e.center.y-t.y},a=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),s=this.model.bounding,c=s.getCenter(new r.Vector3),l={x:(s.max.x-s.min.x)/90*this.cameraMotion.value.fov,y:(s.max.y-s.min.y)/90*this.cameraMotion.value.fov,z:(s.max.z-s.min.z)/90*this.cameraMotion.value.fov},h=(this.camera.position.y-s.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),u=this.renderer.getSize(new r.Vector2);a.add(By(2*o.x*h/u.y,this.camera.matrix)),a.add(Dy(2*o.y*h/u.y,this.camera.up,this.camera.matrix)),a.x=Im(a.x,c.x-l.x,c.x+l.x),a.z=Im(a.z,c.z-l.z,c.z+l.z);var d={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:a,distance:this.locationMotion.value.distance};if(this.emit("wantsPanGesture",d,e.isFinal))return;this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",d,e.isFinal),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(Pe)}else{a={x:e.center.x-t.x,y:e.center.y-t.y};var p=this.coordinatesForOffset(a),f=Vg(this.cameraMotion.value.longitude+-1*p.longitude),m=Im(this.cameraMotion.value.latitude+-1*p.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(m=this.cameraMotion.value.latitude);d={longitude:f,latitude:m,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance};if(this.emit("wantsPanGesture",d,e.isFinal))return;this.emit("gesture","pan",n,e.isFinal),this.emit("panGesture",d,e.isFinal),this.userAction=!0,this.interiaMovement=!1;var g={longitude:d.longitude,latitude:d.latitude,fov:d.fov};if(this.cameraMotion.set(g,0).catch(Pe),e.isFinal)this.emit("wantsInteriaPan",d)||(this.interiaMovement=!0,e.velocityX,e.velocityY)}}},i.prototype.onPinchGesture=function(e){var t=this.pinchState||{},i=t.distance;t.offsetY;var n=!1;if("pinchstart"!==e.type){if("pinchend"===e.type&&(n=!0,delete this.pinchState),void 0!==i){this.pinchState={distance:i};var o=e.pointers.map((function(e){return qt(e,["x","y"])}));if(this.emit("wantsGesture","pinch",o,n))return;var a=Im(i/e.scale,this.minDistance,this.maxDistance);if(this.emit("wantsPinchGesture",e.scale,this.camera.pose.fov,n))return;this.emit("gesture","pinch",o,n),this.emit("pinchGesture",e.scale,this.camera.pose.fov,n),this.userAction=!0,this.locationMotion.set({distance:a},0).catch(Pe)}var s=this.panState,c=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:c,x:e.center.x,y:e.center.y},void 0!==s&&s.pointerLength===c){var l=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",l,n)){var h=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","pinch",h,n)){var u={x:e.center.x-s.x,y:e.center.y-s.y},d=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),p=this.model.bounding,f=p.getCenter(new r.Vector3),m={x:(p.max.x-p.min.x)/90*this.cameraMotion.value.fov,y:(p.max.y-p.min.y)/90*this.cameraMotion.value.fov,z:(p.max.z-p.min.z)/90*this.cameraMotion.value.fov},g=(this.camera.position.y-p.min.y)*Math.tan(this.camera.fov/2*Math.PI/180),v=this.renderer.getSize(new r.Vector2);d.add(By(2*u.x*g/v.y,this.camera.matrix)),d.add(Dy(2*u.y*g/v.y,this.camera.up,this.camera.matrix)),d.x=Im(d.x,f.x-m.x,f.x+m.x),d.z=Im(d.z,f.z-m.z,f.z+m.z);var y={longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:d,distance:this.locationMotion.value.distance};this.emit("wantsPanGesture",y,e.isFinal)||(this.emit("gesture","pan",h,e.isFinal),this.emit("panGesture",y,e.isFinal),this.userAction=!0,this.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(Pe))}}}}else this.pinchState={distance:this.locationMotion.value.distance}},i.prototype.onMouseWheel=function(e){var t=this,i=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=[{x:e.clientX,y:e.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Im(this.locationMotion.value.distance-i/2,this.minDistance,this.maxDistance);this.emit("wantsMouseWheel",i,this.camera.pose.fov,!1)||(this.emit("gesture","mouseWheel",n,!1),this.emit("mouseWheel",i,this.camera.pose.fov,!1),this.userAction=!0,this.locationMotion.set({distance:r},0).catch(Pe),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete t.mouseWheelState;t.emit("wantsGesture","mouseWheel",n,!0)||t.emit("wantsMouseWheel",i,t.camera.pose.fov,!0)||(t.emit("gesture","mouseWheel",n,!0),t.emit("mouseWheel",0,t.camera.pose.fov,!0))}),200)})}},i.prototype.onTapGesture=function(e){var t=e.pointers.map((function(e){return qt(e,["x","y"])}));if(!this.emit("wantsGesture","tap",t,!0)){var i=this.relativeClientPosition(e.center),n=new r.Raycaster;if(n.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",n,i,!0)){this.emit("gesture","tap",t,!0),this.emit("tapGesture",n,i,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(n);if(!Em(o)){this.emit("panoSelected",o);var a={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,a,!0)}}}},i.prototype.onPressGesture=function(e,t){var i,n,o=[e];if(this.emit("wantsGesture","press",o,t))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var a=this.relativeClientPosition(e),s=new r.Raycaster;if(s.setFromCamera(a,this.camera),this.emit("wantsPressGesture",s,a,e.delta,t))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,t),this.emit("pressGesture",s,a,e.delta,t)},i}(av),Ny={type:"move"},ky=function(){function e(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return e.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new r.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},e.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new r.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new r.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new r.Vector3),this._targetRay},e.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new r.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new r.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new r.Vector3),this._grip},e.prototype.dispatchEvent=function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},e.prototype.disconnect=function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},e.prototype.getAxes=function(){return this._axes},e.prototype.update=function(e,t,i){var n=null,o=null,a=null,s=this._targetRay,c=this._grip,l=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&"visible-blurred"!==t.session.visibilityState)if(null!==s&&null!==(n=t.getPose(e.targetRaySpace,i))&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Ny)),l&&e.hand){a=!0;for(var h=0,u=e.hand.values();h<u.length;h++){var d=u[h],p=t.getJointPose(d,i);if(void 0===l.joints[d.jointName]){var f=new r.Group;f.matrixAutoUpdate=!1,f.visible=!1,l.joints[d.jointName]=f,l.add(f)}var m=l.joints[d.jointName];null!==p&&(m.matrix.fromArray(p.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=p.radius),m.visible=null!==p}var g=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],y=g.position.distanceTo(v.position);l.inputState.pinching&&y>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&y<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==c&&e.gripSpace&&null!==(o=t.getPose(e.gripSpace,i))&&(c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),o.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(o.linearVelocity)):c.hasLinearVelocity=!1,o.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(o.angularVelocity)):c.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==n),null!==c&&(c.visible=null!==o),null!==l&&(l.visible=null!==a),this},e}(),Fy=function(e){function i(t,i,n){var o,a,s,c=this;return(c=e.call(this)||this).isPanorama=null===(o=null==n?void 0:n.isPanorama)||void 0===o||o,c.machineType=null!==(a=null==n?void 0:n.machineType)&&void 0!==a?a:"Pico",c.renderer=t,c.gl=i,c.enabled=!1,c.session=null,c.referenceSpaceType=null!==(s=null==n?void 0:n.referenceSpaceType)&&void 0!==s?s:"local-floor",c.referenceSpace=null,c.controllers=[new ky,new ky],c.inputSourcesMap=new Map,c.cameraVR=new r.ArrayCamera,c.cameraL=new r.PerspectiveCamera,c.cameraR=new r.PerspectiveCamera,c.cameraL.viewport=new r.Vector4,c.cameraR.viewport=new r.Vector4,c.cameraL.layers.enable(1),c.cameraR.layers.enable(2),c.cameraVR.layers.enable(1),c.cameraVR.layers.enable(2),c.isPresenting=!1,c.currentDepthNear=null,c.currentDepthFar=null,c.cameraLPos=new r.Vector3,c.cameraRPos=new r.Vector3,c}return t.__extends(i,e),i.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},i.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},i.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},i.prototype.setProjectionFromUnion=function(e,t,i){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(i.matrixWorld);var n=this.cameraLPos.distanceTo(this.cameraRPos),r=t.projectionMatrix.elements,o=i.projectionMatrix.elements,a=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(o[8]+1)/o[0],d=a*h,p=a*u,f=n/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=a+f,v=s+f,y=d-m,A=p+(n-m),x=c*s/v*g,b=l*s/v*g;e.projectionMatrix.makePerspective(y,A,x,b,g,v)},i.prototype.getCamera=function(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.far,!this.session||this.currentDepthNear===this.cameraVR.near&&this.currentDepthFar===this.cameraVR.far||(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var t=e.parent,i=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(var n=0;n<i.length;n++)this.updateCamera(i[n],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var r=e.children,o=(n=0,r.length);n<o;n++)r[n].updateMatrixWorld(!0);return 2===i.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},i.prototype.updateInputSources=function(e){if(this.session){for(var t=this.session.inputSources,i=0;i<this.controllers.length;i++)this.inputSourcesMap.set(t[i],this.controllers[i]);for(i=0;i<e.removed.length;i++){var n=e.removed[i];(r=this.inputSourcesMap.get(n))&&(r.dispatchEvent({type:"disconnected",data:n}),this.inputSourcesMap.delete(n))}for(i=0;i<e.added.length;i++){var r;n=e.added[i];(r=this.inputSourcesMap.get(n))&&r.dispatchEvent({type:"connected",data:n})}}else console.warn("session is lose!")},i.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},i.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach((function(e,t){e.disconnect(t)})),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,Je.shared.setContext(null),this.emit("webXRSessionEnd")},i.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.emit("webXRSessionStart")},i.prototype.setSession=function(e){var t=this;if(this.session=e,this.session){this.session.addEventListener("select",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectstart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeeze",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezestart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezeend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("end",(function(e){t.onSessionEnd()}));var i=this.gl.getContextAttributes();this.gl.makeXRCompatible().then((function(){var e={antialias:null==i?void 0:i.antialias,alpha:null==i?void 0:i.alpha,depth:null==i?void 0:i.depth,stencil:null==i?void 0:i.stencil,framebufferScaleFactor:1};if(t.session){switch(t.machineType){case"Pico":t.session.updateRenderState({baseLayer:new XRWebGLLayer(t.session,t.gl,e)});break;case"Oculus":t.session.updateRenderState({layers:[new XRWebGLLayer(t.session,t.gl,e)]});break;default:t.machineType}t.session.requestReferenceSpace(t.referenceSpaceType).then((function(e){t.onRequestReferenceSpace(e)})),t.session.addEventListener("inputsourceschange",(function(e){t.updateInputSources(e)}))}else console.error("session is lose while set session!")}))}},i}(Ie),Vy=["webXRSessionStart","webXRSessionEnd"];function zy(e,t){if(!t)return e;var i=e.match(/\d+_[a-z].png/);return e.substring(0,i.index)+t+"/"+e.substring(i.index)}var Hy=(new r.Matrix4).makeRotationAxis(new r.Vector3(0,1,0),Math.PI),Uy=new r.Vector3(-1,1,1),Gy=function(e){function i(i){var n=e.call(this,i)||this;n.xrManager=new Fy(n.renderer,n.renderer.getContext()),n.xrControllerRay=new r.Raycaster,n.panoResources={},n.panoResources[n.locationMotion.keyframes[0].key=n.locationMotion.keyframes[1].key=Lr()]={panoIndex:n.currentPanoIndex,workCode:n.work.workCode,leftPanoPicture:null,position:n.camera.pose.offset.clone(),effect:"fly"};var o=Je.shared.getContext();if(!o)return console.error("获取session失败,请退出重试"),n;o.addEventListener("select",(function(e){n.emit("webXRSelected","Select"),n.checkSelectedPano()})),o.addEventListener("squeeze",(function(e){n.emit("webXRSelected","Squeeze")})),n.xrManager.setSession(o);for(var a=function(e){s.xrManager.on(e,(function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];n.emit.apply(n,t.__spreadArray([e],i,!1))}))},s=this,c=0,l=Vy;c<l.length;c++){a(l[c])}return n}return t.__extends(i,e),i.parseArgs=function(i){var n=t.__assign(t.__assign({},i),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,n)},i.initAnimationEndPose=function(t){var i=this.parseArgs(t);return e.initAnimationEndPose.call(this,i)},i.prototype.moveToPano=function(e,i,n){var o,a,s,c=this,l=this.work.observers[e],h=t.__assign({key:"pano.".concat(e),basisLoaderInitialized:fi.isInitialized()},qt(this.imageOptions,["format","size","quality"])),u=null!==(o=this.imageOptions.transform)&&void 0!==o?o:it,d={right:zy(u(l.images.right,t.__assign(t.__assign({},h),{key:"".concat(h.key,".right")}))),left:zy(u(l.images.left,t.__assign(t.__assign({},h),{key:"".concat(h.key,".left")}))),up:zy(u(l.images.up,t.__assign(t.__assign({},h),{key:"".concat(h.key,".up")}))),down:zy(u(l.images.down,t.__assign(t.__assign({},h),{key:"".concat(h.key,".down")}))),front:zy(u(l.images.front,t.__assign(t.__assign({},h),{key:"".concat(h.key,".front")}))),back:zy(u(l.images.back,t.__assign(t.__assign({},h),{key:"".concat(h.key,".back")})))},p={key:"pano_luminance.".concat(e),basisLoaderInitialized:fi.isInitialized(),size:h.size?h.size/2:1024},f=this.enableIOSEDR&&l.images.luminance?{right:u(l.images.luminance.right,t.__assign(t.__assign({},p),{key:"".concat(p.key,".right")})),left:u(l.images.luminance.left,t.__assign(t.__assign({},p),{key:"".concat(p.key,".left")})),up:u(l.images.luminance.up,t.__assign(t.__assign({},p),{key:"".concat(p.key,".up")})),down:u(l.images.luminance.down,t.__assign(t.__assign({},p),{key:"".concat(p.key,".down")})),front:u(l.images.luminance.front,t.__assign(t.__assign({},p),{key:"".concat(p.key,".front")})),back:u(l.images.luminance.back,t.__assign(t.__assign({},p),{key:"".concat(p.key,".back")}))}:null,m="pano:"+hv(d);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===m)return;var g=this.pendingTextureTask.panoIndex;null===(a=this.panoMeshes[g])||void 0===a||a.setProgress(0),this.emit("textureAbort",g,l),this.pendingTextureTask.onError(new Error("texture aborted"))}var v,y=this.model.getMaterial()||{},A=y.pano0,x=y.pano1;if((null==A?void 0:A.map.name)===m?v=A:(null==x?void 0:x.map.name)===m&&(v=x),v){var b={panoIndex:e,workCode:this.work.workCode,effect:null!==(s=i.effect)&&void 0!==s?s:"fly",leftPanoPicture:{map:v.map,luminanceMap:v.luminanceMap,matrix:(new r.Matrix4).compose(l.position,l.quaternion,Uy)},position:l.position.clone()};this.doMoveToPano(e,b,i,n)}else this.pending=!0,this.pendingTextureTask={panoIndex:e,hash:m,onLoad:function(t,o){var a,s;if(c.pending=!1,c.destroyed)t.body.dispose();else{t.body.name=m;var h={panoIndex:e,workCode:c.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fly",leftPanoPicture:{map:t.body,luminanceMap:null!==(s=null==o?void 0:o.body)&&void 0!==s?s:null,matrix:(new r.Matrix4).compose(l.position,l.quaternion,Uy)},position:l.position.clone()};c.doMoveToPano(e,h,i,n)}},onError:function(t){c.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),c.emit("panoLoadError",t,e),c.emit("moveToPanoCanceled",e)}},Promise.all([this.textureLoader.loadCube(d,{format:r.RGBFormat},void 0,void 0,(function(t){var i,n;(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(n=c.panoMeshes[e])||void 0===n||n.setProgress(t)),c.emit("textureLoading",t,e,l)})),f?this.textureLoader.loadCube(f,{format:r.LuminanceFormat}).catch((function(){return null})):Promise.resolve(null)]).then((function(t){var i,n,r=t[0],o=t[1];(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m?(c.pendingTextureTask.onLoad(r,o),null===(n=c.panoMeshes[e])||void 0===n||n.setProgress(0),delete c.pendingTextureTask,c.emit("textureLoaded",e,l,r.meta)):(r.body.dispose(),null==o||o.body.dispose())})).catch((function(t){var i,n;(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(c.pendingTextureTask.onError(t),null===(n=c.panoMeshes[e])||void 0===n||n.setProgress(0),delete c.pendingTextureTask,c.emit("textureError",t,e,l),c.emit("error",t))})),this.emit("textureStartLoad",e,l)},i.prototype.doMoveToPano=function(e,i,n,o){var a,s,c,l=this;void 0===n&&(n={}),this.userAction=o;var h=Le(),u=Lr();this.panoResources[u]=i;var d,p,f;if(this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(h);m[0];var g=m[1],v=this.locationMotion.value,y=this.panoResourceFromLocationMotionKeyframe(g).position,A=i.position;d=Math.max(y.distanceTo(A),1),p=[{key:g.key,progress:0,value:t.__assign(t.__assign({},v),{count:0})},{key:u,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,count:1}}],f=0}else{var x=this.locationMotion.getKeyFrameSegment(h),b=x[0],w=(g=x[1],v=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),M=(y=this.panoResourceFromLocationMotionKeyframe(g).position,A=i.position,g.value.count-v.count),E=Math.max(w.distanceTo(y),1)*M;d=E+Math.max(y.distanceTo(A),1),p=[{key:b.key,progress:0,value:t.__assign({},v)},{key:g.key,progress:E/d,value:g.value},{key:u,progress:1,value:{count:g.value.count+1,distance:0,perspToOrtho:0,modelAlpha:0}}];var S=this.locationMotionKeyframesLength(this.locationMotion.keyframes),_=this.locationMotionKeyframesLength(p);f=this.locationMotion.getProgressVelocity(h)*S/_}var T=this.calculateMovingDuration(n.duration,d),C={longitude:n.longitude,latitude:n.latitude,fov:n.fov},I={longitude:null!==(a=C.longitude)&&void 0!==a?a:this.camera.pose.longitude,latitude:null!==(s=C.latitude)&&void 0!==s?s:this.camera.pose.latitude,fov:null!==(c=C.fov)&&void 0!==c?c:this.camera.pose.fov,offset:i.position.clone(),distance:0};n.moveStartCallback&&n.moveStartCallback(e,I),this.emit("panoWillArrive",e,I,this.userAction),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=Pe,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(C,T).catch(Pe),this.locationMotion.setKeyframes(p,T,f).then((function(){var t,i,a,s={longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:0};n.moveEndCallback&&n.moveEndCallback(e,s),l.emit("panoArrived",e,s,o);var c=l.work.observers[l.currentPanoIndex];if(c&&c.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var h=Hy.clone().multiply(null!==(a=null===(i=null===(t=l.model.getMaterial())||void 0===t?void 0:t.pano1)||void 0===i?void 0:i.matrix)&&void 0!==a?a:new r.Matrix4).multiply(c.video.matrix),u={map:l.videoTexture,size:c.video.size,matrix:h,alpha:1},d=Lr(),p=l.videoTexture.image;p.setAttribute("uuid",d),pv().then((function(e){e&&c.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=Pe,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=Pe,l.panoVideo.setMaterial(u))},p.src=c.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){n.moveCancelCallback&&n.moveCancelCallback(),l.emit("moveToPanoCanceled",e)}))},i.prototype.checkSelectedPano=function(){var e=this,i=this.xrControllerRay;this.interiaMovement=!1;var n=this.camera.getWorldDirection(new r.Vector3).setY(0),o=null,a=this.work.observers[this.currentPanoIndex];if(!a)return o;var s=a.accessibleNodes.filter((function(t){if(t===e.currentPanoIndex)return!1;var i=e.work.observers[t];return!(i.position.distanceTo(e.camera.position)>e.maxAccessibleDistance)&&(i.loadable||i.active)})),c=this.model.intersectRaycaster(i)[0];if(c){var l=qg(s,(function(t){var i=e.work.observers[t].standingPosition.clone();return i.clone().sub(e.camera.position).setY(0).angleTo(n)>Math.PI/2?1/0:i.distanceTo(c.point)}),!0),h=l[0];l[1]<this.panoTapTriggerRadius&&(o=h)}Em(o)&&(o=this.getForwardPanoIndexOrNot(i));for(var u=0,d=this.locationMotion.keyframes;u<d.length;u++){var p=d[u],f=this.panoResourceFromLocationMotionKeyframe(p);if(!(p.progress<this.locationMotion.progress)&&f.panoIndex===o){o=null;break}}if(this.emit("panoSelected",o),Em(o))return!0===this.locationMotion.ended&&this.cameraBounce(),o;var m=this.work.observers[o];if(!m.active)return this.panoMeshes[o]&&(this.panoMeshes[o].setDisabled(!1),this.panoMeshes[o].setLoading(!0)),o;for(var g={effect:"fade"},v=Math.PI/6,y=Math.PI/12,A=new r.Vector3(0,1,0),x=m.position.clone().setY(0).sub(a.position.clone().setY(0)).normalize(),b=x.clone().applyAxisAngle(A,v),w=x.clone().applyAxisAngle(A,-v),M=[],E=[],S=[],_=0,T=m.accessibleNodes;_<T.length;_++){if((h=T[_])!==this.currentPanoIndex&&h!==o){var C=this.work.observers[h].position.clone().sub(m.position).setY(0);x.angleTo(C)<v?S.push(C):b.angleTo(C)<v?M.push(C):w.angleTo(C)<v&&E.push(C)}}var I=(S.length>0?S:t.__spreadArray(t.__spreadArray([],M,!0),E,!0)).slice().sort((function(e,t){return e.angleTo(x)-t.angleTo(x)}))[0];return I&&I.angleTo(n)>y&&(g.longitude=Math.atan2(-I.x,-I.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(g.latitude=Im(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(g.fov=this.defaultFov),this.emit("wantsMoveToPano",o,g,!0),o},i.prototype.destroy=function(){e.prototype.destroy.call(this)},i.prototype.isReady=function(){return!1},i.prototype.updateTime=function(e,t){for(var i,n,o,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];var c={},l={};if(!1===this.locationMotion.ended){this.locationMotion.update(e);var h=this.locationMotion.getKeyFrameSegment(e),u=h[0],d=h[1],p=this.panoResourceFromLocationMotionKeyframe(u),f=this.panoResourceFromLocationMotionKeyframe(d),m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),v=(new r.Vector3).copy(p.position),y=(new r.Vector3).copy(f.position),A=this.locationMotion.value.count-d.value.count+1;c.modelAlpha=this.locationMotion.value.modelAlpha,c.perspToOrtho=Im(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),c.useBlackTransition="instant"===f.effect,f.leftPanoPicture&&(A<1?p.leftPanoPicture&&(c.pano0=p.leftPanoPicture):c.pano0=f.leftPanoPicture,c.pano1=f.leftPanoPicture),c.progress=A,l.distance=this.locationMotion.value.distance,l.offset=new r.Vector3(v.x+(y.x-v.x)*A,v.y+(y.y-v.y)*A,v.z+(y.z-v.z)*A);for(var x=[],b=[],w=0,M=this.locationMotion.keyframes;w<M.length;w++){var E=M[w],S=E.key,_=E.progress;void 0!==S&&(x.push(S),_>=this.locationMotion.progress&&b.push(S))}for(var T=0,C=Object.keys(this.panoResources);T<C.length;T++){var I=C[T];if(!(b.indexOf(I)>=0)){var P=this.panoResources[I];if(P.leftPanoPicture){var R=P.leftPanoPicture.map;if(R){if(R===(null===(i=c.pano0)||void 0===i?void 0:i.map))continue;if(R===(null===(n=c.pano1)||void 0===n?void 0:n.map))continue;R.dispose(),null===(o=P.leftPanoPicture.luminanceMap)||void 0===o||o.dispose(),P.leftPanoPicture=null}}x.indexOf(I)>=0||delete this.panoResources[I]}}p.workCode===f.workCode?this.currentPanoIndex=A<.5?p.panoIndex:f.panoIndex:this.currentPanoIndex=f.panoIndex,this.emit("movingToPano",g.panoIndex,m.panoIndex,this.locationMotion.progress),this.tiling.object.visible=!1}else this.tiling.object.visible=!1!==this.tileLevelForFov;!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),l.longitude=this.cameraMotion.value.longitude,l.latitude=this.cameraMotion.value.latitude,l.fov=this.cameraMotion.value.fov),!1===Kg(c)&&(this.model.setMaterial(c),this.boundingMesh.setMaterial(c)),!1===Kg(l)&&this.setCamera(l),a[0];var L=a[1];if(L)if(this.xrManager.session){var B=this.xrManager.referenceSpace;if(B){var D=this.xrManager.cameraVR,O=this.xrManager.cameraL,N=this.xrManager.cameraR,k=[O,N],F=L.getViewerPose(B),V=new r.Vector3(0,0,0);if(F){var z=void 0;switch(this.xrManager.machineType){case"Pico":z=this.xrManager.session.renderState.baseLayer;break;case"Oculus":var H=this.xrManager.session.renderState.layers;H&&(z=H[0]);break;default:this.xrManager.machineType}var U=F.views;if(!z)return void console.error("no layer found");this.renderer.setFramebuffer(z.framebuffer);var G=!1;U.length!==D.cameras.length&&(D.cameras.length=0,G=!0);for(var j=0;j<U.length;j++){var Q=U[j],W=z.getViewport(Q),q=k[j];q.matrix.fromArray(Q.transform.matrix);var K=new r.Vector3,X=new r.Quaternion,Y=new r.Vector3;q.matrix.decompose(K,X,Y);var Z=new r.Vector3,J=new r.Quaternion,$=new r.Vector3;this.camera.matrix.decompose(Z,J,$),V.copy(Z),q.matrix.compose(Z,X,Y),q.projectionMatrix.fromArray(Q.projectionMatrix),q.viewport.set(W.x,W.y,W.width,W.height),0===j&&D.matrix.copy(q.matrix),!0===G&&D.cameras.push(q)}}var ee=this.xrManager.session.inputSources;for(j=0;j<this.xrManager.controllers.length;j++){var te=this.xrManager.controllers[j],ie=ee[j];te.update(ie,L,B)}var ne=this.xrManager.getController(0),re=ne.position.add(V);this.xrControllerRay.set(re,new r.Vector3(0,0,-1).applyEuler(ne.rotation));var oe=this.model.intersectRaycaster(this.xrControllerRay);if(oe.length>=1&&oe[0].face){var ae=oe[0].face.normal,se=ae.clone().multiplyScalar(.05),ce=oe[0].point.clone().add(se);this.intersectMesh.position.copy(ce);var le=ce.clone().add(se);if(this.intersectMesh.lookAt(le),Math.abs(ae.y)>.99){var he=this.camera.position.clone().sub(ce);this.intersectMesh.rotation.z=-Math.atan2(he.z,he.x)}this.intersectMesh.visible=!0,this.needsRender=!0,this.emit("intersectionOnModelUpdate",oe[0],this.intersectMesh)}if(this.camera.pose.distance>.1)for(var ue=0;ue<this.work.observers.length;ue++){(me=this.panoMeshes[ue])&&(me.visible=!1)}else{var de=this.work.observers[this.currentPanoIndex];if(de){var pe=de.visibleNodes.concat(this.currentPanoIndex),fe=this.getForwardPanoIndexOrNot();for(ue=0;ue<this.work.observers.length;ue++){var me,ge=this.work.observers[ue];if(me=this.panoMeshes[ue])if(ge.loadable||ge.active)if(-1!==pe.indexOf(ue)){me.visible=!0;var ve=me.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);me.setCurrent(fe===ue),me.setOpacity(ve<.01?0:Im(1.4/ve,.5,.7)),me.updateTime&&me.updateTime(e,t)}else me.visible=!1,me.setOpacity(0);else me.visible=!1,me.setOpacity(0)}}}this.needsRender=!0}}else console.error("session丢失,请重试");else console.error("xrFrame丢失,请重试")},i.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},i.prototype.onPanGesture=function(){},i.prototype.onTapGesture=function(){},i.prototype.onPinchGesture=function(){},i.prototype.onMouseMove=function(){},i.prototype.onMouseOut=function(){},i.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},i.prototype.prepareForMoveToPano=function(e){var t=this,i={useXRBlackTransition:!0},n=Le(),r=0;return new Promise((function(e,o){var a=setInterval((function(){if((r=Math.min(1,(Le()-n)/1e3))>=1)return i.useXRBlackTransition=!1,i.progress=0,t.model.setMaterial(i),clearInterval(a),void e(!0);i.progress=r,t.model.setMaterial(i)}),50)}))},i}(Hv),jy=["Panorama","DepthPanorama","Model"],Qy={Floorplan:sv,Topview:cv,Panorama:Hv,VRPanorama:Ey,Model:Sy,DepthPanorama:Ly,Mapview:Oy,XRPanorama:Gy};function Wy(e){for(var t=0,i=jy;t<i.length;t++){var n=i[t];if("string"==typeof e){if(n===e)return!0}else if(e instanceof av&&e instanceof Qy[n])return!0}return!1}var qy=["cameraDirectionUpdate","cameraUpdate","cameraPositionUpdate","panoSelected","moveToPano","moveToPanoCanceled","panoWillArrive","movingToPano","panoArrived","panoWillLoad","panoLoaded","panoLoadError","initAnimationEnded","initAnimationWillStart","wantsGesture","gesture","wantsTapGesture","tapGesture","wantsPressGesture","pressGesture","wantsPanGesture","wantsInteriaPan","panGesture","interiaPan","wantsPinchGesture","pinchGesture","wantsMouseWheel","mouseWheel","wantsShowIntersectionOnModel","intersectionOnModelUpdate","intersectionHidden","textureStartLoad","textureLoading","textureAbort","textureLoaded","textureError","webXRSessionStart","webXRSessionEnd","webXRSelected"];function Ky(e){for(var t,i,n={},r=0,o=e.split(/(\;|\,)/);r<o.length;r++){var a=o[r].split("="),s=null===(t=a[0])||void 0===t?void 0:t.trim(),c=null===(i=a[1])||void 0===i?void 0:i.trim();s&&c&&(n[s]=c)}return n}function Xy(){for(var e,t=document.getElementsByTagName("meta"),i=0;i<t.length;i++){var n=t[i];if("viewport"===n.getAttribute("name")){var r=Ky(null!==(e=n.getAttribute("content"))&&void 0!==e?e:""),o=Number(r["initial-scale"]);if(!isNaN(o))return o}}return 1}var Yy=[351,63],Zy=[20,20],Jy=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),$y=new Float32Array([0,0,1,0,0,1,1,1]),eA=new Uint8Array([0,1,2,1,3,2]),tA=new r.BufferGeometry;tA.setAttribute("position",new r.BufferAttribute(Jy,3)),tA.setAttribute("uv",new r.BufferAttribute($y,2)),tA.setIndex(new r.BufferAttribute(eA,1));var iA=new r.MeshBasicMaterial({transparent:!0,depthTest:!1}),nA=new r.Mesh(tA,iA),rA=new r.Scene;rA.add(nA);var oA=new r.OrthographicCamera(-.5,.5,.5,-.5,.1,1);oA.position.set(0,0,.5),oA.lookAt(0,0,0);var aA=new r.Vector4,sA=new r.Vector4;function cA(e){if(iA.map){var t=e.getViewport(aA),i=e.getScissor(sA),n=e.getScissorTest(),o=e.autoClear;e.setViewport(i.x+Zy[0]/3,i.y+Zy[1]/3,Yy[0]/3,Yy[1]/3),e.setScissor(i.x+Zy[0]/3,i.y+Zy[1]/3,Yy[0]/3,Yy[1]/3),e.setScissorTest(!0),e.autoClear=!1,e.render(rA,oA),e.setViewport(t),e.setScissor(i),e.setScissorTest(n),e.autoClear=o}else{var a=new r.Texture,s=new Image;s.onload=function(){a.image=s,a.wrapS=r.ClampToEdgeWrapping,a.wrapT=r.ClampToEdgeWrapping,a.minFilter=r.LinearFilter,a.needsUpdate=!0,iA.needsUpdate=!0,s.onload=function(){}},s.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==",iA.map=a}}var lA=new r.Box3(new r.Vector3(-50,-50,-50),new r.Vector3(50,50,50)),hA=function(e){return e.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},uA=new r.Vector2,dA=new r.Frustum,pA=new r.Matrix4,fA=new WeakMap,mA=new WeakMap,gA=function(e){function i(i){void 0===i&&(i={});var n,o,a,s,c,l,h,u,d,p,f,m=this;if((m=e.call(this)||this).ident=Lr(),vA.instances[m.ident]=m,m.renderSwitch01=0,m.panoIndex=0,m.needsRender=!1,m.onlyRenderIfNeeds=null===(n=i.onlyRenderIfNeeds)||void 0===n||n,m.imageOptions=t.__assign({},null!==(o=i.imageOptions)&&void 0!==o?o:{}),m.textureOptions=t.__assign({},null!==(a=i.textureOptions)&&void 0!==a?a:{}),m.poweredByRealsee=null===(s=i.poweredByRealsee)||void 0===s||s,m.extraElements=[],m.controllerInits={Panorama:Object.assign({},i.panorama),Model:Object.assign({},i.model),Floorplan:Object.assign({},i.floorplan),Topview:Object.assign({},i.topview),Mapview:Object.assign({},i.mapview),DepthPanorama:Object.assign({},i.depthPanorama),VRPanorama:Object.assign({},i.vrPanorama),XRPanorama:Object.assign({},i.xrPanorama)},m.fps={testCount:0,testTime:Le()},m.modeChangeDuration=null!==(c=i.modeChangeDuration)&&void 0!==c?c:800,m.panoramaLikeSavedPose={},"undefined"!=typeof window)if(i.renderer)i.renderer instanceof gt&&m.throwError(new Error("cannot render a internal renderer")),m.renderer=i.renderer;else try{m.renderer=new gt({preserveDrawingBuffer:i.preserveDrawingBuffer,backgroundColor:i.backgroundColor,backgroundAlpha:i.backgroundAlpha,antialias:i.antialias,webgl2:null==i?void 0:i.webgl2});var g=Xy();m.renderer.setPixelRatio(1===g?window.devicePixelRatio:1),m.renderer.setSize(512,512)}catch(e){e instanceof Error&&m.throwError(e)}m.getPixelsRenderTarget=new r.WebGLRenderTarget(1,1,{encoding:null!==(h=null===(l=m.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==h?h:r.sRGBEncoding}),m.scissor=Object.assign({left:0,bottom:0,width:1,height:1},i.scissor),m.camera=new St(80),m.scene=new vt,m.lastLoadWorkTask=Promise.resolve(),m.requestProxy=null!==(u=i.requestProxy)&&void 0!==u?u:hA,m.networkSubscribe=new We,m.networkSubscribe.on("network",(function(e,t,i,n){var r;m.emit("network",e,t,i,n),null===(r=m.analysis)||void 0===r||r.network(m.work,e,t,i,n)})),m.model=new Cm({allowHosts:[],requestProxy:m.requestProxy,networkSubscribe:m.networkSubscribe});var v=Ng(lA);v.name="model_empty",m.model.add(v),m.model.visible=!1,m.readyCallbacks=[],m.modelPending=!1,m.syncingState=!1,m.scene.add(m.model),m.helperGroup=new r.Group,m.helperGroup.name="helper",m.scene.add(m.helperGroup),m.videoTexture=new r.VideoTexture(i.videoInstance||function(){var e=document.createElement("video");e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),e.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),e}()),function(e){(t=new r.DirectionalLight(16777215,.5)).position.copy(new r.Vector3(1,1,1)),e.add(t);var t=new r.DirectionalLight(16777215,.3);e.add(t),t=new r.AmbientLight(16777215,.3),e.add(t)}(m.scene),m.state={mode:null!==(d=m.currentMode)&&void 0!==d?d:"Panorama",panoIndex:null!==(p=m.panoIndex)&&void 0!==p?p:0,longitude:m.camera.pose.longitude,latitude:m.camera.pose.latitude,fov:m.camera.pose.fov,offset:m.camera.pose.offset.clone(),distance:m.camera.pose.distance},m.stateSynced=!1,m._enableIOSEDR=!1,m.destroyed=!1,m.paused=!0,"undefined"!=typeof window&&(!1!==i.play&&m.play(),!1!==(null!==(f=i.initialBasisLoader)&&void 0!==f&&f)&&("string"==typeof i.initialBasisLoader?m.initBasisLoader(i.initialBasisLoader):m.initBasisLoader()),m.stopAnimationLoop=Je.shared.add((function(e,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];m.updateTime.apply(m,t.__spreadArray([e,i],n,!1))}),!1,0,10));var y=function(){"undefined"!=typeof document&&null===document.fullscreenElement&&"VRPanorama"===m.currentMode&&m.controller.emit("vrWantsToExit")};if("undefined"!=typeof document&&document.addEventListener("fullscreenchange",y,!1),m.removeEventListeners=function(){"undefined"!=typeof document&&document.removeEventListener("fullscreenchange",y,!1)},m.plugins={},i.plugins&&i.plugins.length)for(var A=0,x=i.plugins;A<x.length;A++){var b=x[A];if("function"==typeof b)b(m);else if(Array.isArray(b)){var w=b[0],M=b[1],E=b[2];if("function"==typeof w){var S=w(m,E);"string"==typeof M&&(m.plugins[M]?m.throwError(new Error("plugin name ".concat(M," is exists."))):m.plugins[M]=S)}}}return m}return t.__extends(i,e),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.142"},enumerable:!1,configurable:!0}),i.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete vA.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),null===(e=this.renderer)||void 0===e||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i),this.scene.remove(this.model);var n=this.model.getMaterial();n&&(n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==(null===(t=n.pano0)||void 0===t?void 0:t.map)&&n.pano1.map.dispose()),this.model.dispose(),this.renderer instanceof gt&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},i.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(i.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpersVisibleChange",e),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&"Panorama"===this.currentMode&&this.changeMode(this.currentMode,{},0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffer},set:function(e){var t,i;if(e){if(!this.screenBuffer){var n=this.getDrawingBufferSize(uA);this.screenBuffer=new r.WebGLRenderTarget(n.x,n.y,{encoding:null!==(i=null===(t=this.renderer)||void 0===t?void 0:t.outputEncoding)&&void 0!==i?i:r.sRGBEncoding})}}else this.screenBuffer&&(this.screenBuffer.dispose(),delete this.screenBuffer);this.needsRender=!0},enumerable:!1,configurable:!0}),i.prototype.updateConfiguration=function(e){var t=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),"Panorama"===this.currentMode&&(t=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),"Model"===this.currentMode&&(t=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),"Floorplan"===this.currentMode&&(t=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),"Topview"===this.currentMode&&(t=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.topview),"Mapview"===this.currentMode&&(t=!0)),e.depthPanorama&&(Object.assign(this.controllerInits.DepthPanorama,e.depthPanorama),"DepthPanorama"===this.currentMode&&(t=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),"VRPanorama"===this.currentMode&&(t=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),"Panorama"!==this.currentMode&&"DepthPanorama"!==this.currentMode&&"VRPanorama"!==this.currentMode||(t=!0)),t&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},i.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof gt){var i=this.getElement();if(i){e.appendChild(i),this.refresh(t);var n=window.getComputedStyle(e).position;"relative"!==n&&"absolute"!==n&&"fixed"!==n&&"sticky"!==n&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},i.prototype.refresh=function(e,t){if(void 0===e&&(e={}),this.renderer){var i=this.getElement();if(i){var n=i.parentNode;if(n&&n.nodeName){var o=e.width,a=void 0===o?n.offsetWidth:o,s=e.height,c=void 0===s?n.offsetHeight:s;this.renderer instanceof gt&&(t&&this.renderer.setPixelRatio(t),this.renderer.setSize(a,c))}var l=this.renderer.getSize(new r.Vector2);this.camera.aspect=l.x*this.scissor.width/(l.y*this.scissor.height),this.camera.updateProjectionMatrix(),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(),this.needsRender=!0}}},i.prototype.addExtraElement=function(e){var t=this;return-1===this.extraElements.indexOf(e)&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return t.removeExtraElement(e)}},i.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},i.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,i=e.latitude,n=e.fov,r=e.offset,o=e.distance;return{longitude:t,latitude:i,fov:n,offset:r.clone(),distance:o}},i.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},i.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},i.prototype.updateCamera=function(e,t,i){return void 0===i&&(i=!0),this.controller?this.controller.updateCamera(e,t,i):Promise.reject(new Error("controller is not initialized."))},i.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},i.prototype.getOffset=function(){return this.getPose().offset},i.prototype.getCameraLocal=function(){if("number"==typeof this.panoIndex&&this.controller&&this.work){var e=this.work.observers[this.panoIndex],t=new r.Object3D;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.set(1,1,1),t.updateMatrixWorld(!0),function(e,t){var i=new r.Vector3(0,0,-1);i.applyQuaternion(e.quaternion);var n=t.quaternion.clone().inverse();return i.applyQuaternion(n),{theta:Math.atan2(i.x,-i.z),phi:-Math.asin(i.y),lookAtVector:i}}(this.camera,t)}},i.prototype.initBasisLoader=function(e){try{if(!this.renderer)throw new Error("renderer is not initialized.");if("undefined"==typeof Promise||"undefined"==typeof WeakMap||"undefined"==typeof WebAssembly)throw new Error("Basis loader not support.");"string"==typeof e&&fi.setTranscoderPath(e),fi.workerConfig.format||fi.detectSupport(this.renderer),fi._allocateWorker(0)}catch(e){e instanceof Error&&this.throwError(e)}},Object.defineProperty(i.prototype,"work",{get:function(){var e=mA.get(this);if(e&&zm.get(e))return e},enumerable:!1,configurable:!0}),i.prototype.load=function(e,t,i,n){var r=this;if(void 0===n&&(n=!0),!this.renderer)throw new Error("renderer is not initialized");var o=this.lastLoadWorkTask.then((function(){return!(o=e)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then?r.load_(e,t,i,n):e.then((function(e){return r.load_(e,t,i,n)}));var o}));return this.lastLoadWorkTask=o.catch((function(e){r.throwError(e)})),o},i.prototype.load_=function(e,n,r,o){var a,s,c,l,h,u,d,p,f,m=this;void 0===o&&(o=!0);var g,v,y,A=Qm(e),x=this.work;void 0===n&&(n=x?"inherit":"initial"),"inherit"===n?(g="number"==typeof this.panoIndex&&A.observers[this.panoIndex]?this.panoIndex:A.initial.panoIndex,v=null!==(a=this.currentMode)&&void 0!==a?a:A.initial.mode,y={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}):"initial"===n?(v=null!==(s=this.currentMode)&&void 0!==s?s:A.initial.mode,g=A.initial.panoIndex,y=v===i.Mode.Panorama||v===i.Mode.DepthPanorama||v===i.Mode.Model||v===i.Mode.VRPanorama||v===i.Mode.XRPanorama?{longitude:A.initial.longitude,latitude:A.initial.latitude,fov:A.initial.fov}:{longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}):(g=null!==(c=n.panoIndex)&&void 0!==c?c:A.initial.panoIndex,v=null!==(h=null!==(l=n.mode)&&void 0!==l?l:this.currentMode)&&void 0!==h?h:"Panorama",y={longitude:null!==(u=n.longitude)&&void 0!==u?u:A.initial.longitude,latitude:null!==(d=n.latitude)&&void 0!==d?d:A.initial.latitude,fov:null!==(p=n.fov)&&void 0!==p?p:A.initial.fov}),this.emit("willLoad",e,A,{panoIndex:g,mode:v,longitude:y.longitude,latitude:y.latitude,fov:y.fov});var b=function(){var i;m.panoIndex=g,m.panoramaLikeSavedPose.longitude=A.initial.longitude,m.panoramaLikeSavedPose.latitude=A.initial.latitude,m.panoramaLikeSavedPose.fov=A.initial.fov;var n=m.controller?null!=r?r:m.modeChangeDuration:0,a=t.__assign(t.__assign({initial:[g,y,n,o]},m.commonParams()),m.controllerInits[v]);m.controller?!1===m.controller.updateWork(A,g,y,n,o)&&(m.controller.destroy(),m.controller=m.applyController(v,a)):m.controller=m.applyController(v,a),m.emit("load",e,A,{panoIndex:g,mode:v,longitude:y.longitude,latitude:y.latitude,fov:y.fov}),null===(i=m.analysis)||void 0===i||i.work(A)},w=function(e){var t;void 0===e&&(e=Pe),A.model&&(m.model.name!==(null===(t=A.model)||void 0===t?void 0:t.file)?(m.emit("modelWillLoad",A.model),m.loadModel(A.model,A.allowHosts,e,!0)):e&&e())};return mA.set(this,A),v===i.Mode.Floorplan||v===i.Mode.Topview||v===i.Mode.Mapview||v===i.Mode.Model?w((function(){b(),m.needsRender=!0})):(this.controller||(this.camera.setFromPose({distance:0,fov:A.initial.fov,longitude:A.initial.longitude,latitude:A.initial.latitude,offset:A.observers[A.initial.panoIndex].position}),this.needsRender=!0),b(),null===(f=this.controller)||void 0===f||f.once("panoLoaded",(function(){m.needsRender=!0,m.emit("cameraUpdate",m.camera.copyPose(),o),w()}))),this.ready().then((function(){m.emit("loaded",e,m.work)}))},i.prototype.changeMode=function(e,n,r,o,a){var s=this;if(void 0===n&&(n={}),void 0===r&&(r=this.modeChangeDuration),void 0===o&&(o=!0),void 0===a&&(a=!1),!this.renderer)throw new Error("renderer is not initialized.");return new Promise((function(c,l){if(!i.Mode.hasOwnProperty(e)){var h=new Error('mode "'.concat(e,'" is not existed'));return s.throwError(h),void l(h)}if((e===i.Mode.Floorplan||e===i.Mode.Topview||e===i.Mode.Mapview||e===i.Mode.Model)&&(Em(s.model)||!0!==s.model.loaded)){h=new Error("model is not ready.");return s.throwError(h),void l(h)}if(Em(s.controller)){h=new Error("controller is not ready.");return s.throwError(h),void l(h)}var u=s.controller,d=s.currentMode,p=function(){var h,p,f,m;if(s.emit("wantsChangeMode",e,d))l(new Error("change mode canceled."));else{if(s.controller&&!1===a&&d===e)e===i.Mode.Panorama||e===i.Mode.DepthPanorama||e===i.Mode.Model||e===i.Mode.VRPanorama||e===i.Mode.XRPanorama?"number"==typeof n.panoIndex&&n.panoIndex!==s.panoIndex?s.controller.moveToPano(null!==(p=null!==(h=n.panoIndex)&&void 0!==h?h:s.panoIndex)&&void 0!==p?p:0,t.__assign({duration:r},n),o):s.controller.updateCamera(n,r,o).catch(Pe):("number"==typeof n.panoIndex&&n.panoIndex!==s.panoIndex&&(s.panoIndex=n.panoIndex),s.controller.updateCamera(n,r,o).catch(Pe));else{u.destroy();var g=null!==(m=null!==(f=n.panoIndex)&&void 0!==f?f:s.panoIndex)&&void 0!==m?m:0,v=Wy(e)?s.panoramaLikeSavedPose:{};e===i.Mode.Mapview&&(v.longitude=s.panoramaLikeSavedPose.longitude),"number"!=typeof n.longitude&&"number"!=typeof n.latitude||(v.longitude=n.longitude,v.latitude=n.latitude),"number"==typeof n.fov&&(v.fov=n.fov);var y=t.__assign(t.__assign({initial:[g,v,r,o]},s.commonParams()),s.controllerInits[e]);s.saveControllerPose(u),s.controller=s.applyController(e,y);var A=Qy[e].initAnimationEndPose(y);s.emit("modeChange",e,d,g,A,o)}c()}};if(e===i.Mode.VRPanorama)s.requestFullscreen(),("undefined"==typeof location||"https:"!==location.protocol?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){if("granted"==e)return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)})):Promise.resolve()).then((function(){return p()})).catch((function(e){e instanceof Error&&(s.exitFullscreen(),s.throwError(e),l(e))}));else if(e===i.Mode.XRPanorama){var f=Je.shared.getContext();f?f.end():function(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then((function(e){return e?Promise.resolve():Promise.reject()})).then((function(){return navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"]}).then((function(e){return Promise.resolve(e)}))}));var e=new Error("Request XR Permission denied.");return Promise.reject(e)}().then((function(e){Je.shared.setContext(e),p()})).catch((function(e){e instanceof Error&&(s.throwError(e),l(e))})),s.on("webXRSessionEnd",(function(){s.changeMode("Panorama")}))}else p()}))},i.prototype.getPixels=function(e,t,i,n,o){if(void 0===o&&(o=1),!this.renderer)throw new Error("renderer is not initialized.");var a=this.getPixelsRenderTarget,s=this.renderer.getSize(new r.Vector2);e=Im(e,Math.floor(i/2),Math.floor(s.x-i)),t=Im(t,Math.floor(n/2),Math.floor(s.y-n)),a.setSize(i*o,n*o),this.renderer.setRenderTarget(a),this.camera.setViewOffset(s.width,s.height,e,s.height-t-n,i,n),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var c=new Uint8Array(i*o*n*o*4);return this.renderer.readRenderTargetPixels(a,0,0,i*o,n*o,c),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),c},i.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},i.prototype.render=function(e,t){var i=this;if(void 0===t&&(t=!1),!this.renderer)return null;if(t){var n=this.renderer.getSize(uA);this.scene.traverseVisible((function(e){e.setResolution&&e.setResolution(n.x,n.y)}))}if(this.controller&&this.screenBuffer&&null===this.renderer.getRenderTarget()){var r=this.getDrawingBufferSize(uA);return this.screenBuffer.setSize(r.x,r.y),this.renderer.setRenderTarget(this.screenBuffer),this.controller.render(),this.renderer.setRenderTarget(null),"VRPanorama"!==this.currentMode&&"XRPanorama"!==this.currentMode&&this.poweredByRealsee&&cA(this.renderer),this.renderer.setRenderTarget(null),e&&Je.shared.add(e,!0),this.screenBuffer}return this.aroundScissor((function(){i.renderer&&(i.controller?i.controller.render():i.renderer.render(i.scene,i.camera),i.poweredByRealsee&&"VRPanorama"!==i.currentMode&&"XRPanorama"!==i.currentMode&&cA(i.renderer)),e&&Je.shared.add(e,!0)})),null},i.prototype.updateTime=function(e,i){for(var n,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];if(!this.destroyed){this.syncingState=this.syncState(e,i),this.controller&&(n=this.controller).updateTime.apply(n,t.__spreadArray([e,i],a,!1)),this.syncingState=!1;var c=new r.Vector2(512,512),l=new r.Vector2(512,512);this.renderer&&(this.renderer.getSize(c),c.x*=this.scissor.width,c.y*=this.scissor.height,this.renderer.getDrawingBufferSize(l),l.x*=this.scissor.width,l.y*=this.scissor.height);var h=[];if(pA.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.renderer&&this.model.update(this.renderer,this.camera),dA.setFromProjectionMatrix(pA),this.scene.traverse((function(e){if(e.setResolution&&e.setResolution(c.x,c.y),e.mixer instanceof r.AnimationMixer){var t=fA.get(e.mixer);t||(t=new r.Clock,fA.set(e.mixer,t)),e.mixer.update(t.getDelta())}(e instanceof r.Mesh||e instanceof r.Line||e instanceof r.Points)&&(e instanceof r.ImmediateRenderObject||!e.frustumCulled||dA.intersectsObject(e))&&h.push(e)})),l.width*l.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var u=void 0;if(!0!==this.onlyRenderIfNeeds)u=this.render();else{for(var d=0,p=h;d<p.length;d++){var f=p[d],m=function(e){!0===e.needsRender?(e.needsRender=!1,o.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(o.needsRender=!0)};m(f),f.traverseAncestors(m)}this.controller&&!0===this.controller.needsRender&&(this.controller.needsRender=!1,this.needsRender=!0),!1!==this.needsRender&&(u=this.render())}this.needsRender=!1,this.controller&&this.screenBuffer&&this.aroundScissor((function(){return o.controller.postProcessing(o.screenBuffer,void 0)})),this.hasListener("renderFrame")&&this.emit("renderFrame",void 0!==u)}if(this.fps.testTime&&e-this.fps.testTime<1e3)this.fps.testCount++;else if(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0,this.renderer){var g=this.renderer.getContext(),v=kg(g);v&&this.throwError(v)}}},i.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof gt&&this.renderer.clear(!0,!0,!0)},i.prototype.play=function(){this.needsRender=!0,this.paused=!1},i.prototype.moveToPano=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!0);var r=this,o=r.controller,a=r.currentMode,s=r.renderer;return o?s?(a===i.Mode.Floorplan||a===i.Mode.Topview||a===i.Mode.Mapview?Em(e)||(this.panoIndex=e,this.changeMode(i.Mode.Panorama,t,void 0,n)):o.moveToPano(e,t,n),this.ready()):(this.throwError(new Error("renderer is not initialized.")),Promise.resolve()):(this.throwError(new Error("controller is not initialized.")),Promise.resolve())},i.prototype.preloadPano=function(e,i){var n=this;if(void 0===i&&(i=Pe),!this.work)return Promise.reject(new Error("work never loaded"));var r=this.work.observers[e],o=Le();return Promise.all(["right","left","up","down","front","back"].map((function(i){var o=t.__assign({key:"pano.".concat(e,".").concat(i),basisLoaderInitialized:fi.isInitialized()},qt(n.imageOptions,["size","format","quality","mappings"])),a=r.images[i];return function(e,t){return void 0===t&&(t={}),t.requestProxy&&(e=t.requestProxy(e)),e in Ke?Ke[e]:Ke[e]=new Promise((function(i,n){var r=document.createElement("link");r.href=e,r.rel=r.relList&&r.relList.supports("prefetch")?"prefetch":"preload",r.as="fetch",r.crossOrigin="";var o=Le(),a=document.head||document.getElementsByTagName("head")[0];a&&a.appendChild(r);var s=!1;r.onload=function(){var n;if(!0!==s){s=!0,i();var r=Le(),a={source:e,requestTime:o,responseTime:r,costs:r-o,headers:{}};null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Link","preload",JSON.stringify(a))}},r.onerror=function(i){var r;if(!0!==s){s=!0;var o=new ze(e,"Link",0);n(o),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Link","error",o.message)}}}))}(n.imageOptions.transform?n.imageOptions.transform(a,o):it(a,o),{requestProxy:n.requestProxy,networkSubscribe:n.networkSubscribe})}))).then((function(){var e=Le()-o;return i(e),e}))},i.prototype.project2d=function(e,t){if(void 0===t&&(t=!1),!this.renderer)return null;if(!1===this.model.empty&&t){var i=this.camera.position,n=e.clone().sub(i),o=new r.Raycaster(i,n.clone().normalize()),a=this.model.intersectRaycaster(o)[0];if(a&&a.distance+.01<n.length())return null}var s=e.clone().project(this.camera);if(Math.abs(s.z)>1)return null;var c=this.renderer.getSize(new r.Vector2),l=c.x*this.scissor.width,h=c.y*this.scissor.height,u=c.x*this.scissor.left+(s.x+1)/2*l,d=c.y*(1-this.scissor.bottom-this.scissor.height)+(1-s.y)/2*h;return new r.Vector2(u,d)},i.prototype.getRenderObjects=function(e){pA.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),dA.setFromProjectionMatrix(pA),e||(e=this.scene);var t=[];return e.traverseVisible((function(e){(e instanceof r.Mesh||e instanceof r.Line||e instanceof r.Points)&&(e instanceof r.ImmediateRenderObject||!e.frustumCulled||dA.intersectsObject(e))&&t.push(e)})),t},i.prototype.getCurrentState=function(){return t.__assign(t.__assign({},this.getPose()),{mode:this.currentMode||i.Mode.Panorama,panoIndex:this.panoIndex||0})},i.prototype.setState=function(e,n,o){var a,s,c,l,h,u,d,p,f;void 0===n&&(n=!1),void 0===o&&(o=!0),!(e=Object.assign({},e)).offset||e instanceof r.Vector3||(e.offset=new r.Vector3(e.offset.x,e.offset.y,e.offset.z));var m,g,v,y,A,x=null!==(a=e.panoIndex)&&void 0!==a?a:this.state.panoIndex,b=null!==(s=e.mode)&&void 0!==s?s:this.state.mode;if(this.work)if(this.work.observers[x])if(e.mode!==i.Mode.Floorplan&&e.mode!==i.Mode.Topview&&e.mode!==i.Mode.Mapview&&e.mode!==i.Mode.Model||!Em(this.model)&&!0===this.model.loaded){if(this.state.mode!==b){if("VRPanorama"===b)return void this.changeMode("VRPanorama",void 0,void 0,!0);var w=void 0;w=Wy(this.state.mode)&&Wy(b)?t.__assign({},this.state):Wy(b)?t.__assign({},this.panoramaLikeSavedPose):b===i.Mode.Mapview?{longitude:this.panoramaLikeSavedPose.latitude}:t.__assign({},e),"number"==typeof e.longitude&&(w.longitude=e.longitude),"number"==typeof e.latitude&&(w.latitude=e.latitude),"number"==typeof e.fov&&(w.fov=e.fov);var M=t.__assign(t.__assign({initial:[x,w,this.modeChangeDuration,!1]},this.commonParams()),this.controllerInits[b]),E=Qy[b].initAnimationEndPose(M);m=E.longitude,g=E.latitude,v=E.fov,y=E.offset,A=E.distance}else m=null!==(c=e.longitude)&&void 0!==c?c:this.state.longitude,g=null!==(l=e.latitude)&&void 0!==l?l:this.state.latitude,v=null!==(h=e.fov)&&void 0!==h?h:this.state.fov,y=null!==(u=e.offset)&&void 0!==u?u:this.state.offset,A=null!==(d=e.distance)&&void 0!==d?d:this.state.distance;var S={panoIndex:x,mode:b,longitude:m,latitude:g,fov:v,offset:y,distance:A};this.emit("setState",S),Qg(this.state,S)||(this.controller&&"VRPanorama"===S.mode&&S.mode!==this.state.mode?(jg(this.state,S),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===S.mode&&S.mode!==this.state.mode?(jg(this.state,S),this.changeMode("XRPanorama")):(jg(this.state,S),this.controller&&(this.controller.userAction=o),n&&this.state.mode===S.mode&&(this.syncingState=this.syncState(Le(),0,n),this.syncingState&&(null===(p=this.controller)||void 0===p||p.updateTime(Le(),0),this.syncingState=!1)),this.emit("stateChange",this.state,o),null===(f=this.analysis)||void 0===f||f.state(this.work,this.state)))}else this.throwError(new Error("model is not ready."));else this.throwError(new Error("panoIndex not found in work"));else this.throwError(new Error("work never load."))},i.prototype.aroundScissor=function(e){if(this.renderer)if("XRPanorama"!==this.state.mode){var t=new r.Vector2,i=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(i){this.renderer.getSize(t);var n=Math.floor(t.x*this.scissor.left),o=Math.floor(t.y*this.scissor.bottom),a=Math.floor(t.x*this.scissor.width),s=Math.floor(t.y*this.scissor.height);this.renderer.setViewport(n,o,a,s),this.renderer.setScissor(n,o,a,s),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,t.x,t.y),this.renderer.setScissor(0,0,t.x,t.y),this.renderer.setScissorTest(!1))}else e()},i.prototype.syncState=function(e,t,n){void 0===n&&(n=!1);var o=this.stateSynced;if(this.stateSynced=!1,!this.work)return!1;if(!this.controller)return!1;if(this.state.mode!==this.currentMode){var a={mode:this.state.mode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.changeMode(this.state.mode,a,this.modeChangeDuration,this.controller.userAction),!0}if(!1===this.controller.isReady())return!1;if(this.readyCallbacks.length){var s=this.currentMode;if(!(s===i.Mode.Floorplan||s===i.Mode.Topview||s===i.Mode.Mapview||s===i.Mode.Model)||!this.modelPending){var c=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var l=0,h=c;l<h.length;l++){var u=h[l];this.controller instanceof Qy.Panorama?!0!==u.tile||this.controller.isTileReady()?u():this.readyCallbacks.push(u):u()}}}if(this.controller instanceof Qy.Model){if(!this.camera.pose.offset.equals(this.state.offset)){var d={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,d,!1),!0}}else if(this.state.panoIndex!==this.panoIndex){d={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(this.state.panoIndex,d,!1),!0}if(this.controller instanceof Qy.Topview||this.controller instanceof Qy.Mapview){var p=1,f=n?this.state.fov:Ug(this.camera.pose.fov,this.state.fov,p),m=n?new r.Vector3(this.state.offset.x,this.state.offset.y,this.state.offset.z):new r.Vector3(Ug(this.camera.pose.offset.x,this.state.offset.x,.2),Ug(this.camera.pose.offset.y,this.state.offset.y,.2),Ug(this.camera.pose.offset.z,this.state.offset.z,.2));if(Rg(f,this.camera.pose.fov)||Bg(m,this.camera.pose.offset))return this.controller.cameraMotion.set({fov:f},0).catch(Pe),this.controller.locationMotion.set({x:m.x,y:m.y,z:m.z},0).catch(Pe),!0}else{p=1;var g=Math.PI/45,v=(f=n?this.state.fov:Ug(this.camera.pose.fov,this.state.fov,p),n?{longitude:this.state.longitude,latitude:this.state.latitude}:function(e,t,i){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var n=Vg(e.longitude),r=e.latitude,o=Vg(t.longitude),a=t.latitude;o-n>zg?n+=Hg:n-o>zg&&(n-=Hg);var s=i/Math.sqrt(Math.pow(o-n,2)+Math.pow(a-r,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:n+(o-n)*s,latitude:r+(a-r)*s}}({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},g)),y=v.longitude,A=v.latitude;if(Rg(y,this.camera.pose.longitude,2*Math.PI)||Rg(A,this.camera.pose.latitude)||Rg(f,this.camera.pose.fov))return this.controller.cameraMotion.set({longitude:y,latitude:A,fov:f},0).catch(Pe),!0}return this.stateSynced=!0,!1===o&&this.emit("stateSynced",this.state),!1},i.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(i){var n;t.readyCallbacks.push(Object.assign(i,{tile:null!==(n=e.tile)&&void 0!==n&&n}))}))},i.prototype.requestFullscreen=function(){var e;if(Gg()){var t=null===(e=this.getElement())||void 0===e?void 0:e.parentNode;t&&"requestFullscreen"in t&&"undefined"!=typeof document&&null===document.fullscreenElement&&t.requestFullscreen()}},i.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},i.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},i.prototype.loadModel=function(e,t,i,n){var o=this,a=e.file;this.emit("modelWillLoad",e);var s=new Cm({allowHosts:t,requestProxy:this.requestProxy,networkSubscribe:this.networkSubscribe});s.once("bvhLoaded",(function(){var e,t;o.destroyed||a===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&o.emit("modelBvhLoaded",s)})),s.once("materialLoaded",(function(){var e,t;o.destroyed||a===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&o.emit("modelMaterialLoaded",s)})),s.once("geometryLoaded",(function(){var e,t;o.destroyed||a===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)&&(s.bounding.max.y-s.bounding.min.y<1.5&&(s.bounding.max.y=s.bounding.min.y+10),o.emit("modelGeometryLoaded",s))})),s.once("loaded",(function(){var e,t,n,r;if(!o.destroyed&&a===(null===(t=null===(e=o.work)||void 0===e?void 0:e.model)||void 0===t?void 0:t.file)){var c,l=o.model;l&&(l.show(),c=l.getMaterial()||{},o.scene.remove(l),l.dispose(),s.setTransparent(l.getTransparent())),c&&s.setMaterial(c),o.model=s,o.scene.add(s),null===(n=o.controller)||void 0===n||n.updateModel(s),null===(r=o.renderer)||void 0===r||r.compile(o.scene,o.camera),o.needsRender=!0,o.modelPending=!1,i(),o.emit("modelLoaded",s)}})),s.on("shownFloorChange",(function(e,t){var i,n;o.destroyed||a===(null===(n=null===(i=o.work)||void 0===i?void 0:i.model)||void 0===n?void 0:n.file)&&o.emit("modelShownFloorChange",e,t)})),s.on("error",(function(e){var t,n,c,l;if(!o.destroyed&&a===(null===(n=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===n?void 0:n.file)){s.bounding.makeEmpty();for(var h=0,u=o.work.observers;h<u.length;h++){var d=u[h];s.bounding.expandByPoint(d.standingPosition),s.bounding.expandByPoint((new r.Vector3).fromArray([d.position.x,2*d.position.y-d.standingPosition.y,d.position.z]))}var p=Ng(s.bounding,new r.Vector3(1,0,1));p.visible=!0,p.name="model_empty",s.add(p);var f,m=o.model;m&&(m.show(),f=m.getMaterial()||{},o.scene.remove(m),m.dispose(),s.setTransparent(m.getTransparent())),f&&s.setMaterial(f),o.model=s,o.scene.add(s),null===(c=o.controller)||void 0===c||c.updateModel(s),null===(l=o.renderer)||void 0===l||l.compile(o.scene,o.camera),o.emit("modelLoadError",e,s),o.throwError(e),o.modelPending=!1,i()}})),this.modelPending=!0,s.load(e,this.textureOptions).catch(Pe)},i.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),model:this.model,work:this.work,imageOptions:this.imageOptions,enableIOSEDR:this._enableIOSEDR,extraElements:this.extraElements,videoTexture:this.videoTexture,networkSubscribe:this.networkSubscribe,requestProxy:this.requestProxy}},i.prototype.saveControllerPose=function(e){void 0===e&&(e=this.controller),e&&Wy(e)&&(this.panoramaLikeSavedPose.longitude=this.camera.pose.longitude,this.panoramaLikeSavedPose.latitude=this.camera.pose.latitude,this.panoramaLikeSavedPose.fov=this.camera.pose.fov)},i.prototype.applyController=function(e,n){var r=this;if(!this.renderer)throw new Error("renderer is not initialized.");var o=Qy[e];e===this.currentMode||this.model.empty||this.model.show(),this.model.setTransparent(e===i.Mode.Floorplan||e===i.Mode.Topview||e===i.Mode.Model||e===i.Mode.Mapview),this.currentMode=e;for(var a=new o(n),s=function(e){a.on(e,(function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var o=r.emit.apply(r,t.__spreadArray([e],i,!1));if(o)return!1}))},c=0,l=qy;c<l.length;c++){s(l[c])}var h=Qy[e].initAnimationEndPose(n),u=n.initial[3],d={panoIndex:n.initial[0],mode:e,longitude:h.longitude,latitude:h.latitude,fov:h.fov,offset:h.offset,distance:h.distance};return Qg(this.state,d)||(jg(this.state,d),this.emit("stateChange",this.state,u)),this.emit("currentStateChange",this.getCurrentState(),u),a.on("cameraUpdate",(function(i,n){var o;if(r.controller){var a=t.__assign(t.__assign({},r.controller.getTargetPose()),{panoIndex:r.panoIndex,mode:e});n&&!1===r.syncingState&&r.state.mode===a.mode&&!Qg(r.state,a)&&(jg(r.state,a),r.emit("stateChange",r.state,n),null===(o=r.analysis)||void 0===o||o.state(r.work,r.state))}r.emit("currentStateChange",r.getCurrentState(),n)})),a.on("initAnimationWillStart",(function(i,n,o){var a,s=t.__assign(t.__assign({},n),{panoIndex:i,mode:e});o&&r.state.mode===s.mode&&!Qg(r.state,s)&&(jg(r.state,s),r.emit("stateChange",r.state,o),null===(a=r.analysis)||void 0===a||a.state(r.work,r.state))})),a.on("initAnimationEnded",(function(i,n,o){var a,s=t.__assign(t.__assign({},n),{panoIndex:i,mode:e});o&&r.state.mode===s.mode&&!Qg(r.state,s)&&(jg(r.state,s),r.emit("stateChange",r.state,o),null===(a=r.analysis)||void 0===a||a.state(r.work,r.state))})),a.on("panoWillArrive",(function(i,n,o){var a;r.panoIndex=i;var s=t.__assign(t.__assign({},n),{panoIndex:i,mode:e});o&&r.state.mode===s.mode&&!Qg(r.state,s)&&(jg(r.state,s),r.emit("stateChange",r.state,o),null===(a=r.analysis)||void 0===a||a.state(r.work,r.state))})),a.on("panoArrived",(function(i,n,o){var a,s=t.__assign(t.__assign({},n),{panoIndex:i,mode:e});o&&r.state.mode===s.mode&&!Qg(r.state,s)&&(jg(r.state,s),r.emit("stateChange",r.state,o),null===(a=r.analysis)||void 0===a||a.state(r.work,r.state))})),a.on("moveToPano",(function(e,t){r.emit("currentStateChange",r.getCurrentState(),t)})),a.on("wantsMoveToPano",(function(e,t,i){var n=r.emit("wantsMoveToPano",e,t,i);n||(n=r.emit("wantsToMoveToPano",e,t,i)),n||r.moveToPano(e,t,i)})),a.on("vrWantsToExit",(function(){r.currentMode===i.Mode.VRPanorama&&(r.exitFullscreen(),r.changeMode(i.Mode.Panorama))})),a.on("error",(function(e){return r.throwError(e)})),a},i.prototype.removeEventListeners=function(){},i.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},i.Line=null,i}(Ie),vA={instances:{},constructor:gA};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:vA});var yA=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function i(){t.style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.onmouseenter=null,t.onmouseleave=null,t.onclick=null,t.textContent="VR NOT SUPPORTED"}function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return t.id="VRButton",t.style.display="none",n(t),navigator.xr.isSessionSupported("immersive-vr").then((function(n){n?(t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR",t.onmouseenter=function(){t.style.opacity="1.0"},t.onmouseleave=function(){t.style.opacity="0.5"},t.onclick=function(){e&&e()}):i()})),t;var r=document.createElement("a");return!1===window.isSecureContext?(r.href=document.location.href.replace(/^http:/,"https:"),r.innerHTML="WEBXR NEEDS HTTPS"):(r.href="https://immersiveweb.dev/",r.innerHTML="WEBXR NOT AVAILABLE"),r.style.left="calc(50% - 90px)",r.style.width="180px",r.style.textDecoration="none",n(r),r},e}();exports.AnimationFrameLoop=Je,exports.BVH=Bt,exports.BVHIntersect=Ct,exports.BVHNode=Tt,exports.BVHVector3=_t,exports.Camera=St,exports.Five=gA,exports.InternalWebGLRenderer=gt,exports.IntersectMesh=Ig,exports.LegacyPanoCircleMesh=hg,exports.Model=Cm,exports.NetworkSubscribe=We,exports.PBMContainer=at,exports.PBMGroup=st,exports.PBMMaterial=mt,exports.PBMMesh=ot,exports.PROXY_CONTROLLER_EVENT_NAMES=qy,exports.PanoCircleMesh=Sg,exports.Scene=vt,exports.Subscribe=Ie,exports.Tile3D=_r,exports.Tile3DModel=Mm,exports.TileBoundingSphere=tr,exports.TileCacheNode=sn,exports.TileCullingVolume=Sn,exports.TileOrientedBoundingBox=Ar,exports.TilePlane=xn,exports.TileRequestScheduler=an,exports.Tileset3D=Pr,exports.Tileset3DTraverser=Cr,exports.TilesetCache=ln,exports.Work=Hm,exports.XRButton=yA,exports.defaultImageURLTransform=it,exports.getViewportScale=Xy,exports.imageSupport=function(){return rt||(rt=Promise.all([nt("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),nt("data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA")]).then((function(e){var t=e[0];return{webp:e[1],avif:t}})).catch((function(){return{webp:!1,avif:!1}})))},exports.parseWork=Qm;
|