@realsee/five 5.0.0-alpha.13 → 5.0.0-alpha.130

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.
Files changed (203) hide show
  1. package/README.md +21 -11
  2. package/docs/.nojekyll +1 -0
  3. package/docs/assets/highlight.css +134 -0
  4. package/docs/assets/icons.css +1043 -0
  5. package/docs/assets/{images/icons.png → icons.png} +0 -0
  6. package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
  7. package/docs/assets/main.js +52 -0
  8. package/docs/assets/search.js +1 -0
  9. package/docs/assets/style.css +1413 -0
  10. package/docs/assets/{images/widgets.png → widgets.png} +0 -0
  11. package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
  12. package/docs/classes/five.AnimationFrameLoop.html +15 -0
  13. package/docs/classes/five.BVH.html +10 -0
  14. package/docs/classes/five.BVHIntersect.html +1 -0
  15. package/docs/classes/five.BVHNode.html +7 -0
  16. package/docs/classes/five.BVHVector3.html +1 -0
  17. package/docs/classes/five.Camera.html +11 -0
  18. package/docs/classes/five.Five.html +303 -0
  19. package/docs/classes/five.InternalWebGLRenderer.html +1 -0
  20. package/docs/classes/five.IntersectMesh.html +1 -0
  21. package/docs/classes/five.LegacyPanoCircleMesh.html +5 -0
  22. package/docs/classes/five.Model.html +87 -0
  23. package/docs/classes/five.NetworkSubscribe.html +50 -0
  24. package/docs/classes/five.PBMContainer.html +17 -0
  25. package/docs/classes/five.PBMGroup.html +19 -0
  26. package/docs/classes/five.PBMMaterial.html +17 -0
  27. package/docs/classes/five.PBMMesh.html +7 -0
  28. package/docs/classes/five.PanoCircleMesh.html +7 -0
  29. package/docs/classes/five.Scene.html +3 -0
  30. package/docs/classes/five.Subscribe.html +56 -0
  31. package/docs/classes/five.Tile3DModel.html +15 -0
  32. package/docs/classes/five.Work.html +30 -0
  33. package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
  34. package/docs/classes/gltf_loader.GLTFObject.html +7 -0
  35. package/docs/classes/line.Line.html +1 -0
  36. package/docs/classes/line.LineGeometry.html +1 -0
  37. package/docs/classes/line.LineMaterial.html +1 -0
  38. package/docs/classes/line.LineSegmentsGeometry.html +1 -0
  39. package/docs/classes/line.THREE_Line2.html +1 -0
  40. package/docs/classes/line.THREE_LineSegments2.html +1 -0
  41. package/docs/classes/react.Store.html +29 -0
  42. package/docs/classes/server.BVH.html +10 -0
  43. package/docs/classes/server.BVHIntersect.html +1 -0
  44. package/docs/classes/server.BVHNode.html +7 -0
  45. package/docs/classes/server.BVHVector3.html +1 -0
  46. package/docs/classes/server.Model.html +63 -0
  47. package/docs/classes/server.PBMGroup.html +9 -0
  48. package/docs/classes/server.PBMMesh.html +7 -0
  49. package/docs/classes/sticker.Sticker.html +32 -0
  50. package/docs/index.html +166 -422
  51. package/docs/interfaces/five.AddableObject.html +1 -0
  52. package/docs/interfaces/five.AnimationFrame.html +1 -0
  53. package/docs/interfaces/five.CameraPose.html +1 -0
  54. package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
  55. package/docs/interfaces/five.EventCallback.html +391 -0
  56. package/docs/interfaces/five.FiveInitArgs.html +100 -0
  57. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +15 -0
  58. package/docs/interfaces/five.ImageOptions.html +18 -0
  59. package/docs/interfaces/five.ImageURLMappings.html +1 -0
  60. package/docs/interfaces/five.ImageURLOptions.html +17 -0
  61. package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
  62. package/docs/interfaces/five.Intersection.html +7 -0
  63. package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +15 -0
  64. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
  65. package/docs/interfaces/five.ModelEventCallback.html +22 -0
  66. package/docs/interfaces/five.MovePanoOptions.html +42 -0
  67. package/docs/interfaces/five.PBMPanoPicture.html +7 -0
  68. package/docs/interfaces/five.PBMParameters.html +17 -0
  69. package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
  70. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +28 -0
  71. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
  72. package/docs/interfaces/five.Pose.html +37 -0
  73. package/docs/interfaces/five.Scissor.html +14 -0
  74. package/docs/interfaces/five.State.html +21 -0
  75. package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
  76. package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
  77. package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
  78. package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
  79. package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
  80. package/docs/interfaces/five.TextureOptions.html +20 -0
  81. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -0
  82. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +24 -0
  83. package/docs/interfaces/five.WorkCubeImage.html +13 -0
  84. package/docs/interfaces/five.WorkImage.html +21 -0
  85. package/docs/interfaces/five.WorkInitial.html +13 -0
  86. package/docs/interfaces/five.WorkModel.html +11 -0
  87. package/docs/interfaces/five.WorkModelTiles.html +3 -0
  88. package/docs/interfaces/five.WorkObserver.html +25 -0
  89. package/docs/interfaces/five.WorkTile.html +1 -0
  90. package/docs/interfaces/five.WorkVideo.html +9 -0
  91. package/docs/interfaces/gltf_loader.GLTF.html +7 -0
  92. package/docs/interfaces/react.FiveActionReactCallbacks.html +62 -0
  93. package/docs/interfaces/react.FiveInjectionTypes.html +191 -0
  94. package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
  95. package/docs/interfaces/server.Intersection.html +7 -0
  96. package/docs/interfaces/server.ModelEventCallback.html +18 -0
  97. package/docs/interfaces/sticker.IntersectionLike.html +8 -0
  98. package/docs/interfaces/vue.FiveActionVueCallbacks.html +62 -0
  99. package/docs/modules/five.SubscribeMixinType.html +1 -0
  100. package/docs/modules/five.html +482 -0
  101. package/docs/modules/gltf_loader.html +1 -0
  102. package/docs/modules/line.html +1 -0
  103. package/docs/modules/react.html +130 -1178
  104. package/docs/modules/server.html +18 -0
  105. package/docs/modules/sticker.html +1 -0
  106. package/docs/modules/vue.html +112 -0
  107. package/docs/modules.html +1 -120
  108. package/exporters/staticify.js +210 -0
  109. package/{index.d.ts → five/index.d.ts} +1178 -322
  110. package/five/index.js +372 -0
  111. package/gltf-loader/index.d.ts +75 -0
  112. package/gltf-loader/index.js +260 -0
  113. package/line/index.d.ts +68 -0
  114. package/line/index.js +260 -0
  115. package/package.json +25 -17
  116. package/react/index.d.ts +160 -92
  117. package/react/index.js +260 -1
  118. package/resource/{basis_transcoder.js → basis/basis_transcoder.js} +0 -0
  119. package/resource/{basis_transcoder.wasm → basis/basis_transcoder.wasm} +0 -0
  120. package/resource/gltf/draco_decoder.js +31 -0
  121. package/resource/gltf/draco_decoder.wasm +0 -0
  122. package/resource/gltf/draco_wasm_wrapper.js +119 -0
  123. package/scripts/five-staticify.js +26 -0
  124. package/server/index.d.ts +194 -25
  125. package/server/index.js +367 -1
  126. package/sticker/index.d.ts +70 -0
  127. package/sticker/index.js +260 -0
  128. package/templates/quick-start/README.md +1 -1
  129. package/templates/quick-start/package.json +1 -1
  130. package/templates/react-component/lib/index.tsx +3 -3
  131. package/umd/five-gltf-loader.js +2 -0
  132. package/umd/five-gltf-loader.js.LICENSE.txt +14 -0
  133. package/umd/five-line.js +2 -0
  134. package/umd/five-line.js.LICENSE.txt +14 -0
  135. package/umd/five-react.js +2 -0
  136. package/umd/five-react.js.LICENSE.txt +14 -0
  137. package/umd/five-sticker.js +2 -0
  138. package/umd/five-sticker.js.LICENSE.txt +14 -0
  139. package/umd/five-vue.js +1 -0
  140. package/umd/five.js +2 -0
  141. package/umd/five.js.LICENSE.txt +116 -0
  142. package/vue/index.d.ts +433 -0
  143. package/vue/index.js +260 -0
  144. package/bundles/five.js +0 -2
  145. package/bundles/five.js.LICENSE.txt +0 -160
  146. package/docs/assets/css/main.css +0 -2660
  147. package/docs/assets/js/main.js +0 -248
  148. package/docs/assets/js/search.js +0 -1
  149. package/docs/classes/index.five.html +0 -2498
  150. package/docs/classes/index.fivecamera.html +0 -311
  151. package/docs/classes/index.fivehashcubetexture.html +0 -240
  152. package/docs/classes/index.fiveline.html +0 -342
  153. package/docs/classes/index.fivelinegeometry.html +0 -500
  154. package/docs/classes/index.fivelinematerial.html +0 -276
  155. package/docs/classes/index.fivelinesegmentsgeometry.html +0 -447
  156. package/docs/classes/index.fivescene.html +0 -186
  157. package/docs/classes/index.internalwebglrenderer.html +0 -200
  158. package/docs/classes/index.model.html +0 -883
  159. package/docs/classes/index.pbmgroup.html +0 -415
  160. package/docs/classes/index.pbmmaterial.html +0 -521
  161. package/docs/classes/index.pbmmesh.html +0 -242
  162. package/docs/classes/index.subscribe.html +0 -556
  163. package/docs/classes/react.store.html +0 -584
  164. package/docs/interfaces/index.depthpanoramacontrollercustominitargs.html +0 -408
  165. package/docs/interfaces/index.eventcallback.html +0 -2452
  166. package/docs/interfaces/index.fiveinitargs.html +0 -695
  167. package/docs/interfaces/index.floorplancontrollercustominitargs.html +0 -283
  168. package/docs/interfaces/index.imageoptions.html +0 -320
  169. package/docs/interfaces/index.intersection.html +0 -215
  170. package/docs/interfaces/index.intersectmeshinterface.html +0 -176
  171. package/docs/interfaces/index.modelcontrollercustominitargs.html +0 -354
  172. package/docs/interfaces/index.modeleventcallback.html +0 -316
  173. package/docs/interfaces/index.movepanooptions.html +0 -457
  174. package/docs/interfaces/index.panocirclemeshinterface.html +0 -349
  175. package/docs/interfaces/index.panoramacontrollercustominitargs.html +0 -433
  176. package/docs/interfaces/index.panoramalikecontrollercustominitargs.html +0 -352
  177. package/docs/interfaces/index.pbmparameters.html +0 -462
  178. package/docs/interfaces/index.pose.html +0 -258
  179. package/docs/interfaces/index.scissor.html +0 -240
  180. package/docs/interfaces/index.state.html +0 -288
  181. package/docs/interfaces/index.subscribemixintype.emit.html +0 -180
  182. package/docs/interfaces/index.subscribemixintype.haslistener.html +0 -171
  183. package/docs/interfaces/index.subscribemixintype.off.html +0 -198
  184. package/docs/interfaces/index.subscribemixintype.on.html +0 -213
  185. package/docs/interfaces/index.subscribemixintype.once.html +0 -210
  186. package/docs/interfaces/index.topviewcontrollercustominitargs.html +0 -214
  187. package/docs/interfaces/index.vrpanoramacontrollercustominitargs.html +0 -420
  188. package/docs/interfaces/react.fiveactionreactcallbacks.html +0 -559
  189. package/docs/interfaces/react.fiveinjectiontypes.html +0 -1473
  190. package/docs/interfaces/react.injectfivetoprops.html +0 -259
  191. package/docs/modules/index.html +0 -3027
  192. package/docs/modules/index.subscribemixintype.html +0 -143
  193. package/five.js.LICENSE.txt +0 -160
  194. package/index.js +0 -1
  195. package/scripts/export-five-resource/chfs.exe +0 -0
  196. package/scripts/export-five-resource/fileify.js +0 -192
  197. package/scripts/export-five-resource/format-work.js +0 -71
  198. package/scripts/export-five-resource/staticify.js +0 -327
  199. package/scripts/transcode-model/BufferGeometryUtils.js +0 -832
  200. package/scripts/transcode-model/LoaderSupport.js +0 -1545
  201. package/scripts/transcode-model/MTLLoader.js +0 -602
  202. package/scripts/transcode-model/OBJLoader2.js +0 -1470
  203. 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-06-28
5
+ * Version: 5.0.0-alpha.130
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 t=require("three"),e=require("tslib"),i=require("protobufjs/minimal");function n(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var r=n(t),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(t,e){var i={},n=i.lib={},r=n.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var i=new t;return e&&i.mixIn(e),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes,r=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<r;o++){var a=i[o>>>2]>>>24-o%4*8&255;e[n+o>>>2]|=a<<24-(n+o)%4*8}else for(o=0;o<r;o+=4)e[n+o>>>2]=i[o>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var i=[],n=0;n<e;n+=4)i.push(4294967296*t.random()|0);return new o.init(i,e)}}),a=i.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r++){var o=e[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n<e;n+=2)i[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(i,e/2)}},c=a.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r++){var o=e[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n<e;n++)i[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(i,e)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},h=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var i=this._data,n=i.words,r=i.sigBytes,a=this.blockSize,s=r/(4*a),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*a,l=t.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 t=r.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});n.Hasher=h.extend({cfg:r.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,i){return new t.init(i).finalize(e)}},_createHmacHelper:function(t){return function(e,i){return new u.HMAC.init(t,i).finalize(e)}}});var u=i.algo={};return i}(Math);function u(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function d(){return new u(null)}!function(t){for(var e=h,i=(r=e.lib).WordArray,n=r.Hasher,r=e.algo,o=[],a=[],s=function(t){return 4294967296*(t-(0|t))|0},c=2,l=0;64>l;){var u;t:{u=c;for(var d=t.sqrt(u),p=2;p<=d;p++)if(!(u%p)){u=!1;break t}u=!0}u&&(8>l&&(o[l]=s(t.pow(c,.5))),a[l]=s(t.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(t,e){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|t[e+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 e=this._data,i=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=t.floor(n/4294967296),i[15+(r+64>>>9<<4)]=n,e.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=n._createHelper(r),e.HmacSHA256=n._createHmacHelper(r)}(Math),h.lib.Cipher||function(t){var e=(f=h).lib,i=e.Base,n=e.WordArray,r=e.BufferedBlockAlgorithm,o=f.enc.Base64,a=f.algo.EvpKDF,s=e.Cipher=r.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,i){this.cfg=this.cfg.extend(i),this._xformMode=t,this._key=e,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,i,n){return("string"==typeof i?m:p).encrypt(t,e,i,n)},decrypt:function(e,i,n){return("string"==typeof i?m:p).decrypt(t,e,i,n)}}}});e.StreamCipher=s.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var c=f.mode={},l=function(t,e,i){var n=this._iv;n?this._iv=undefined:n=this._prevBlock;for(var r=0;r<i;r++)t[e+r]^=n[r]},u=(e.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();u.Encryptor=u.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize;l.call(this,t,e,n),i.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),u.Decryptor=u.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,r=t.slice(e,e+n);i.decryptBlock(t,e),l.call(this,t,e,n),this._prevBlock=r}}),c=c.CBC=u,u=(f.pad={}).Pkcs7={pad:function(t,e){for(var i,r=(i=(i=4*e)-t.sigBytes%i)<<24|i<<16|i<<8|i,o=[],a=0;a<i;a+=4)o.push(r);i=n.create(o,i),t.concat(i)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},e.BlockCipher=s.extend({cfg:s.cfg.extend({mode:c,padding:u}),reset:function(){s.reset.call(this);var t=(e=this.cfg).iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=e.createEncryptor;else i=e.createDecryptor,this._minBufferSize=1;this._mode=i.call(e,this,t&&t.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var d=e.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),p=(c=(f.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return((t=t.salt)?n.create([1398893684,1701076831]).concat(t).concat(e):e).toString(o)},parse:function(t){var e=(t=o.parse(t)).words;if(1398893684==e[0]&&1701076831==e[1]){var i=n.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return d.create({ciphertext:t,salt:i})}},e.SerializableCipher=i.extend({cfg:i.extend({format:c}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=t.createEncryptor(i,n);return e=r.finalize(e),r=r.cfg,d.create({ciphertext:e,key:i,iv:r.iv,algorithm:t,mode:r.mode,padding:r.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,i,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(i,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}})),f=(f.kdf={}).OpenSSL={execute:function(t,e,i,r){return r||(r=n.random(8)),t=a.create({keySize:e+i}).compute(t,r),i=n.create(t.words.slice(e),4*i),t.sigBytes=4*e,d.create({key:t,iv:i,salt:r})}},m=e.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:f}),encrypt:function(t,e,i,n){return i=(n=this.cfg.extend(n)).kdf.execute(i,t.keySize,t.ivSize),n.iv=i.iv,(t=p.encrypt.call(this,t,e,i.key,n)).mixIn(i),t},decrypt:function(t,e,i,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),i=n.kdf.execute(i,t.keySize,t.ivSize,e.salt),n.iv=i.iv,p.decrypt.call(this,t,e,i.key,n)}})}(),function(){for(var t=h,e=t.lib.BlockCipher,i=t.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=e.extend({_doReset:function(){for(var t=(i=this._key).words,e=i.sigBytes/4,i=4*((this._nRounds=e+6)+1),r=this._keySchedule=[],o=0;o<i;o++)if(o<e)r[o]=t[o];else{var a=r[o-1];o%e?6<e&&4==o%e&&(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/e|0]<<24),r[o]=r[o-e]^a}for(t=this._invKeySchedule=[],e=0;e<i;e++)o=i-e,a=e%4?r[o]:r[o-4],t[e]=4>e||4>=o?a:l[n[a>>>24]]^u[n[a>>>16&255]]^d[n[a>>>8&255]]^p[n[255&a]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,s,c,n)},decryptBlock:function(t,e){var i=t[e+1];t[e+1]=t[e+3],t[e+3]=i,this._doCryptBlock(t,e,this._invKeySchedule,l,u,d,p,r),i=t[e+1],t[e+1]=t[e+3],t[e+3]=i},_doCryptBlock:function(t,e,i,n,r,o,a,s){for(var c=this._nRounds,l=t[e]^i[0],h=t[e+1]^i[1],u=t[e+2]^i[2],d=t[e+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++],t[e]=m,t[e+1]=g,t[e+2]=v,t[e+3]=d},keySize:8});t.AES=e._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(t,e,i){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),i){var r;for(r in i)t.prototype[r]=i[r];var o=function(){},a=["toString","valueOf"];try{/MSIE/.test("undefined"!=typeof navigator?navigator.userAgent:"node")&&(o=function(t,e){for(r=0;r<a.length;r+=1){var i=a[r],n=e[i];"function"==typeof n&&n!=Object.prototype[i]&&(t[i]=n)}})}catch(t){}o(t.prototype,i)}}},"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(u.prototype.am=function(t,e,i,n,r,o){for(var a=32767&e,s=e>>15;--o>=0;){var c=32767&this[t],l=this[t++]>>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(t,e,i,n,r,o){for(;--o>=0;){var a=e*this[t++]+i[n]+r;r=Math.floor(a/67108864),i[n++]=67108863&a}return r},s=26):(u.prototype.am=function(t,e,i,n,r,o){for(var a=16383&e,s=e>>14;--o>=0;){var c=16383&this[t],l=this[t++]>>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(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function v(t,e){var i=m[t.charCodeAt(e)];return null==i?-1:i}function y(t){var e=d();return e.fromInt(t),e}function A(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function x(t){this.m=t}function b(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function w(t,e){return t&e}function M(t,e){return t|e}function E(t,e){return t^e}function S(t,e){return t&~e}function _(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function T(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function C(){}function I(t){return t}function P(t){this.r2=d(),this.q3=d(),u.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}x.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},x.prototype.revert=function(t){return t},x.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},x.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},x.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},b.prototype.convert=function(t){var e=d();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(u.ZERO)>0&&this.m.subTo(e,e),e},b.prototype.revert=function(t){var e=d();return t.copyTo(e),this.reduce(e),e},b.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],n=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},b.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},b.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},u.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},u.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},u.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var n=t.length,r=!1,o=0;--n>=0;){var a=8==i?255&t[n]:v(t,n);a<0?"-"==t.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&t[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 t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},u.prototype.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},u.prototype.drShiftTo=function(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s},u.prototype.lShiftTo=function(t,e){var i,n=t%this.DB,r=this.DB-n,o=(1<<r)-1,a=Math.floor(t/this.DB),s=this.s<<n&this.DM;for(i=this.t-1;i>=0;--i)e[i+a+1]=this[i]>>r|s,s=(this[i]&o)<<n;for(i=a-1;i>=0;--i)e[i]=0;e[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},u.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var n=t%this.DB,r=this.DB-n,o=(1<<n)-1;e[0]=this[i]>>n;for(var a=i+1;a<this.t;++a)e[a-i-1]|=(this[a]&o)<<r,e[a-i]=this[a]>>n;n>0&&(e[this.t-i-1]|=(this.s&o)<<r),e.t=this.t-i,e.clamp()}},u.prototype.subTo=function(t,e){for(var i=0,n=0,r=Math.min(t.t,this.t);i<r;)n+=this[i]-t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n-=t[i],e[i++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[i++]=this.DV+n:n>0&&(e[i++]=n),e.t=i,e.clamp()},u.prototype.multiplyTo=function(t,e){var i=this.abs(),n=t.abs(),r=i.t;for(e.t=r+n.t;--r>=0;)e[r]=0;for(r=0;r<n.t;++r)e[r+i.t]=i.am(0,n[r],e,r,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&u.ZERO.subTo(e,e)},u.prototype.squareTo=function(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var n=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,n,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},u.prototype.divRemTo=function(t,e,i){var n=t.abs();if(!(n.t<=0)){var r=this.abs();if(r.t<n.t)return null!=e&&e.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=d());var o=d(),a=this.s,s=t.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==e?d():e;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!=e&&(i.drShiftTo(l,e),a!=s&&u.ZERO.subTo(e,e)),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 t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},u.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},u.prototype.exp=function(t,e){if(t>4294967295||t<1)return u.ONE;var i=d(),n=d(),r=e.convert(this),o=A(t)-1;for(r.copyTo(i);--o>=0;)if(e.sqrTo(i,n),(t&1<<o)>0)e.mulTo(n,r,i);else{var a=i;i=n,n=a}return e.revert(i)},u.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,n=(1<<e)-1,r=!1,o="",a=this.t,s=this.DB-a*this.DB%e;if(a-- >0)for(s<this.DB&&(i=this[a]>>s)>0&&(r=!0,o=g(i));a>=0;)s<e?(i=(this[a]&(1<<s)-1)<<e-s,i|=this[--a]>>(s+=this.DB-e)):(i=this[a]>>(s-=e)&n,s<=0&&(s+=this.DB,--a)),i>0&&(r=!0),r&&(o+=g(i));return r?o:"0"},u.prototype.negate=function(){var t=d();return u.ZERO.subTo(this,t),t},u.prototype.abs=function(){return this.s<0?this.negate():this},u.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;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(t){var e=d();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(u.ZERO)>0&&t.subTo(e,e),e},u.prototype.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new x(e):new b(e),this.exp(t,i)},u.ZERO=y(0),u.ONE=y(1),C.prototype.convert=I,C.prototype.revert=I,C.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},C.prototype.sqrTo=function(t,e){t.squareTo(e)},P.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=d();return t.copyTo(e),this.reduce(e),e},P.prototype.revert=function(t){return t},P.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},P.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},P.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};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],B=(1<<26)/R[R.length-1];u.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},u.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),n=y(i),r=d(),o=d(),a="";for(this.divRemTo(n,r,o);r.signum()>0;)a=(i+o.intValue()).toString(t).substr(1)+a,r.divRemTo(n,r,o);return o.intValue().toString(t)+a},u.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),r=!1,o=0,a=0,s=0;s<t.length;++s){var c=v(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(r=!0):(a=e*a+c,++o>=i&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(a,0)),r&&u.ZERO.subTo(this,this)},u.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(u.ONE.shiftLeft(t-1),M,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(u.ONE.shiftLeft(t-1),this);else{var n=new Array,r=7&t;n.length=1+(t>>3),e.nextBytes(n),r>0?n[0]&=(1<<r)-1:n[0]=0,this.fromString(n,256)}},u.prototype.bitwiseTo=function(t,e,i){var n,r,o=Math.min(t.t,this.t);for(n=0;n<o;++n)i[n]=e(this[n],t[n]);if(t.t<this.t){for(r=t.s&this.DM,n=o;n<this.t;++n)i[n]=e(this[n],r);i.t=this.t}else{for(r=this.s&this.DM,n=o;n<t.t;++n)i[n]=e(r,t[n]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()},u.prototype.changeBit=function(t,e){var i=u.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},u.prototype.addTo=function(t,e){for(var i=0,n=0,r=Math.min(t.t,this.t);i<r;)n+=this[i]+t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n+=t[i],e[i++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[i++]=n:n<-1&&(e[i++]=this.DV+n),e.t=i,e.clamp()},u.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},u.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},u.prototype.multiplyLowerTo=function(t,e,i){var n,r=Math.min(this.t+t.t,e);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,t[r],i,r,0,this.t);for(n=Math.min(t.t,e);r<n;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()},u.prototype.multiplyUpperTo=function(t,e,i){--e;var n=i.t=this.t+t.t-e;for(i.s=0;--n>=0;)i[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)i[this.t+n-e]=this.am(e-n,t[n],i,0,0,this.t+n-e);i.clamp(),i.drShiftTo(1,i)},u.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var n=this.t-1;n>=0;--n)i=(e*i+this[n])%t;return i},u.prototype.millerRabin=function(t){var e=this.subtract(u.ONE),i=e.getLowestSetBit();if(i<=0)return!1;var n=e.shiftRight(i);(t=t+1>>1)>R.length&&(t=R.length);for(var r=d(),o=0;o<t;++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(e)){for(var s=1;s++<i&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(u.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},u.prototype.clone=
358
+ /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
359
+ function(){var t=d();return this.copyTo(t),t},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 t=this.t,e=new Array;e[0]=this.s;var i,n=this.DB-t*this.DB%8,r=0;if(t-- >0)for(n<this.DB&&(i=this[t]>>n)!=(this.s&this.DM)>>n&&(e[r++]=i|this.s<<this.DB-n);t>=0;)n<8?(i=(this[t]&(1<<n)-1)<<8-n,i|=this[--t]>>(n+=this.DB-8)):(i=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==r&&(128&this.s)!=(128&i)&&++r,(r>0||i!=this.s)&&(e[r++]=i);return e},u.prototype.equals=function(t){return 0==this.compareTo(t)},u.prototype.min=function(t){return this.compareTo(t)<0?this:t},u.prototype.max=function(t){return this.compareTo(t)>0?this:t},u.prototype.and=function(t){var e=d();return this.bitwiseTo(t,w,e),e},u.prototype.or=function(t){var e=d();return this.bitwiseTo(t,M,e),e},u.prototype.xor=function(t){var e=d();return this.bitwiseTo(t,E,e),e},u.prototype.andNot=function(t){var e=d();return this.bitwiseTo(t,S,e),e},u.prototype.not=function(){for(var t=d(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},u.prototype.shiftLeft=function(t){var e=d();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},u.prototype.shiftRight=function(t){var e=d();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},u.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+_(this[t]);return this.s<0?this.t*this.DB:-1},u.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=T(this[i]^e);return t},u.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},u.prototype.setBit=function(t){return this.changeBit(t,M)},u.prototype.clearBit=function(t){return this.changeBit(t,S)},u.prototype.flipBit=function(t){return this.changeBit(t,E)},u.prototype.add=function(t){var e=d();return this.addTo(t,e),e},u.prototype.subtract=function(t){var e=d();return this.subTo(t,e),e},u.prototype.multiply=function(t){var e=d();return this.multiplyTo(t,e),e},u.prototype.divide=function(t){var e=d();return this.divRemTo(t,e,null),e},u.prototype.remainder=function(t){var e=d();return this.divRemTo(t,null,e),e},u.prototype.divideAndRemainder=function(t){var e=d(),i=d();return this.divRemTo(t,e,i),new Array(e,i)},u.prototype.modPow=function(t,e){var i,n,r=t.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(e):e.isEven()?new P(e):new b(e);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=t.t-1,m=!0,g=d();for(r=A(t[f])-1;f>=0;){for(r>=c?u=t[f]>>r-c&l:(u=(t[f]&(1<<r+1)-1)<<c-r,f>0&&(u|=t[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==(t[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(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return u.ZERO;for(var i=t.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),e?(r.isEven()&&o.isEven()||(r.addTo(this,r),o.subTo(t,o)),r.rShiftTo(1,r)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?(a.isEven()&&s.isEven()||(a.addTo(this,a),s.subTo(t,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);i.compareTo(n)>=0?(i.subTo(n,i),e&&r.subTo(a,r),o.subTo(s,o)):(n.subTo(i,n),e&&a.subTo(r,a),s.subTo(o,s))}return 0!=n.compareTo(u.ONE)?u.ZERO:s.compareTo(t)>=0?s.subtract(t):s.signum()<0?(s.addTo(t,s),s.signum()<0?s.add(t):s):s},u.prototype.pow=function(t){return this.exp(t,new C)},u.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var n=e;e=i,i=n}var r=e.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)return e;for(r<o&&(o=r),o>0&&(e.rShiftTo(o,e),i.rShiftTo(o,i));e.signum()>0;)(r=e.getLowestSetBit())>0&&e.rShiftTo(r,e),(r=i.getLowestSetBit())>0&&i.rShiftTo(r,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i},u.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=R[R.length-1]){for(e=0;e<R.length;++e)if(i[0]==R[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<R.length;){for(var n=R[e],r=e+1;r<R.length&&n<B;)n*=R[r++];for(n=i.modInt(n);e<r;)if(n%R[e++]==0)return!1}return i.millerRabin(t)},u.prototype.square=function(){var t=d();return this.squareTo(t),t};
360
+ /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
361
+ var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function D(t){var e,i,n="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),n+=L.charAt(i>>6)+L.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),n+=L.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),n+=L.charAt(i>>2)+L.charAt((3&i)<<4));(3&n.length)>0;)n+="=";return n}function O(t){var e,i,n,r="",o=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(n=L.indexOf(t.charAt(e)))<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(t){var e,i,n;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[i],this.S[i]=n;this.i=0,this.j=0},N.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var k,F,V;
363
+ /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function z(){var t;t=(new Date).getTime(),F[V++]^=255&t,F[V++]^=t>>8&255,F[V++]^=t>>16&255,F[V++]^=t>>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(t,e){return new u(t,e)}function K(t,e,i){for(var n="",r=0;n.length<e;)n+=i(String.fromCharCode.apply(String,t.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(t,e,i){for(var n="",r=0;n.length<e;)n+=i(t+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])),r+=1;return n}function Z(t){for(var e="",i=0;i<t.length;i++){var n=t[i].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function J(t){return Z(function(t){for(var e=new Array,i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}(t))}function $(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),t=(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function tt(t){return t.length%2==1&&(t="0"+t),function(t){return(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}(D(t))}function et(t){return O($(t))}function it(t){return function(t){return t.replace(/%/g,"")}(function(t){for(var e=encodeURIComponent(t),i="",n=0;n<e.length;n++)"%"==e[n]?(i+=e.substr(n,3),n+=2):i=i+"%"+J(e[n]);return i}(t))}function nt(t){return decodeURIComponent(function(t){return t.replace(/(..)/g,"%$1")}(t))}function rt(t){for(var e="",i=0;i<t.length-1;i+=2)e+=String.fromCharCode(parseInt(t.substr(i,2),16));return e}function ot(t){for(var e="",i=0;i<t.length;i++)e+=("0"+t.charCodeAt(i).toString(16)).slice(-2);return e}function at(t){var e=function(t){return D(t)}(t).replace(/(.{64})/g,"$1\r\n");return e=e.replace(/\r\n$/,"")}function st(t,e){return"-----BEGIN "+e+"-----\r\n"+at(t)+"\r\n-----END "+e+"-----\r\n"}function ct(t,e){if(-1==t.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;return function(t){return O(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function lt(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?function(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var e=(t=t.toLowerCase()).match(/.{1,4}/g),i=0;i<8;i++)e[i]=e[i].replace(/^0+/,""),""==e[i]&&(e[i]="0");var n=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null===n)return t.slice(1,-1);var r="";for(i=0;i<n.length;i++)n[i].length>r.length&&(r=n[i]);return(t=t.replace(r,"::")).slice(1,-1)}(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function ht(t){return t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),i=parseInt(t.substr(2),16);if(0==e&i<128)return String.fromCharCode(i);if(e<8){var n=128|63&i;return nt((192|(7&e)<<3|(192&i)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&i)>>6;var r=128|63&i;return nt((224|(240&e)>>4).toString(16)+n.toString(16)+r.toString(16))})).join("")}function ut(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function dt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}W.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=Q()},X.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},X.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=q(t,16),this.e=parseInt(e,16)}},X.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)throw"Message too long for RSA";for(var i=new Array,n=t.length-1;n>=0&&e>0;){var r=t.charCodeAt(n--);r<128?i[--e]=r:r>127&&r<2048?(i[--e]=63&r|128,i[--e]=r>>6|192):(i[--e]=63&r|128,i[--e]=r>>6&63|128,i[--e]=r>>12|224)}i[--e]=0;for(var o=new W,a=new Array;e>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);i[--e]=a[0]}return i[--e]=2,i[--e]=0,new u(i)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var i=this.doPublic(e);if(null==i)return null;var n=i.toString(16);return 0==(1&n.length)?n:"0"+n},X.prototype.encryptOAEP=function(t,e,i){var n=function(t,e,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(t){return rt(o.hashHex(ot(t),a))}),t.length+2*n+2>e)throw"Message too long for RSA";var s,l="";for(s=0;s<e-t.length-2*n-2;s+=1)l+="\0";var h=i("")+l+""+t,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))}(t,this.n.bitLength()+7>>3,e,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(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},X.prototype.setPrivate=function(t,e,i){if(this.isPrivate=!0,"string"!=typeof t)this.n=t,this.e=e,this.d=i;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key";this.n=q(t,16),this.e=parseInt(e,16),this.d=q(i,16)}},X.prototype.setPrivateEx=function(t,e,i,n,r,o,a,s){if(this.isPrivate=!0,this.isPublic=!1,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=q(t,16),this.e=parseInt(e,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(t,e){var i=new W,n=t>>1;this.e=parseInt(e,16);for(var r=new u(e,16);;){for(;this.p=new u(t-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()==t)){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(t){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var e=q(t,16),i=this.doPrivate(e);return null==i?null:
366
+ /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
367
+ function(t,e){for(var i=t.toByteArray(),n=0;n<i.length&&0==i[n];)++n;if(i.length-n!=e-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(t,e,i){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=q(t,16),r=this.doPrivate(n);return null==r?null:function(t,e,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(t){return rt(o.hashHex(ot(t),a))}),t=t.toByteArray(),s=0;s<t.length;s+=1)t[s]&=255;for(;t.length<e;)t.unshift(0);if((t=String.fromCharCode.apply(String,t)).length<2*n+2)throw"Cipher too short";var s,l=t.substr(1,n),h=t.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),t.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,e,i)},void 0!==c.lang&&c.lang||(c.lang={}),c.lang.String=function(){},c.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},c.lang.String.isHex=function(t){return ut(t)},c.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},c.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=$(t),c.lang.String.isBase64(t))},c.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},c.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},c.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},c.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var pt=function(t,e,i){return null==i&&(i="0"),t.length>=e?t:new Array(e-t.length+1).join(i)+t};function ft(t,e){var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}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(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,i){var n=this.getDigestInfoHex(t,e),r=i/4;if(n.length+22>r)throw"key is too short for SigAlg: keylen="+i+","+e;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(t,e){return new c.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new c.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof X||t instanceof c.crypto.DSA||t instanceof c.crypto.ECDSA}},c.crypto.Util.md5=function(t){return new c.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},c.crypto.Util.ripemd160=function(t){return new c.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},c.crypto.Util.SECURERANDOMGEN=new W,c.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return c.crypto.Util.SECURERANDOMGEN.nextBytes(e),Z(e)},c.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new u(c.crypto.Util.getRandomHexOfNbytes(t),16)},c.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,i=new Array((t-e)/8+1);return c.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<e&255^255)&i[0],Z(i)},c.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new u(c.crypto.Util.getRandomHexOfNbits(t),16)},c.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var i=c.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(i))return i}},c.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var i=t.compareTo(e);if(1==i)throw"biMin is greater than biMax";if(0==i)return t;var n=e.subtract(t);return c.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t)},c.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=c.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=c.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=c.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=h.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(h.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){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(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=c.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},c.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},c.crypto.MessageDigest.getHashLength=function(t){var e=c.crypto.MessageDigest,i=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[i])throw"not supported algorithm: "+t;return e.HASHLENGTH[i]},c.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},c.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=c.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var i=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==e){try{var n=c.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=h.algo.HMAC.create(n,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=h.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(h.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){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(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=ot(t)),void(this.pass=h.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=it(t.utf8)),void 0!==t.rstr&&(e=ot(t.rstr)),void 0!==t.b64&&(e=O(t.b64)),void 0!==t.b64u&&(e=et(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=h.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=c.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},c.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var i="",n=e/4-t.length,r=0;r<n;r++)i+="0";return i+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new c.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var i=null;try{i=void 0===e?mt.getKey(t):mt.getKey(t,e)}catch(t){throw"init failed:"+t}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(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},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(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){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,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof X&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==c.crypto.ECDSA&&this.pubKey instanceof c.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==c.crypto.DSA&&this.pubKey instanceof c.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){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(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=c.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=mt.getKey(t.prvkeypem);this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},c.crypto.Cipher=function(t){},c.crypto.Cipher.encrypt=function(t,e,i){if(e instanceof X&&e.isPublic){var n=c.crypto.Cipher.getAlgByKeyAndName(e,i);if("RSA"===n)return e.encrypt(t);if("RSAOAEP"===n)return e.encryptOAEP(t,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return e.encryptOAEP(t,"sha"+r[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.encrypt: unsupported key or algorithm"},c.crypto.Cipher.decrypt=function(t,e,i){if(e instanceof X&&e.isPrivate){var n=c.crypto.Cipher.getAlgByKeyAndName(e,i);if("RSA"===n)return e.decrypt(t);if("RSAOAEP"===n)return e.decryptOAEP(t,"sha1");var r=n.match(/^RSAOAEP(\d+)$/);if(null!==r)return e.decryptOAEP(t,"sha"+r[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+i}throw"Cipher.decrypt: unsupported key or algorithm"},c.crypto.Cipher.getAlgByKeyAndName=function(t,e){if(t instanceof X){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(e))return e;if(null==e)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+e}throw"getAlgByKeyAndName: not supported algorithm name: "+e},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 mt=function(){var t=function(t,i,n){return e(h.AES,t,i,n)},e=function(t,e,i,n){var r=h.enc.Hex.parse(e),o=h.enc.Hex.parse(i),a=h.enc.Hex.parse(n),s={};s.key=o,s.iv=a,s.ciphertext=r;var c=t.decrypt(s,o,{iv:a});return h.enc.Hex.stringify(c)},i=function(t,e,i){return n(h.AES,t,e,i)},n=function(t,e,i,n){var r=h.enc.Hex.parse(e),o=h.enc.Hex.parse(i),a=h.enc.Hex.parse(n),s=t.encrypt(r,o,{iv:a}),c=h.enc.Hex.parse(s.toString());return h.enc.Base64.stringify(c)},r={"AES-256-CBC":{proc:t,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,i,n){return e(h.TripleDES,t,i,n)},eproc:function(t,e,i){return n(h.TripleDES,t,e,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,i,n){return e(h.DES,t,i,n)},eproc:function(t,e,i){return n(h.DES,t,e,i)},keylen:8,ivlen:8}},o=function(t){var e={},i=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));i&&(e.cipher=i[1],e.ivsalt=i[2]);var n=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(e.type=n[1]);var r=-1,o=0;-1!=t.indexOf("\r\n\r\n")&&(r=t.indexOf("\r\n\r\n"),o=2),-1!=t.indexOf("\n\n")&&(r=t.indexOf("\n\n"),o=1);var a=t.indexOf("-----END");if(-1!=r&&-1!=a){var s=t.substring(r+2*o,a-o);s=s.replace(/\s+/g,""),e.data=s}return e},a=function(t,e,i){for(var n=i.substring(0,16),o=h.enc.Hex.parse(n),a=h.enc.Utf8.parse(e),s=r[t].keylen+r[t].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[t].keylen),d.ivhex=c.substr(2*r[t].keylen,2*r[t].ivlen),d},s=function(t,e,i,n){var o=h.enc.Base64.parse(t),a=h.enc.Hex.stringify(o);return(0,r[e].proc)(a,i,n)};return{version:"1.0.0",parsePKCS5PEM:function(t){return o(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,i){return a(t,e,i)},decryptKeyB64:function(t,e,i,n){return s(t,e,i,n)},getDecryptedKeyHex:function(t,e){var i=o(t),n=i.cipher,r=i.ivsalt,c=i.data,l=a(n,e,r).keyhex;return s(c,n,l,r)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,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(t){var e=h.lib.WordArray.random(t);return h.enc.Hex.stringify(e)}(r[n].ivlen).toUpperCase());var c=function(t,e,i,n){return(0,r[e].eproc)(t,i,n)}(e,n,a(n,i,o).keyhex,o);s="-----BEGIN "+t+" 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 "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=gt,i=e.getChildIdx,n=e.getV,r={},o=i(t,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;r.ciphertext=n(t,o[1]);var a=i(t,o[0]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+a.length;if("2a864886f70d01050d"!=n(t,a[0]))throw"this only supports pkcs5PBES2";var s=i(t,a[1]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+s.length;var c=i(t,s[1]);if(2!=c.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length;if("2a864886f70d0307"!=n(t,c[0]))throw"this only supports TripleDES";r.encryptionSchemeAlg="TripleDES",r.encryptionSchemeIV=n(t,c[1]);var l=i(t,s[0]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length;if("2a864886f70d01050c"!=n(t,l[0]))throw"this only supports pkcs5PBKDF2";var h=i(t,l[1]);if(h.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length;r.pbkdf2Salt=n(t,h[0]);var u=n(t,h[1]);try{r.pbkdf2Iter=parseInt(u,16)}catch(t){throw"malformed format pbkdf2Iter: "+u}return r},getPBKDF2KeyHexFromParam:function(t,e){var i=h.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,r=h.PBKDF2(e,i,{keySize:6,iterations:n});return h.enc.Hex.stringify(r)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var i=ct(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(i),r=mt.getPBKDF2KeyHexFromParam(n,e),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(t,e){var i=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(i)},parsePlainPrivatePKCS8Hex:function(t){var e=gt,i=e.getChildIdx,n=e.getV,r={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=i(t,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=i(t,o[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(r.algoid=n(t,a[0]),"06"==t.substr(a[1],2)&&(r.algparam=n(t,a[1])),"04"!=t.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return r.keyidx=e.getVidx(t,o[2]),r},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=ct(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,i=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==i.algoid)e=new X;else if("2a8648ce380401"==i.algoid)e=new c.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw"unsupported private key algorithm";e=new c.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,i=gt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===i)e=new X;else if("2a8648ce380401"===i)e=new c.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw"unsupported PKCS#8 public key hex";e=new c.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=gt,i=e.getChildIdx,n=e.getV,r={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var o=i(t,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(o[0],2))throw"malformed RSA key(code:003)";if(r.n=n(t,o[0]),"02"!=t.substr(o[1],2))throw"malformed RSA key(code:004)";return r.e=n(t,o[1]),r},parsePublicPKCS8Hex:function(t){var e=gt,i=e.getChildIdx,n=e.getV,r={algparam:null},o=i(t,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var a=o[0];if("30"!=t.substr(a,2))throw"malformed PKCS8 public key(code:001)";var s=i(t,a);if(2!=s.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(s[0],2))throw"malformed PKCS8 public key(code:003)";if(r.algoid=n(t,s[0]),"06"==t.substr(s[1],2)?r.algparam=n(t,s[1]):"30"==t.substr(s[1],2)&&(r.algparam={},r.algparam.p=e.getVbyList(t,s[1],[0],"02"),r.algparam.q=e.getVbyList(t,s[1],[1],"02"),r.algparam.g=e.getVbyList(t,s[1],[2],"02")),"03"!=t.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return r.key=n(t,o[1]).substr(2),r}}}();mt.getKey=function(t,e,i){var n=(y=gt).getChildIdx;y.getV;var r=y.getVbyList,o=c.crypto,a=o.ECDSA,s=o.DSA,l=X,h=ct,d=mt;if(void 0!==l&&t instanceof l)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==s&&t instanceof s)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new a({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new a({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(I=new l).setPublic(t.n,t.e),I;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(I=new l).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),I;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(I=new l).setPrivate(t.n,t.e,t.d),I;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(I=new s).setPublic(t.p,t.q,t.g,t.y),I;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(I=new s).setPrivate(t.p,t.q,t.g,t.y,t.x),I;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(I=new l).setPublic(et(t.n),et(t.e)),I;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(I=new l).setPrivateEx(et(t.n),et(t.e),et(t.d),et(t.p),et(t.q),et(t.dp),et(t.dq),et(t.qi)),I;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(I=new l).setPrivate(et(t.n),et(t.e),et(t.d)),I;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var p=(C=new a({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+et(t.x)).slice(-p)+("0000000000"+et(t.y)).slice(-p);return C.setPublicKeyHex(f),C}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){p=(C=new a({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+et(t.x)).slice(-p)+("0000000000"+et(t.y)).slice(-p);var m=("0000000000"+et(t.d)).slice(-p);return C.setPublicKeyHex(f),C.setPrivateKeyHex(m),C}if("pkcs5prv"===i){var g,v=t,y=gt;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(t);if("pkcs8pub"===i)return d._getKeyFromPublicPKCS8Hex(t);if("x509pub"===i)return xt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return xt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var A=ct(t,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(A)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var x=h(t,"RSA PRIVATE KEY");return d.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var b=r(B=h(t,"DSA PRIVATE KEY"),0,[1],"02"),w=r(B,0,[2],"02"),M=r(B,0,[3],"02"),E=r(B,0,[4],"02"),S=r(B,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!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){x=h(t,"EC PRIVATE KEY");return d.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END PRIVATE KEY-"))return d.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var _=d.getDecryptedKeyHex(t,e),T=new X;return T.readPKCS5PrvKeyHex(_),T}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var C,I=r(B=d.getDecryptedKeyHex(t,e),0,[1],"04"),P=r(B,0,[2,0],"06"),R=r(B,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!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var B;b=r(B=d.getDecryptedKeyHex(t,e),0,[1],"02"),w=r(B,0,[2],"02"),M=r(B,0,[3],"02"),E=r(B,0,[4],"02"),S=r(B,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!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return d.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},mt.generateKeypair=function(t,e){if("RSA"==t){var i=e;(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"==t){var a,s,l=e,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: "+t},mt.getPEM=function(t,e,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(t){return d({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function A(t){return d({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function x(t){return d({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==v&&t instanceof v||void 0!==m&&t instanceof m||void 0!==g&&t instanceof g)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return st(E=new p(t).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==v&&t instanceof v&&(void 0===i||null==i)&&1==t.isPrivate)return st(E=y(t).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===i||null==i)&&1==t.isPrivate){var b=new l({name:t.curveName}).getEncodedHex(),w=A(t).getEncodedHex(),M="";return M+=st(b,"EC PARAMETERS"),M+=st(w,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==m&&t instanceof m&&(void 0===i||null==i)&&1==t.isPrivate)return st(E=x(t).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==v&&t instanceof v&&void 0!==i&&null!=i&&1==t.isPrivate){var E=y(t).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,i,n,o)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==i&&null!=i&&1==t.isPrivate){E=A(t).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,i,n,o)}if("PKCS5PRV"==e&&void 0!==m&&t instanceof m&&void 0!==i&&null!=i&&1==t.isPrivate){E=x(t).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,i,n,o)}var S=function(t,e){var i=_(t,e);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(t,e){var i=h.lib.WordArray.random(8),n=h.lib.WordArray.random(8),r=h.PBKDF2(e,i,{keySize:6,iterations:100}),o=h.enc.Hex.parse(t),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"==e&&null!=v&&t instanceof v&&1==t.isPrivate){var T=y(t).getEncodedHex();E=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:T}}]}).getEncodedHex();return void 0===i||null==i?st(E,"PRIVATE KEY"):st(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){T=new d({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}).getEncodedHex(),E=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:T}}]}).getEncodedHex();return void 0===i||null==i?st(E,"PRIVATE KEY"):st(w=S(E,i),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==m&&t instanceof m&&1==t.isPrivate){T=new u({bigint:t.x}).getEncodedHex(),E=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:T}}]}).getEncodedHex();return void 0===i||null==i?st(E,"PRIVATE KEY"):st(w=S(E,i),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},mt.getKeyFromCSRPEM=function(t){var e=ct(t,"CERTIFICATE REQUEST");return mt.getKeyFromCSRHex(e)},mt.getKeyFromCSRHex=function(t){var e=mt.parseCSRHex(t);return mt.getKey(e.p8pubkeyhex,null,"pkcs8pub")},mt.parseCSRHex=function(t){var e=gt,i=e.getChildIdx,n=e.getTLV,r={},o=t;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},mt.getKeyID=function(t){var e=mt,i=gt;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var n=ct(e.getPEM(t)),r=i.getIdxbyList(n,0,[1]),o=i.getV(n,r).substring(2);return c.crypto.Util.hashHex(o,"sha1")},mt.getJWKFromKey=function(t){var e={};if(t instanceof X&&t.isPrivate)return e.kty="RSA",e.n=tt(t.n.toString(16)),e.e=tt(t.e.toString(16)),e.d=tt(t.d.toString(16)),e.p=tt(t.p.toString(16)),e.q=tt(t.q.toString(16)),e.dp=tt(t.dmp1.toString(16)),e.dq=tt(t.dmq1.toString(16)),e.qi=tt(t.coeff.toString(16)),e;if(t instanceof X&&t.isPublic)return e.kty="RSA",e.n=tt(t.n.toString(16)),e.e=tt(t.e.toString(16)),e;if(t instanceof c.crypto.ECDSA&&t.isPrivate){if("P-256"!==(n=t.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;var i=t.getPublicKeyXYHex();return e.kty="EC",e.crv=n,e.x=tt(i.x),e.y=tt(i.y),e.d=tt(t.prvKeyHex),e}if(t instanceof c.crypto.ECDSA&&t.isPublic){var n;if("P-256"!==(n=t.getShortNISTPCurveName())&&"P-384"!==n)throw"unsupported curve name for JWT: "+n;i=t.getPublicKeyXYHex();return e.kty="EC",e.crv=n,e.x=tt(i.x),e.y=tt(i.y),e}throw"not supported key object"},void 0!==c.asn1&&c.asn1||(c.asn1={}),c.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var i=e.substr(1).length;i%2==1?i+=1:e.match(/^[0-7]/)||(i+=2);for(var n="",r=0;r<i;r++)n+="f";e=new u(n,16).xor(t).add(u.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return st(t,e)},this.newObject=function(t){var e=c.asn1,i=e.ASN1Object,n=e.DERBoolean,r=e.DERInteger,o=e.DERBitString,a=e.DEROctetString,s=e.DERNull,l=e.DERObjectIdentifier,h=e.DEREnumerated,u=e.DERUTF8String,d=e.DERNumericString,p=e.DERPrintableString,f=e.DERTeletexString,m=e.DERIA5String,g=e.DERUTCTime,v=e.DERGeneralizedTime,y=e.DERVisibleString,A=e.DERBMPString,x=e.DERSequence,b=e.DERSet,w=e.DERTaggedObject,M=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var E=Object.keys(t);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(t[S]);if("int"==S)return new r(t[S]);if("bitstr"==S)return new o(t[S]);if("octstr"==S)return new a(t[S]);if("null"==S)return new s(t[S]);if("oid"==S)return new l(t[S]);if("enum"==S)return new h(t[S]);if("utf8str"==S)return new u(t[S]);if("numstr"==S)return new d(t[S]);if("prnstr"==S)return new p(t[S]);if("telstr"==S)return new f(t[S]);if("ia5str"==S)return new m(t[S]);if("utctime"==S)return new g(t[S]);if("gentime"==S)return new v(t[S]);if("visstr"==S)return new y(t[S]);if("bmpstr"==S)return new A(t[S]);if("asn1"==S)return new i(t[S]);if("seq"==S){for(var _=t[S],T=[],C=0;C<_.length;C++){var I=M(_[C]);T.push(I)}return new x({array:T})}if("set"==S){for(_=t[S],T=[],C=0;C<_.length;C++){I=M(_[C]);T.push(I)}return new b({array:T})}if("tag"==S){var P=t[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(t){return this.newObject(t).getEncodedHex()}},c.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",i=parseInt(t.substr(0,2),16),n=(e=Math.floor(i/40)+"."+i%40,""),r=2;r<t.length;r+=2){var o=("00000000"+parseInt(t.substr(r,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),"0"==o.substr(0,1))e=e+"."+new u(n,2).toString(10),n=""}return e},c.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},i=function(t){var i="",n=new u(t,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+=e(parseInt(s,2))}return i};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",r=t.split("."),o=40*parseInt(r[0])+parseInt(r[1]);n+=e(o),r.splice(0,2);for(var a=0;a<r.length;a++)n+=i(r[a]);return n},c.asn1.ASN1Object=function(t){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 t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var i=e.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},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(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},c.asn1.DERAbstractString=function(t){c.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=it(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},l.lang.extend(c.asn1.DERAbstractString,c.asn1.ASN1Object),c.asn1.DERAbstractTime=function(t){c.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,i){var n=this.zeroPadding,r=this.localDateToUTC(t),o=String(r.getFullYear());"utc"==e&&(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(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=J(t)},this.setByDateValue=function(t,e,i,n,r,o){var a=new Date(Date.UTC(t,e-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(t){c.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},l.lang.extend(c.asn1.DERAbstractStructured,c.asn1.ASN1Object),c.asn1.DERBoolean=function(t){c.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},l.lang.extend(c.asn1.DERBoolean,c.asn1.ASN1Object),c.asn1.DERInteger=function(t){c.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new u(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},l.lang.extend(c.asn1.DERInteger,c.asn1.ASN1Object),c.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=c.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}c.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var i="0"+t;this.hTLV=null,this.isModified=!0,this.hV=i+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var i=0;i<=e;i++)t+="0";var n="";for(i=0;i<t.length-1;i+=8){var r=t.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"+e+n},this.setByBooleanArray=function(t){for(var e="",i=0;i<t.length;i++)1==t[i]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},l.lang.extend(c.asn1.DERBitString,c.asn1.ASN1Object),c.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=c.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}c.asn1.DEROctetString.superclass.constructor.call(this,t),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(t){c.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},i=function(t){var i="",n=parseInt(t,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+=e(parseInt(s,2))}return i};try{if(!t.match(/^[0-9.]+$/))return null;var n="",r=t.split("."),o=40*parseInt(r[0],10)+parseInt(r[1],10);n+=e(o),r.splice(0,2);for(var a=0;a<r.length;a++)n+=i(r[a]);return n}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=c.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},l.lang.extend(c.asn1.DERObjectIdentifier,c.asn1.ASN1Object),c.asn1.DEREnumerated=function(t){c.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=c.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new u(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},l.lang.extend(c.asn1.DEREnumerated,c.asn1.ASN1Object),c.asn1.DERUTF8String=function(t){c.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},l.lang.extend(c.asn1.DERUTF8String,c.asn1.DERAbstractString),c.asn1.DERNumericString=function(t){c.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},l.lang.extend(c.asn1.DERNumericString,c.asn1.DERAbstractString),c.asn1.DERPrintableString=function(t){c.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},l.lang.extend(c.asn1.DERPrintableString,c.asn1.DERAbstractString),c.asn1.DERTeletexString=function(t){c.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},l.lang.extend(c.asn1.DERTeletexString,c.asn1.DERAbstractString),c.asn1.DERIA5String=function(t){c.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},l.lang.extend(c.asn1.DERIA5String,c.asn1.DERAbstractString),c.asn1.DERVisibleString=function(t){c.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},l.lang.extend(c.asn1.DERVisibleString,c.asn1.DERAbstractString),c.asn1.DERBMPString=function(t){c.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},l.lang.extend(c.asn1.DERBMPString,c.asn1.DERAbstractString),c.asn1.DERUTCTime=function(t){c.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,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!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},l.lang.extend(c.asn1.DERUTCTime,c.asn1.DERAbstractTime),c.asn1.DERGeneralizedTime=function(t){c.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,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!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},l.lang.extend(c.asn1.DERGeneralizedTime,c.asn1.DERAbstractTime),c.asn1.DERSequence=function(t){c.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].getEncodedHex()}return this.hV=t,this.hV}},l.lang.extend(c.asn1.DERSequence,c.asn1.DERAbstractStructured),c.asn1.DERSet=function(t){c.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t.push(i.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},l.lang.extend(c.asn1.DERSet,c.asn1.DERAbstractStructured),c.asn1.DERTaggedObject=function(t){c.asn1.DERTaggedObject.superclass.constructor.call(this);var e=c.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,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(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){null!=t.tag&&(this.hT=t.tag),null!=t.explicit&&(this.isExplicit=t.explicit),null!=t.tage&&(this.hT=t.tage,this.isExplicit=!0),null!=t.tagi&&(this.hT=t.tagi,this.isExplicit=!1),null!=t.obj&&(t.obj instanceof e.ASN1Object?(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof t.obj&&(this.asn1Object=e.ASN1Util.newObject(t.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=t&&this.setByParam(t)},l.lang.extend(c.asn1.DERTaggedObject,c.asn1.ASN1Object);var gt=new function(){};function vt(t,e){for(var i="",n=e/4-t.length,r=0;r<n;r++)i+="0";return i+t}function yt(t,e,i){for(var n="",r=0;n.length<e;)n+=rt(i(ot(t+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])))),r+=1;return n}function At(t){for(var e in c.crypto.Util.DIGESTINFOHEAD){var i=c.crypto.Util.DIGESTINFOHEAD[e],n=i.length;if(t.substring(0,n)==i)return[e,t.substring(n)]}return[]}function xt(t){var e,i=gt,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=ct;try{e=c.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}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 t=l(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=l(t,0,[0]),i=f(e,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 t=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var i in e)if(t===e[i])return i;return m(s(t,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 t=a(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=a(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},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 t=this.getPublicKeyIdx();return u(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return mt.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),n=l(this.hex,0,[0],"30"),r=new c.crypto.Signature({alg:e});return r.init(t),r.updateHex(n),r.verify(i)},this.parseExt=function(t){var e,o,s;if(void 0===t){if(s=this.hex,3!==this.version)return-1;e=u(s,0,[0,7,0],"30"),o=n(s,e)}else{s=ct(t);var c=u(s,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=r(s,c))return void(this.aExtInfo=new Array);e=u(s,0,[0,3,0,1,0],"30"),o=n(s,e),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(t){var e=this.aExtInfo,i=t;if(t.match(/^[0-9.]+$/)||(i=c.asn1.x509.OID.name2oid(t)),""!==i)for(var n=0;n<e.length;n++)if(e[n].oid===i)return e[n]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("basicConstraints");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var n={extname:"basicConstraints"};if(e&&(n.critical=!0),"3000"===t)return n;if("30030101ff"===t)return n.cA=!0,n;if("30060101ff02"===t.substr(0,12)){var a=r(t,10),s=parseInt(a,16);return n.cA=!0,n.pathLen=s,n}throw new Error("hExtV parse error: "+t)},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("keyUsage");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var i="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(i=i.slice(-8)),10==t.length&&(i=i.slice(-16)),""==(i=i.replace(/0+$/,""))&&(i="0"),i},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),i=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&i.push(xt.KEYUSAGE_NAME[n]);return i.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("subjectKeyIdentifier");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var n={extname:"subjectKeyIdentifier"};e&&(n.critical=!0);var a=r(t,0);return n.kid={hex:a},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var a={extname:"authorityKeyIdentifier"};e&&(a.critical=!0);for(var s=n(t,0),c=0;c<s.length;c++){var l=t.substr(s[c],2);if("80"===l&&(a.kid={hex:r(t,s[c])}),"a1"===l){var h=o(t,s[c]),u=this.getGeneralNames(h);a.issuer=u[0].dn}"82"===l&&(a.sn={hex:r(t,s[c])})}return a},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var a={extname:"extKeyUsage",array:[]};e&&(a.critical=!0);for(var s=n(t,0),c=0;c<s.length;c++)a.array.push(m(r(t,s[c])));return a},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,i=o(this.hex,t.vidx);if(""===i)return e;for(var a=n(i,0),s=0;s<a.length;s++)e.push(m(r(i,a[s])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("subjectAltName");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("issuerAltName");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),i=[],r=0;r<e.length;r++){var a=this.getGeneralName(o(t,e[r]));void 0!==a&&i.push(a)}return i},this.getGeneralName=function(t){var e=t.substr(0,2),i=r(t,0),n=rt(i);return"81"==e?{rfc822:n}:"82"==e?{dns:n}:"86"==e?{uri:n}:"87"==e?{ip:lt(i)}:"a4"==e?{dn:this.getX500Name(i)}:void 0},this.getExtSubjectAltName2=function(){var t,e,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),t=r(c,l[h]),"81"===i&&(e=nt(t),s.push(["MAIL",e])),"82"===i&&(e=nt(t),s.push(["DNS",e])),"84"===i&&(e=xt.hex2dn(t,0),s.push(["DN",e])),"86"===i&&(e=nt(t),s.push(["URI",e])),"87"===i&&(e=lt(t),s.push(["IP",e]));return s},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("cRLDistributionPoints");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var r={extname:"cRLDistributionPoints",array:[]};e&&(r.critical=!0);for(var a=n(t,0),s=0;s<a.length;s++){var c=o(t,a[s]);r.array.push(this.getDistributionPoint(c))}return r},this.getDistributionPoint=function(t){for(var e={},i=n(t,0),r=0;r<i.length;r++){var a=t.substr(i[r],2),s=o(t,i[r]);"a0"==a&&(e.dpname=this.getDistributionPointName(s))}return e},this.getDistributionPointName=function(t){for(var e={},i=n(t,0),r=0;r<i.length;r++){var a=t.substr(i[r],2),s=o(t,i[r]);"a0"==a&&(e.full=this.getGeneralNames(s))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo("cRLDistributionPoints");if(void 0===t)return t;for(var e=new Array,i=n(this.hex,t.vidx),r=0;r<i.length;r++)try{var o=nt(a(this.hex,i[r],[0,0,0],"86"));e.push(o)}catch(t){}return e},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},i=n(this.hex,t.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&&e.ocsp.push(nt(s)),"2b06010505073002"===o&&e.caissuer.push(nt(s))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("authorityInfoAccess");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var r={extname:"authorityInfoAccess",array:[]};e&&(r.critical=!0);for(var c=n(t,0),l=0;l<c.length;l++){var h=s(t,c[l],[0],"06"),u=nt(a(t,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(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("certificatePolicies");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var r={extname:"certificatePolicies",array:[]};e&&(r.critical=!0);for(var a=n(t,0),s=0;s<a.length;s++){var c=o(t,a[s]),l=this.getPolicyInformation(c);r.array.push(l)}return r},this.getPolicyInformation=function(t){var e={},i=a(t,0,[0],"06");e.policyoid=m(i);var r=d(t,0,[1],"30");if(-1!=r){e.array=[];for(var s=n(t,r),c=0;c<s.length;c++){var l=o(t,s[c]),h=this.getPolicyQualifierInfo(l);e.array.push(h)}}return e},this.getPolicyQualifierInfo=function(t){var e={},i=a(t,0,[0],"06");if("2b06010505070201"===i){var n=s(t,0,[1],"16");e.cps=rt(n)}else if("2b06010505070202"===i){var r=l(t,0,[1],"30");e.unotice=this.getUserNotice(r)}return e},this.getUserNotice=function(t){for(var e={},i=n(t,0),r=0;r<i.length;r++){var a=o(t,i[r]);"30"!=a.substr(0,2)&&(e.exptext=this.getDisplayText(a))}return e},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=rt(r(t,0)),e},this.getExtCRLNumber=function(t,e){var i={extname:"cRLNumber"};if(e&&(i.critical=!0),"02"==t.substr(0,2))return i.num={hex:r(t,0)},i;throw new Error("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var i={extname:"cRLReason"};if(e&&(i.critical=!0),"0a"==t.substr(0,2))return i.code=parseInt(r(t,0),16),i;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var i={extname:"ocspNonce"};e&&(i.critical=!0);var n=r(t,0);return i.hex=n,i},this.getExtOcspNoCheck=function(t,e){var i={extname:"ocspNoCheck"};return e&&(i.critical=!0),i},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("adobeTimeStamp");if(void 0===i)return;t=o(this.hex,i.vidx),e=i.critical}var r={extname:"adobeTimeStamp"};e&&(r.critical=!0);var a=n(t,0);if(a.length>1){var s=o(t,a[1]),c=this.getGeneralName(s);null!=c.uri&&(r.uri=c.uri)}if(a.length>2){var l=o(t,a[2]);"0101ff"==l&&(r.reqauth=!0),"010100"==l&&(r.reqauth=!1)}return r},this.getX500NameRule=function(t){for(var e=null,i=[],n=0;n<t.length;n++)for(var r=t[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==e)e=s;else if(e!==s)return"mixed"}return null==e?"prn":e},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.getX500NameArray=function(t){for(var e=[],i=n(t,0),r=0;r<i.length;r++)e.push(this.getRDN(o(t,i[r])));return e},this.getRDN=function(t){for(var e=[],i=n(t,0),r=0;r<i.length;r++)e.push(this.getAttrTypeAndValue(o(t,i[r])));return e},this.getAttrTypeAndValue=function(t){var e={type:null,value:null,ds:null},i=n(t,0),r=a(t,i[0],[],"06"),o=a(t,i[1],[]),s=c.asn1.ASN1Util.oidHexToInt(r);return e.type=c.asn1.x509.OID.oid2atype(s),e.ds=this.HEX2STAG[t.substr(i[1],2)],"bmp"!=e.ds?e.value=nt(o):e.value=ht(o),e},this.readCertPEM=function(t){this.readCertHex(v(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{u(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(){var t={};return t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(),t.sbjpubkey=st(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=d(this.hex,0,[0,"[3]"])&&(t=h(this.hex,0,[0,"[3]",0],"30")));for(var e=[],i=n(t,0),r=0;r<i.length;r++){var a=o(t,i[r]),s=this.getExtParam(a);null!=s&&e.push(s)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var i=g(a(t,0,[0],"06")),r=!1;3==e&&"0101ff"==l(t,0,[1])&&(r=!0);var o=l(t,0,[e-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(t,e){for(var i=0;i<t.length;i++)if(t[i].extname==e)return t[i];return null},this.updateExtCDPFullURI=function(t,e){var i=this.findExt(t,"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=e)}},this.updateExtAIAOCSP=function(t,e){var i=this.findExt(t,"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=e)},this.updateExtAIACAIssuer=function(t,e){var i=this.findExt(t,"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=e)},this.dnarraytostr=function(t){return"/"+t.map((function(t){return function(t){return t.map((function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")})).join("+")}(t).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var t,e,i,n,r=function(t){for(var e="",i=t.array,n=0;n<i.length;n++){var r=i[n];if(e+=" 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&&(e+=" cps: "+a.cps+"\n")}}return e},o=function(t){for(var e="",i=t.array,n=0;n<i.length;n++){var r=i[n];try{void 0!==r.dpname.full[0].uri&&(e+=" "+r.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==r.dname.full[0].dn.hex&&(e+=" "+xt.hex2dn(r.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},a=function(t){for(var e="",i=t.array,n=0;n<i.length;n++){var r=i[n];void 0!==r.caissuer&&(e+=" caissuer: "+r.caissuer+"\n"),void 0!==r.ocsp&&(e+=" ocsp: "+r.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+dt(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+dt(e.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){t+="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"),t+=" "+h+" "+u+":\n","basicConstraints"===h){var d=this.getExtBasicConstraints();void 0===d.cA?t+=" {}\n":(t+=" cA=true",void 0!==d.pathLen&&(t+=", pathLen="+d.pathLen),t+="\n")}else if("keyUsage"===h)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===h)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===h){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(t+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"===h)t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===h)t+=" "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===h)t+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===h)t+=a(this.getExtAuthorityInfoAccess());else"certificatePolicies"===h&&(t+=r(this.getExtCertificatePolicies()))}}}return t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",t+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):c.lang.String.isHex(t)&&this.readCertHex(t))}function bt(t){return h.SHA256(t).toString()}gt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var i=parseInt(t.substr(e+3,1));return 0==i?-1:0<i&&i<10?i+1:-2},gt.getL=function(t,e){var i=gt.getLblen(t,e);return i<1?"":t.substr(e+2,2*i)},gt.getVblen=function(t,e){var i;return""==(i=gt.getL(t,e))?-1:("8"===i.substr(0,1)?new u(i.substr(2),16):new u(i,16)).intValue()},gt.getVidx=function(t,e){var i=gt.getLblen(t,e);return i<0?i:e+2*(i+1)},gt.getV=function(t,e){var i=gt.getVidx(t,e),n=gt.getVblen(t,e);return t.substr(i,2*n)},gt.getTLV=function(t,e){return t.substr(e,2)+gt.getL(t,e)+gt.getV(t,e)},gt.getTLVblen=function(t,e){return 2+2*gt.getLblen(t,e)+2*gt.getVblen(t,e)},gt.getNextSiblingIdx=function(t,e){return gt.getVidx(t,e)+2*gt.getVblen(t,e)},gt.getChildIdx=function(t,e){var i,n,r,o=gt,a=[];i=o.getVidx(t,e),n=2*o.getVblen(t,e),"03"==t.substr(e,2)&&(i+=2,n-=2),r=0;for(var s=i;r<=n;){var c=o.getTLVblen(t,s);if((r+=c)<=n&&a.push(s),s+=c,r>=n)break}return a},gt.getNthChildIdx=function(t,e,i){return gt.getChildIdx(t,e)[i]},gt.getIdxbyList=function(t,e,i,n){var r,o,a=gt;return 0==i.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(r=i.shift())>=(o=a.getChildIdx(t,e)).length?-1:a.getIdxbyList(t,o[r],i,n)},gt.getIdxbyListEx=function(t,e,i,n){var r,o,a=gt;if(0==i.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;r=i.shift(),o=a.getChildIdx(t,e);for(var s=0,c=0;c<o.length;c++){var l=t.substr(o[c],2);if("number"==typeof r&&!a.isContextTag(l)&&s==r||"string"==typeof r&&a.isContextTag(l,r))return a.getIdxbyListEx(t,o[c],i,n);a.isContextTag(l)||s++}return-1},gt.getTLVbyList=function(t,e,i,n){var r=gt,o=r.getIdxbyList(t,e,i,n);return-1==o||o>=t.length?null:r.getTLV(t,o)},gt.getTLVbyListEx=function(t,e,i,n){var r=gt,o=r.getIdxbyListEx(t,e,i,n);return-1==o?null:r.getTLV(t,o)},gt.getVbyList=function(t,e,i,n,r){var o,a,s=gt;return-1==(o=s.getIdxbyList(t,e,i,n))||o>=t.length?null:(a=s.getV(t,o),!0===r&&(a=a.substr(2)),a)},gt.getVbyListEx=function(t,e,i,n,r){var o,a,s=gt;return-1==(o=s.getIdxbyListEx(t,e,i,n))?null:(a=s.getV(t,o),"03"==t.substr(o,2)&&!1!==r&&(a=a.substr(2)),a)},gt.getInt=function(t,e,i){null==i&&(i=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return i;var r=gt.getV(t,e);return"02"==n?parseInt(r,16):function(t){try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var i=parseInt(e,16),n=t.substr(2),r=parseInt(n,16).toString(2);return"0"==r&&(r="00000000"),r=r.slice(0,0-i),parseInt(r,2)}catch(t){return-1}}(r)}catch(t){return i}},gt.getOID=function(t,e,i){null==i&&(i=null);try{return"06"!=t.substr(e,2)?i:function(t){if(!ut(t))return null;try{var e=[],i=t.substr(0,2),n=parseInt(i,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var r=t.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+=pt((127&o[a]).toString(2),7):(c+=pt((127&o[a]).toString(2),7),s.push(new String(parseInt(c,2))),c="");var l=e.join(".");return s.length>0&&(l=l+"."+s.join(".")),l}catch(t){return null}}(gt.getV(t,e))}catch(t){return i}},gt.getOIDName=function(t,e,i){null==i&&(i=null);try{var n=gt.getOID(t,e,i);if(n==i)return i;var r=c.asn1.x509.OID.oid2name(n);return""==r?n:r}catch(t){return i}},gt.getString=function(t,e,i){null==i&&(i=null);try{return rt(gt.getV(t,e))}catch(t){return i}},gt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},i=[],n=t.substr(0,2),r=parseInt(n,16);i[0]=new String(Math.floor(r/40)),i[1]=new String(r%40);for(var o=t.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+=e((127&a[s]).toString(2),7):(l+=e((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},gt.dump=function(t,e,i,n){var r=gt,o=r.getV,a=r.dump,s=r.getChildIdx,l=t;t instanceof c.asn1.ASN1Object&&(l=t.getEncodedHex());var h=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===i&&(i=0),void 0===n&&(n="");var u,d=e.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),e,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,e,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 '"+nt(o(l,i))+"'\n";if("13"==u)return n+"PrintableString '"+nt(o(l,i))+"'\n";if("14"==u)return n+"TeletexString '"+nt(o(l,i))+"'\n";if("16"==u)return n+"IA5String '"+nt(o(l,i))+"'\n";if("17"==u)return n+"UTCTime "+nt(o(l,i))+"\n";if("18"==u)return n+"GeneralizedTime "+nt(o(l,i))+"\n";if("1a"==u)return n+"VisualString '"+nt(o(l,i))+"'\n";if("1e"==u)return n+"BMPString '"+ht(o(l,i))+"'\n";if("30"==u){if("3000"==l.substr(i,4))return n+"SEQUENCE {}\n";f=n+"SEQUENCE\n";var A=e;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(e));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,e,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,e,w[b],n+" ");return f}p=o(l,i);if(gt.isASN1HEX(p)){var f=n+"["+M+"]\n";return f+=a(p,e,0,n+" ")}return("68747470"==p.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==M)&&(p=nt(p)),f=n+"["+M+"] "+p+"\n"}return n+"UNKNOWN("+u+") "+o(l,i)+"\n"},gt.isContextTag=function(t,e){var i,n;t=t.toLowerCase();try{i=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&i);try{return null!=e.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(e.substr(1,e.length-1),10))>31)&&(128==(192&i)&&(31&i)==n))}catch(t){return!1}},gt.isASN1HEX=function(t){var e=gt;if(t.length%2==1)return!1;var i=e.getVblen(t,0),n=t.substr(0,2),r=e.getL(t,0);return t.length-n.length-r.length==2*i},gt.checkStrictDER=function(t,e,i,n,r){var o=gt;if(void 0===i){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!c.lang.String.isHex(t))throw new Error("not hex string");i=t.length,r=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(t,e).length>2*r)throw new Error("L of TLV too long: idx="+e);var a=o.getVblen(t,e);if(a>n)throw new Error("value of L too long than hex: idx="+e);var s=o.getTLV(t,e),l=s.length-2-o.getL(t,e).length;if(l!==2*a)throw new Error("V string length and L's value not the same:"+l+"/"+2*a);if(0===e&&t.length!=s.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+s.length);var h=t.substr(e,2);if("02"===h){var u=o.getVidx(t,e);if("00"==t.substr(u,2)&&t.charCodeAt(u+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(h,16)){for(var d=o.getVblen(t,e),p=0,f=o.getChildIdx(t,e),m=0;m<f.length;m++){p+=o.getTLV(t,f[m]).length,o.checkStrictDER(t,f[m],i,n,r)}if(2*d!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*d+"!="+p)}},gt.oidname=function(t){var e=c.asn1;c.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var i=e.x509.OID.oid2name(t);return""===i&&(i=t),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(t){c.asn1.x509.Certificate.superclass.constructor.call(this);var e=c.asn1,i=e.DERBitString,n=e.DERSequence,r=e.x509,o=r.TBSCertificate,a=r.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.sigalg;null!=t.sigalg.name&&(e=t.sigalg.name);var i=t.tbsobj.getEncodedHex(),n=new c.crypto.Signature({alg:e});n.init(t.cakey),n.updateHex(i),t.sighex=n.sign()},this.getPEM=function(){return st(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var t=this.params;if(null!=t.tbsobj&&null!=t.tbsobj||(t.tbsobj=new o(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new a({name:t.sigalg})),e.push(new i({hex:"00"+t.sighex})),new n({array:e}).getEncodedHex()},null!=t&&(this.params=t)},ft(c.asn1.x509.Certificate,c.asn1.ASN1Object),c.asn1.x509.TBSCertificate=function(t){c.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=c.asn1,i=e.x509,n=e.DERTaggedObject,r=e.DERInteger,o=e.DERSequence,a=i.AlgorithmIdentifier,s=i.Time,l=i.X500Name,h=i.Extensions,u=i.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(t){this.params=t},this.getEncodedHex=function(){var t=[],e=this.params;if(null!=e.version||1!=e.version){var i=2;null!=e.version&&(i=e.version-1);var d=new n({obj:new r({int:i})});t.push(d)}return t.push(new r(e.serial)),t.push(new a({name:e.sigalg})),t.push(new l(e.issuer)),t.push(new o({array:[new s(e.notbefore),new s(e.notafter)]})),t.push(new l(e.subject)),t.push(new u(mt.getKey(e.sbjpubkey))),void 0!==e.ext&&e.ext.length>0&&t.push(new n({tag:"a3",obj:new h(e.ext)})),new c.asn1.DERSequence({array:t}).getEncodedHex()},void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.TBSCertificate,c.asn1.ASN1Object),c.asn1.x509.Extensions=function(t){c.asn1.x509.Extensions.superclass.constructor.call(this);var e=c.asn1,i=e.DERSequence,n=e.x509;this.aParam=[],this.setByParam=function(t){this.aParam=t},this.getEncodedHex=function(){for(var t=[],e=0;e<this.aParam.length;e++){var r=this.aParam[e],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&&t.push(a)}return new i({array:t}).getEncodedHex()},null!=t&&this.setByParam(t)},ft(c.asn1.x509.Extensions,c.asn1.ASN1Object),c.asn1.x509.Extension=function(t){c.asn1.x509.Extension.superclass.constructor.call(this);var e=c.asn1,i=e.DERObjectIdentifier,n=e.DEROctetString;e.DERBitString;var r=e.DERBoolean,o=e.DERSequence;this.getEncodedHex=function(){var t=new i({oid:this.oid}),e=new n({hex:this.getExtnValueHex()}),a=new Array;return a.push(t),this.critical&&a.push(new r),a.push(e),new o({array:a}).getEncodedHex()},this.critical=!1,void 0!==t&&void 0!==t.critical&&(this.critical=t.critical)},ft(c.asn1.x509.Extension,c.asn1.ASN1Object),c.asn1.x509.KeyUsage=function(t){c.asn1.x509.KeyUsage.superclass.constructor.call(this,t);var e=xt.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==t&&(void 0!==t.bin&&(this.asn1ExtnValue=new c.asn1.DERBitString(t)),void 0!==t.names&&void 0!==t.names.length)){for(var i=t.names,n="000000000",r=0;r<i.length;r++)for(var o=0;o<e.length;o++)i[r]===e[o]&&(n=n.substring(0,o)+"1"+n.substring(o+1,n.length));this.asn1ExtnValue=new c.asn1.DERBitString({bin:n})}},ft(c.asn1.x509.KeyUsage,c.asn1.x509.Extension),c.asn1.x509.BasicConstraints=function(t){c.asn1.x509.BasicConstraints.superclass.constructor.call(this,t);var e=c.asn1,i=e.DERBoolean,n=e.DERInteger,r=e.DERSequence;this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new i),this.pathLen>-1&&t.push(new n({int:this.pathLen}));var e=new r({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==t&&(void 0!==t.cA&&(this.cA=t.cA),void 0!==t.pathLen&&(this.pathLen=t.pathLen))},ft(c.asn1.x509.BasicConstraints,c.asn1.x509.Extension),c.asn1.x509.CRLDistributionPoints=function(t){c.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=c.asn1,i=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(t){for(var n=[],r=0;r<t.length;r++)if(t[r]instanceof c.asn1.ASN1Object)n.push(t[r]);else{var o=new i.DistributionPoint(t[r]);n.push(o)}this.asn1ExtnValue=new e.DERSequence({array:n})},this.setByOneURI=function(t){var e=new i.DistributionPoint({fulluri:t});this.setByDPArray([e])},this.oid="2.5.29.31",void 0!==t&&(void 0!==t.array?this.setByDPArray(t.array):void 0!==t.uri&&this.setByOneURI(t.uri))},ft(c.asn1.x509.CRLDistributionPoints,c.asn1.x509.Extension),c.asn1.x509.DistributionPoint=function(t){c.asn1.x509.DistributionPoint.superclass.constructor.call(this);var e=c.asn1,i=e.x509.DistributionPointName;this.getEncodedHex=function(){var t=new e.DERSequence;if(null!=this.asn1DP){var i=new e.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});t.appendASN1Object(i)}return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==t&&(void 0!==t.dpobj?this.asn1DP=t.dpobj:void 0!==t.dpname?this.asn1DP=new i(t.dpname):void 0!==t.fulluri&&(this.asn1DP=new i({full:[{uri:t.fulluri}]})))},ft(c.asn1.x509.DistributionPoint,c.asn1.ASN1Object),c.asn1.x509.DistributionPointName=function(t){c.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=c.asn1,i=e.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!==t)if(e.x509.GeneralNames.prototype.isPrototypeOf(t))this.type="full",this.tag="a0",this.asn1V=t;else{if(void 0===t.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new e.x509.GeneralNames(t.full)}},ft(c.asn1.x509.DistributionPointName,c.asn1.ASN1Object),c.asn1.x509.CertificatePolicies=function(t){c.asn1.x509.CertificatePolicies.superclass.constructor.call(this,t);var e=c.asn1,i=e.x509,n=e.DERSequence,r=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++)t.push(new r(this.params.array[e]));var i=new n({array:t});return this.asn1ExtnValue=i,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==t&&(this.params=t)},ft(c.asn1.x509.CertificatePolicies,c.asn1.x509.Extension),c.asn1.x509.PolicyInformation=function(t){c.asn1.x509.PolicyInformation.superclass.constructor.call(this,t);var e=c.asn1,i=e.DERSequence,n=e.DERObjectIdentifier,r=e.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 t=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var e=[],o=0;o<this.params.array.length;o++)e.push(new r(this.params.array[o]));e.length>0&&t.push(new i({array:e}))}return new i({array:t}).getEncodedHex()},void 0!==t&&(this.params=t)},ft(c.asn1.x509.PolicyInformation,c.asn1.ASN1Object),c.asn1.x509.PolicyQualifierInfo=function(t){c.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=c.asn1,i=e.DERSequence,n=e.DERIA5String,r=e.DERObjectIdentifier,o=e.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!==t&&(this.params=t)},ft(c.asn1.x509.PolicyQualifierInfo,c.asn1.ASN1Object),c.asn1.x509.UserNotice=function(t){c.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=c.asn1.DERSequence;c.asn1.DERInteger;var i=c.asn1.x509.DisplayText,n=c.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var t=[];return void 0!==this.params.noticeref&&t.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&t.push(new i(this.params.exptext)),new e({array:t}).getEncodedHex()},void 0!==t&&(this.params=t)},ft(c.asn1.x509.UserNotice,c.asn1.ASN1Object),c.asn1.x509.NoticeReference=function(t){c.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=c.asn1.DERSequence,i=c.asn1.DERInteger,n=c.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var t=[];if(void 0!==this.params.org&&t.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]));t.push(new e({array:r}))}if(0==t.length)throw new Error("parameter is empty");return new e({array:t}).getEncodedHex()},void 0!==t&&(this.params=t)},ft(c.asn1.x509.NoticeReference,c.asn1.ASN1Object),c.asn1.x509.DisplayText=function(t){c.asn1.x509.DisplayText.superclass.constructor.call(this,t),this.hT="0c",void 0!==t&&("ia5"===t.type?this.hT="16":"vis"===t.type?this.hT="1a":"bmp"===t.type&&(this.hT="1e"))},ft(c.asn1.x509.DisplayText,c.asn1.DERAbstractString),c.asn1.x509.ExtKeyUsage=function(t){c.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t);var e=c.asn1;this.setPurposeArray=function(t){this.asn1ExtnValue=new e.DERSequence;for(var i=0;i<t.length;i++){var n=new e.DERObjectIdentifier(t[i]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==t&&void 0!==t.array&&this.setPurposeArray(t.array)},ft(c.asn1.x509.ExtKeyUsage,c.asn1.x509.Extension),c.asn1.x509.AuthorityKeyIdentifier=function(t){c.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,t);var e=c,i=e.asn1,n=i.DERTaggedObject,r=i.x509.GeneralNames;e.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var t=new Array;this.asn1KID&&t.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&t.push(new n({explicit:!1,tag:"a1",obj:new r([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&t.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var e=new i.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new c.asn1.DEROctetString(t);else if("object"==typeof t&&c.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN ")){var e=t;"string"==typeof t&&(e=mt.getKey(t));var i=mt.getKeyID(e);this.asn1KID=new c.asn1.DEROctetString({hex:i})}},this.setCertIssuerByParam=function(t){void 0!==t.str||void 0!==t.ldapstr||void 0!==t.hex||void 0!==t.certsubject||void 0!==t.certissuer?this.asn1CertIssuer=new c.asn1.x509.X500Name(t):"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&-1!=t.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new c.asn1.x509.X500Name({certissuer:t}))},this.setCertSNByParam=function(t){if(void 0!==t.str||void 0!==t.bigint||void 0!==t.hex)this.asn1CertSN=new c.asn1.DERInteger(t);else if("string"==typeof t&&-1!=t.indexOf("BEGIN ")&&t.indexOf("CERTIFICATE")){var e=new xt;e.readCertPEM(t);var i=e.getSerialNumberHex();this.asn1CertSN=new c.asn1.DERInteger({hex:i})}},this.oid="2.5.29.35",void 0!==t&&(void 0!==t.kid&&this.setKIDByParam(t.kid),void 0!==t.issuer&&this.setCertIssuerByParam(t.issuer),void 0!==t.sn&&this.setCertSNByParam(t.sn),void 0!==t.issuersn&&"string"==typeof t.issuersn&&-1!=t.issuersn.indexOf("BEGIN ")&&t.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(t.issuersn),this.setCertIssuerByParam(t.issuersn)))},ft(c.asn1.x509.AuthorityKeyIdentifier,c.asn1.x509.Extension),c.asn1.x509.SubjectKeyIdentifier=function(t){c.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,t);var e=c.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new e(t);else if("object"==typeof t&&c.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN")){var i=t;"string"==typeof t&&(i=mt.getKey(t));var n=mt.getKeyID(i);this.asn1KID=new c.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==t&&void 0!==t.kid&&this.setKIDByParam(t.kid)},ft(c.asn1.x509.SubjectKeyIdentifier,c.asn1.x509.Extension),c.asn1.x509.AuthorityInfoAccess=function(t){c.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,t),this.setAccessDescriptionArray=function(t){for(var e=new Array,i=c.asn1,n=i.DERSequence,r=i.DERObjectIdentifier,o=i.x509.GeneralName,a=0;a<t.length;a++){var s,l=t[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})]})}e.push(s)}this.asn1ExtnValue=new n({array:e})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==t&&void 0!==t.array&&this.setAccessDescriptionArray(t.array)},ft(c.asn1.x509.AuthorityInfoAccess,c.asn1.x509.Extension),c.asn1.x509.SubjectAltName=function(t){c.asn1.x509.SubjectAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new c.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},ft(c.asn1.x509.SubjectAltName,c.asn1.x509.Extension),c.asn1.x509.IssuerAltName=function(t){c.asn1.x509.IssuerAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new c.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},ft(c.asn1.x509.IssuerAltName,c.asn1.x509.Extension),c.asn1.x509.SubjectDirectoryAttributes=function(t){c.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,t);var e=c.asn1,i=e.DERSequence,n=e.ASN1Util.newObject,r=e.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++){var o=this.params.array[e],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}}t.push(new n(a))}var s=new i({array:t});return this.asn1ExtnValue=s,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==t&&(this.params=t)},ft(c.asn1.x509.SubjectDirectoryAttributes,c.asn1.x509.Extension),c.asn1.x509.PrivateExtension=function(t){c.asn1.x509.PrivateExtension.superclass.constructor.call(this,t);var e=c,i=e.lang.String.isHex,n=e.asn1,r=n.x509.OID.name2oid,o=n.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.oid=r(t.extname),this.params=t},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var t=this.params.extn;if("string"==typeof t&&i(t))return t;if("object"==typeof t)try{return o(t).getEncodedHex()}catch(t){}throw new Error("unsupported extn value")},null!=t&&this.setByParam(t)},ft(c.asn1.x509.PrivateExtension,c.asn1.x509.Extension),c.asn1.x509.CRL=function(t){c.asn1.x509.CRL.superclass.constructor.call(this);var e=c.asn1,i=e.DERSequence,n=e.DERBitString,r=e.x509,o=r.AlgorithmIdentifier,a=r.TBSCertList;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=new a(this.params).getEncodedHex(),e=new c.crypto.Signature({alg:this.params.sigalg});e.init(this.params.cakey),e.updateHex(t);var i=e.sign();this.params.sighex=i},this.getPEM=function(){return st(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var t=this.params;if(null==t.tbsobj&&(t.tbsobj=new a(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new o({name:t.sigalg})),e.push(new n({hex:"00"+t.sighex})),new i({array:e}).getEncodedHex()},null!=t&&(this.params=t)},ft(c.asn1.x509.CRL,c.asn1.ASN1Object),c.asn1.x509.TBSCertList=function(t){c.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=c.asn1,i=e.DERInteger,n=e.DERSequence,r=e.DERTaggedObject;e.DERObjectIdentifier;var o=e.x509,a=o.AlgorithmIdentifier,s=o.Time,l=o.Extensions,h=o.X500Name;this.params=null,this.setByParam=function(t){this.params=t},this.getRevCertSequence=function(){for(var t=[],e=this.params.revcert,r=0;r<e.length;r++){var o=[new i(e[r].sn),new s(e[r].date)];null!=e[r].ext&&o.push(new l(e[r].ext)),t.push(new n({array:o}))}return new n({array:t})},this.getEncodedHex=function(){var t=[],e=this.params;if(null!=e.version){var o=e.version-1,c=new i({int:o});t.push(c)}if(t.push(new a({name:e.sigalg})),t.push(new h(e.issuer)),t.push(new s(e.thisupdate)),null!=e.nextupdate&&t.push(new s(e.nextupdate)),null!=e.revcert&&t.push(this.getRevCertSequence()),null!=e.ext){var u=new l(e.ext);t.push(new r({tag:"a0",explicit:!0,obj:u}))}return new n({array:t}).getEncodedHex()},void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.TBSCertList,c.asn1.ASN1Object),c.asn1.x509.CRLEntry=function(t){c.asn1.x509.CRLEntry.superclass.constructor.call(this);var e=c.asn1;this.setCertSerial=function(t){this.sn=new e.DERInteger(t)},this.setRevocationDate=function(t){this.time=new e.x509.Time(t)},this.getEncodedHex=function(){var t=new e.DERSequence({array:[this.sn,this.time]});return this.TLV=t.getEncodedHex(),this.TLV},void 0!==t&&(void 0!==t.time&&this.setRevocationDate(t.time),void 0!==t.sn&&this.setCertSerial(t.sn))},ft(c.asn1.x509.CRLEntry,c.asn1.ASN1Object),c.asn1.x509.CRLNumber=function(t){c.asn1.x509.CRLNumber.superclass.constructor.call(this,t),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!=t&&(this.params=t)},ft(c.asn1.x509.CRLNumber,c.asn1.x509.Extension),c.asn1.x509.CRLReason=function(t){c.asn1.x509.CRLReason.superclass.constructor.call(this,t),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!=t&&(this.params=t)},ft(c.asn1.x509.CRLReason,c.asn1.x509.Extension),c.asn1.x509.OCSPNonce=function(t){c.asn1.x509.OCSPNonce.superclass.constructor.call(this,t),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!=t&&(this.params=t)},ft(c.asn1.x509.OCSPNonce,c.asn1.x509.Extension),c.asn1.x509.OCSPNoCheck=function(t){c.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,t),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!=t&&(this.params=t)},ft(c.asn1.x509.OCSPNoCheck,c.asn1.x509.Extension),c.asn1.x509.AdobeTimeStamp=function(t){c.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,t);var e=c.asn1,i=e.DERInteger,n=e.DERBoolean,r=e.DERSequence,o=e.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[new i(1)];return e.push(new o({uri:t.uri})),null!=t.reqauth&&e.push(new n(t.reqauth)),this.asn1ExtnValue=new r({array:e}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.AdobeTimeStamp,c.asn1.x509.Extension),c.asn1.x509.X500Name=function(t){c.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=c.asn1,i=e.x509,n=i.RDN;this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var i=t.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(t,e){void 0!==e&&(this.sRule=e);var n=i.X500Name.ldapToCompat(t);this.setByString(n,e)},this.setByObject=function(t,e){for(var i in void 0!==e&&(this.sRule=e),t)if(t.hasOwnProperty(i)){var r=new n({str:i+"="+t[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(r):this.asn1Array=[r]}},this.setByParam=function(t){var e;(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.array)?this.paramArray=t.array:void 0!==t.str?this.setByString(t.str):void 0!==t.ldapstr?this.setByLdapString(t.ldapstr):void 0!==t.hex?this.hTLV=t.hex:void 0!==t.certissuer?((e=new xt).readCertPEM(t.certissuer),this.hTLV=e.getIssuerHex()):void 0!==t.certsubject?((e=new xt).readCertPEM(t.certsubject),this.hTLV=e.getSubjectHex()):"object"==typeof t&&void 0===t.certsubject&&void 0===t.certissuer&&this.setByObject(t)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var i={array:this.paramArray[t]};"utf8"!=this.sRule&&(i.rule=this.sRule);var r=new n(i);this.asn1Array.push(r)}var o=new e.DERSequence({array:this.asn1Array});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.X500Name,c.asn1.ASN1Object),c.asn1.x509.X500Name.compatToLDAP=function(t){if("/"!==t.substr(0,1))throw"malformed input";var e=(t=t.substr(1)).split("/");return e.reverse(),(e=e.map((function(t){return t.replace(/,/,"\\,")}))).join(",")},c.asn1.x509.X500Name.onelineToLDAP=function(t){return c.asn1.x509.X500Name.compatToLDAP(t)},c.asn1.x509.X500Name.ldapToCompat=function(t){for(var e=t.split(","),i=!1,n=[],r=0;e.length>0;r++){var o=e.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(t){return t.replace("/","\\/")}))).reverse(),"/"+n.join("/")},c.asn1.x509.X500Name.ldapToOneline=function(t){return c.asn1.x509.X500Name.ldapToCompat(t)},c.asn1.x509.RDN=function(t){c.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=c.asn1.x509.AttributeTypeAndValue;this.setByParam=function(t){void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.str&&this.addByMultiValuedString(t.str),void 0!==t.array&&(this.paramArray=t.array)},this.addByString=function(t){this.asn1Array.push(new c.asn1.x509.AttributeTypeAndValue({str:t,rule:this.sRule}))},this.addByMultiValuedString=function(t){for(var e=c.asn1.x509.RDN.parseString(t),i=0;i<e.length;i++)this.addByString(e[i])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var i=this.paramArray[t];void 0!==i.rule&&"utf8"!=this.sRule&&(i.rule=this.sRule);var n=new e(i);this.asn1Array.push(n)}var r=new c.asn1.DERSet({array:this.asn1Array});return this.TLV=r.getEncodedHex(),this.TLV},void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.RDN,c.asn1.ASN1Object),c.asn1.x509.RDN.parseString=function(t){for(var e=t.split(/\+/),i=!1,n=[],r=0;e.length>0;r++){var o=e.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(t){c.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=c,i=e.asn1,n=i.DERSequence,r=i.DERUTF8String,o=i.DERPrintableString,a=i.DERTeletexString,s=i.DERIA5String,l=i.DERVisibleString,h=i.DERBMPString,u=e.lang.String.isMail,d=e.lang.String.isPrintable;this.setByParam=function(t){if(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.ds&&(this.dsType=t.ds),void 0===t.value&&void 0!==t.str){var e=t.str.match(/^([^=]+)=(.+)$/);if(!e)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=e[1],this.sValue=e[2]}else this.sType=t.type,this.sValue=t.value},this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var i=t.match(/^([^=]+)=(.+)$/);if(!i)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(i[1],i[2])},this._getDsType=function(){var t=this.sType,e=this.sValue,i=this.sRule;return"prn"===i?"CN"==t&&u(e)?"ia5":d(e)?"prn":"utf8":"utf8"===i?"CN"==t&&u(e)?"ia5":"C"==t?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(t,e,i){void 0!==i&&(this.sRule=i),this.sType=t,this.sValue=e},this.getValueObj=function(t,e){if("utf8"==t)return new r({str:e});if("prn"==t)return new o({str:e});if("tel"==t)return new a({str:e});if("ia5"==t)return new s({str:e});if("vis"==t)return new l({str:e});if("bmp"==t)return new h({str:e});throw new Error("unsupported directory string type: type="+t+" value="+e)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var t=c.asn1.x509.OID.atype2obj(this.sType),e=this.getValueObj(this.dsType,this.sValue),i=new n({array:[t,e]});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.AttributeTypeAndValue,c.asn1.ASN1Object),c.asn1.x509.SubjectPublicKeyInfo=function(t){c.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=c,i=e.asn1,n=i.DERInteger,r=i.DERBitString,o=i.DERObjectIdentifier,a=i.DERSequence,s=i.ASN1Util.newObject,l=i.x509.AlgorithmIdentifier,h=e.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 t=this.getASN1Object();return this.hTLV=t.getEncodedHex(),this.hTLV},this.setPubKey=function(t){try{if(t instanceof X){var e=s({seq:[{int:{bigint:t.n}},{int:{int:t.e}}]}).getEncodedHex();this.asn1AlgId=new l({name:"rsaEncryption"}),this.asn1SubjPKey=new r({hex:"00"+e})}}catch(t){}try{if(t instanceof c.crypto.ECDSA){var i=new o({name:t.curveName});this.asn1AlgId=new l({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new r({hex:"00"+t.pubKeyHex})}}catch(t){}try{if(t instanceof c.crypto.DSA){i=new s({seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]});this.asn1AlgId=new l({name:"dsa",asn1params:i});var a=new n({bigint:t.y});this.asn1SubjPKey=new r({hex:"00"+a.getEncodedHex()})}}catch(t){}},void 0!==t&&this.setPubKey(t)},ft(c.asn1.x509.SubjectPublicKeyInfo,c.asn1.ASN1Object),c.asn1.x509.Time=function(t){c.asn1.x509.Time.superclass.constructor.call(this);var e=c.asn1,i=e.DERUTCTime,n=e.DERGeneralizedTime;this.setTimeParams=function(t){this.timeParams=t},this.getEncodedHex=function(){var t=null;return t=null!=this.timeParams?"utc"==this.type?new i(this.timeParams):new n(this.timeParams):"utc"==this.type?new i:new n,this.TLV=t.getEncodedHex(),this.TLV},this.type="utc",void 0!==t&&(void 0!==t.type?this.type=t.type:void 0!==t.str&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)},ft(c.asn1.x509.Time,c.asn1.ASN1Object),c.asn1.x509.AlgorithmIdentifier=function(t){c.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=c.asn1,i=e.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 t=null;for(var n in i)n===this.nameAlg&&(t=i[n]);if(null!==t)return this.hTLV=t,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=e.x509.OID.name2obj(this.nameAlg));var r=[this.asn1Alg];null!==this.asn1Params&&r.push(this.asn1Params);var o=new e.DERSequence({array:r});return this.hTLV=o.getEncodedHex(),this.hTLV},void 0!==t&&(void 0!==t.name&&(this.nameAlg=t.name),void 0!==t.asn1params&&(this.asn1Params=t.asn1params),void 0!==t.paramempty&&(this.paramEmpty=t.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 e.DERNull)}},ft(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(t){c.asn1.x509.GeneralName.superclass.constructor.call(this);var e={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=ct;this.explicit=!1,this.setByParam=function(t){var i=null;if(void 0!==t){if(void 0!==t.rfc822&&(this.type="rfc822",i=new r({str:t[this.type]})),void 0!==t.dns&&(this.type="dns",i=new r({str:t[this.type]})),void 0!==t.uri&&(this.type="uri",i=new r({str:t[this.type]})),void 0!==t.dn&&(this.type="dn",this.explicit=!0,i="string"==typeof t.dn?new s({str:t.dn}):t.dn instanceof c.asn1.x509.X500Name?t.dn:new s(t.dn)),void 0!==t.ldapdn&&(this.type="dn",this.explicit=!0,i=new s({ldapstr:t.ldapdn})),void 0!==t.certissuer){this.type="dn",this.explicit=!0;var h=null;if((d=t.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(h=l(d)),null==h)throw"certissuer param not cert";(p=new xt).hex=h;var u=p.getIssuerHex();(i=new a).hTLV=u}if(void 0!==t.certsubj){this.type="dn",this.explicit=!0;var d,p;h=null;if((d=t.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=d.indexOf("-----BEGIN ")&&(h=l(d)),null==h)throw"certsubj param not cert";(p=new xt).hex=h;u=p.getSubjectHex();(i=new a).hTLV=u}if(void 0!==t.ip){this.type="ip",this.explicit=!1;var f,m=t.ip,g="malformed IP address";if(m.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(f=function(t){t=(t=(t=t.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return t.split(/,/).map((function(t,e,i){var n=parseInt(t);if(n<0||255<n)throw"integer not in range 0-255";return("00"+n.toString(16)).slice(-2)})).join("")}catch(t){throw"malformed integer array string: "+t}}("["+m.split(".").join(",")+"]")).length)throw g}else if(m.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))f=function(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var i=(t=t.toLowerCase()).split(":").length-1;if(i<2)throw e;var n=":".repeat(7-i+2),r=(t=t.replace("::",n)).split(":");if(8!=r.length)throw e;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="+t;this.asn1Obj=new o({explicit:this.explicit,tag:e[this.type],obj:i})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==t&&this.setByParam(t)},ft(c.asn1.x509.GeneralName,c.asn1.ASN1Object),c.asn1.x509.GeneralNames=function(t){c.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=c.asn1;this.setByParamArray=function(t){for(var i=0;i<t.length;i++){var n=new e.x509.GeneralName(t[i]);this.asn1Array.push(n)}},this.getEncodedHex=function(){return new e.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==t&&this.setByParamArray(t)},ft(c.asn1.x509.GeneralNames,c.asn1.ASN1Object),c.asn1.x509.OID=new function(t){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(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.name2oidList[t])throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],i=new c.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=i,i},this.atype2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(void 0!==this.atype2oidList[t])e=this.atype2oidList[t];else{if(void 0===this.name2oidList[t])throw"AttributeType name undefined: "+t;e=this.name2oidList[t]}var i=new c.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=i,i}},c.asn1.x509.OID.oid2name=function(t){var e=c.asn1.x509.OID.name2oidList;for(var i in e)if(e[i]==t)return i;return""},c.asn1.x509.OID.oid2atype=function(t){var e=c.asn1.x509.OID.atype2oidList;for(var i in e)if(e[i]==t)return i;return t},c.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=c.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},c.asn1.x509.X509Util={},c.asn1.x509.X509Util.newCertPEM=function(t){var e=c.asn1.x509;return e.TBSCertificate,new(0,e.Certificate)(t).getPEM()},X.getPosArrayOfChildrenFromHex=function(t){return gt.getChildIdx(t,0)},X.getHexValueArrayOfChildrenFromHex=function(t){var e,i=gt.getV,n=i(t,(e=X.getPosArrayOfChildrenFromHex(t))[0]),r=i(t,e[1]),o=i(t,e[2]),a=i(t,e[3]),s=i(t,e[4]),c=i(t,e[5]),l=i(t,e[6]),h=i(t,e[7]),u=i(t,e[8]);return(e=new Array).push(n,r,o,a,s,c,l,h,u),e},X.prototype.readPrivateKeyFromPEMString=function(t){var e=ct(t),i=X.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},X.prototype.readPKCS5PrvKeyHex=function(t){var e=X.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},X.prototype.readPKCS8PrvKeyHex=function(t){var e,i,n,r,o,a,s,c,l=gt,h=l.getVbyListEx;if(!1===l.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=h(t,0,[2,0,1],"02"),i=h(t,0,[2,0,2],"02"),n=h(t,0,[2,0,3],"02"),r=h(t,0,[2,0,4],"02"),o=h(t,0,[2,0,5],"02"),a=h(t,0,[2,0,6],"02"),s=h(t,0,[2,0,7],"02"),c=h(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,i,n,r,o,a,s,c)},X.prototype.readPKCS5PubKeyHex=function(t){var e=gt,i=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var r=i(t,n[0]),o=i(t,n[1]);this.setPublic(r,o)},X.prototype.readPKCS8PubKeyHex=function(t){var e=gt;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var i=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(i)},X.prototype.readCertPubKeyHex=function(t,e){var i,n;(i=new xt).readCertHex(t),n=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},X.prototype.sign=function(t,e){var i,n=(i=t,c.crypto.Util.hashString(i,e));return this.signWithMessageHash(n,e)},X.prototype.signWithMessageHash=function(t,e){var i=q(c.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return vt(this.doPrivate(i).toString(16),this.n.bitLength())},X.prototype.signPSS=function(t,e,i){var n,r=(n=ot(t),c.crypto.Util.hashHex(n,e));return void 0===i&&(i=-1),this.signWithMessageHashPSS(r,e,i)},X.prototype.signWithMessageHashPSS=function(t,e,i){var n,r=rt(t),o=r.length,a=this.n.bitLength()-1,s=Math.ceil(a/8),l=function(t){return c.crypto.Util.hashHex(t,e)};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=rt(l(ot("\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=yt(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),vt(this.doPrivate(new u(g)).toString(16),this.n.bitLength())},X.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=q(e,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=At(r.replace(/^1f+00/,""));if(0==o.length)return!1;var a,s=o[0];return o[1]==(a=t,c.crypto.Util.hashString(a,s))},X.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=q(e,16);if(i.bitLength()>this.n.bitLength())return 0;var n=At(this.doPublic(i).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==t)},X.prototype.verifyPSS=function(t,e,i,n){var r,o=(r=ot(t),c.crypto.Util.hashHex(r,i));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(o,e,i,n)},X.prototype.verifyWithMessageHashPSS=function(t,e,i,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r,o=new u(e,16),a=function(t){return c.crypto.Util.hashHex(t,i)},s=rt(t),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=yt(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===rt(a(ot("\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,xt.hex2dn=function(t,e){void 0===e&&(e=0);var i=new xt;return gt.getTLV(t,e),i.getX500Name(t).str},xt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var i=new Array,n=gt.getChildIdx(t,e),r=0;r<n.length;r++)i.push(xt.hex2attrTypeValue(t,n[r]));return(i=i.map((function(t){return t.replace("+","\\+")}))).join("+")},xt.hex2attrTypeValue=function(t,e){var i=gt,n=i.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var r=i.getChildIdx(t,e);2!==r.length||t.substr(r[0],2);var o=n(t,r[0]),a=c.asn1.ASN1Util.oidHexToInt(o);return c.asn1.x509.OID.oid2atype(a)+"="+rt(n(t,r[1]))},xt.getPublicKeyFromCertHex=function(t){var e=new xt;return e.readCertHex(t),e.getPublicKey()},xt.getPublicKeyFromCertPEM=function(t){var e=new xt;return e.readCertPEM(t),e.getPublicKey()},xt.getPublicKeyInfoPropOfCertPEM=function(t){var e,i,n=gt.getVbyList,r={};return r.algparam=null,(e=new xt).readCertPEM(t),i=e.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},xt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var wt,Mt=[(wt=new xt,wt.readCertPEM(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.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:::::")),wt)];function Et(t,e){var i=t.getIssuerHex();if(i===t.getSubjectHex())return t.verifySignature(t.getPublicKey());var n=function(t,e){for(var i=0,n=e;i<n.length;i++){var r=n[i];if(r.getSubjectHex()===t)return r}}(i,e);return!!n&&(!1!==t.verifySignature(n.getPublicKey())&&Et(n,e))}function St(t){return t.getIssuerHex()!==t.getSubjectHex()&&Et(t,Mt)}!function(t){var e=new xt;"string"==typeof t?e.readCertPEM(t):e.readCertHex(t.hex);var i=St(e);Mt.push(e)}(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.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 _t,Tt=(_t="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(_t,">$"):Symbol(_t));function Ct(t){return t[Tt]||(t[Tt]={}),t[Tt]}var It=function(){function t(){}return t.prototype.hasListener=function(t){var e=Ct(this);return e&&e[t]&&e[t].length>0},t.prototype.on=function(t,e,i){var n=this,r=Ct(this);return r[t]||(r[t]=[]),r[t].push([e,i||!1]),function(){return n.off(t,e)}},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.off=function(t,e){if(void 0!==t){var i,n=Ct(this);if(n[t]||(n[t]=[]),void 0!==e){for(var r=0;r<n[t].length&&n[t][r][0]!==e;r++);r<n[t].length&&n[t].splice(r,1)}else n[t].length=0}else(i=this)[Tt]||delete i[Tt]},t.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];for(var n=!1,r=Ct(this),o=r[t]||[],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,e);u&&this.off(t,l),!1===d&&(n=!0)}return n},t}();function Pt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]}var Rt="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),Bt="undefined"!=typeof performance?function(){return Rt+performance.now()}:function(){return Date.now()};function Lt(t){Object.freeze(t);var e="function"==typeof t,i=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(t).forEach((function(n){!i.call(t,n)||e&&("caller"===n||"callee"===n||"arguments"===n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||Object.isFrozen(t[n])||Lt(t[n])})),t}var Dt=/^([^.]+)(\.([^.]+))*$/;function Ot(t){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(t)}function Nt(t,e){return Dt.test(t)&&Dt.test(e)&&function(t,e){if("*"===t)return!0;var i=t.split(".").reverse(),n=e.split(".").reverse();if(i.length<=1)return t===e;for(var r=0;r<i.length;r++)if(i[r]!==n[r])return!1;return!0}(t,e)}var kt=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Ft=Lt(JSON.parse(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.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"))),Vt=function(t){function i(e,i,n){return t.call(this,"[NETWORK]: response error(type: ".concat(i,", reason: ").concat(n,"): ").concat(e))||this}return e.__extends(i,t),i}(Error),zt=function(t){function i(e,i,n){var r=t.call(this,"[NETWORK]: response error(type: ".concat(i,", status: ").concat(n,"): ").concat(e))||this;return r.httpStatus=n,r}return e.__extends(i,t),i}(Error);!function(t){function i(e,i){return t.call(this,"[NETWORK]: request abort(type: ".concat(i,"): ").concat(e))||this}e.__extends(i,t)}(Error);var Ht=function(t){function i(e,i,n){return t.call(this,"[NETWORK]: request timeout(type: ".concat(i,", timeout: ").concat(n,"ms): ").concat(e))||this}return e.__extends(i,t),i}(Error);function Ut(t){for(var e=0,i=kt;e<i.length;e++){var n=i[e],r=t.match(n);if(r)return"jsonp_"+r[1]}return null}function Gt(t){return null!==Ut(t)}function jt(t){return kt.reduce((function(t,e){return t.replace(e,"")}),t)}function Qt(t){var e=t.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/);return e?e[2]:location.hostname}!function(t){function i(e,i,n){return t.call(this,"[NETWORK]: request forbidden(type: ".concat(i,", reason: ").concat(n,"): ").concat(e))||this}e.__extends(i,t)}(Error);var Wt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(i,t),i}(It);function qt(t,e,i,n,r){return void 0===e&&(e={}),void 0===i&&(i=Pt),void 0===n&&(n=Pt),void 0===r&&(r=Pt),new Promise((function(o,a){var s,c=e.allowHosts?Ft.concat(e.allowHosts):Ft.slice(),l=Qt(t),h=Ut(t);if(0!==location.hostname.length&&!Ot(location.hostname)&&0===Ft.filter((function(t){return Nt(t,location.hostname)})).length&&!Ot(l)&&0===c.filter((function(t){return Nt(t,l)})).length){var u=h?"Script":"XMLHttpRequest",d=new Vt(t,u,"request host(".concat(l,") is not allowed"));return n(d),a(d),void(null===(s=e.networkSubscribe)||void 0===s||s.emit("network",t,u,"forbidden",d.message))}if(h){var p=window,f=null,m=!1,g=Bt(),v=document.createElement("script");p[h]=function(r){var s,c,l=Bt(),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 zt(t,"Script",500);return n(d),a(d),void(null===(s=e.networkSubscribe)||void 0===s||s.emit("network",t,"Script","error",d.message))}var y=r.split(","),A=(y[0].match(/:(.*?);/)||[])[1],x=y[1];if("arraybuffer"===e.responseType||"blob"===e.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"===e.responseType?M.buffer:new Blob([M],{type:A})}var S={body:x,meta:{source:t,requestTime:g,responseTime:l,costs:u,headers:{}}};i(S),o(S),null===(c=e.networkSubscribe)||void 0===c||c.emit("network",t,"Script","ok",JSON.stringify(S.meta)),m=!0}},v.src=t,document.body.appendChild(v),"number"==typeof e.timeout&&(f=window.setTimeout((function(){var i;if(f=null,!0!==m){m=!0;var r=new Ht(t,"Script",e.timeout||NaN);n(r),a(r),null===(i=e.networkSubscribe)||void 0===i||i.emit("network",t,"Script","timeout",r.message)}}),e.timeout))}else{var y=Bt(),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=Pt},w=function(){var i;if(!0!==A){A=!0,b();var r=new Ht(t,"XMLHttpRequest",e.timeout||NaN);n(r),a(r),null===(i=e.networkSubscribe)||void 0===i||i.emit("network",t,"XMLHttpRequest","timeout",r.message)}},M=function(t){!0!==A&&t.lengthComputable&&(t.total<=0||r(t.loaded/t.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=Bt(),c=s-y,l=function(t){if(!t)return{};for(var e={},i=t.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&&(e[a]?e[a]+=", "+s:e[a]=s)}return e}(this.getAllResponseHeaders()),h=n.total,u={body:this.response,meta:{source:t,requestTime:y,responseTime:s,costs:c,headers:l,size:h}};i(u),o(u),null===(r=e.networkSubscribe)||void 0===r||r.emit("network",t,"XMLHttpRequest","ok",JSON.stringify(u.meta))}else S.call(this)}},S=function(){var i;if(!0!==A){A=!0,b();var r=new zt(t,"XMLHttpRequest",this.status);n(r),a(r),null===(i=e.networkSubscribe)||void 0===i||i.emit("network",t,"XMLHttpRequest","error",r.message)}};x.addEventListener("timeout",w,!1),x.addEventListener("progress",M,!1),x.addEventListener("load",E,!1),x.addEventListener("error",S,!1),e.responseType&&(x.responseType=e.responseType),"number"==typeof e.timeout&&(x.timeout=e.timeout),x.open("GET",t,!0),x.send(null)}}))}var Kt={};function Xt(t,e,i,n,r,o){return void 0===e&&(e={}),void 0===i&&(i=Pt),void 0===n&&(n=Pt),void 0===r&&(r=Pt),new Promise((function(a,s){var c,l=e.allowHosts?Ft.concat(e.allowHosts):Ft.slice(),h=Qt(t);if(0!==location.hostname.length&&!Ot(location.hostname)&&0===Ft.filter((function(t){return Nt(t,location.hostname)})).length&&!Ot(h)&&0===l.filter((function(t){return Nt(t,h)})).length){var u=new Vt(t,"Image","request host(".concat(h,") is not allowed"));return n(u),s(u),void(null===(c=e.networkSubscribe)||void 0===c||c.emit("network",t,"Image","forbidden",u.message))}var d=null!=o?o:new Image,p=Bt(),f=!1,m=null;"number"==typeof e.timeout&&(m=window.setTimeout((function(){var i;if(d.onload=Pt,d.onerror=Pt,m=null,!0!==f){f=!0;var r=new Ht(t,"Image",e.timeout);n(r),s(r),null===(i=e.networkSubscribe)||void 0===i||i.emit("network",t,"Image","timeout",r.message)}}),e.timeout)),d.onload=function(){var n;if(d.onload=Pt,d.onerror=Pt,null!==m&&(clearTimeout(m),m=null),!0!==f){var o=Bt();f=!0;var s={body:d,meta:{headers:{},source:t,requestTime:p,responseTime:o,costs:o-p}};r(1),i(s),a(s),null===(n=e.networkSubscribe)||void 0===n||n.emit("network",t,"Image","ok",JSON.stringify(s.meta))}},d.onerror=function(){var i;if(d.onload=Pt,d.onerror=Pt,null!==m&&(clearTimeout(m),m=null),!0!==f){f=!0;var r=new zt(t,"Image",0);n(r),s(r),null===(i=e.networkSubscribe)||void 0===i||i.emit("network",t,"Image","ok",r.message)}},r(0),d.src=t}))}var Yt=function(){if("undefined"!=typeof window){var t=window;return t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16)}}return function(t){return setTimeout(t,16)}}(),Zt=16,Jt=function(){function t(){this.frames=[],this.stoped=!1,this.time=Bt(),this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(t,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new t),this.sharedInstance},enumerable:!1,configurable:!0}),t.getFrameTime=function(){return Zt},t.prototype.loop=function(){if(!this.stoped){var t=Bt(),e=t-this.time;this.time=t;var i=[];Zt=e;for(var n=0,r=this.frames;n<r.length;n++){var o=r[n];if(o.delay>0)o.delay=o.delay-1;else{try{o.callback(t,e)}catch(t){console.error(t)}o.once&&i.push(o)}}i.length>0&&(this.frames=this.frames.filter((function(t){return-1===i.indexOf(t)}))),Yt(this.loop)}},t.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},t.prototype.add=function(t,e,i,n){var r=this;void 0===e&&(e=!1),void 0===i&&(i=0),void 0===n&&(n=5);var o={callback:t,once:e,delay:i,order:n};return this.frames.push(o),this.frames.sort((function(t,e){return t.order-e.order})),function(){return r.remove(o)}},t.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},t}(),$t=/^https?\:\/\/?([^\/]+)/;function te(t,e){return t.replace($t,(function(t,i){return t.slice(0,t.length-i.length)+e}))}var ee={"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 ie(t,i){var n=e.__assign(e.__assign({},ee),i.mappings),r=function(t){var e=t.match($t);return null===e?null:e[1]}(t);if(null===r)return t;var o=n[r];return o?(/\.basis(\?|$)/.test(t)&&!0!==i.basisLoaderInitialized&&(t=t.replace(/\.basis(\?|$)/,".jpg$1")),function(t,e){var i,n=t.split("?")[0],r=n.split(".").pop();if("jpeg"===r&&(r="jpg"),"png"!==r&&"jpg"!==r)return t;var o="";if(void 0!==e.format&&e.format!==r&&(o+="/format/".concat(e.format)),void 0!==e.cut&&(o+="/cut/".concat(e.cut[2],"x").concat(e.cut[3],"x").concat(e.cut[0],"x").concat(e.cut[1])),void 0!==e.quality){var a=null!==(i=e.format)&&void 0!==i?i:r;a&&["jpg","webp","tpg","heif","avif"].indexOf(a)>=0&&(o+="/quality/".concat(e.quality))}if(void 0!==e.size){var s=t.match(/\/cube_(\d+)\//);(s?Number(s[1]):NaN)!==Number(e.size)&&(o+="/thumbnail/".concat(e.size,"x"))}return void 0!==e.sharpen&&(o+="/sharpen/".concat(e.sharpen)),o.length&&(o="?imageMogr2"+o),n+o}(function(t,e,i){var n=e.split("."),r=n[0],o=n.slice(1);if("texture"===r)return te(t,i.texture[0]);if("pano"===r||"pano_luminance"===r)switch(o[0],o[1]){case"front":case"left":case"up":return te(t,i.pano[0]);case"down":case"right":case"back":return te(t,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 te(t,i.tile[l%2])}return te(t,i.default[0])}(t,i.key,o),i)):t}function ne(t){return new Promise((function(e){var i=new Image,n=setTimeout((function(){i.onload=i.onerror=function(){},clearTimeout(n),e(!1)}));i.onload=i.onerror=function(){i.onload=i.onerror=function(){},clearTimeout(n),e(2===i.height)},i.src=t}))}var re=null;var oe=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.floorIndex=0,e.needsRender=!0,e}return e.__extends(i,t),i}(r.Mesh),ae=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.needsRender=!0,e.enableTransparent=!0,e}return e.__extends(i,t),i.prototype.getTransparent=function(){return this.enableTransparent},i.prototype.setTransparent=function(t){this.enableTransparent=t,this.traverse((function(e){e instanceof oe&&e.material.forEach((function(e){e.transparent=t}))}))},i.prototype.getMaterial=function(){var t=null;return this.traverse((function(e){if(null===t&&e instanceof oe){var i=e.material[0];t={pano0:i.pano0,pano1:i.pano1,modelAlpha:i.modelAlpha,progress:i.progress,useBlackTransition:i.useBlackTransition,perspToOrtho:i.perspToOrtho,opacity:i.opacity,floorInfo:i.floorInfo}}})),t},i.prototype.setMaterial=function(t){this.traverse((function(e){e instanceof oe&&e.material.forEach((function(e){void 0!==t.pano0&&(e.pano0=t.pano0),void 0!==t.pano1&&(e.pano1=t.pano1),void 0!==t.modelAlpha&&(e.modelAlpha=t.modelAlpha),void 0!==t.progress&&(e.progress=t.progress),void 0!==t.useBlackTransition&&(e.useBlackTransition=t.useBlackTransition),void 0!==t.perspToOrtho&&(e.perspToOrtho=t.perspToOrtho),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.floorInfo&&(e.floorInfo=t.floorInfo)}))}))},i.prototype.disposeMaterial=function(){this.traverse((function(t){if(t instanceof oe){var e=[];t.material.forEach((function(t){var i=t.uniforms;Object.keys(i).map((function(t){if(/^pano\d\_/.test(t))i[t].value=null;else{var n=i[t].value;n&&"function"==typeof n.dispose&&-1===e.indexOf(n)&&(i[t].value=null,e.push(n))}})),t.dispose()})),e.forEach((function(t){return t.dispose()}))}}))},i.prototype.disposeGeometry=function(){this.traverse((function(t){t instanceof oe&&t.geometry.dispose()}))},i}(r.Group),se=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.floorIndex=0,e}return e.__extends(i,t),i}(ae),ce=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.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"),le=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.charCodeAt(r)+i)%n)})).join(o)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=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->;=6-<-aNb-7-?;=H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-pynz}5oynpx]|tr-7-@;=9-=;=9->;=66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-pynz}5oynpx]|tr-7-@;=-:-?;=9-=;=9->;=66H--0ryr----}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 he(){return"undefined"==typeof document?{}:document.createElementNS("http://www.w3.org/1999/xhtml","img")}var ue=he();ue.width=ue.height=8;var de=new r.Texture(ue);de.name="EMPTY_TEXTURE";var pe=new r.CubeTexture([ue,ue,ue,ue,ue,ue]);pe.name="EMPTY_CUBE_TEXTURE",de.dispose=pe.dispose=function(){};var fe=Object.assign({modelAlpha:new r.Uniform(0),progress:new r.Uniform(0),pano0_map:new r.Uniform(pe),pano0_luminanceMap:new r.Uniform(null),pano0_matrix:new r.Uniform(new r.Matrix4),pano1_map:new r.Uniform(pe),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)),me=function(t){function i(e){void 0===e&&(e={});var i,n,o,a,s,c,l,h,u=this;return u=t.call(this,{vertexShader:ce,fragmentShader:le,uniforms:r.UniformsUtils.clone(fe),defines:{USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_CLIPFLOOR:!1},blending:r.NoBlending,lights:!0})||this,Object.defineProperties(u,{pano0:{get:function(){return this.uniforms.pano0_map.value===pe?null:{map:this.uniforms.pano0_map.value,luminanceMap:this.uniforms.pano0_luminanceMap.value,matrix:this.uniforms.pano0_matrix.value.clone()}},set:function(t){null===t?(this.uniforms.pano0_map.value=pe,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=t.map,this.uniforms.pano0_luminanceMap.value=t.luminanceMap,this.uniforms.pano0_matrix.value.copy(t.matrix));var e=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==e&&(this.defines.USE_LUMINANCE=e,this.needsUpdate=!0)}},pano1:{get:function(){return this.uniforms.pano1_map.value===pe?null:{map:this.uniforms.pano1_map.value,luminanceMap:this.uniforms.pano1_luminanceMap.value,matrix:this.uniforms.pano1_matrix.value.clone()}},set:function(t){null===t?(this.uniforms.pano1_map.value=pe,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=t.map,this.uniforms.pano1_luminanceMap.value=t.luminanceMap,this.uniforms.pano1_matrix.value.copy(t.matrix));var e=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==e&&(this.defines.USE_LUMINANCE=e,this.needsUpdate=!0)}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(t){this.uniforms.modelAlpha.value=t}},progress:{get:function(){return this.uniforms.progress.value},set:function(t){this.uniforms.progress.value=t}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(t){this.defines.USE_BLACK_TRANSITION!==t&&(this.defines.USE_BLACK_TRANSITION=t,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t;var e=t<1?r.NormalBlending:r.NoBlending;e!==this.blending&&(this.blending=e,this.needsUpdate=!0)}},perspToOrtho:{get:function(){return this.uniforms.perspToOrtho.value},set:function(t){this.uniforms.perspToOrtho.value=t}},floorInfo:{get:function(){return this.uniforms.floorInfo.value},set:function(t){t&&t.equals(new r.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!1,this.needsUpdate=!0),t&&!t.equals(new r.Vector3(0,0,0))&&(this.defines.USE_CLIPFLOOR=!0,this.uniforms.floorInfo.value=t,this.needsUpdate=!0)}}}),u.pano0=null!==(i=e.pano0)&&void 0!==i?i:null,u.pano1=null!==(n=e.pano1)&&void 0!==n?n:null,u.modelAlpha=null!==(o=e.modelAlpha)&&void 0!==o?o:1,u.progress=null!==(a=e.progress)&&void 0!==a?a:0,u.useBlackTransition=null!==(s=e.useBlackTransition)&&void 0!==s&&s,u.perspToOrtho=null!==(c=e.perspToOrtho)&&void 0!==c?c:0,u.opacity=null!==(l=e.opacity)&&void 0!==l?l:1,u.originOpacity=1,u.floorInfo=null!==(h=e.floorInfo)&&void 0!==h?h:null,u}return e.__extends(i,t),i}(r.ShaderMaterial),ge=function(t){function i(e){var i=e.preserveDrawingBuffer,n=void 0===i||i,o=e.backgroundColor,a=void 0===o?1579548:o,s=e.backgroundAlpha,c=void 0===s?1:s,l=e.pixelRatio,h=void 0===l?1:l,u=e.antialias,d=void 0!==u&&u,p=e.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=t.call(this,{antialias:d,preserveDrawingBuffer:n,alpha:c<1,canvas:m,context:g})||this}else f=t.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 e.__extends(i,t),i}(r.WebGLRenderer),ve=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(i,t),i.prototype.add=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.prototype.add.apply(this,e)},i.prototype.remove=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.prototype.remove.apply(this,e)},i}(r.Scene);var ye=2*Math.PI,Ae=Math.PI/2;function xe(t){return t>0&&t<=ye?t:(t%ye+ye)%ye}var be,we,Me,Ee,Se=function(t){function i(e){var i=t.call(this,e,1,.1,1e3)||this;return i.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new r.Vector3},i.computePose(),i}return e.__extends(i,t),i.prototype.computePose=function(){var t=this.getWorldDirection(new r.Vector3);return this.pose.longitude=xe(-Math.atan2(t.x,-t.z)),this.pose.latitude=-Math.asin(t.y/1),this.pose.fov=this.fov,this.pose.distance=0,this.pose.offset.copy(this.position),this},i.prototype.setFromPose=function(t){var e,i,n,o,a,s=xe(null!==(e=t.longitude)&&void 0!==e?e:this.pose.longitude),c=Math.max(1e-4-Ae,Math.min(Ae-1e-4,null!==(i=t.latitude)&&void 0!==i?i:this.pose.latitude)),l=null!==(n=t.fov)&&void 0!==n?n:this.pose.fov,h=null!==(o=t.distance)&&void 0!==o?o:this.pose.distance,u=null!==(a=t.offset)&&void 0!==a?a:this.pose.offset,d=function(t){var e=Math.abs(Math.cos(t.latitude));return new r.Vector3(-Math.sin(t.longitude)*e,-Math.sin(t.latitude),-Math.cos(t.longitude)*e)}({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),_e=function(){function t(t,e,i){this.x=t,this.y=e,this.z=i}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},t.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){var e=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-e*t.z,this.z=e*t.y-i*t.x,this},t.prototype.crossVectors=function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t}(),Te=function(t,e,i){this.extents=t,this.startIndex=e,this.endIndex=i},Ce=function(t,e){this.triangle=t,this.intersectionPoint=e},Ie=(be=new _e(0,0,0),we=new _e(0,0,0),Me=new _e(0,0,0),Ee=new _e(0,0,0),function(t,e,i,n,r,o){we.subVectors(e,t),Me.subVectors(i,t),Ee.crossVectors(we,Me);var a,s=r.dot(Ee);if(s>0){if(o)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}be.subVectors(n,t);var c=a*r.dot(Me.crossVectors(be,Me));if(c<0)return null;var l=a*r.dot(we.cross(be));if(l<0)return null;if(c+l>s)return null;var h=-a*be.dot(Ee);if(h<0)return null;var u=h/s;return new _e(0,0,0).copy(r).multiplyScalar(u).add(n)}),Pe=function(t,e){this.min=t,this.max=e};function Re(t,e,i){var n=new Pe(0,0);e.x>=0?(n.min=(i.extents[0]-t.x)*e.x,n.max=(i.extents[3]-t.x)*e.x):(n.min=(i.extents[3]-t.x)*e.x,n.max=(i.extents[0]-t.x)*e.x);var r=new Pe(0,0);if(e.y>=0?(r.min=(i.extents[1]-t.y)*e.y,r.max=(i.extents[4]-t.y)*e.y):(r.min=(i.extents[4]-t.y)*e.y,r.max=(i.extents[1]-t.y)*e.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 Pe(0,0);return e.z>=0?(o.min=(i.extents[2]-t.z)*e.z,o.max=(i.extents[5]-t.z)*e.z):(o.min=(i.extents[5]-t.z)*e.z,o.max=(i.extents[2]-t.z)*e.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 Be(t,e,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=e[d=6*t[u]])<o&&(o=p),(p=e[d+1])<a&&(a=p),(p=e[d+2])<s&&(s=p),(p=e[d+3])>c&&(c=p),(p=e[d+4])>l&&(l=p),(p=e[d+5])>h&&(h=p);return[o-r,a-r,s-r,c+r,l+r,h+r]}var Le=function(){function t(){}return t.prototype.create=function(t){return this.trianglesArray=t,this},t.prototype.splitNode=function(t){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");for(var e=this.trianglesArray,i=e.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=e[f],(b=e[f+3])<m&&(m=b),b>y&&(y=b),(b=e[f+6])<m&&(m=b),b>y&&(y=b),g=A=e[f+1],(b=e[f+4])<g&&(g=b),b>A&&(A=b),(b=e[f+7])<g&&(g=b),b>A&&(A=b),v=x=e[f+2],(b=e[f+5])<v&&(v=b),b>x&&(x=b),(b=e[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 Te([a,s,c,l,h,u],0,i);function E(e){for(var i=e.startIndex,a=e.endIndex,s=e.extents,c=[s[3]-s[0],s[4]-s[1],s[5]-s[2]],l=[0,1,2].sort((function(t,e){return c[e]-c[t]})),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 Te(Be(n,r,i,p,1e-6),i,p);v.endIndex-v.startIndex>t&&o.push(v);var y=new Te(Be(n,r,p,a,1e-6),p,a);y.endIndex-y.startIndex>t&&o.push(y),e.node0=v,e.node1=y,e.startIndex=0,e.endIndex=0;break}}}for(o.push(M);w=o.pop();)E(w);return this.offsetArray=n,this.rootNode=M,this},t.prototype.intersectRay=function(t,e,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 _e(1/e.x,1/e.y,1/e.z),h=[a];n=h.pop();)if(Re(t,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 _e(0,0,0),p=new _e(0,0,0),f=new _e(0,0,0),m=new _e(t.x,t.y,t.z),g=new _e(e.x,e.y,e.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=Ie(d,p,f,m,g,i);A&&c.push(new Ce([d.clone(),p.clone(),f.clone()],A))}return c},t.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},t}(),De=null,Oe=!1,Ne=[];function ke(t){if(void 0===t&&(t=!1),t||!Oe)if(De)Oe=!1;else{Oe=!0;var e=Ne.shift();if(e){try{e()}catch(t){}Jt.shared.add((function(){return ke(!0)}),!0,2)}else Oe=!1}}function Fe(){De=null,ke()}function Ve(t){return new Promise((function(e,i){Ne.push((function(){try{e(t())}catch(t){i(t)}})),ke()}))}function ze(){var t={OutWindow:function(){this._windowSize=0}};return t.OutWindow.prototype.create=function(t){this._buffer&&this._windowSize===t||(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},t.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(0!==t){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},t.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},t.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},t.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},t.OutWindow.prototype.copyBlock=function(t,e){var i=this._pos-t-1;for(i<0&&(i+=this._windowSize);e--;)i>=this._windowSize&&(i=0),this._buffer[this._pos++]=this._buffer[i++],this._pos>=this._windowSize&&this.flush()},t.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},t.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},t.RangeDecoder=function(){},t.RangeDecoder.prototype.setStream=function(t){this._stream=t},t.RangeDecoder.prototype.releaseStream=function(){this._stream=null},t.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},t.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e,i=0,n=t;n--;)this._range>>>=1,e=this._code-this._range>>>31,this._code-=this._range&e-1,i=i<<1|1-e,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return i},t.RangeDecoder.prototype.decodeBit=function(t,e){var i=t[e],n=(this._range>>>11)*i;return(2147483648^this._code)<(2147483648^n)?(this._range=n,t[e]+=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,t[e]-=i>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},t.initBitModels=function(t,e){for(;e--;)t[e]=1024},t.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},t.BitTreeDecoder.prototype.init=function(){t.initBitModels(this._models,1<<this._numBitLevels)},t.BitTreeDecoder.prototype.decode=function(t){for(var e=1,i=this._numBitLevels;i--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},t.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e,i=1,n=0,r=0;r<this._numBitLevels;++r)i=i<<1|(e=t.decodeBit(this._models,i)),n|=e<<r;return n},t.reverseDecode2=function(t,e,i,n){for(var r,o=1,a=0,s=0;s<n;++s)o=o<<1|(r=i.decodeBit(t,e+o)),a|=r<<s;return a},t.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new t.BitTreeDecoder(8),this._numPosStates=0},t.LenDecoder.prototype.create=function(e){for(;this._numPosStates<e;++this._numPosStates)this._lowCoder[this._numPosStates]=new t.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new t.BitTreeDecoder(3)},t.LenDecoder.prototype.init=function(){var e=this._numPosStates;for(t.initBitModels(this._choice,2);e--;)this._lowCoder[e].init(),this._midCoder[e].init();this._highCoder.init()},t.LenDecoder.prototype.decode=function(t,e){return 0===t.decodeBit(this._choice,0)?this._lowCoder[e].decode(t):0===t.decodeBit(this._choice,1)?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},t.Decoder2=function(){this._decoders=[]},t.Decoder2.prototype.init=function(){t.initBitModels(this._decoders,768)},t.Decoder2.prototype.decodeNormal=function(t){var e=1;do{e=e<<1|t.decodeBit(this._decoders,e)}while(e<256);return 255&e},t.Decoder2.prototype.decodeWithMatchByte=function(t,e){var i,n,r=1;do{if(i=e>>7&1,e<<=1,r=r<<1|(n=t.decodeBit(this._decoders,(1+i<<8)+r)),i!==n){for(;r<256;)r=r<<1|t.decodeBit(this._decoders,r);break}}while(r<256);return 255&r},t.LiteralDecoder=function(){},t.LiteralDecoder.prototype.create=function(e,i){var n;if(!this._coders||this._numPrevBits!==i||this._numPosBits!==e)for(this._numPosBits=e,this._posMask=(1<<e)-1,this._numPrevBits=i,this._coders=[],n=1<<this._numPrevBits+this._numPosBits;n--;)this._coders[n]=new t.Decoder2},t.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},t.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((255&e)>>>8-this._numPrevBits)]},t.Decoder=function(){this._outWindow=new t.OutWindow,this._rangeDecoder=new t.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new t.BitTreeDecoder(4),this._lenDecoder=new t.LenDecoder,this._repLenDecoder=new t.LenDecoder,this._literalDecoder=new t.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new t.BitTreeDecoder(6),this._posSlotDecoder[1]=new t.BitTreeDecoder(6),this._posSlotDecoder[2]=new t.BitTreeDecoder(6),this._posSlotDecoder[3]=new t.BitTreeDecoder(6)},t.Decoder.prototype.setDictionarySize=function(t){return!(t<0)&&(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},t.Decoder.prototype.setLcLpPb=function(t,e,i){var n=1<<i;return!(t>8||e>4||i>4)&&(this._literalDecoder.create(e,t),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,!0)},t.Decoder.prototype.init=function(){var e=4;for(this._outWindow.init(!1),t.initBitModels(this._isMatchDecoders,192),t.initBitModels(this._isRep0LongDecoders,192),t.initBitModels(this._isRepDecoders,12),t.initBitModels(this._isRepG0Decoders,12),t.initBitModels(this._isRepG1Decoders,12),t.initBitModels(this._isRepG2Decoders,12),t.initBitModels(this._posDecoders,114),this._literalDecoder.init();e--;)this._posSlotDecoder[e].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},t.Decoder.prototype.decode=function(e,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(e),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+=t.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},t.Decoder.prototype.setDecoderProperties=function(t){var e,i,n,r,o;return!(t.size<5)&&(i=(e=t.readByte())%9,n=(e=~~(e/9))%5,r=~~(e/5),!!this.setLcLpPb(i,n,r)&&(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=16777216*t.readByte(),this.setDictionarySize(o)))},t.decompress=function(e,i,n,r){var o=new t.Decoder;if(!o.setDecoderProperties(e))throw"Incorrect stream properties";if(!o.decode(i,n,r))throw"Error in data stream";return!0},t.decompressFile=function(e,i){var n,r=new t.Decoder;if(!r.setDecoderProperties(e))throw"Incorrect stream properties";if(n=e.readByte(),n|=e.readByte()<<8,n|=e.readByte()<<16,n+=16777216*e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),!r.decode(e,i,n))throw"Error in data stream";return!0},t}var He=ze();var Ue="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(ze.toString(),")();\n return function(data, callback) {\n return (").concat(function(t,e,i){try{var n={data:e,offset:0,readByte:function(){return this.data[this.offset++]}},r=n.data.length,o={data:[],offset:0,writeByte:function(t){var e=Math.floor(this.offset/r);this.data[e]||(this.data[e]=new Uint8Array(r)),this.data[e][this.offset%r]=t,this.offset++}};t.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(t){i(t)}}.toString(),")(LZMA, data, callback);\n }\n})();\n\nvar decodeLZMAWithWASM = (function() {\n var LZMA_WASM = (").concat(function(){return function(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(256),n=0;n<e.length;n++)i[e.charCodeAt(n)]=n;var r,o,a,s,c,l=.75*t.length,h=t.length,u=0;"="===t[t.length-1]&&(l--,"="===t[t.length-2]&&l--);var d=new ArrayBuffer(l),p=new Uint8Array(d);for(r=0;r<h;r+=4)o=i[t.charCodeAt(r)],a=i[t.charCodeAt(r+1)],s=i[t.charCodeAt(r+2)],c=i[t.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(t,e,i){try{var n=new WebAssembly.Memory({initial:16}),r=new WebAssembly.Module(t),o=new WebAssembly.Instance(r,{env:{memory:n,abort:function(){i(new Error("webAssembly abort"))}}}).exports,a=o.newU8Array(e.length);new Uint8Array(n.buffer,a+24,e.length).set(e);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(t){i(t)}}.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'),Ge="undefined"!=typeof Worker&&"undefined"!=typeof Blob,je="";if(Ge)try{var Qe=new Blob([Ue],{type:"text/javascript"});je=URL.createObjectURL(Qe)}catch(t){}var We=function(){function t(){var t=this;if(!Ge)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(je);e.onmessage=function(e){var i=e.data,n=i.id,r=i.result,o=i.error,a=t.getKey(n);t.requests[a]&&(o?t.requests[a](new Error(o)):t.requests[a](null,r),delete t.requests[a])},e.onerror=function(t){return console.error(t)}}return t.prototype.getKey=function(t){return"key_"+String(t)},t.prototype.decompress=function(t,e){var i=++this.callCounter;this.requests[this.getKey(i)]=e,this.worker.postMessage({type:"decompress",id:i,data:t},[t.buffer])},t.prototype.terminate=function(){this.worker.terminate()},t.support=Ge,t}();function qe(t){return Array.prototype.reduce.call(t,(function(t,e,i){return t|e<<8*i}),0)}function Ke(t){var e=new Uint8Array(t),i=qe(e.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]=qe(e.slice(4+4*a,8+4*a)),n[a]=a===i-1?e.subarray(o,o+r[a]):e.slice(o,o+r[a]),o+=r[a];return We.support?function(t){for(var e=[],i=t.length,n=function(i){e.push(new Promise((function(e,n){var r=new We;r.decompress(t[i],(function(t,i){if(r.terminate(),t)return n(t);e(i)}))})))},r=0;r<i;r++)n(r);return Promise.all(e)}(n):Promise.resolve(function(t){for(var e,i=[],n=t.length,r=function(n){var r={data:t[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=r.data.length,a={data:[],offset:0,writeByte:function(t){var e=Math.floor(this.offset/o);this.data[e]||(this.data[e]=new Uint8Array(o)),this.data[e][this.offset%o]=t,this.offset++}};He.decompressFile(r,a),e=new Uint8Array(a.offset);for(var s=0;s<a.offset;s++)e[s]=a.data[Math.floor(s/o)][s%o];i.push(e)},o=0;o<n;o++)r(o);return i}(n))}function Xe(t,e){for(var i={},n=0,r=e;n<r.length;n++){var o=r[n];o in t&&(i[o]=t[o])}return i}var Ye=!1;try{Ye="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}var Ze=[];function Je(){var t=this.src;this.onerror=this.onload=Pt,this.removeAttribute("src"),/^blob\:/.test(t)&&URL.revokeObjectURL(t),this.close=Pt}function $e(){Ze.push(this)}function ti(){return Object.assign(new Image,{crossOrigin:"",close:Je})}function ei(t){return new Promise((function(e,i){var n=ti();n.onload=function(){n.onload=n.onerror=Pt,setTimeout((function(){return e(n)}),30)},n.onerror=function(){var t=n.src;n.onload=n.onerror=Pt,n.close(),i(new Error("image load error: ".concat(t)))},n.src=URL.createObjectURL(t)}))}function ii(t,e){if(e&&(t.width>e.width||t.height>e.height)){var i=function(t,e){var i=Ze.shift();if(i)return i.width=t,i.height=e,i;if(Ye){var n=new OffscreenCanvas(t,e);return Object.assign(n,{close:$e})}return n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),Object.assign(n,{close:$e})}(Math.min(t.width,e.width),Math.min(t.height,e.height)),n=i.getContext("2d");n.clearRect(0,0,i.width,i.height),n.drawImage(t,0,0,i.width,i.height),t.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(t);s.needsUpdate=!0,s.minFilter=r.LinearFilter,s.magFilter=r.LinearFilter,s.flipY=!0;var c=s.dispose;return s.dispose=function(){t.close(),c.call(s),delete s.dispose},s}var ni=new r.WebGLRenderTarget(1,1),ri=new r.OrthographicCamera(-1,1,1,-1,0,1),oi=new r.BufferGeometry;oi.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),oi.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));var ai=new r.Mesh(oi),si=new r.Scene;si.add(ai);var ci,li=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 "}),hi=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 ui(t,e,i){return void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.format&&(t.format=e.format),void 0!==e.encoding&&(t.encoding=e.encoding),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.magFilter&&(t.magFilter=e.magFilter),i?new Promise((function(e){Jt.shared.add((function(){try{var n=i.getRenderTarget();i.setRenderTarget(ni),t instanceof r.CubeTexture?(ai.material=hi,hi.uniforms.map.value=t,i.render(si,ri),hi.uniforms.map.value=null):(ai.material=li,li.uniforms.map.value=t,i.render(si,ri),hi.uniforms.map.value=null),i.setRenderTarget(n),e(t)}catch(i){e(t)}}),!0,1)})):Promise.resolve(t)}var di='\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',pi={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},fi={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},mi=((ci={})[pi.cTFBC1]=fi.COMPRESSED_RGB_S3TC_DXT1_EXT,ci[pi.cTFBC3]=fi.COMPRESSED_RGBA_S3TC_DXT5_EXT,ci),gi=function(){function t(){}return t.setTranscoderPath=function(t){return this.transcoderPath=t,this},t.setWorkerLimit=function(t){return this.workerLimit=t,this},t.isInitialized=function(){return 0!==this.workerPool.filter((function(t){return t._initialized})).length},t.detectSupport=function(e){var i=this.workerConfig;if(i.astcSupported=!!e.extensions.get("WEBGL_compressed_texture_astc"),i.bptcSupported=!!e.extensions.get("EXT_texture_compression_bptc"),i.etcSupported=!!e.extensions.get("WEBGL_compressed_texture_etc1"),i.dxtSupported=!!e.extensions.get("WEBGL_compressed_texture_s3tc"),i.pvrtcSupported=!!e.extensions.get("WEBGL_compressed_texture_pvrtc")||!!e.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),i.astcSupported)i.format=t.BASIS_FORMAT.cTFASTC_4x4;else if(i.bptcSupported)i.format=t.BASIS_FORMAT.cTFBC7_M5;else if(i.dxtSupported)i.format=t.BASIS_FORMAT.cTFBC3;else if(i.pvrtcSupported)i.format=t.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!i.etcSupported)throw new Error("BasisTextureLoader: No suitable compressed texture format found.");i.format=t.BASIS_FORMAT.cTFETC1}return this},t.createTexture=function(t){var e,i,n=this,o=t.byteLength,a=this._allocateWorker(o).then((function(r){return e=r,i=n.workerNextTaskID++,new Promise((function(n,r){e._callbacks[i]={resolve:n,reject:r},e.postMessage({type:"transcode",id:i,buffer:t},[t])}))})).then((function(t){var e,i=n.workerConfig,o=t.width,a=t.height,s=t.mipmaps;switch(t.format){case pi.cTFASTC_4x4:e=new r.CompressedTexture(s,o,a,r.RGBA_ASTC_4x4_Format);break;case pi.cTFBC1:case pi.cTFBC3:e=new r.CompressedTexture(s,o,a,mi[i.format],r.UnsignedByteType);break;case pi.cTFETC1:e=new r.CompressedTexture(s,o,a,r.RGB_ETC1_Format);break;case pi.cTFPVRTC1_4_RGB:e=new r.CompressedTexture(s,o,a,r.RGB_PVRTC_4BPPV1_Format);break;case pi.cTFPVRTC1_4_RGBA:e=new r.CompressedTexture(s,o,a,r.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("BasisTextureLoader: No supported format available.")}return e.minFilter=1===s.length?r.LinearFilter:r.LinearMipmapLinearFilter,e.magFilter=r.LinearFilter,e.generateMipmaps=!1,e.needsUpdate=!0,e}));return a.catch((function(){return!0})).then((function(){e&&i&&(e._taskLoad-=o,delete e._callbacks[i])})),a},t._initTranscoder=function(){var t=this;if(!this.transcoderPending){var e=new r.FileLoader;e.setPath(this.transcoderPath);var i=new Promise((function(t,i){e.load("basis_transcoder.js",t,void 0,i)})),n=new r.FileLoader;n.setPath(this.transcoderPath),n.setResponseType("arraybuffer");var o=new Promise((function(t,e){n.load("basis_transcoder.wasm",t,void 0,e)}));this.transcoderPending=Promise.all([i,o]).then((function(e){var i=e[0],n=e[1],r=["/* basis_transcoder.js */",i,"/* worker */",di].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([r])),t.transcoderBinary=n}))}return this.transcoderPending},t._allocateWorker=function(t){var e=this;return this._initTranscoder().then((function(){if(e.workerPool.length<e.workerLimit){var i=function(t){var e=new Worker(t);return Object.assign(e,{_callbacks:{},_initialized:!1,_taskLoad:0})}(e.workerSourceURL);i._callbacks={},i._initialized=!1,i._taskLoad=0,i.postMessage({type:"init",config:e.workerConfig,transcoderBinary:e.transcoderBinary}),i.onmessage=function(t){var e=t.data;switch(e.type){case"initialized":i._initialized=!0,console.info("BasisTextureLoader: basis loader initialized");break;case"transcode":i._callbacks[e.id].resolve(e);break;case"error":i._callbacks[e.id].reject(e);break;default:console.error('BasisTextureLoader: Unexpected message, "'.concat(e.type,'"'))}},e.workerPool.push(i)}else e.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));var n=e.workerPool[e.workerPool.length-1];return n._taskLoad+=t,n}))},t.prototype.dispose=function(){for(var e=0;e<t.workerPool.length;e++)t.workerPool[e].terminate();return t.workerPool.length=0,this},t.BASIS_FORMAT=pi,t.DXT_FORMAT=fi,t.DXT_FORMAT_MAP=mi,t.transcoderPath="https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/",t.transcoderBinary=null,t.transcoderPending=null,t.workerLimit=1,t.workerPool=[],t.workerNextTaskID=1,t.workerSourceURL="",t.workerConfig={format:null,astcSupported:!1,bptcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1},t}();function vi(t){var e=t.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return e?e[1]:location.protocol}var yi=function(){function t(t){this.timeout=t.timeout,this.allowHosts=t.allowHosts,this.networkSubscribe=t.networkSubscribe}return t.prototype.setAllowHosts=function(t){this.allowHosts=t},t.prototype.setNetworkSubscribe=function(t){this.networkSubscribe=t},t.prototype.load=function(t,i,n,o,a,s){var c;void 0===i&&(i={}),void 0===n&&(n=Pt),void 0===o&&(o=Pt),void 0===a&&(a=Pt);var l=vi(t),h={timeout:this.timeout,allowHosts:this.allowHosts,networkSubscribe:this.networkSubscribe},u=null!==(c=i.viaAjax)&&void 0!==c&&c,d=Gt(t),p=/^https?:$/.test(l),f=/\.basis$/.test(jt(t).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.")):qt(t,e.__assign(e.__assign({},h),{responseType:g}),void 0,void 0,a).then((function(t){return m=t.meta,gi.createTexture(t.body)})).then((function(t){return!1!==i.preInit?ui(t,e.__assign({flipY:!1,encoding:r.sRGBEncoding},Xe(i,["wrapS","wrapT"])),s):t})).then((function(t){var e={meta:m,body:t};return n(e),e})).catch((function(t){return o(t),Promise.reject(t)}))}g="blob";return qt(t,e.__assign(e.__assign({},h),{responseType:g}),void 0,void 0,a).then((function(t){return ei(t.body)})).then((function(t){return ii(t,i.maxSize)})).then((function(t){return!1!==i.preInit?ui(t,e.__assign({flipY:!0,encoding:r.sRGBEncoding},i),s):t})).then((function(t){var e={meta:null,body:t};return n(e),e})).catch((function(t){return o(t),Promise.reject(t)}))}if(f){var v=new Error("cannot load basis texture via image");return o(v),Promise.reject(v)}var y=null,A=ti();return Xt(t,h,void 0,void 0,a,A).then((function(t){return y=t.meta,ii(t.body,i.maxSize)})).then((function(t){return!1!==i.preInit?ui(t,e.__assign({flipY:!0,encoding:r.sRGBEncoding},i),s):t})).then((function(t){var e={meta:y,body:t};return n(e),e})).catch((function(t){return A.close(),o(t),Promise.reject(t)}))},t.prototype.loadCube=function(t,i,n,o,a,s){var c;void 0===i&&(i={}),void 0===n&&(n=Pt),void 0===o&&(o=Pt),void 0===a&&(a=Pt),Array.isArray(t)||(t=[t.right,t.left,t.up,t.down,t.front,t.back]);for(var l={timeout:this.timeout,allowHosts:this.allowHosts,networkSubscribe:this.networkSubscribe},h=[],u=[0,0,0,0,0,0],d=[],p=function(n){var r=t[n],s=vi(r),p=function(t){u[n]=t,a(u.reduce((function(t,e){return t+e}),0)/6)},f=null!==(c=i.viaAjax)&&void 0!==c&&c,m=/^https?:$/.test(s),g=Gt(r),v=/\.basis$/.test(jt(r).split("?")[0]);if(g?f=!0:m||(f=!1),f)if(v){var y="arraybuffer",A=qt(r,e.__assign(e.__assign({},l),{responseType:y}),void 0,void 0,p).then((function(t){return d[n]=t.meta,gi.createTexture(t.body)}));h.push(A)}else{y="blob",A=qt(r,e.__assign(e.__assign({},l),{responseType:y}),void 0,void 0,p).then((function(t){return d[n]=t.meta,ei(t.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=ti();A=Xt(r,l,void 0,void 0,p,b).then((function(t){return d[n]=t.meta,t.body})).catch((function(t){return b.close(),Promise.reject(t)}));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(t){return t[0]instanceof r.CompressedTexture?function(t){var e=new r.CubeTexture(t);e.needsUpdate=!0;var i=e.dispose;return e.dispose=function(){for(var n=0,r=t;n<r.length;n++)r[n].dispose();i.call(e),delete e.dispose},e.isCompressedTexture=!0,e.format=t[0].format,e.minFilter=t[0].minFilter,e.magFilter=t[0].magFilter,e}(t):function(t){var e=new r.CubeTexture(t);e.needsUpdate=!0,e.minFilter=r.LinearFilter,e.magFilter=r.LinearFilter,e.flipY=!1;var i=e.dispose;return e.dispose=function(){for(var n=0,r=t;n<r.length;n++)r[n].close();i.call(e),delete e.dispose},e}(t)})).then((function(t){return!1!==i.preInit?t.isCompressedTexture?ui(t,e.__assign({flipY:!1,encoding:r.sRGBEncoding},Xe(i,["wrapS","wrapT"])),s):ui(t,e.__assign({flipY:!1,encoding:r.sRGBEncoding},i),s):t})).then((function(t){var e={body:t,meta:d};return n(e),e})).catch((function(t){for(var e=0,i=h;e<i.length;e++){i[e].then((function(t){t instanceof r.Texture?t.dispose():t.close()})).catch(Pt)}return o(t),Promise.reject(t)}))},t}();const Ai=o.Reader,xi=o.util,bi=o.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(o.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),wi=bi.Model=(()=>{function t(t){if(this.chunks=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.chunks=xi.emptyArray,t.decode=function(t,e){t instanceof Ai||(t=Ai.create(t));let i=void 0===e?t.len:t.pos+e,n=new bi.Model;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(bi.Chunk.decode(t,t.uint32()));break;default:t.skipType(7&e)}}return n},t})();function Mi(t){var e,i,n=(new r.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);function o(t){var e=t.match(/(group|floor)-?(\d+)/);return e?parseInt(e[2],10):0}function a(t){var e=t.match(/(chunk)-?(\d+)/);return e?parseInt(e[2],10):0}function s(t){return 1e6*o(t.name)+1e3*a(t.name)+function(t){var e=t.match(/(sub)-?(\d+)/);return e?parseInt(e[2],10):0}(t.name)}for(var c=[],l=0,h=(null!==(e=t.chunks)&&void 0!==e?e:[]).sort((function(t,e){return s(t)-s(e)}));l<h.length;l++){var u=o((B=h[l]).name);c[u]||(c[u]=[]),c[u].push(B)}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+=(B=f[v]).vertices.xyz.length/3,m+=B.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 B,L=(B=f[R]).vertices.xyz,D=B.vertices.uvs,O=B.faces.indices,N=L.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=L[3*v],z=L[3*v+1],H=L[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:B.name,chunkName:a(B.name),start:I,count:B.faces.indices.length,texture:null!==(i=B.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,$,tt,et,it,nt,rt,ot,at,st,ct,lt,ht,ut;q=3*_[v],K=3*_[v+1],X=3*_[v+2],Y=M[q],Z=M[q+1],J=M[q+2],$=M[K],tt=M[K+1],et=M[K+2],it=M[X],lt=(rt=M[X+1]-tt)*(ct=J-et)-(ot=M[X+2]-et)*(st=Z-tt),ht=ot*(at=Y-$)-(nt=it-$)*ct,ut=nt*st-rt*at,S[q]+=lt,S[q+1]+=ht,S[q+2]+=ut,S[K]+=lt,S[K+1]+=ht,S[K+2]+=ut,S[X]+=lt,S[X+1]+=ht,S[X+2]+=ut}d.push({floorIndex:p,vertices:M,uvs:E,indices:_,normals:S,groups:T,extents:C})}}return d}function Ei(t,i,n,o){var a=e.__assign({key:"texture.pbm",basisLoaderInitialized:gi.isInitialized()},Xe(i,["format","quality","size","sharpen","mappings"]));return t=i.transform?i.transform(t,a):ie(t,a),new yi({allowHosts:n,networkSubscribe:o}).load(t,{wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,minFilter:r.LinearFilter,maxSize:"number"==typeof a.size?new r.Vector2(a.size,a.size):void 0,preInit:!0}).then((function(t){var e=t.body;return e.needsUpdate=!0,e}))}function Si(t,e,i,n,o,a,s){void 0===o&&(o={});for(var c=[],l=0,h=Mi(t);l<h.length;l++){var u=h[l],d=u.floorIndex,p=u.vertices,f=u.uvs,m=u.indices,g=u.normals,v=u.groups,y=u.extents,A=new r.Box3;A.min.x=y[0],A.min.y=y[1],A.min.z=y[2],A.max.x=y[3],A.max.y=y[4],A.max.z=y[5];var x=new r.BufferGeometry;x.setAttribute("position",new r.BufferAttribute(p,3)),x.setAttribute("uv",new r.BufferAttribute(f,2)),x.setAttribute("normal",new r.BufferAttribute(g,3)),x.setIndex(new r.BufferAttribute(m,1)),x.boundingBox=A,x.boundingSphere=A.getBoundingSphere(new r.Sphere);for(var b=0,w=v;b<w.length;b++){var M=w[b];x.addGroup(M.start,M.count,M.materialIndex)}for(var E=[],S=function(t){var c=i[t.chunkName]||(t.texture?e+t.texture:void 0),l=new me;if(E.push(l),c){var h=void 0;c in o?h=o[c]:(h=Ei(c,n,a,s),o[c]=h),h.then((function(t){l.uniforms.map.value=t,l.uniforms.exposure.value=3.3}),(function(){l.defines.USE_MAP=!1,l.uniforms.diffuse.value=new r.Color(16777215)}))}else l.defines.USE_MAP=!1,l.uniforms.diffuse.value=new r.Color(16777215)},_=0,T=v;_<T.length;_++){S(M=T[_])}var C=new oe(x,E);C.name="model_floor_"+d,C.floorIndex=d,c.push(C)}return{objects:c,texturePromise:Promise.all(Object.keys(o).map((function(t){return o[t].catch(Pt)}))).then(Pt)}}function _i(t,e){return!1!==(t=Object.assign({},t)).autoResize&&(t.size=e>96?Math.min(t.size||1/0,100):e>48?Math.min(t.size||1/0,200):e>24?Math.min(t.size||1/0,400):e>12?Math.min(t.size||1/0,800):Math.min(t.size||1/0,1024)),t}function Ti(t){return 0===t.indexOf("//")||/^[0-9a-z]+\:/i.test(t)}bi.Chunk=(()=>{function t(t){if(t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.vertices=null,t.prototype.faces=null,t.prototype.name="",t.prototype.texture="",t.decode=function(t,e){t instanceof Ai||(t=Ai.create(t));let i=void 0===e?t.len:t.pos+e,n=new bi.Chunk;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.vertices=bi.Vertices.decode(t,t.uint32());break;case 2:n.faces=bi.Faces.decode(t,t.uint32());break;case 3:n.name=t.string();break;case 4:n.texture=t.string();break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("vertices"))throw xi.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw xi.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw xi.ProtocolError("missing required 'name'",{instance:n});return n},t})(),bi.Vertices=(()=>{function t(t){if(this.xyz=[],this.uvs=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.xyz=xi.emptyArray,t.prototype.uvs=xi.emptyArray,t.decode=function(t,e){t instanceof Ai||(t=Ai.create(t));let i=void 0===e?t.len:t.pos+e,n=new bi.Vertices;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.xyz.push(t.float())}else n.xyz.push(t.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.uvs.push(t.float())}else n.uvs.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),bi.Faces=(()=>{function t(t){if(this.indices=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.indices=xi.emptyArray,t.decode=function(t,e){t instanceof Ai||(t=Ai.create(t));let i=void 0===e?t.len:t.pos+e,n=new bi.Faces;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.indices.push(t.uint32())}else n.indices.push(t.uint32());break;default:t.skipType(7&e)}}return n},t})();const Ci=o.Reader,Ii=o.util,Pi=o.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(o.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),Ri=Pi.Model=(()=>{function t(t){if(this.meshes=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.meshes=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Model;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(Pi.Mesh.decode(t,t.uint32()));break;default:t.skipType(7&e)}}return n},t})();function Bi(t){for(var e=[0,0,0],i=0;i<t.attributes.normal.array.length/9;i++)e[0]=t.attributes.normal.array[9*i],e[1]=t.attributes.normal.array[9*i+1],e[2]=t.attributes.normal.array[9*i+2],t.attributes.normal.array[9*i]=t.attributes.normal.array[9*i+6],t.attributes.normal.array[9*i+1]=t.attributes.normal.array[9*i+7],t.attributes.normal.array[9*i+2]=t.attributes.normal.array[9*i+8],t.attributes.normal.array[9*i+6]=e[0],t.attributes.normal.array[9*i+7]=e[1],t.attributes.normal.array[9*i+8]=e[2];for(i=0;i<t.attributes.position.array.length/9;i++)e[0]=t.attributes.position.array[9*i],e[1]=t.attributes.position.array[9*i+1],e[2]=t.attributes.position.array[9*i+2],t.attributes.position.array[9*i]=t.attributes.position.array[9*i+6],t.attributes.position.array[9*i+1]=t.attributes.position.array[9*i+7],t.attributes.position.array[9*i+2]=t.attributes.position.array[9*i+8],t.attributes.position.array[9*i+6]=e[0],t.attributes.position.array[9*i+7]=e[1],t.attributes.position.array[9*i+8]=e[2];for(i=0;i<t.attributes.uv.array.length/6;i++)e[0]=t.attributes.uv.array[6*i],e[1]=t.attributes.uv.array[6*i+1],t.attributes.uv.array[6*i]=t.attributes.uv.array[6*i+4],t.attributes.uv.array[6*i+1]=t.attributes.uv.array[6*i+5],t.attributes.uv.array[6*i+4]=e[0],t.attributes.uv.array[6*i+5]=e[1];t.attributes.normal.needsUpdate=!0,t.attributes.position.needsUpdate=!0,t.attributes.uv.needsUpdate=!0}function Li(t){var e=t.position,i=t.normal,n=t.uv,o=t.uv2,a=t.groups,s=new r.BufferGeometry;s.setAttribute("position",new r.BufferAttribute(new Float32Array(e.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 Di(t,i,n,o,a,s){if(s.hasOwnProperty(t))return s[t];Ti(t=t.split("?")[0])||(t=i+t),0===(t=t.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(t="https:"+t);var c=e.__assign({key:"texture.dome",size:64,basisLoaderInitialized:gi.isInitialized()},Xe(n,["quality","format","sharpen","mappings"]));return s[t=n.transform?n.transform(t,c):ie(t,c)]=a.load(t,{wrapS:r.RepeatWrapping,wrapT:r.RepeatWrapping}).then((function(t){var e=t.body;return o&&e.repeat.copy(o),e.needsUpdate=!0,e.updateMatrix(),e}))}function Oi(t,e,i,n,o){var a=[],s=new me,c=s.uniforms;c.exposure.value=4.3;var l=s.defines;if(l.USE_MAP=!1,l.USE_UV=!1,t.kd&&(c.diffuse.value=(new r.Color).fromArray(t.kd.rgb)),t.mapkd){var h=null;if(t.mapkdrepeat){var u=t.mapkdrepeat.split(/\s+/).map((function(t){return Number(t)})),d=u[0],p=u[1];h=new r.Vector2(d,p)}a.push(Di(t.mapkd,e,i,h,n,o).then((function(t){l.USE_MAP=!0,l.USE_UV=!0,c.map.value=t,c.uvTransform.value=t.matrix,s.needsUpdate=!0})).catch(Pt))}if(t.ks&&(c.specular.value=(new r.Color).fromArray(t.ks.rgb)),t.mapks&&a.push(Di(t.mapks,e,i,null,n,o).then((function(t){c.specularMap.value=t})).catch(Pt)),t.ke&&(c.emissive.value=(new r.Color).fromArray(t.ke.rgb)),t.mapke&&a.push(Di(t.mapke,e,i,null,n,o).then((function(t){c.emissiveMap.value=t})).catch(Pt)),t.norm&&a.push(Di(t.norm,e,i,null,n,o).then((function(t){c.normalMap.value=t})).catch(Pt)),t.mapbump&&a.push(Di(t.mapbump,e,i,null,n,o).then((function(t){c.bumpMap.value=t})).catch(Pt)),t.bump&&a.push(Di(t.bump,e,i,null,n,o).then((function(t){c.bumpMap.value=t})).catch(Pt)),"number"==typeof t.ns&&(c.shininess.value=t.ns),"number"==typeof t.d){var f=t.d;f>0&&f<1&&(s.originOpacity=f,s.opacity=f)}return{material:s,textureReady:Promise.all(a).then(Pt)}}function Ni(t,e,i,n,o){for(var a,s=[],c=[],l=(a=t,Ri.decode(a).meshes),h=new yi({allowHosts:n,networkSubscribe:o}),u=new r.Matrix4,d=new r.Vector3,p=new r.Quaternion,f=new r.Vector3,m={},g=0,v=l;g<v.length;g++){var y=v[g],A=y.name,x=y.chunks,b=y.matrix;if("Ceiling"!==A&&"CeilingDrop"!==A)for(var w=0,M=b;w<M.length;w++){var E=M[w];u.elements=E.elements;var S=new se;S.renderOrder=-3;for(var _=0;_<x.length;_++){var T=Li(x[_].geometry);T.applyMatrix4(u),u.decompose(d,p,f),f.x*f.y*f.z<0&&T.attributes.normal&&T.attributes.position&&T.attributes.uv&&Bi(T);for(var C=[],I=0,P=x[_].material;I<P.length;I++){var R=Oi(P[I],e,i,h,m),B=R.material,L=R.textureReady;c.push(L),C.push(B)}var D=new oe(T,C);D.name="chunk_"+_,S.add(D)}S.floorIndex=0,S.name=A,s.push(S)}}return{objects:s,texturePromise:Promise.all(c).catch(Pt)}}function ki(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}Pi.Mesh=(()=>{function t(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.name="",t.prototype.chunks=Ii.emptyArray,t.prototype.matrix=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Mesh;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.name=t.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Pi.Chunk.decode(t,t.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(Pi.Matrix.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("name"))throw Ii.ProtocolError("missing required 'name'",{instance:n});return n},t})(),Pi.Matrix=(()=>{function t(t){if(this.elements=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.elements=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Matrix;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.elements&&n.elements.length||(n.elements=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.elements.push(t.float())}else n.elements.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),Pi.Chunk=(()=>{function t(t){if(this.material=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.geometry=null,t.prototype.material=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Chunk;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 2:n.geometry=Pi.Geometry.decode(t,t.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(Pi.Material.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("geometry"))throw Ii.ProtocolError("missing required 'geometry'",{instance:n});return n},t})(),Pi.Geometry=(()=>{function t(t){if(this.groups=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.position=null,t.prototype.uv=null,t.prototype.uv2=null,t.prototype.normal=null,t.prototype.groups=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Geometry;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.position=Pi.Position.decode(t,t.uint32());break;case 2:n.uv=Pi.UV.decode(t,t.uint32());break;case 3:n.uv2=Pi.UV.decode(t,t.uint32());break;case 4:n.normal=Pi.Normal.decode(t,t.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(Pi.Group.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("position"))throw Ii.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw Ii.ProtocolError("missing required 'normal'",{instance:n});return n},t})(),Pi.Position=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.array=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Position;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),Pi.UV=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.array=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.UV;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),Pi.Normal=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.array=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Normal;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),Pi.Group=(()=>{function t(t){if(t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.start=0,t.prototype.count=0,t.prototype.materialIndex=0,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Group;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.start=t.uint32();break;case 2:n.count=t.uint32();break;case 3:n.materialIndex=t.uint32();break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("start"))throw Ii.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw Ii.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw Ii.ProtocolError("missing required 'materialIndex'",{instance:n});return n},t})(),Pi.Material=(()=>{function t(t){if(t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.kd=null,t.prototype.ks=null,t.prototype.ke=null,t.prototype.mapkd="",t.prototype.mapks="",t.prototype.mapke="",t.prototype.norm="",t.prototype.mapbump="",t.prototype.bump="",t.prototype.mapd="",t.prototype.ns=0,t.prototype.d=0,t.prototype.tr=0,t.prototype.mapkdrepeat="",t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Material;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:n.kd=Pi.Color.decode(t,t.uint32());break;case 2:n.ks=Pi.Color.decode(t,t.uint32());break;case 3:n.ke=Pi.Color.decode(t,t.uint32());break;case 4:n.mapkd=t.string();break;case 5:n.mapks=t.string();break;case 6:n.mapke=t.string();break;case 7:n.norm=t.string();break;case 8:n.mapbump=t.string();break;case 9:n.bump=t.string();break;case 10:n.mapd=t.string();break;case 11:n.ns=t.float();break;case 12:n.d=t.float();break;case 13:n.tr=t.float();break;case 14:n.mapkdrepeat=t.string();break;default:t.skipType(7&e)}}return n},t})(),Pi.Color=(()=>{function t(t){if(this.rgb=[],t)for(let e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return t.prototype.rgb=Ii.emptyArray,t.decode=function(t,e){t instanceof Ci||(t=Ci.create(t));let i=void 0===e?t.len:t.pos+e,n=new Pi.Color;for(;t.pos<i;){let e=t.uint32();switch(e>>>3){case 1:if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.rgb.push(t.float())}else n.rgb.push(t.float());break;default:t.skipType(7&e)}}return n},t})();const Fi={};function Vi(t,{precision:e=Fi.precision||4}={}){return t=function(t){return Math.round(t/Fi.EPSILON)*Fi.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function zi(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Hi(t,e,i){const n=Fi.EPSILON;i&&(Fi.EPSILON=i);try{if(t===e)return!0;if(zi(t)&&zi(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(!Hi(t[i],e[i]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):!(!Number.isFinite(t)||!Number.isFinite(e))&&Math.abs(t-e)<=Fi.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{Fi.EPSILON=n}}Fi.EPSILON=1e-12,Fi.debug=!1,Fi.precision=4,Fi.printTypes=!1,Fi.printDegrees=!1,Fi.printRowMajor=!0;class Ui extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){get ELEMENTS(){return ki(!1),0}clone(){return(new this.constructor).copy(this)}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}fromArray(t,e=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=t[i+e];return this.check()}to(t){return t===this?this:zi(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toArray(t=[],e=0){for(let i=0;i<this.ELEMENTS;++i)t[e+i]=this[i];return t}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Fi)}formatString(t){let e="";for(let i=0;i<this.ELEMENTS;++i)e+=(i>0?", ":"")+Vi(this[i],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Hi(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,i){void 0===i&&(i=e,e=t,t=this);for(let n=0;n<this.ELEMENTS;++n){const r=t[n];this[n]=r+i*(e[n]-r)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],t[i]),e[i]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if(Array.isArray(t))return this.multiply(t);for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.scale(1/t)}clampScalar(t,e){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],t),e);return this.check()}multiplyByScalar(t){return this.scale(t)}get elements(){return this}check(){if(Fi.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}}function Gi(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function ji(t,e,i=""){if(Fi.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(i," some fields set to invalid numbers'"));return t}const Qi={};function Wi(t,e){Qi[t]||(Qi[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class qi extends Ui{get ELEMENTS(){return ki(!1),0}copy(t){return ki(!1),this}get x(){return this[0]}set x(t){this[0]=Gi(t)}get y(){return this[1]}set y(t){this[1]=Gi(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let i=0;i<this.ELEMENTS;++i){const n=this[i]-t[i];e+=n*n}return Gi(e)}dot(t){let e=0;for(let i=0;i<this.ELEMENTS;++i)e+=this[i]*t[i];return Gi(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ki(t>=0&&t<this.ELEMENTS,"index is out of range"),Gi(this[t])}setComponent(t,e){return ki(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Ki="undefined"!=typeof Float32Array?Float32Array:Array;function Xi(){var t=new Ki(3);return Ki!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Yi(t,e,i){var n=new Ki(3);return n[0]=t,n[1]=e,n[2]=i,n}function Zi(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ji(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[0],s=i[1],c=i[2];return t[0]=r*c-o*s,t[1]=o*a-n*c,t[2]=n*s-r*a,t}function $i(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/a,t[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,t[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,t}function tn(t,e,i){var n=e[0],r=e[1],o=e[2];return t[0]=n*i[0]+r*i[3]+o*i[6],t[1]=n*i[1]+r*i[4]+o*i[7],t[2]=n*i[2]+r*i[5]+o*i[8],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var en=function(t){var e=t[0],i=t[1],n=t[2];return Math.hypot(e,i,n)};function nn(t,e,i){const n=e[0],r=e[1],o=e[2],a=i[3]*n+i[7]*r+i[11]*o||1;return t[0]=(i[0]*n+i[4]*r+i[8]*o)/a,t[1]=(i[1]*n+i[5]*r+i[9]*o)/a,t[2]=(i[2]*n+i[6]*r+i[10]*o)/a,t}Xi();const rn=[0,0,0],on={};class an extends qi{static get ZERO(){return on.ZERO=on.ZERO||Object.freeze(new an(0,0,0,0))}constructor(t=0,e=0,i=0){super(-0,-0,-0),1===arguments.length&&zi(t)?this.copy(t):(Fi.debug&&(Gi(t),Gi(e),Gi(i)),this[0]=t,this[1]=e,this[2]=i)}set(t,e,i){return this[0]=t,this[1]=e,this[2]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Fi.debug&&(Gi(t.x),Gi(t.y),Gi(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Gi(t)}angle(t){return i=t,n=(e=this)[0],r=e[1],o=e[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&&Zi(e,i)/l,Math.acos(Math.min(Math.max(h,-1),1));var e,i,n,r,o,a,s,c,l,h}cross(t){return Ji(this,this,t),this.check()}rotateX({radians:t,origin:e=rn}){var i,n,r,o,a,s;return i=this,r=e,o=t,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:t,origin:e=rn}){var i,n,r,o,a,s;return i=this,r=e,o=t,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:t,origin:e=rn}){var i,n,r,o,a,s;return i=this,r=e,o=t,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(t){return this.transformAsPoint(t)}transformAsPoint(t){return $i(this,this,t),this.check()}transformAsVector(t){return nn(this,this,t),this.check()}transformByMatrix3(t){return tn(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,i){const n=e[0],r=e[1];t[0]=i[0]*n+i[2]*r,t[1]=i[1]*n+i[3]*r,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,i){var n=i[0],r=i[1],o=i[2],a=i[3],s=e[0],c=e[1],l=e[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,t[0]=s+h+p,t[1]=c+u+f,t[2]=l+d+m}(this,this,t),this.check()}}var sn={throttleRequests:!0,maxRequests:5},cn=function(){function t(t){void 0===t&&(t={}),this.props=e.__assign(e.__assign({},sn),t),this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return t.prototype.scheduleRequest=function(t,e){if(void 0===e&&(e=function(){return 0}),!this.props.throttleRequests)return Promise.resolve({done:function(){}});if(this.requestMap.has(t))return this.requestMap.get(t);var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},n=new Promise((function(t){return i.resolve=t}));return this.requestQueue.push(i),this.requestMap.set(t,n),this.issueNewRequests(),n},t.prototype.issueRequest=function(t){var e=this,i=t.identiy,n=t.resolve,r=!1;this.activeRequestCount++,n({done:function(){r||(r=!0,e.requestMap.delete(i),e.activeRequestCount--,e.issueNewRequests())}})},t.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout((function(){return t.issueNewRequestsAsync()}),0))},t.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this.updateAllRequests();for(var e=0;e<t;e++){var i=this.requestQueue.shift();i&&this.issueRequest(i)}}},t.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var i=t[e];this.updateRequest(i)||(t.splice(e,1),this.requestMap.delete(i.identiy),e--)}t.sort((function(t,e){return t.priority-e.priority}))},t.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),!(t.priority<0)||(t.resolve(null),!1)},t}(),ln=function(t,e,i){this.item=t,this.previous=e,this.next=i},hn=function(){function t(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(t.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),t.prototype.add=function(t){var e=new ln(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},t.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},t.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},t.prototype.insert=function(t,e){var i=t.next;t.next=e,this.tail===t?this.tail=e:i.previous=e,e.next=i,e.previous=t,this._length++},t}(),un=function(){function t(){this.list=new hn,this.sentinel=this.list.add("sentinel")}return t.prototype.reset=function(){this.list.splice(this.list.tail,this.sentinel)},t.prototype.touch=function(t){var e=t.cacheNode;e&&this.list.splice(this.sentinel,e)},t.prototype.add=function(t,e){t.cacheNode||(t.cacheNode=this.list.add(t),e&&e(t))},t.prototype.unloadTile=function(t,e){var i=t.cacheNode;i&&(this.list.remove(i),t.cacheNode=void 0,e&&e(t))},t.prototype.unloadTiles=function(t,e){for(var i=this.list.head;i!==this.sentinel&&t();){var n=i.item;i=i.next,this.unloadTile(n,e)}},t}();class dn extends Ui{get ELEMENTS(){return ki(!1),0}get RANK(){return ki(!1),0}toString(){let t="[";if(Fi.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let i=0;i<this.RANK;++i)t+=" ".concat(this[i*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,i){return this[e*this.RANK+t]=Gi(i),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const i=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[i+t];return e}setColumn(t,e){const i=t*this.RANK;for(let t=0;t<this.RANK;++t)this[i+t]=e[t];return this}}function pn(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],m=e[12],g=e[13],v=e[14],y=e[15],A=i[0],x=i[1],b=i[2],w=i[3];return t[0]=A*n+x*s+b*u+w*m,t[1]=A*r+x*c+b*d+w*g,t[2]=A*o+x*l+b*p+w*v,t[3]=A*a+x*h+b*f+w*y,A=i[4],x=i[5],b=i[6],w=i[7],t[4]=A*n+x*s+b*u+w*m,t[5]=A*r+x*c+b*d+w*g,t[6]=A*o+x*l+b*p+w*v,t[7]=A*a+x*h+b*f+w*y,A=i[8],x=i[9],b=i[10],w=i[11],t[8]=A*n+x*s+b*u+w*m,t[9]=A*r+x*c+b*d+w*g,t[10]=A*o+x*l+b*p+w*v,t[11]=A*a+x*h+b*f+w*y,A=i[12],x=i[13],b=i[14],w=i[15],t[12]=A*n+x*s+b*u+w*m,t[13]=A*r+x*c+b*d+w*g,t[14]=A*o+x*l+b*p+w*v,t[15]=A*a+x*h+b*f+w*y,t}function fn(t,e,i){var n=i[0],r=i[1],o=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}!function(){var t,e=(t=new Ki(2),Ki!=Float32Array&&(t[0]=0,t[1]=0),t)}(),function(){var t,e=(t=new Ki(4),Ki!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();const mn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gn=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),vn=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}),yn={};class An extends dn{static get IDENTITY(){return yn.IDENTITY=yn.IDENTITY||Object.freeze(new An(mn)),yn.IDENTITY}static get ZERO(){return yn.ZERO=yn.ZERO||Object.freeze(new An(gn)),yn.ZERO}get INDICES(){return vn}get ELEMENTS(){return 16}get RANK(){return 4}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,i,n,r,o,a,s,c,l,h,u,d,p,f,m){return this[0]=t,this[1]=e,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(t,e,i,n,r,o,a,s,c,l,h,u,d,p,f,m){return this[0]=t,this[1]=r,this[2]=c,this[3]=d,this[4]=e,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(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(mn)}fromQuaternion(t){return function(t,e){var i=e[0],n=e[1],r=e[2],o=e[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;t[0]=1-u-f,t[1]=h+v,t[2]=d-g,t[3]=0,t[4]=h-v,t[5]=1-l-f,t[6]=p+m,t[7]=0,t[8]=d+g,t[9]=p-m,t[10]=1-l-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum({left:t,right:e,bottom:i,top:n,near:r,far:o}){return o===1/0?An._computeInfinitePerspectiveOffCenter(this,t,e,i,n,r):function(t,e,i,n,r,o,a){var s=1/(i-e),c=1/(r-n),l=1/(o-a);t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*c,t[6]=0,t[7]=0,t[8]=(i+e)*s,t[9]=(r+n)*c,t[10]=(a+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*l,t[15]=0}(this,t,e,i,n,r,o),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,i,n,r,o){const a=2*o/(i-e),s=2*o/(r-n),c=(i+e)/(i-e),l=(r+n)/(r-n),h=-2*o;return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=c,t[9]=l,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=h,t[15]=0,t}lookAt(t,e,i){return 1===arguments.length&&({eye:t,center:e,up:i}=t),function(t,e,i,n){var r,o,a,s,c,l,h,u,d,p,f=e[0],m=e[1],g=e[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(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(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),t[0]=r,t[1]=s,t[2]=h,t[3]=0,t[4]=o,t[5]=c,t[6]=u,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(r*f+o*m+a*g),t[13]=-(s*f+c*m+l*g),t[14]=-(h*f+u*m+d*g),t[15]=1)}(this,t,e=e||[0,0,0],i=i||[0,1,0]),this.check()}ortho({left:t,right:e,bottom:i,top:n,near:r=.1,far:o=500}){return function(t,e,i,n,r,o,a){var s=1/(e-i),c=1/(n-r),l=1/(o-a);t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+i)*s,t[13]=(r+n)*c,t[14]=(a+o)*l,t[15]=1}(this,t,e,i,n,r,o),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:i=1,near:n=.1,far:r=500}){if(t>2*Math.PI)throw Error("radians");const o=t/2,a=i*Math.tan(o),s=a*e;return(new An).ortho({left:-s,right:s,bottom:-a,top:a,near:n,far:r})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:i=1,near:n=.1,far:r=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,i,n,r){var o,a=1/Math.tan(e/2);t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0?(o=1/(n-r),t[10]=(r+n)*o,t[14]=2*r*n*o):(t[10]=-1,t[14]=-2*n)}(this,t,i,n,r),this.check()}determinant(){return e=(t=this)[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],(e*a-i*o)*(u*g-d*m)-(e*s-n*o)*(h*g-d*f)+(e*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 t,e,i,n,r,o,a,s,c,l,h,u,d,p,f,m,g}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const i=this.getScale(e||[-0,-0,-0]),n=1/i[0],r=1/i[1],o=1/i[2];return t[0]=this[0]*n,t[1]=this[1]*r,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*r,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*r,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const i=this.getScale(e||[-0,-0,-0]),n=1/i[0],r=1/i[1],o=1/i[2];return t[0]=this[0]*n,t[1]=this[1]*r,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*r,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*r,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var i=e[1],n=e[2],r=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=r,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){var t,e,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 t=this,i=(e=this)[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],m=e[13],g=e[14],v=e[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,t[0]=(s*I-c*C+l*T)*P,t[1]=(r*C-n*I-o*T)*P,t[2]=(m*M-g*w+v*b)*P,t[3]=(d*w-u*M-p*b)*P,t[4]=(c*_-a*I-l*S)*P,t[5]=(i*I-r*_+o*S)*P,t[6]=(g*x-f*M-v*A)*P,t[7]=(h*M-d*x+p*A)*P,t[8]=(a*C-s*_+l*E)*P,t[9]=(n*_-i*C-o*E)*P,t[10]=(f*w-m*x+v*y)*P,t[11]=(u*x-h*w-p*y)*P,t[12]=(s*S-a*T-c*E)*P,t[13]=(i*T-n*S+r*E)*P,t[14]=(m*A-f*b-g*y)*P,t[15]=(h*b-u*A+d*y)*P),this.check()}multiplyLeft(t){return pn(this,t,this),this.check()}multiplyRight(t){return pn(this,this,t),this.check()}rotateX(t){var e,i,n,r,o,a,s,c,l,h,u,d,p;return e=this,i=this,n=t,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!==e&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[4]=a*o+h*r,e[5]=s*o+u*r,e[6]=c*o+d*r,e[7]=l*o+p*r,e[8]=h*o-a*r,e[9]=u*o-s*r,e[10]=d*o-c*r,e[11]=p*o-l*r,this.check()}rotateY(t){var e,i,n,r,o,a,s,c,l,h,u,d,p;return e=this,i=this,n=t,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!==e&&(e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=a*o-h*r,e[1]=s*o-u*r,e[2]=c*o-d*r,e[3]=l*o-p*r,e[8]=a*r+h*o,e[9]=s*r+u*o,e[10]=c*r+d*o,e[11]=l*r+p*o,this.check()}rotateZ(t){var e,i,n,r,o,a,s,c,l,h,u,d,p;return e=this,i=this,n=t,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!==e&&(e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=a*o+h*r,e[1]=s*o+u*r,e[2]=c*o+d*r,e[3]=l*o+p*r,e[4]=h*o-a*r,e[5]=u*o-s*r,e[6]=d*o-c*r,e[7]=p*o-l*r,this.check()}rotateXYZ([t,e,i]){return this.rotateX(t).rotateY(e).rotateZ(i)}rotateAxis(t,e){return function(t,e,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=e[0],c=e[1],l=e[2],h=e[3],u=e[4],d=e[5],p=e[6],f=e[7],m=e[8],g=e[9],v=e[10],y=e[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,t[0]=s*A+u*x+m*b,t[1]=c*A+d*x+g*b,t[2]=l*A+p*x+v*b,t[3]=h*A+f*x+y*b,t[4]=s*w+u*M+m*E,t[5]=c*w+d*M+g*E,t[6]=l*w+p*M+v*E,t[7]=h*w+f*M+y*E,t[8]=s*S+u*_+m*T,t[9]=c*S+d*_+g*T,t[10]=l*S+p*_+v*T,t[11]=h*S+f*_+y*T,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return Array.isArray(t)?fn(this,this,t):fn(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,i){var n,r,o,a,s,c,l,h,u,d,p,f,m=i[0],g=i[1],v=i[2];e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],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]=n*m+s*g+u*v+e[12],t[13]=r*m+c*g+d*v+e[13],t[14]=o*m+l*g+p*v+e[14],t[15]=a*m+h*g+f*v+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(ji(e=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,t}(e||[-0,-0,-0,-0],t,this),4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:i}=t;switch(i){case 2:n=e||[-0,-0],o=this,a=(r=t)[0],s=r[1],n[0]=o[0]*a+o[4]*s+o[12],n[1]=o[1]*a+o[5]*s+o[13],e=n;break;case 3:e=$i(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var n,r,o,a,s;return ji(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=function(t,e,i){const n=e[0],r=e[1],o=i[3]*n+i[7]*r||1;return t[0]=(i[0]*n+i[4]*r)/o,t[1]=(i[1]*n+i[5]*r)/o,t}(e||[-0,-0],t,this);break;case 3:e=nn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ji(e,t.length),e}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,i){return this.identity().translate([t,e,i])}transformPoint(t,e){return Wi("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return Wi("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return Wi("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}var xn=new an,bn=new an,wn=function(){function t(t,e){void 0===t&&(t=[0,0,1]),void 0===e&&(e=0),this.normal=new an,this.distance=-0,this.fromNormalDistance(t,e)}return t.prototype.fromNormalDistance=function(t,e){return this.normal.from(t).normalize(),this.distance=e,this},t.prototype.fromPointNormal=function(t,e){t=xn.from(t),this.normal.from(e).normalize();var i=-this.normal.dot(t);return this.distance=i,this},t.prototype.fromCoefficients=function(t,e,i,n){return this.normal.set(t,e,i),this.distance=n,this},t.prototype.clone=function(){return new t(this.normal,this.distance)},t.prototype.equals=function(t){return this.distance===t.distance&&this.normal.equals(t.normal)},t.prototype.getPointDistance=function(t){return this.normal.dot(t)+this.distance},t.prototype.transform=function(t){var e=bn.copy(this.normal).transformAsVector(t).normalize(),i=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(i,e)},t.prototype.projectPointOntoPlane=function(t,e){void 0===e&&(e=[0,0,0]),t=xn.from(t);var i=this.getPointDistance(t),n=bn.copy(this.normal).scale(i);return t.subtract(n).to(e)},t}(),Mn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),En=[new an([1,0,0]),new an([0,1,0]),new an([0,0,1])],Sn=new an,_n=new an,Tn=function(){function t(t){void 0===t&&(t=[]),this.planes=t}return Object.defineProperty(t,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(t,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),t.prototype.fromBoundingSphere=function(t){this.planes.length=2*En.length;for(var e=t.center,i=t.radius,n=0,r=0,o=En;r<o.length;r++){var a=o[r],s=this.planes[n],c=this.planes[n+1];s||(s=this.planes[n]=new wn),c||(c=this.planes[n+1]=new wn);var l=Sn.copy(a).scale(-i).add(e);s.fromPointNormal(l,a);var h=Sn.copy(a).scale(i).add(e),u=_n.copy(a).negate();c.fromPointNormal(h,u),n+=2}return this},t.prototype.computeVisibility=function(t){for(var e=Mn.INSIDE,i=0,n=this.planes;i<n.length;i++){var r=n[i];switch(t.intersectPlane(r)){case Mn.OUTSIDE:return Mn.OUTSIDE;case Mn.INTERSECTING:e=Mn.INTERSECTING}}return e},t.prototype.computeVisibilityWithPlaneMask=function(e,i){if(i===t.MASK_OUTSIDE||i===t.MASK_INSIDE)return i;for(var n=t.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=e.intersectPlane(s);if(c===Mn.OUTSIDE)return t.MASK_OUTSIDE;c===Mn.INTERSECTING&&(n|=a)}}return n},t}();function Cn(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[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 t[0]=d*n+p*a+f*l,t[1]=d*r+p*s+f*h,t[2]=d*o+p*c+f*u,t[3]=m*n+g*a+v*l,t[4]=m*r+g*s+v*h,t[5]=m*o+g*c+v*u,t[6]=y*n+A*a+x*l,t[7]=y*r+A*s+x*h,t[8]=y*o+A*c+x*u,t}function In(t,e,i){var n=i[0],r=i[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Pn(){var t=new Ki(4);return Ki!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Rn(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t}function Bn(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=i[0],c=i[1],l=i[2],h=i[3];return t[0]=n*h+a*s+r*l-o*c,t[1]=r*h+a*c+o*s-n*l,t[2]=o*h+a*l+n*c-r*s,t[3]=a*h-n*s-r*c-o*l,t}function Ln(t,e,i,n){var r,o,a,s,c,l=e[0],h=e[1],u=e[2],d=e[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),t[0]=s*l+c*p,t[1]=s*h+c*f,t[2]=s*u+c*m,t[3]=s*d+c*g,t}function Dn(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;i=Math.sqrt(e[3*r+r]-e[3*o+o]-e[3*a+a]+1),t[r]=.5*i,i=.5/i,t[3]=(e[3*o+a]-e[3*a+o])*i,t[o]=(e[3*o+r]+e[3*r+o])*i,t[a]=(e[3*a+r]+e[3*r+a])*i}return t}var On,Nn,kn,Fn,Vn=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},zn=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},Hn=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},Un=function(t,e,i,n){var r=e[0],o=e[1],a=e[2],s=e[3];return t[0]=r+n*(i[0]-r),t[1]=o+n*(i[1]-o),t[2]=a+n*(i[2]-a),t[3]=s+n*(i[3]-s),t},Gn=function(t){var e=t[0],i=t[1],n=t[2],r=t[3];return Math.hypot(e,i,n,r)},jn=function(t){var e=t[0],i=t[1],n=t[2],r=t[3];return e*e+i*i+n*n+r*r},Qn=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=i*i+n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=i*a,t[1]=n*a,t[2]=r*a,t[3]=o*a,t},Wn=(On=Xi(),Nn=Yi(1,0,0),kn=Yi(0,1,0),function(t,e,i){var n=Zi(e,i);return n<-.999999?(Ji(On,Nn,e),en(On)<1e-6&&Ji(On,kn,e),function(t,e){var i=e[0],n=e[1],r=e[2],o=i*i+n*n+r*r;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o}(On,On),Rn(t,On,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Ji(On,e,i),t[0]=On[0],t[1]=On[1],t[2]=On[2],t[3]=1+n,Qn(t,t))});Pn(),Pn(),Fn=new Ki(9),Ki!=Float32Array&&(Fn[1]=0,Fn[2]=0,Fn[3]=0,Fn[5]=0,Fn[6]=0,Fn[7]=0),Fn[0]=1,Fn[4]=1,Fn[8]=1;const qn=[0,0,0,1];class Kn extends Ui{constructor(t=0,e=0,i=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,i,n)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,i,n){return this[0]=t,this[1]=e,this[2]=i,this[3]=n,this.check()}fromMatrix3(t){return Dn(this,t),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}fromAxisRotation(t,e){return Rn(this,t,e),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Gi(t)}get y(){return this[1]}set y(t){this[1]=Gi(t)}get z(){return this[2]}set z(t){this[2]=Gi(t)}get w(){return this[3]}set w(t){this[3]=Gi(t)}len(){return Gn(this)}lengthSquared(){return jn(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return Hn(this,t)}rotationTo(t,e){return Wn(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return Vn(this,this,t),this.check()}calculateW(){return function(t,e){var i=e[0],n=e[1],r=e[2];t[0]=i,t[1]=n,t[2]=r,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-r*r))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=i*i+n*n+r*r+o*o,s=a?1/a:0;t[0]=-i*s,t[1]=-n*s,t[2]=-r*s,t[3]=o*s}(this,this),this.check()}lerp(t,e,i){return Un(this,t,e,i),this.check()}multiplyRight(t,e){return ki(!e),Bn(this,this,t),this.check()}multiplyLeft(t,e){return ki(!e),Bn(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,i){i*=.5;var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),c=Math.cos(i);t[0]=n*c+a*s,t[1]=r*c+o*s,t[2]=o*c-r*s,t[3]=a*c-n*s}(this,this,t),this.check()}rotateY(t){return function(t,e,i){i*=.5;var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),c=Math.cos(i);t[0]=n*c-o*s,t[1]=r*c+a*s,t[2]=o*c+n*s,t[3]=a*c-r*s}(this,this,t),this.check()}rotateZ(t){return function(t,e,i){i*=.5;var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),c=Math.cos(i);t[0]=n*c+r*s,t[1]=r*c-n*s,t[2]=o*c+a*s,t[3]=a*c-o*s}(this,this,t),this.check()}scale(t){return zn(this,this,t),this.check()}slerp(t,e,i){switch(arguments.length){case 1:({start:t=qn,target:e,ratio:i}=arguments[0]);break;case 2:[e,i]=arguments,t=this}return Ln(this,t,e,i),this.check()}transformVector4(t,e=t){return function(t,e,i){var n=e[0],r=e[1],o=e[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;t[0]=h*l+p*-a+u*-c-d*-s,t[1]=u*l+p*-s+d*-a-h*-c,t[2]=d*l+p*-c+h*-s-u*-a,t[3]=e[3]}(e,t,this),ji(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t,e){return this.multiplyLeft(t,e)}multiply(t,e){return this.multiplyRight(t,e)}}const Xn=Object.freeze([1,0,0,0,1,0,0,0,1]),Yn=Object.freeze([0,0,0,0,0,0,0,0,0]),Zn=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Jn={};class $n extends dn{static get IDENTITY(){return Jn.IDENTITY=Jn.IDENTITY||Object.freeze(new $n(Xn)),Jn.IDENTITY}static get ZERO(){return Jn.ZERO=Jn.ZERO||Object.freeze(new $n(Yn)),Jn.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Zn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}set(t,e,i,n,r,o,a,s,c){return this[0]=t,this[1]=e,this[2]=i,this[3]=n,this[4]=r,this[5]=o,this[6]=a,this[7]=s,this[8]=c,this.check()}setRowMajor(t,e,i,n,r,o,a,s,c){return this[0]=t,this[1]=n,this[2]=a,this[3]=e,this[4]=r,this[5]=s,this[6]=i,this[7]=o,this[8]=c,this.check()}determinant(){return e=(t=this)[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8],e*(l*o-a*c)+i*(-l*r+a*s)+n*(c*r-o*s);var t,e,i,n,r,o,a,s,c,l}identity(){return this.copy(Xn)}fromQuaternion(t){return function(t,e){var i=e[0],n=e[1],r=e[2],o=e[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;t[0]=1-u-f,t[3]=h-v,t[6]=d+g,t[1]=h+v,t[4]=1-l-f,t[7]=p-m,t[2]=d-g,t[5]=p+m,t[8]=1-l-u}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var i=e[1],n=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=n,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){var i=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=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,t[0]=u*f,t[1]=(-h*n+r*l)*f,t[2]=(s*n-r*a)*f,t[3]=d*f,t[4]=(h*i-r*c)*f,t[5]=(-s*i+r*o)*f,t[6]=p*f,t[7]=(-l*i+n*c)*f,t[8]=(a*i-n*o)*f)}(this,this),this.check()}multiplyLeft(t){return Cn(this,t,this),this.check()}multiplyRight(t){return Cn(this,this,t),this.check()}rotate(t){return function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=Math.sin(i),p=Math.cos(i);t[0]=p*n+d*a,t[1]=p*r+d*s,t[2]=p*o+d*c,t[3]=p*a-d*n,t[4]=p*s-d*r,t[5]=p*c-d*o,t[6]=l,t[7]=h,t[8]=u}(this,this,t),this.check()}scale(t){return Array.isArray(t)?In(this,this,t):In(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=i[0],p=i[1];t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=c,t[6]=d*n+p*a+l,t[7]=d*r+p*s+h,t[8]=d*o+p*c+u}(this,this,t),this.check()}transform(t,e){switch(t.length){case 2:e=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[3]*r+i[6],t[1]=i[1]*n+i[4]*r+i[7],t}(e||[-0,-0],t,this);break;case 3:e=tn(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,i){const n=e[0],r=e[1],o=e[2];return t[0]=i[0]*n+i[3]*r+i[6]*o,t[1]=i[1]*n+i[4]*r+i[7]*o,t[2]=i[2]*n+i[5]*r+i[8]*o,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ji(e,t.length),e}transformVector(t,e){return Wi("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return Wi("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return Wi("Matrix3.transformVector"),this.transform(t,e)}}var tr=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),er=new an,ir=new an,nr=function(){function t(t,e){void 0===t&&(t=[0,0,0]),void 0===e&&(e=0),this.radius=-0,this.center=new an,this.fromCenterRadius(t,e)}return t.prototype.fromCenterRadius=function(t,e){return this.center.from(t),this.radius=e,this},t.prototype.fromCornerPoints=function(t,e){return e=er.from(e),this.center=(new an).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this},t.prototype.equals=function(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius},t.prototype.clone=function(){return new t(this.center,this.radius)},t.prototype.union=function(t){var e=this.center,i=this.radius,n=t.center,r=t.radius,o=er.copy(n).subtract(e),a=o.magnitude();if(i>=a+r)return this.clone();if(r>=a+i)return t.clone();var s=.5*(i+a+r);return ir.copy(o).scale((-i+s)/a).add(e),this.center.copy(ir),this.radius=s,this},t.prototype.expand=function(t){var e=(t=er.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this},t.prototype.transform=function(t){this.center.transform(t);var e=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[4],a=e[5],s=e[6],c=e[8],l=e[9],h=e[10];return t[0]=Math.hypot(i,n,r),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(c,l,h),t}(er,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this},t.prototype.distanceSquaredTo=function(t){var e=this.distanceTo(t);return e*e},t.prototype.distanceTo=function(t){var e=(t=er.from(t)).subtract(this.center);return Math.max(0,e.len()-this.radius)},t.prototype.intersectPlane=function(t){var e=this.center,i=this.radius,n=t.normal.dot(e)+t.distance;return n<-i?tr.OUTSIDE:n<i?tr.INTERSECTING:tr.INSIDE},t}(),rr=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),or=new an,ar=new an,sr=new an,cr=new an,lr=new an,hr=new an,ur=new an,dr=0,pr=1,fr=2,mr=3,gr=4,vr=5,yr=6,Ar=7,xr=8,br=function(){function t(t,e){void 0===t&&(t=[0,0,0]),void 0===e&&(e=[0,0,0,0,0,0,0,0,0]),this.center=(new an).from(t),this.halfAxes=new $n(e)}return Object.defineProperty(t.prototype,"halfSize",{get:function(){var t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new an(t).len(),new an(e).len(),new an(i).len()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quaternion",{get:function(){var t=this.halfAxes.getColumn(0),i=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),r=new an(t).normalize(),o=new an(i).normalize(),a=new an(n).normalize();return(new Kn).fromMatrix3(new $n(e.__spreadArray(e.__spreadArray(e.__spreadArray([],r,!0),o,!0),a,!0)))},enumerable:!1,configurable:!0}),t.prototype.fromCenterHalfSizeQuaternion=function(t,e,i){var n=new Kn(i),r=(new $n).fromQuaternion(n);return r[0]=r[0]*e[0],r[1]=r[1]*e[0],r[2]=r[2]*e[0],r[3]=r[3]*e[1],r[4]=r[4]*e[1],r[5]=r[5]*e[1],r[6]=r[6]*e[2],r[7]=r[7]*e[2],r[8]=r[8]*e[2],this.center=(new an).from(t),this.halfAxes=r,this},t.prototype.clone=function(){return new t(this.center,this.halfAxes)},t.prototype.equals=function(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)},t.prototype.getBoundingSphere=function(t){void 0===t&&(t=new nr);var e=this.halfAxes,i=e.getColumn(0,sr),n=e.getColumn(1,cr),r=e.getColumn(2,lr),o=or.copy(i).add(n).add(r);return t.center.copy(this.center),t.radius=o.magnitude(),t},t.prototype.intersectPlane=function(t){var e=this.center,i=t.normal,n=this.halfAxes,r=i.x,o=i.y,a=i.z,s=Math.abs(r*n[dr]+o*n[pr]+a*n[fr])+Math.abs(r*n[mr]+o*n[gr]+a*n[vr])+Math.abs(r*n[yr]+o*n[Ar]+a*n[xr]),c=i.dot(e)+t.distance;return c<=-s?rr.OUTSIDE:c>=s?rr.INSIDE:rr.INTERSECTING},t.prototype.distanceTo=function(t){return Math.sqrt(this.distanceSquaredTo(t))},t.prototype.distanceSquaredTo=function(t){var e=ar.from(t).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,sr),r=i.getColumn(1,cr),o=i.getColumn(2,lr),a=n.magnitude(),s=r.magnitude(),c=o.magnitude();n.normalize(),r.normalize(),o.normalize();var l,h=0;return(l=Math.abs(e.dot(n))-a)>0&&(h+=l*l),(l=Math.abs(e.dot(r))-s)>0&&(h+=l*l),(l=Math.abs(e.dot(o))-c)>0&&(h+=l*l),h},t.prototype.computePlaneDistances=function(t,e,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,sr),c=a.getColumn(1,cr),l=a.getColumn(2,lr),h=hr.copy(s).add(c).add(l).add(o),u=ur.copy(h).subtract(t),d=e.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(t),d=e.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(t),d=e.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(t),d=e.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(t),d=e.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(t),d=e.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(t),d=e.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(t),d=e.dot(u),n=Math.min(d,n),r=Math.max(d,r),i[0]=n,i[1]=r,i},t.prototype.transform=function(t){this.center.transformAsPoint(t);var i=this.halfAxes.getColumn(0,sr);i.transformAsPoint(t);var n=this.halfAxes.getColumn(1,cr);n.transformAsPoint(t);var r=this.halfAxes.getColumn(2,lr);return r.transformAsPoint(t),this.halfAxes=new $n(e.__spreadArray(e.__spreadArray(e.__spreadArray([],i,!0),n,!0),r,!0)),this},t}();function wr(t,i){if(t.box)return function(t,i){var n=new an(t[0],t[1],t[2]);i.transform(n,n);var r=[];if(10===t.length){var o=t.slice(3,6),a=new Kn;a.fromArray(t,6);var s=new an([1,0,0]),c=new an([0,1,0]),l=new an([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=e.__spreadArray(e.__spreadArray(e.__spreadArray([],s.toArray(),!0),c.toArray(),!0),l.toArray(),!0)}else r=e.__spreadArray(e.__spreadArray(e.__spreadArray([],t.slice(3,6),!0),t.slice(6,9),!0),t.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 $n([h[0],h[1],h[2],u[0],u[1],u[2],d[0],d[1],d[2]]);return new br(n,p)}(t.box,i);throw new Error("3D Tile: boundingVolume must only can be box")}function Mr(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){var i=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor;return function(t,e){var i=t*e;return 1-Math.exp(-i*i)}(e,i)*n}return 0}function Er(t,e,i){var n=new TextDecoder("utf8"),r=new Uint8Array(t,e,i);return n.decode(r)}function Sr(t,e,i){return void 0===i&&(i=0),i=function(t,e,i){void 0===i&&(i=0);var n=t.header,r=n.featureTableJsonByteLength,o=n.featureTableBinaryByteLength,a=n.batchLength;if(t.featureTableJson={BATCH_LENGTH:a||0},r>0){var s=Er(e,i,r);t.featureTableJson=JSON.parse(s)}return i+=r,t.featureTableBinary=new Uint8Array(e,i,o),i+=o}(t,e,i),i=function(t,e,i){void 0===i&&(i=0);var n=t.header,r=n.batchTableJsonByteLength,o=n.batchTableBinaryByteLength;if(r>0){var a=Er(e,i,r);t.batchTableJson=JSON.parse(a),i+=r,o>0&&(t.batchTableBinary=new Uint8Array(e,i,o),t.batchTableBinary=new Uint8Array(t.batchTableBinary),i+=o)}return i}(t,e,i)}function _r(t,e,i){void 0===i&&(i=0);var n=t.byteOffset+t.byteLength-i;if(0===n)throw new Error("glTF byte length must be greater than 0.");return t.rotateYtoZ=!0,t.gltfUpAxis="Y",t.gltfArrayBuffer=function(t,e,i){var n=void 0!==i?new Uint8Array(t).subarray(e,e+i):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}(e,i,n),t.gltfByteOffset=0,t.gltfByteLength=n,i%4==0||console.warn("".concat(t.type,": embedded glb is not aligned to a 4-byte boundary.")),t.byteOffset+t.byteLength}function Tr(t,e,i){i=function(t,e,i){void 0===i&&(i=0);var n=new DataView(e);if(t.magic=n.getUint32(i,!0),i+=4,t.version=n.getUint32(i,!0),i+=4,t.byteLength=n.getUint32(i,!0),i+=4,1!==t.version)throw new Error("3D Tile Version ".concat(t.version," not supported"));return i}(t,e,i),i=function(t,e,i){void 0===i&&(i=0);var n,r=new DataView(e);t.header=t.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.")),t.header.featureTableJsonByteLength=o,t.header.featureTableBinaryByteLength=a,t.header.batchTableJsonByteLength=s,t.header.batchTableBinaryByteLength=c,t.header.batchLength=n,i}(t,e,i),i=_r(t,e,i=Sr(t,e,i));var n=t.featureTableJson.RTC_CENTER;return n&&Number.isFinite(n.byteOffset)&&(t.rtcCenter=new Float32Array(t.featureTableBinary.buffer,t.featureTableBinary.buffer.byteOffset+n.byteOffset,3)),i}var Cr=function(){function t(t,e,i){this.header=e,this.tileset=t,this.parent=i,this.children=[],this.contentState="UNLOADED",this.transform=this.header.transform?new An(this.header.transform.slice()):new An;var n=this.parent&&this.parent.computedTransform?this.parent.computedTransform.clone():t.modelMatrix.clone();this.computedTransform=new An(n).multiplyRight(this.transform),this.boundingVolume=wr(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=Tn.MASK_INDETERMINATE,this.visible=!1,this.selectionDepth=0,this.frameNumber=0,this.touchedFrameNumber=0,this.selectedFrameNumber=0,this.requestedFrameNumber=0}return Object.defineProperty(t.prototype,"id",{get:function(){return this.header.id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refine",{get:function(){return this.header.refine||this.parent&&this.parent.refine||"REPLACE"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.header.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentUrl",{get:function(){if(this.header.content.uri){var t=this.tileset.b3dmMapping.b3dm_base_url;t=/\/$/.test(t)?t:t+"/";var e=this.tileset.b3dmMapping.b3dm_url[this.header.content.uri];e=/^\//.test(e)?e.slice(1):e;var i=/^https?:/.test(e)?e:t+e;if(i.indexOf("http")){var n=i.slice(4);i="https"+n}return i}return this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricType",{get:function(){return this.header.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricValue",{get:function(){return this.header.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasEmptyContent",{get:function(){return!this.header.contentUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selected",{get:function(){return this.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRenderContent",{get:function(){return!this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasChildren",{get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentReady",{get:function(){return"READY"===this.contentState||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentAvailable",{get:function(){return Boolean(this.contentReady&&this.hasRenderContent||!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasUnloadedContent",{get:function(){return this.hasRenderContent&&this.contentUnloaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentUnloaded",{get:function(){return"UNLOADED"===this.contentState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentFailed",{get:function(){return"FAILED"===this.contentState},enumerable:!1,configurable:!0}),t.prototype.getScreenSpaceError=function(t,e){if("TILES3D"===this.tileset.type)return function(t,e,i){var n=t.tileset,r=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,o=i?r:t.lodMetricValue;if(0===o)return 0;var a=Math.max(t.distanceToCamera,1e-7),s=n.options.viewDistanceScale,c=o*e.height*s/(a*e.sseDenominator);return c-Mr(n,a)}(this,t,e);throw new Error("Unsupported tileset type")},t.prototype.getPriority=function(){var t=this.tileset.traverser,e=t.options.skipLevelOfDetail,i="ADD"===this.refine||e;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=t.root?t.root.screenSpaceError:0;return Math.max(o-r,0)},t.prototype.loadContent=function(){var t=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 t.getPriority()})).then((function(e){return e?qt(t.contentUrl,{responseType:"arraybuffer",allowHosts:t.tileset.options.allowHosts,networkSubscribe:t.tileset.options.networkSubscribe}).then((function(t){return t.body})).then((function(t){return Tr(e={byteOffset:0,type:"b3dm"},t,e.byteOffset),e;var e})).then((function(i){return t.content=i,t.tileset.options.contentLoader(t).then((function(){return t.contentState="READY",e.done(),!0}))})).catch((function(i){return t.contentState="FAILED",e.done(),Promise.reject(i)})):(t.contentState="UNLOADED",Promise.resolve(!1))})))},t.prototype.unloadContent=function(){this.content=void 0,this.contentState="UNLOADED"},t.prototype.updateVisibility=function(t){if(this.frameNumber!==t.frameNumber){var e=this.parent,i=e?e.visibilityPlaneMask:Tn.MASK_INDETERMINATE,n=e?e.computedTransform:this.tileset.modelMatrix;this.updateTransform(n),this.distanceToCamera=this.distanceToTile(t),this.screenSpaceError=this.getScreenSpaceError(t,!1),this.visibilityPlaneMask=this.visibility(t,i),this.visible=this.visibilityPlaneMask!==Tn.MASK_OUTSIDE,this.frameNumber=t.frameNumber}},t.prototype.visibility=function(t,e){return t.cullingVolume.computeVisibilityWithPlaneMask(this.boundingVolume,e)},t.prototype.distanceToTile=function(t){return Math.sqrt(Math.max(this.boundingVolume.distanceSquaredTo(t.camera.position),0))},t.prototype.updateTransform=function(t){void 0===t&&(t=new An);var e=t.clone().multiplyRight(this.transform);!e.equals(this.computedTransform)&&(this.computedTransform.copy(e),this.boundingVolume=wr(this.header.boundingVolume,this.computedTransform))},t}(),Ir=function(){function t(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(t.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),t.prototype.get=function(t){return this.array[t]},t.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},t.prototype.delete=function(t){var e=this.map.get(t);void 0!==e&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},t.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},t.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),t},t.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},t.prototype.find=function(t){return this.map.has(t)},t}(),Pr=function(){function t(t){this.options=t,this._traversalStack=new Ir,this._emptyTraversalStack=new Ir,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return t.prototype.traverse=function(t,e){this.root=t,this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)},t.prototype.reset=function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(t,e){var i=this._traversalStack;for(t.selectionDepth=1,i.push(t);i.length>0;){var n=i.pop(),r=!1;if(this.canTraverse(n,e)){this.updateChildTiles(n,e);var o=n.hasRenderContent?n.selectionDepth+1:n.selectionDepth;r=this.updateAndPushChildren(n,e,i,o)}var a=n.parent,s=Boolean(!a||a.shouldRefine),c=!r;n.hasRenderContent?"ADD"===n.refine?(this.loadTile(n,e),this.selectTile(n,e)):"REPLACE"===n.refine&&(this.loadTile(n,e),c&&this.selectTile(n,e)):(this.emptyTiles[n.id]=n,this.loadTile(n,e),c&&this.selectTile(n,e)),this.touchTile(n,e),n.shouldRefine=r&&s}this.options.onTraversalEnd(e)},t.prototype.updateChildTiles=function(t,e){for(var i=0,n=t.children;i<n.length;i++){var r=n[i];this.updateTile(r,e)}return!0},t.prototype.updateAndPushChildren=function(t,e,i,n){var r=this.options,o=r.loadSiblings,a=r.skipLevelOfDetail,s=t.children;s.sort(this.compareDistanceToCamera.bind(this));for(var c="REPLACE"===t.refine&&t.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,e),this.touchTile(p,e)),c){var f=void 0;if(f=p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,e),!(h=h&&f))return!1}}return l||(h=!1),h},t.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e)},t.prototype.selectTile=function(t,e){this.shouldSelectTile(t)&&(t.selectedFrameNumber=e.frameNumber,this.selectedTiles[t.id]=t)},t.prototype.loadTile=function(t,e){this.shouldLoadTile(t)&&(t.requestedFrameNumber=e.frameNumber,this.requestedTiles[t.id]=t)},t.prototype.touchTile=function(t,e){t.tileset.cache.touch(t),t.touchedFrameNumber=e.frameNumber},t.prototype.canTraverse=function(t,e,i,n){return void 0===i&&(i=!1),void 0===n&&(n=!1),!!t.hasChildren&&(!(!n&&!t.visible)&&this.shouldRefine(t,e,i))},t.prototype.shouldLoadTile=function(t){var e=!this.options.maxDepth||t.depth<=this.options.maxDepth;return t.hasUnloadedContent&&e},t.prototype.shouldSelectTile=function(t){var e=!this.options.maxDepth||t.depth<=this.options.maxDepth;return t.contentAvailable&&!this.options.skipLevelOfDetail&&e},t.prototype.shouldRefine=function(t,e,i){var n=t.screenSpaceError;return i&&(n=t.getScreenSpaceError(e,!0)),n>this.options.maxScreenSpaceError},t.prototype.updateTileVisibility=function(t,e){if(t.updateVisibility(e),t.visible){var i=t.children.length>0;this.meetsScreenSpaceErrorEarly(t,e)?t.visible=!1:"REPLACE"!==t.refine||!i||this.anyChildrenVisible(t,e)||(t.visible=!1)}},t.prototype.meetsScreenSpaceErrorEarly=function(t,e){var i=t.parent;return!(!i||"ADD"!==i.refine)&&!this.shouldRefine(t,e,!0)},t.prototype.compareDistanceToCamera=function(t,e){return 0===e.distanceToCamera&&0===t.distanceToCamera?e.centerZDepth-t.centerZDepth:e.distanceToCamera-t.distanceToCamera},t.prototype.anyChildrenVisible=function(t,e){for(var i=!1,n=0,r=t.children;n<r.length;n++){var o=r[n];o.updateVisibility(e),i=i||o.visible}return i},t.prototype.everyChildrenVisibleIsLoaded=function(t){for(var e=!0,i=0,n=t.children;i<n.length;i++){var r=n[i];r.visible&&"READY"!==r.contentState&&(e=!1)}return e},t.prototype.executeEmptyTraversal=function(t,e){var i=!0,n=this._emptyTraversalStack;for(n.push(t);n.length>0&&i;){var r=n.pop();if(this.updateTile(r,e),r.visible||this.loadTile(r,e),this.touchTile(r,e),!r.hasRenderContent&&this.canTraverse(r,e,!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},t}();function Rr(t){for(var e=[],i=0,n=Object.keys(t);i<n.length;i++){var r=n[i];e.push(t[r])}return e}var Br=function(){function t(t,e){var i=this;this.rawJson=t,this.b3dmMapping=t.b3dmMapping,this.options=e,this.traverser=new Pr({loadSiblings:!1,maxScreenSpaceError:this.options.maxScreenSpaceError,skipLevelOfDetail:!1,maxDepth:this.options.maxDepth,onTraversalEnd:function(t){return i.onTraversalEnd(t)}}),this.cache=new un,this.requestScheduler=new cn({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 Cr(this,t.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 Cr(this,s,r);c.depth=r.depth+1,r.children.push(c),n.push(c)}}return Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.options.maxMemoryUsage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asset",{get:function(){return this.rawJson.asset},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.rawJson.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"basePath",{get:function(){return this.rawJson.basePath},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelMatrix",{get:function(){return this.options.modelMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometricError",{get:function(){return this.rawJson.geometricError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricType",{get:function(){return this.rawJson.lodMetricType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodMetricValue",{get:function(){return this.rawJson.lodMetricValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refine",{get:function(){return this.rawJson.root.refine},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tiles",{get:function(){return Rr(this._tiles)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"floorInfo",{get:function(){return this.rawJson.floorInfo||this.rawJson.floor_info||[]},enumerable:!1,configurable:!0}),t.prototype.reset=function(){for(var t=[this.root];t.length>0;){for(var e=t.pop(),i=0,n=e.children;i<n.length;i++){var r=n[i];t.push(r)}this.cache.unloadTile(e),this.unloadTile(e)}this.cache.reset(),this.traverser.reset(),this.selectedTiles=[],this.requestedTiles=[]},t.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},t.prototype.onTraversalEnd=function(t){var e=this,i=new an(t.camera.position);this.selectedTiles=this.options.onTraversalComplete(Rr(this.traverser.selectedTiles)),this.requestedTiles=Rr(this.traverser.requestedTiles).slice().sort((function(t,e){return t.boundingVolume.center.distanceTo(i)-e.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 e.memoryUsageInBytes>1024*e.maxMemoryUsage*1024}),(function(t){return e.unloadTile(t)}))},t.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch((function(i){var n=i.message||i.toString();return console.error("A 3D tile failed to load: ".concat(t.id," ").concat(n)),e.options.onTileError(t,n),!1})).then((function(i){e.pendingCount--,i&&(e.cache.add(t,(function(){t.content&&(e.memoryUsageInBytes+=t.content.byteLength||0)})),e.options.onTileLoad(t))}))},t.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.content&&t.content.byteLength||0,this.options.onTileUnload(t),t.unloadContent()},t}();function Lr(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function Dr(){return(Lr()+Lr()+"-"+Lr()+"-4"+Lr().substr(0,3)+"-"+Lr()+"-"+Lr()+Lr()+Lr()).toLowerCase()}function Or(t,e){var i;return t.content&&(t.contentUrl="".concat(e,"/").concat(t.content.uri||t.content.url)),t.id=null!==(i=t.contentUrl)&&void 0!==i?i:"empty:"+Dr(),t.lodMetricType="geometricError",t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,t.type=t.contentUrl?"SCENEGRAPH":"EMPTY",t.refine=function(t){switch(t){case"REPLACE":case"replace":return"REPLACE";case"ADD":case"add":return"ADD";default:throw new Error("refine ".concat(t," is not supported."))}}(t.refine),t}function Nr(t,e){var i,n=JSON.parse(JSON.stringify(t));return n.basePath=e,n.root=function(t,e){t=Or(t,e);var i=[];for(i.push(t);i.length>0;)for(var n=0,r=(i.pop()||{}).children||[];n<r.length;n++){var o=r[n];Or(o,e),i.push(o)}return t}(n.root,e),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(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"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(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");const e=Object(t);for(let t=1;t<arguments.length;t++){const i=arguments[t];if(null!=i)for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}return e});function kr(){}Object.assign(kr.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var i=this._listeners[t];if(void 0!==i){var n=i.indexOf(e);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var i=e.slice(0),n=0,r=i.length;n<r;n++)i[n].call(this,t)}}}});for(var Fr=[],Vr=0;Vr<256;Vr++)Fr[Vr]=(Vr<16?"0":"")+Vr.toString(16);var zr,Hr={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Fr[255&t]+Fr[t>>8&255]+Fr[t>>16&255]+Fr[t>>24&255]+"-"+Fr[255&e]+Fr[e>>8&255]+"-"+Fr[e>>16&15|64]+Fr[e>>24&255]+"-"+Fr[63&i|128]+Fr[i>>8&255]+"-"+Fr[i>>16&255]+Fr[i>>24&255]+Fr[255&n]+Fr[n>>8&255]+Fr[n>>16&255]+Fr[n>>24&255]).toUpperCase()},clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Hr.DEG2RAD},radToDeg:function(t){return t*Hr.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,n,r){var o=Math.cos,a=Math.sin,s=o(i/2),c=a(i/2),l=o((e+n)/2),h=a((e+n)/2),u=o((e-n)/2),d=a((e-n)/2),p=o((n-e)/2),f=a((n-e)/2);switch(r){case"XYX":t.set(s*h,c*u,c*d,s*l);break;case"YZY":t.set(c*d,s*h,c*u,s*l);break;case"ZXZ":t.set(c*u,c*d,s*h,s*l);break;case"XZX":t.set(s*h,c*f,c*p,s*l);break;case"YXY":t.set(c*p,s*h,c*f,s*l);break;case"ZYZ":t.set(c*f,c*p,s*h,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function Ur(t,e){this.x=t||0,this.y=e||0}function Gr(){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(Ur.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Ur.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.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(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(Gr.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,c){var l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,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(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},extractBasis:function(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.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(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8];return e*o*l-e*a*c-i*r*l+i*a*s+n*r*c-n*o*s},getInverse:function(t,e){void 0!==e&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var i=t.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 t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,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+t,-n*c,n*s,-n*(-c*o+s*a)+a+e,0,0,1)},scale:function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],o=n[3],a=n[6],s=n[1],c=n[4],l=n[7];return n[0]=e*r+i*s,n[3]=e*o+i*c,n[6]=e*a+i*l,n[1]=-i*r+e*s,n[4]=-i*o+e*c,n[7]=-i*a+e*l,this},translate:function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}});var jr={getDataURL:function(t){var e;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===zr&&(zr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),zr.width=t.width,zr.height=t.height;var i=zr.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=zr}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},Qr=0;function Wr(t,e,i,n,r,o,a,s,c,l){Object.defineProperty(this,"id",{value:Qr++}),this.uuid=Hr.generateUUID(),this.name="",this.image=void 0!==t?t:Wr.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Wr.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 Ur(0,0),this.repeat=new Ur(1,1),this.center=new Ur(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gr,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(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function Kr(t,e,i){this.width=t,this.height=e,this.scissor=new qr(0,0,t,e),this.scissorTest=!1,this.viewport=new qr(0,0,t,e),i=i||{},this.texture=new Wr(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=t,this.texture.image.height=e,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 Xr(t,e,i){Kr.call(this,t,e,i),this.samples=4}function Yr(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}Wr.DEFAULT_IMAGE=void 0,Wr.DEFAULT_MAPPING=300,Wr.prototype=Object.assign(Object.create(kr.prototype),{constructor:Wr,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(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.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=Hr.generateUUID()),!e&&void 0===t.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var o=0,a=n.length;o<a;o++)r.push(jr.getDataURL(n[o]))}else r=jr.getDataURL(n);t.images[n.uuid]={uuid:n.uuid,url:r}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Wr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.defineProperties(qr.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(qr.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){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: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*e+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*e+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*e+o[7]*i+o[11]*n+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,o=.01,a=.1,s=t.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;e=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,e),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(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),Kr.prototype=Object.assign(Object.create(kr.prototype),{constructor:Kr,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Xr.prototype=Object.assign(Object.create(Kr.prototype),{constructor:Xr,isWebGLMultisampleRenderTarget:!0,copy:function(t){return Kr.prototype.copy.call(this,t),this.samples=t.samples,this}}),Object.assign(Yr,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,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}}t[e]=s,t[e+1]=c,t[e+2]=l,t[e+3]=h},multiplyQuaternionsFlat:function(t,e,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 t[e]=a*p+l*h+s*d-c*u,t[e+1]=s*p+l*u+c*h-a*d,t[e+2]=c*p+l*d+a*u-s*h,t[e+3]=l*p-a*h-s*u-c*d,t}}),Object.defineProperties(Yr.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(Yr.prototype,{isQuaternion:!0,set:function(t,e,i,n){return this._x=t,this._y=e,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(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,o=t.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!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.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?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-l)*e,this._z=(a-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(h-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+l)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(o-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(a-r)/e,this._x=(o+l)/e,this._y=(c+h)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(Hr.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var n=Math.min(1,e/i);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,l=e._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(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),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-e;return this._w=c*o+e*this._w,this._x=c*i+e*this._x,this._y=c*n+e*this._y,this._z=c*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),h=Math.atan2(l,a),u=Math.sin((1-e)*h)/l,d=Math.sin(e*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(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},fromBufferAttribute:function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var Zr=new $r,Jr=new Yr;function $r(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}Object.assign($r.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jr.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(Jr.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*n-a*i,l=s*i+a*e-r*n,h=s*n+r*i-o*e,u=-r*e-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(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)},projectOnPlane:function(t){return Zr.copy(this).projectOnVector(t),this.sub(Zr)},reflect:function(t){return this.sub(Zr.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Hr.clamp(i,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},setFromMatrix3Column:function(t,e){return this.fromArray(t.elements,3*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var to=new $r,eo=new so,io=new $r(0,0,0),no=new $r(1,1,1),ro=new $r,oo=new $r,ao=new $r;function so(){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(so.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,c,l,h,u,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,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 so).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(t){var e=this.elements,i=t.elements,n=1/to.setFromMatrixColumn(t,0).length(),r=1/to.setFromMatrixColumn(t,1).length(),o=1/to.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.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"===t.order){var u=o*l,d=o*h,p=a*l,f=a*h;e[0]=s*l,e[4]=-s*h,e[8]=c,e[1]=d+p*c,e[5]=u-f*c,e[9]=-a*s,e[2]=f-u*c,e[6]=p+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*l,g=s*h,v=c*l,y=c*h;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*h,e[5]=o*l,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*l,g=s*h,v=c*l,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*l,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){u=o*l,d=o*h,p=a*l,f=a*h;e[0]=s*l,e[4]=p*c-d,e[8]=u*c+f,e[1]=s*h,e[5]=f*c+u,e[9]=d*c-p,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var A=o*s,x=o*c,b=a*s,w=a*c;e[0]=s*l,e[4]=w-A*h,e[8]=b*h+x,e[1]=h,e[5]=o*l,e[9]=-a*l,e[2]=-c*l,e[6]=x*h+b,e[10]=A-w*h}else if("XZY"===t.order){A=o*s,x=o*c,b=a*s,w=a*c;e[0]=s*l,e[4]=-h,e[8]=c*l,e[1]=A*h+w,e[5]=o*l,e[9]=x*h-b,e[2]=b*h-x,e[6]=a*l,e[10]=w*h+A}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(io,t,no)},lookAt:function(t,e,i){var n=this.elements;return ao.subVectors(t,e),0===ao.lengthSq()&&(ao.z=1),ao.normalize(),ro.crossVectors(i,ao),0===ro.lengthSq()&&(1===Math.abs(i.z)?ao.x+=1e-4:ao.z+=1e-4,ao.normalize(),ro.crossVectors(i,ao)),ro.normalize(),oo.crossVectors(ao,ro),n[0]=ro.x,n[4]=oo.x,n[8]=ao.x,n[1]=ro.y,n[5]=oo.y,n[9]=ao.y,n[2]=ro.z,n[6]=oo.z,n[10]=ao.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.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],B=n[14],L=n[3],D=n[7],O=n[11],N=n[15];return r[0]=o*b+a*S+s*I+c*L,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*B+c*N,r[1]=l*b+h*S+u*I+d*L,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*B+d*N,r[2]=p*b+f*S+m*I+g*L,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*B+g*N,r[3]=v*b+y*S+A*I+x*L,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*B+x*N,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],o=t[1],a=t[5],s=t[9],c=t[13],l=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*s*h-n*c*h-r*a*u+i*c*u+n*a*d-i*s*d)+t[7]*(+e*s*d-e*c*u+r*o*u-n*o*d+n*c*l-r*s*l)+t[11]*(+e*c*h-e*a*d-r*o*h+i*o*d+r*a*l-i*c*l)+t[15]*(-n*a*l-e*s*h+e*a*u+n*o*h-i*o*u+i*s*l)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t,e,i){var n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this},getInverse:function(t,e){void 0!==e&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var i=this.elements,n=t.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(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,o=t.x,a=t.y,s=t.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(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var n=this.elements,r=e._x,o=e._y,a=e._z,s=e._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]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},decompose:function(t,e,i){var n=this.elements,r=to.set(n[0],n[1],n[2]).length(),o=to.set(n[4],n[5],n[6]).length(),a=to.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],eo.copy(this);var s=1/r,c=1/o,l=1/a;return eo.elements[0]*=s,eo.elements[1]*=s,eo.elements[2]*=s,eo.elements[4]*=c,eo.elements[5]*=c,eo.elements[6]*=c,eo.elements[8]*=l,eo.elements[9]*=l,eo.elements[10]*=l,e.setFromRotationMatrix(eo),i.x=r,i.y=o,i.z=a,this},makePerspective:function(t,e,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/(e-t),c=2*r/(i-n),l=(e+t)/(e-t),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(t,e,i,n,r,o){var a=this.elements,s=1/(e-t),c=1/(i-n),l=1/(o-r),h=(e+t)*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(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}});var co=new so,lo=new Yr;function ho(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||ho.DefaultOrder}function uo(){this.mask=1}ho.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ho.DefaultOrder="XYZ",Object.defineProperties(ho.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(ho.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,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(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=Hr.clamp,r=t.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(e=e||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: "+e)}return this._order=e,!1!==i&&this._onChangeCallback(),this},setFromQuaternion:function(t,e,i){return co.makeRotationFromQuaternion(t),this.setFromRotationMatrix(co,e,i)},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(t){return lo.setFromEuler(this),this.setFromQuaternion(lo,t)},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new $r(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(uo.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},enableAll:function(){this.mask=-1},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},disableAll:function(){this.mask=0},test:function(t){return 0!=(this.mask&t.mask)}});let po=0;const fo=new $r,mo=new Yr,go=new so,vo=new $r,yo=new $r,Ao=new $r,xo=new Yr,bo=new $r(1,0,0),wo=new $r(0,1,0),Mo=new $r(0,0,1),Eo={type:"added"},So={type:"removed"};function _o(){Object.defineProperty(this,"id",{value:po++}),this.uuid=Hr.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_o.DefaultUp.clone();var t=new $r,e=new ho,i=new Yr,n=new $r(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new so},normalMatrix:{value:new Gr}}),this.matrix=new so,this.matrixWorld=new so,this.matrixAutoUpdate=_o.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new uo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function To(){_o.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}))}_o.DefaultUp=new $r(0,1,0),_o.DefaultMatrixAutoUpdate=!0,_o.prototype=Object.assign(Object.create(kr.prototype),{constructor:_o,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return mo.setFromAxisAngle(t,e),this.quaternion.multiply(mo),this},rotateOnWorldAxis:function(t,e){return mo.setFromAxisAngle(t,e),this.quaternion.premultiply(mo),this},rotateX:function(t){return this.rotateOnAxis(bo,t)},rotateY:function(t){return this.rotateOnAxis(wo,t)},rotateZ:function(t){return this.rotateOnAxis(Mo,t)},translateOnAxis:function(t,e){return fo.copy(t).applyQuaternion(this.quaternion),this.position.add(fo.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(bo,t)},translateY:function(t){return this.translateOnAxis(wo,t)},translateZ:function(t){return this.translateOnAxis(Mo,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(go.getInverse(this.matrixWorld))},lookAt:function(t,e,i){t.isVector3?vo.copy(t):vo.set(t,e,i);var n=this.parent;this.updateWorldMatrix(!0,!1),yo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?go.lookAt(yo,vo,this.up):go.lookAt(vo,yo,this.up),this.quaternion.setFromRotationMatrix(go),n&&(go.extractRotation(n.matrixWorld),mo.setFromRotationMatrix(go),this.quaternion.premultiply(mo.inverse()))},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Eo)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var i=this.children.indexOf(t);return-1!==i&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(So)),this},attach:function(t){return this.updateWorldMatrix(!0,!1),go.getInverse(this.matrixWorld),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),go.multiply(t.parent.matrixWorld)),t.applyMatrix4(go),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new $r),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Yr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(yo,t,Ao),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new $r),this.updateMatrixWorld(!0),this.matrixWorld.decompose(yo,xo,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new $r),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var i=this.parent;if(!0===t&&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===e)for(var n=this.children,r=0,o=n.length;r<o;r++)n[r].updateWorldMatrix(!1,!0)},toJSON:function(t){var e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),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(t.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(t.shapes,l)}else r(t.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(t.materials,this.material[s]));n.material=h}else n.material=r(t.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(t).object)}if(e){var u=m(t.geometries),d=m(t.materials),p=m(t.textures),f=m(t.images);a=m(t.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(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}}),To.prototype=Object.assign(Object.create(_o.prototype),{constructor:To,isScene:!0,copy:function(t,e){return _o.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=_o.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Co=[new $r,new $r,new $r,new $r,new $r,new $r,new $r,new $r],Io=new $r,Po=new Ho,Ro=new $r,Bo=new $r,Lo=new $r,Do=new $r,Oo=new $r,No=new $r,ko=new $r,Fo=new $r,Vo=new $r,zo=new $r;function Ho(t,e){this.min=void 0!==t?t:new $r(1/0,1/0,1/0),this.max=void 0!==e?e:new $r(-1/0,-1/0,-1/0)}function Uo(t,e,i,n,r){var o,a;for(o=0,a=t.length-3;o<=a;o+=3){zo.fromArray(t,o);var s=r.x*Math.abs(zo.x)+r.y*Math.abs(zo.y)+r.z*Math.abs(zo.z),c=e.dot(zo),l=i.dot(zo),h=n.dot(zo);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>s)return!1}return!0}Object.assign(Ho.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var l=t[s],h=t[s+1],u=t[s+2];l<e&&(e=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(e,i,n),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var l=t.getX(s),h=t.getY(s),u=t.getZ(s);l<e&&(e=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(e,i,n),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var i=Io.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.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(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new $r),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new $r),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(t){t.updateWorldMatrix(!1,!1);var e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),Po.copy(e.boundingBox),Po.applyMatrix4(t.matrixWorld),this.union(Po));for(var i=t.children,n=0,r=i.length;n<r;n++)this.expandByObject(i[n]);return this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new $r),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,Io),Io.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return!1;this.getCenter(ko),Fo.subVectors(this.max,ko),Ro.subVectors(t.a,ko),Bo.subVectors(t.b,ko),Lo.subVectors(t.c,ko),Do.subVectors(Bo,Ro),Oo.subVectors(Lo,Bo),No.subVectors(Ro,Lo);var e=[0,-Do.z,Do.y,0,-Oo.z,Oo.y,0,-No.z,No.y,Do.z,0,-Do.x,Oo.z,0,-Oo.x,No.z,0,-No.x,-Do.y,Do.x,0,-Oo.y,Oo.x,0,-No.y,No.x,0];return!!Uo(e,Ro,Bo,Lo,Fo)&&(!!Uo(e=[1,0,0,0,1,0,0,0,1],Ro,Bo,Lo,Fo)&&(Vo.crossVectors(Do,Oo),Uo(e=[Vo.x,Vo.y,Vo.z],Ro,Bo,Lo,Fo)))},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new $r),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Io.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(Io).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()||(Co[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Co[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Co[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Co[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Co[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Co[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Co[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Co[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Co)),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Go=new Ho;function jo(t,e){this.center=void 0!==t?t:new $r,this.radius=void 0!==e?e:-1}Object.assign(jo.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var i=this.center;void 0!==e?i.copy(e):Go.setFromPoints(t).getCenter(i);for(var n=0,r=0,o=t.length;r<o;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new $r),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Ho),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}});var Qo=new $r,Wo=new $r,qo=new $r,Ko=new $r,Xo=new $r,Yo=new $r,Zo=new $r;function Jo(t,e){this.origin=void 0!==t?t:new $r,this.direction=void 0!==e?e:new $r(0,0,-1)}Object.assign(Jo.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new $r),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,Qo)),this},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new $r),e.subVectors(t,this.origin);var i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=Qo.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Qo.copy(this.direction).multiplyScalar(e).add(this.origin),Qo.distanceToSquared(t))},distanceSqToSegment:function(t,e,i,n){Wo.copy(t).add(e).multiplyScalar(.5),qo.copy(e).sub(t).normalize(),Ko.copy(this.origin).sub(Wo);var r,o,a,s,c=.5*t.distanceTo(e),l=-this.direction.dot(qo),h=Ko.dot(this.direction),u=-Ko.dot(qo),d=Ko.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(Wo),a},intersectSphere:function(t,e){Qo.subVectors(t.center,this.origin);var i=Qo.dot(this.direction),n=Qo.dot(Qo)-i*i,r=t.radius*t.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,e):this.at(a,e)},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){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=(t.min.x-u.x)*c,n=(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,n=(t.min.x-u.x)*c),l>=0?(r=(t.min.y-u.y)*l,o=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,o=(t.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=(t.min.z-u.z)*h,s=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,s=(t.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,e)))},intersectsBox:function(t){return null!==this.intersectBox(t,Qo)},intersectTriangle:function(t,e,i,n,r){Xo.subVectors(e,t),Yo.subVectors(i,t),Zo.crossVectors(Xo,Yo);var o,a=this.direction.dot(Zo);if(a>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Ko.subVectors(this.origin,t);var s=o*this.direction.dot(Yo.crossVectors(Ko,Yo));if(s<0)return null;var c=o*this.direction.dot(Xo.cross(Ko));if(c<0)return null;if(s+c>a)return null;var l=-o*Ko.dot(Zo);return l<0?null:this.at(l/a,r)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}});var $o=new $r,ta=new $r,ea=new Gr;function ia(t,e){this.normal=void 0!==t?t:new $r(1,0,0),this.constant=void 0!==e?e:0}Object.assign(ia.prototype,{isPlane:!0,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(t,e,i){var n=$o.subVectors(i,e).cross(ta.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new $r),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new $r);var i=t.delta($o),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:e.copy(i).multiplyScalar(r).add(t.start)},intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new $r),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,e){var i=e||ea.getNormalMatrix(t),n=this.coplanarPoint($o).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}});var na=new $r,ra=new $r,oa=new $r,aa=new $r,sa=new $r,ca=new $r,la=new $r,ha=new $r,ua=new $r,da=new $r;function pa(t,e,i){this.a=void 0!==t?t:new $r,this.b=void 0!==e?e:new $r,this.c=void 0!==i?i:new $r}Object.assign(pa,{getNormal:function(t,e,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new $r),n.subVectors(i,e),na.subVectors(t,e),n.cross(na);var r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)},getBarycoord:function(t,e,i,n,r){na.subVectors(n,e),ra.subVectors(i,e),oa.subVectors(t,e);var o=na.dot(na),a=na.dot(ra),s=na.dot(oa),c=ra.dot(ra),l=ra.dot(oa),h=o*c-a*a;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new $r),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(t,e,i,n){return pa.getBarycoord(t,e,i,n,aa),aa.x>=0&&aa.y>=0&&aa.x+aa.y<=1},getUV:function(t,e,i,n,r,o,a,s){return this.getBarycoord(t,e,i,n,aa),s.set(0,0),s.addScaledVector(r,aa.x),s.addScaledVector(o,aa.y),s.addScaledVector(a,aa.z),s},isFrontFacing:function(t,e,i,n){return na.subVectors(i,e),ra.subVectors(t,e),na.cross(ra).dot(n)<0}}),Object.assign(pa.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return na.subVectors(this.c,this.b),ra.subVectors(this.a,this.b),.5*na.cross(ra).length()},getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new $r),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return pa.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new ia),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return pa.getBarycoord(t,this.a,this.b,this.c,e)},getUV:function(t,e,i,n,r){return pa.getUV(t,this.a,this.b,this.c,e,i,n,r)},containsPoint:function(t){return pa.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return pa.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new $r);var i,n,r=this.a,o=this.b,a=this.c;sa.subVectors(o,r),ca.subVectors(a,r),ha.subVectors(t,r);var s=sa.dot(ha),c=ca.dot(ha);if(s<=0&&c<=0)return e.copy(r);ua.subVectors(t,o);var l=sa.dot(ua),h=ca.dot(ua);if(l>=0&&h<=l)return e.copy(o);var u=s*h-l*c;if(u<=0&&s>=0&&l<=0)return i=s/(s-l),e.copy(r).addScaledVector(sa,i);da.subVectors(t,a);var d=sa.dot(da),p=ca.dot(da);if(p>=0&&d<=p)return e.copy(a);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return n=c/(c-p),e.copy(r).addScaledVector(ca,n);var m=l*p-d*h;if(m<=0&&h-l>=0&&d-p>=0)return la.subVectors(a,o),n=(h-l)/(h-l+(d-p)),e.copy(o).addScaledVector(la,n);var g=1/(m+f+u);return i=f*g,n=u*g,e.copy(r).addScaledVector(sa,i).addScaledVector(ca,n)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}});var fa={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},ma={h:0,s:0,l:0},ga={h:0,s:0,l:0};function va(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function ya(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Aa(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xa(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function ba(t,e,i,n,r,o){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new $r,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new va,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}Object.assign(va.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(t,e,i){if(t=Hr.euclideanModulo(t,1),e=Hr.clamp(e,0,1),i=Hr.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=ya(r,n,t+1/3),this.g=ya(r,n,t),this.b=ya(r,n,t-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){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,e(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,e(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 e(n[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){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 t&&t.length>0?this.setColorName(t):this},setColorName:function(t){var e=fa[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=Aa(t.r),this.g=Aa(t.g),this.b=Aa(t.b),this},copyLinearToSRGB:function(t){return this.r=xa(t.r),this.g=xa(t.g),this.b=xa(t.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(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,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)e=0,i=0;else{var l=a-s;switch(i=c<=.5?l/(a+s):l/(2-a-s),a){case n:e=(r-o)/l+(r<o?6:0);break;case r:e=(o-n)/l+2;break;case o:e=(n-r)/l+4}e/=6}return t.h=e,t.s=i,t.l=c,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,i){return this.getHSL(ma),ma.h+=t,ma.s+=e,ma.l+=i,this.setHSL(ma.h,ma.s,ma.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},lerpHSL:function(t,e){this.getHSL(ma),t.getHSL(ga);var i=Hr.lerp(ma.h,ga.h,e),n=Hr.lerp(ma.s,ga.s,e),r=Hr.lerp(ma.l,ga.l,e);return this.setHSL(i,n,r),this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}}),va.NAMES=fa,Object.assign(ba.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var wa=0;function Ma(){Object.defineProperty(this,"id",{value:wa++}),this.uuid=Hr.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 Ea(t){Ma.call(this),this.type="MeshBasicMaterial",this.color=new va(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(t)}Ma.prototype=Object.assign(Object.create(kr.prototype),{constructor:Ma,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i)if("shading"!==e){var n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' 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: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).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(t).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),e){var r=n(t.textures),o=n(t.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(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ma.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Ea.prototype=Object.create(Ma.prototype),Ea.prototype.constructor=Ea,Ea.prototype.isMeshBasicMaterial=!0,Ea.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};var Sa=new $r;function _a(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function Ta(t,e,i){_a.call(this,new Int8Array(t),e,i)}function Ca(t,e,i){_a.call(this,new Uint8Array(t),e,i)}function Ia(t,e,i){_a.call(this,new Uint8ClampedArray(t),e,i)}function Pa(t,e,i){_a.call(this,new Int16Array(t),e,i)}function Ra(t,e,i){_a.call(this,new Uint16Array(t),e,i)}function Ba(t,e,i){_a.call(this,new Int32Array(t),e,i)}function La(t,e,i){_a.call(this,new Uint32Array(t),e,i)}function Da(t,e,i){_a.call(this,new Float32Array(t),e,i)}function Oa(t,e,i){_a.call(this,new Float64Array(t),e,i)}function Na(){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 ka(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Object.defineProperty(_a.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_a.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new va),e[i++]=o.r,e[i++]=o.g,e[i++]=o.b}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new Ur),e[i++]=o.x,e[i++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new $r),e[i++]=o.x,e[i++]=o.y,e[i++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new qr),e[i++]=o.x,e[i++]=o.y,e[i++]=o.z,e[i++]=o.w}return this},applyMatrix3:function(t){for(var e=0,i=this.count;e<i;e++)Sa.x=this.getX(e),Sa.y=this.getY(e),Sa.z=this.getZ(e),Sa.applyMatrix3(t),this.setXYZ(e,Sa.x,Sa.y,Sa.z);return this},applyMatrix4:function(t){for(var e=0,i=this.count;e<i;e++)Sa.x=this.getX(e),Sa.y=this.getY(e),Sa.z=this.getZ(e),Sa.applyMatrix4(t),this.setXYZ(e,Sa.x,Sa.y,Sa.z);return this},applyNormalMatrix:function(t){for(var e=0,i=this.count;e<i;e++)Sa.x=this.getX(e),Sa.y=this.getY(e),Sa.z=this.getZ(e),Sa.applyNormalMatrix(t),this.setXYZ(e,Sa.x,Sa.y,Sa.z);return this},transformDirection:function(t){for(var e=0,i=this.count;e<i;e++)Sa.x=this.getX(e),Sa.y=this.getY(e),Sa.z=this.getZ(e),Sa.transformDirection(t),this.setXYZ(e,Sa.x,Sa.y,Sa.z);return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,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}}}),Ta.prototype=Object.create(_a.prototype),Ta.prototype.constructor=Ta,Ca.prototype=Object.create(_a.prototype),Ca.prototype.constructor=Ca,Ia.prototype=Object.create(_a.prototype),Ia.prototype.constructor=Ia,Pa.prototype=Object.create(_a.prototype),Pa.prototype.constructor=Pa,Ra.prototype=Object.create(_a.prototype),Ra.prototype.constructor=Ra,Ba.prototype=Object.create(_a.prototype),Ba.prototype.constructor=Ba,La.prototype=Object.create(_a.prototype),La.prototype.constructor=La,Da.prototype=Object.create(_a.prototype),Da.prototype.constructor=Da,Oa.prototype=Object.create(_a.prototype),Oa.prototype.constructor=Oa,Object.assign(Na.prototype,{computeGroups:function(t){for(var e,i=[],n=void 0,r=t.faces,o=0;o<r.length;o++){var a=r[o];a.materialIndex!==n&&(n=a.materialIndex,void 0!==e&&(e.count=3*o-e.start,i.push(e)),e={start:3*o,materialIndex:n})}void 0!==e&&(e.count=3*o-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,i=t.faces,n=t.vertices,r=t.faceVertexUvs,o=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var l=0;l<c;l++)e[l]={name:s[l].name,data:[]};this.morphTargets.position=e}var h,u=t.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=t.skinIndices,f=t.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 Ur,new Ur,new Ur));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 Ur,new Ur,new Ur));for(var M=0;M<c;M++){var E=s[M].vertices;e[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(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}});var Fa=1,Va=new so,za=new _o,Ha=new $r,Ua=new Ho,Ga=new Ho,ja=new $r;function Qa(){Object.defineProperty(this,"id",{value:Fa+=2}),this.uuid=Hr.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={}}Qa.prototype=Object.assign(Object.create(kr.prototype),{constructor:Qa,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(ka(t)>65535?La:Ra)(t,1):this.index=t},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new Gr).getNormalMatrix(t);i.applyNormalMatrix(n),i.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Va.makeRotationX(t),this.applyMatrix4(Va),this},rotateY:function(t){return Va.makeRotationY(t),this.applyMatrix4(Va),this},rotateZ:function(t){return Va.makeRotationZ(t),this.applyMatrix4(Va),this},translate:function(t,e,i){return Va.makeTranslation(t,e,i),this.applyMatrix4(Va),this},scale:function(t,e,i){return Va.makeScale(t,e,i),this.applyMatrix4(Va),this},lookAt:function(t){return za.lookAt(t),za.updateMatrix(),this.applyMatrix4(za.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ha).negate(),this.translate(Ha.x,Ha.y,Ha.z),this},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new Da(3*e.vertices.length,3),n=new Da(3*e.colors.length,3);if(this.setAttribute("position",i.copyVector3sArray(e.vertices)),this.setAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Da(e.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Da(e,3)),this},updateFromObject:function(t){var e,i=t.geometry;if(t.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!==(e=this.attributes.position)&&(e.copyVector3sArray(i.vertices),e.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(i.normals),e.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(i.colors),e.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(i.uvs),e.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(i.lineDistances),e.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(t.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Na).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.setAttribute("position",new _a(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.setAttribute("normal",new _a(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.setAttribute("color",new _a(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new _a(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new _a(o,2).copyVector2sArray(t.uvs2))}for(var a in this.groups=t.groups,t.morphTargets){for(var s=[],c=t.morphTargets[a],l=0,h=c.length;l<h;l++){var u=c[l],d=new Da(3*u.data.length,3);d.name=u.name,s.push(d.copyVector3sArray(u.data))}this.morphAttributes[a]=s}if(t.skinIndices.length>0){var p=new Da(4*t.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var f=new Da(4*t.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ho);var t=this.attributes.position,e=this.morphAttributes.position;if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var i=0,n=e.length;i<n;i++){var r=e[i];Ua.setFromBufferAttribute(r),this.morphTargetsRelative?(ja.addVectors(this.boundingBox.min,Ua.min),this.boundingBox.expandByPoint(ja),ja.addVectors(this.boundingBox.max,Ua.max),this.boundingBox.expandByPoint(ja)):(this.boundingBox.expandByPoint(Ua.min),this.boundingBox.expandByPoint(Ua.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 jo);var t=this.attributes.position,e=this.morphAttributes.position;if(t){var i=this.boundingSphere.center;if(Ua.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var o=e[n];Ga.setFromBufferAttribute(o),this.morphTargetsRelative?(ja.addVectors(Ua.min,Ga.min),Ua.expandByPoint(ja),ja.addVectors(Ua.max,Ga.max),Ua.expandByPoint(ja)):(Ua.expandByPoint(Ga.min),Ua.expandByPoint(Ga.max))}Ua.getCenter(i);var a=0;for(n=0,r=t.count;n<r;n++)ja.fromBufferAttribute(t,n),a=Math.max(a,i.distanceToSquared(ja));if(e)for(n=0,r=e.length;n<r;n++){o=e[n];for(var s=this.morphTargetsRelative,c=0,l=o.count;c<l;c++)ja.fromBufferAttribute(o,c),s&&(Ha.fromBufferAttribute(t,c),ja.add(Ha)),a=Math.max(a,i.distanceToSquared(ja))}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 t=this.index,e=this.attributes;if(e.position){var i=e.position.array;if(void 0===e.normal)this.setAttribute("normal",new _a(new Float32Array(i.length),3));else for(var n=e.normal.array,r=0,o=n.length;r<o;r++)n[r]=0;var a,s,c,l=e.normal.array,h=new $r,u=new $r,d=new $r,p=new $r,f=new $r;if(t){var m=t.array;for(r=0,o=t.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(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=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!==t.attributes[n])for(var r=i[n].array,o=t.attributes[n],a=o.array,s=o.itemSize*e,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.",t)},normalizeNormals:function(){for(var t=this.attributes.normal,e=0,i=t.count;e<i;e++)ja.x=t.getX(e),ja.y=t.getY(e),ja.z=t.getZ(e),ja.normalize(),t.setXYZ(e,ja.x,ja.y,ja.z)},toNonIndexed:function(){function t(t,e){for(var i=t.array,n=t.itemSize,r=t.normalized,o=new i.constructor(e.length*n),a=0,s=0,c=0,l=e.length;c<l;c++){a=e[c]*n;for(var h=0;h<n;h++)o[s++]=i[a++]}return new _a(o,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Qa,i=this.index.array,n=this.attributes;for(var r in n){var o=t(n[r],i);e.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=t(c[l],i);s.push(o)}e.morphAttributes[r]=s}e.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,d=(l=0,u.length);l<d;l++){var p=u[l];e.addGroup(p.start,p.count,p.materialIndex)}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;null!==n&&(t.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),t.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&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t},clone:function(){return(new Qa).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var o=t.attributes;for(e in o){var a=o[e];this.setAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],l=s[e];for(i=0,n=l.length;i<n;i++)c.push(l[i].clone());this.morphAttributes[e]=c}this.morphTargetsRelative=t.morphTargetsRelative;var h=t.groups;for(i=0,n=h.length;i<n;i++){var u=h[i];this.addGroup(u.start,u.count,u.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Wa=new so,qa=new Jo,Ka=new jo,Xa=new $r,Ya=new $r,Za=new $r,Ja=new $r,$a=new $r,ts=new $r,es=new $r,is=new $r,ns=new $r,rs=new Ur,os=new Ur,as=new Ur,ss=new $r,cs=new $r;function ls(t,e){_o.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Qa,this.material=void 0!==e?e:new Ea,this.updateMorphTargets()}function hs(t,e,i,n,r,o,a,s){if(null===(1===e.side?n.intersectTriangle(a,o,r,!0,s):n.intersectTriangle(r,o,a,2!==e.side,s)))return null;cs.copy(s),cs.applyMatrix4(t.matrixWorld);var c=i.ray.origin.distanceTo(cs);return c<i.near||c>i.far?null:{distance:c,point:cs.clone(),object:t}}function us(t,e,i,n,r,o,a,s,c,l,h,u){Xa.fromBufferAttribute(r,l),Ya.fromBufferAttribute(r,h),Za.fromBufferAttribute(r,u);var d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){es.set(0,0,0),is.set(0,0,0),ns.set(0,0,0);for(var p=0,f=o.length;p<f;p++){var m=d[p],g=o[p];0!==m&&(Ja.fromBufferAttribute(g,l),$a.fromBufferAttribute(g,h),ts.fromBufferAttribute(g,u),a?(es.addScaledVector(Ja,m),is.addScaledVector($a,m),ns.addScaledVector(ts,m)):(es.addScaledVector(Ja.sub(Xa),m),is.addScaledVector($a.sub(Ya),m),ns.addScaledVector(ts.sub(Za),m)))}Xa.add(es),Ya.add(is),Za.add(ns)}t.isSkinnedMesh&&(t.boneTransform(l,Xa),t.boneTransform(h,Ya),t.boneTransform(u,Za));var v=hs(t,e,i,n,Xa,Ya,Za,ss);if(v){s&&(rs.fromBufferAttribute(s,l),os.fromBufferAttribute(s,h),as.fromBufferAttribute(s,u),v.uv=pa.getUV(ss,Xa,Ya,Za,rs,os,as,new Ur)),c&&(rs.fromBufferAttribute(c,l),os.fromBufferAttribute(c,h),as.fromBufferAttribute(c,u),v.uv2=pa.getUV(ss,Xa,Ya,Za,rs,os,as,new Ur));var y=new ba(l,h,u);pa.getNormal(Xa,Ya,Za,y.normal),v.face=y}return v}ls.prototype=Object.assign(Object.create(_o.prototype),{constructor:ls,isMesh:!0,copy:function(t){return _o.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,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={},t=0,e=a.length;t<e;t++)i=a[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}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(t,e){var i,n=this.geometry,r=this.material,o=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),Ka.copy(n.boundingSphere),Ka.applyMatrix4(o),!1!==t.ray.intersectsSphere(Ka)&&(Wa.getInverse(o),qa.copy(t.ray).applyMatrix4(Wa),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=us(this,f,t,qa,g,v,y,A,x,a,s,c))&&(i.faceIndex=Math.floor(h/3),i.face.materialIndex=p.materialIndex,e.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=us(this,r,t,qa,g,v,y,A,x,a,s,c))&&(i.faceIndex=Math.floor(l/3),e.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=us(this,f,t,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,e.push(i));else for(l=Math.max(0,w.start),u=Math.min(g.count,w.start+w.count);l<u;l+=3)(i=us(this,r,t,qa,g,v,y,A,x,a=l,s=l+1,c=l+2))&&(i.faceIndex=Math.floor(l/3),e.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,B=I.length;R<B;R++){var L=I[R],D=T?r[L.materialIndex]:r;if(void 0!==D&&(M=C[L.a],E=C[L.b],S=C[L.c],i=hs(this,D,t,qa,M,E,S,ss))){if(_&&_[R]){var O=_[R];rs.copy(O[0]),os.copy(O[1]),as.copy(O[2]),i.uv=pa.getUV(ss,M,E,S,rs,os,as,new Ur)}i.face=L,i.faceIndex=R,e.push(i)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var ds=0,ps=new so,fs=new _o,ms=new $r;function gs(){Object.defineProperty(this,"id",{value:ds+=2}),this.uuid=Hr.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}gs.prototype=Object.assign(Object.create(kr.prototype),{constructor:gs,isGeometry:!0,applyMatrix4:function(t){for(var e=(new Gr).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){this.vertices[i].applyMatrix4(t)}for(i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(e).normalize();for(var o=0,a=r.vertexNormals.length;o<a;o++)r.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return ps.makeRotationX(t),this.applyMatrix4(ps),this},rotateY:function(t){return ps.makeRotationY(t),this.applyMatrix4(ps),this},rotateZ:function(t){return ps.makeRotationZ(t),this.applyMatrix4(ps),this},translate:function(t,e,i){return ps.makeTranslation(t,e,i),this.applyMatrix4(ps),this},scale:function(t,e,i){return ps.makeScale(t,e,i),this.applyMatrix4(ps),this},lookAt:function(t){return fs.lookAt(t),fs.updateMatrix(),this.applyMatrix4(fs.matrix),this},fromBufferGeometry:function(t){var e=this,i=null!==t.index?t.index.array:void 0,n=t.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)e.vertices.push((new $r).fromArray(r,l)),void 0!==a&&e.colors.push((new va).fromArray(a,l));function h(t,i,n,r){var l=void 0===a?[]:[e.colors[t].clone(),e.colors[i].clone(),e.colors[n].clone()],h=new ba(t,i,n,void 0===o?[]:[(new $r).fromArray(o,3*t),(new $r).fromArray(o,3*i),(new $r).fromArray(o,3*n)],l,r);e.faces.push(h),void 0!==s&&e.faceVertexUvs[0].push([(new Ur).fromArray(s,2*t),(new Ur).fromArray(s,2*i),(new Ur).fromArray(s,2*n)]),void 0!==c&&e.faceVertexUvs[1].push([(new Ur).fromArray(c,2*t),(new Ur).fromArray(c,2*i),(new Ur).fromArray(c,2*n)])}var u=t.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!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ms).negate(),this.translate(ms.x,ms.y,ms.z),this},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new so;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){for(var t=new $r,e=new $r,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];t.subVectors(s,a),e.subVectors(o,a),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e,i,n,r,o,a;for(void 0===t&&(t=!0),a=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)a[e]=new $r;if(t){var s,c,l,h=new $r,u=new $r;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(e=0,i=this.vertices.length;e<i;e++)a[e].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 t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(i=this.faces[t]).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 t,e,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=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var o=new gs;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var a=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)c=new $r,l={a:new $r,b:new $r,c:new $r},a.push(c),s.push(l)}var c,l,h=this.morphNormals[t];for(o.vertices=this.morphTargets[t].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 Ho),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new jo),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(t&&t.isGeometry){var n,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,l=this.colors,h=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new Gr).getNormalMatrix(e));for(var u=0,d=a.length;u<d;u++){var p=a[u].clone();void 0!==e&&p.applyMatrix4(e),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 ba(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=t.faceVertexUvs.length;u<d;u++){var w=t.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.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,i,n,r,o,a,s,c={},l=[],h=[],u=Math.pow(10,4);for(i=0,n=this.vertices.length;i<n;i++)t=this.vertices[i],void 0===c[e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u)]?(c[e]=i,l.push(this.vertices[i]),h[i]=l.length-1):h[i]=h[c[e]];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(t){this.vertices=[];for(var e=0,i=t.length;e<i;e++){var n=t[e];this.vertices.push(new $r(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,i=0;i<e;i++)t[i]._id=i;t.sort((function(t,e){return t.materialIndex-e.materialIndex}));var n,r,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];o&&o.length===e&&(n=[]),a&&a.length===e&&(r=[]);for(i=0;i<e;i++){var s=t[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 t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}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(t,e,i){return i?t|1<<e:t&~(1<<e)}function E(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]||(c[e]=s.length/3,s.push(t.x,t.y,t.z)),c[e]}function S(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==h[e]||(h[e]=l.length,l.push(t.getHex())),h[e]}function _(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]||(d[e]=u.length/2,u.push(t.x,t.y)),d[e]}return t.data={},t.data.vertices=n,t.data.normals=s,l.length>0&&(t.data.colors=l),u.length>0&&(t.data.uvs=[u]),t.data.faces=a,t},clone:function(){return(new gs).copy(this)},copy:function(t){var e,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=t.name;var s=t.vertices;for(e=0,i=s.length;e<i;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,i=c.length;e<i;e++)this.colors.push(c[e].clone());var l=t.faces;for(e=0,i=l.length;e<i;e++)this.faces.push(l[e].clone());for(e=0,i=t.faceVertexUvs.length;e<i;e++){var h=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),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[e].push(d)}}var f=t.morphTargets;for(e=0,i=f.length;e<i;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,r=f[e].vertices.length;n<r;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,r=f[e].normals.length;n<r;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,i=g.length;e<i;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],n=0,r=g[e].vertexNormals.length;n<r;n++){var y=g[e].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[e].faceNormals)for(v.faceNormals=[],n=0,r=g[e].faceNormals.length;n<r;n++)v.faceNormals.push(g[e].faceNormals[n].clone());this.morphNormals.push(v)}var x=t.skinWeights;for(e=0,i=x.length;e<i;e++)this.skinWeights.push(x[e].clone());var b=t.skinIndices;for(e=0,i=b.length;e<i;e++)this.skinIndices.push(b[e].clone());var w=t.lineDistances;for(e=0,i=w.length;e<i;e++)this.lineDistances.push(w[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class vs extends Qa{constructor(t,e,i,n,r,o){super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o};const a=this;t=t||1,e=e||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(t,e,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 $r;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[t]=u*n,T[e]=a*r,T[i]=w,c.push(T.x,T.y,T.z),T[t]=0,T[e]=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 t=0;t<g;t++)for(let e=0;e<m;e++){const i=u+e+M*t,n=u+e+M*(t+1),r=u+(e+1)+M*(t+1),o=u+(e+1)+M*t;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,e,t,o,r,0),p("z","y","x",1,-1,i,e,-t,o,r,1),p("x","z","y",1,1,t,i,e,n,o,2),p("x","z","y",1,-1,t,i,-e,n,o,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(s),this.setAttribute("position",new Da(c,3)),this.setAttribute("normal",new Da(l,3)),this.setAttribute("uv",new Da(h,2))}}function ys(t){var e={};for(var i in t)for(var n in e[i]={},t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}return e}function As(t){for(var e={},i=0;i<t.length;i++){var n=ys(t[i]);for(var r in n)e[r]=n[r]}return e}var xs={clone:ys,merge:As};function bs(t){Ma.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!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function ws(){_o.call(this),this.type="Camera",this.matrixWorldInverse=new so,this.projectionMatrix=new so,this.projectionMatrixInverse=new so}function Ms(t,e,i,n){ws.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t: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!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}bs.prototype=Object.create(Ma.prototype),bs.prototype.constructor=bs,bs.prototype.isShaderMaterial=!0,bs.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ys(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this},bs.prototype.toJSON=function(t){var e=Ma.prototype.toJSON.call(this,t);for(var i in e.uniforms={},this.uniforms){var n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var r={};for(var o in this.extensions)!0===this.extensions[o]&&(r[o]=!0);return Object.keys(r).length>0&&(e.extensions=r),e},ws.prototype=Object.assign(Object.create(_o.prototype),{constructor:ws,isCamera:!0,copy:function(t,e){return _o.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new $r),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){_o.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(t,e){_o.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Ms.prototype=Object.assign(Object.create(ws.prototype),{constructor:Ms,isPerspectiveCamera:!0,copy:function(t,e){return ws.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Hr.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Hr.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Hr.RAD2DEG*Math.atan(Math.tan(.5*Hr.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(t,e,i,n,r,o){this.aspect=t/e,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=t,this.view.fullHeight=e,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 t=this.near,e=t*Math.tan(.5*Hr.DEG2RAD*this.fov)/this.zoom,i=2*e,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,e-=o.offsetY*i/s,n*=o.width/a,i*=o.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=_o.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});function Es(t,e,i){if(_o.call(this),this.type="CubeCamera",!0===i.isWebGLCubeRenderTarget){this.renderTarget=i;var n=new Ms(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new $r(1,0,0)),this.add(n);var r=new Ms(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new $r(-1,0,0)),this.add(r);var o=new Ms(90,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new $r(0,1,0)),this.add(o);var a=new Ms(90,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new $r(0,-1,0)),this.add(a);var s=new Ms(90,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new $r(0,0,1)),this.add(s);var c=new Ms(90,1,t,e);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new $r(0,0,-1)),this.add(c),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var l=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;var u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,o),t.setRenderTarget(i,3),t.render(e,a),t.setRenderTarget(i,4),t.render(e,s),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,c),t.setRenderTarget(h),t.xr.enabled=l},this.clear=function(t,e,n,r){for(var o=t.getRenderTarget(),a=0;a<6;a++)t.setRenderTarget(i,a),t.clear(e,n,r);t.setRenderTarget(o)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function Ss(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),Kr.call(this,t,t,e)}function _s(t,e,i,n,r,o,a,s,c,l,h,u){Wr.call(this,null,o,a,s,c,l,n,r,h,u),this.image={data:t||null,width:e||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}Es.prototype=Object.create(_o.prototype),Es.prototype.constructor=Es,Ss.prototype=Object.create(Kr.prototype),Ss.prototype.constructor=Ss,Ss.prototype.isWebGLCubeRenderTarget=!0,Ss.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=e.format,this.texture.encoding=e.encoding;var i=new To,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 bs({type:"CubemapFromEquirect",uniforms:ys(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;var o=new ls(new vs(5,5,5),r);return i.add(o),new Es(1,10,this).update(t,i),o.geometry.dispose(),o.material.dispose(),this},_s.prototype=Object.create(Wr.prototype),_s.prototype.constructor=_s,_s.prototype.isDataTexture=!0;var Ts=new jo,Cs=new $r;function Is(t,e,i,n,r,o){this.planes=[void 0!==t?t:new ia,void 0!==e?e:new ia,void 0!==i?i:new ia,void 0!==n?n:new ia,void 0!==r?r:new ia,void 0!==o?o:new ia]}Object.assign(Is.prototype,{set:function(t,e,i,n,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),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(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromProjectionMatrix:function(t){var e=this.planes,i=t.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 e[0].setComponents(a-n,h-s,f-u,y-m).normalize(),e[1].setComponents(a+n,h+s,f+u,y+m).normalize(),e[2].setComponents(a+r,h+c,f+d,y+g).normalize(),e[3].setComponents(a-r,h-c,f-d,y-g).normalize(),e[4].setComponents(a-o,h-l,f-p,y-v).normalize(),e[5].setComponents(a+o,h+l,f+p,y+v).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ts.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ts)},intersectsSprite:function(t){return Ts.center.set(0,0,0),Ts.radius=.7071067811865476,Ts.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ts)},intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:function(t){for(var e=this.planes,i=0;i<6;i++){var n=e[i];if(Cs.x=n.normal.x>0?t.max.x:t.min.x,Cs.y=n.normal.y>0?t.max.y:t.min.y,Cs.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Cs)<0)return!1}return!0},containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}});var Ps={common:{diffuse:{value:new va(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Gr},uv2Transform:{value:new Gr},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 Ur(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 va(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 va(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Gr}},sprite:{diffuse:{value:new va(15658734)},opacity:{value:1},center:{value:new Ur(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Gr}}};function Rs(){var t=null,e=!1,i=null;function n(r,o){!1!==e&&(i(r,o),t.requestAnimationFrame(n))}return{start:function(){!0!==e&&null!==i&&(t.requestAnimationFrame(n),e=!0)},stop:function(){e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Bs(t,e){var i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){e.isInterleavedBufferAttribute&&(e=e.data);var o=n.get(e);void 0===o?n.set(e,function(e,i){var n=e.array,r=e.usage,o=t.createBuffer();t.bindBuffer(i,o),t.bufferData(i,n,r),e.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:e.version}}(e,r)):o.version<e.version&&(!function(e,n,r){var o=n.array,a=n.updateRange;t.bindBuffer(r,e),-1===a.count?t.bufferSubData(r,0,o):(i?t.bufferSubData(r,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):t.bufferSubData(r,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,e,r),o.version=e.version)}}}function Ls(t,e,i,n){gs.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Ds(t,e,i,n)),this.mergeVertices()}function Ds(t,e,i,n){Qa.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};var r,o,a=(t=t||1)/2,s=(e=e||1)/2,c=Math.floor(i)||1,l=Math.floor(n)||1,h=c+1,u=l+1,d=t/c,p=e/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 Da(m,3)),this.setAttribute("normal",new Da(g,3)),this.setAttribute("uv",new Da(v,2))}Ls.prototype=Object.create(gs.prototype),Ls.prototype.constructor=Ls,Ds.prototype=Object.create(Qa.prototype),Ds.prototype.constructor=Ds;var Os={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}"},Ns={basic:{uniforms:As([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.fog]),vertexShader:Os.meshbasic_vert,fragmentShader:Os.meshbasic_frag},lambert:{uniforms:As([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.fog,Ps.lights,{emissive:{value:new va(0)}}]),vertexShader:Os.meshlambert_vert,fragmentShader:Os.meshlambert_frag},phong:{uniforms:As([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,Ps.lights,{emissive:{value:new va(0)},specular:{value:new va(1118481)},shininess:{value:30}}]),vertexShader:Os.meshphong_vert,fragmentShader:Os.meshphong_frag},standard:{uniforms:As([Ps.common,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.roughnessmap,Ps.metalnessmap,Ps.fog,Ps.lights,{emissive:{value:new va(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Os.meshphysical_vert,fragmentShader:Os.meshphysical_frag},toon:{uniforms:As([Ps.common,Ps.specularmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.gradientmap,Ps.fog,Ps.lights,{emissive:{value:new va(0)},specular:{value:new va(1118481)},shininess:{value:30}}]),vertexShader:Os.meshtoon_vert,fragmentShader:Os.meshtoon_frag},matcap:{uniforms:As([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,{matcap:{value:null}}]),vertexShader:Os.meshmatcap_vert,fragmentShader:Os.meshmatcap_frag},points:{uniforms:As([Ps.points,Ps.fog]),vertexShader:Os.points_vert,fragmentShader:Os.points_frag},dashed:{uniforms:As([Ps.common,Ps.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Os.linedashed_vert,fragmentShader:Os.linedashed_frag},depth:{uniforms:As([Ps.common,Ps.displacementmap]),vertexShader:Os.depth_vert,fragmentShader:Os.depth_frag},normal:{uniforms:As([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,{opacity:{value:1}}]),vertexShader:Os.normal_vert,fragmentShader:Os.normal_frag},sprite:{uniforms:As([Ps.sprite,Ps.fog]),vertexShader:Os.sprite_vert,fragmentShader:Os.sprite_frag},background:{uniforms:{uvTransform:{value:new Gr},t2D:{value:null}},vertexShader:Os.background_vert,fragmentShader:Os.background_frag},cube:{uniforms:As([Ps.envmap,{opacity:{value:1}}]),vertexShader:Os.cube_vert,fragmentShader:Os.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Os.equirect_vert,fragmentShader:Os.equirect_frag},distanceRGBA:{uniforms:As([Ps.common,Ps.displacementmap,{referencePosition:{value:new $r},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Os.distanceRGBA_vert,fragmentShader:Os.distanceRGBA_frag},shadow:{uniforms:As([Ps.lights,Ps.fog,{color:{value:new va(0)},opacity:{value:1}}]),vertexShader:Os.shadow_vert,fragmentShader:Os.shadow_frag}};function ks(t,e,i,n){var r,o,a=new va(0),s=0,c=null,l=0,h=null;function u(t,i){e.buffers.color.setClear(t.r,t.g,t.b,i,n)}return{getClearColor:function(){return a},setClearColor:function(t,e){a.set(t),u(a,s=void 0!==e?e:1)},getClearAlpha:function(){return s},setClearAlpha:function(t){u(a,s=t)},render:function(e,n,d,p){var f=n.background,m=t.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),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)){void 0===o&&((o=new ls(new vs(1,1,1),new bs({type:"BackgroundCubeMaterial",uniforms:ys(Ns.cube.uniforms),vertexShader:Ns.cube.vertexShader,fragmentShader:Ns.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,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===t.toneMapping||(o.material.needsUpdate=!0,c=f,l=v.version,h=t.toneMapping),e.unshift(o,o.geometry,o.material,0,0,null)}else f&&f.isTexture&&(void 0===r&&((r=new ls(new Ds(2,2),new bs({type:"BackgroundMaterial",uniforms:ys(Ns.background.uniforms),vertexShader:Ns.background.vertexShader,fragmentShader:Ns.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===t.toneMapping||(r.material.needsUpdate=!0,c=f,l=f.version,h=t.toneMapping),e.unshift(r,r.geometry,r.material,0,0,null))}}}function Fs(t,e,i,n){var r,o=n.isWebGL2;this.setMode=function(t){r=t},this.render=function(e,n){t.drawArrays(r,e,n),i.update(n,r)},this.renderInstances=function(n,a,s,c){if(0!==c){var l,h;if(o)l=t,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(l=e.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 Vs(t,e,i){var n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t 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=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=h>0,y=o||!!e.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==n)return n;var i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.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?t.getParameter(36183):0}}function zs(){var t=this,e=null,i=0,n=!1,r=!1,o=new ia,a=new Gr,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function l(e,i,n,r){var c=null!==e?e.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(e[d]).applyMatrix4(u,a),o.normal.toArray(l,p),l[p+3]=o.constant}s.value=l,s.needsUpdate=!0}return t.numPlanes=c,t.numIntersection=0,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(t,r,o){var a=0!==t.length||r||0!==i||n;return n=r,e=l(t,o,0),i=t.length,a},this.beginShadows=function(){r=!0,l(null)},this.endShadows=function(){r=!1,c()},this.setState=function(t,o,a,h,u,d){if(!n||null===t||0===t.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(t,h,f,d);for(var g=0;g!==f;++g)m[g]=e[g];u.clippingState=m,this.numIntersection=o?this.numPlanes:0,this.numPlanes+=p}}}function Hs(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function Us(t,e,i){var n=new WeakMap,r=new WeakMap;function o(t){var a=t.target,s=n.get(a);for(var c in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[c]);a.removeEventListener("dispose",o),n.delete(a);var l=r.get(s);l&&(e.remove(l),r.delete(s)),i.memory.geometries--}function a(t){var i=[],n=t.index,o=t.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(ka(i)>65535?La:Ra)(i,1);p.version=a,e.update(p,34963);var f=r.get(t);f&&e.remove(f),r.set(t,p)}return{get:function(t,e){var r=n.get(e);return r||(e.addEventListener("dispose",o),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Qa).setFromObject(t)),r=e._bufferGeometry),n.set(e,r),i.memory.geometries++,r)},update:function(t){var i=t.index,n=t.attributes;for(var r in null!==i&&e.update(i,34963),n)e.update(n[r],34962);var o=t.morphAttributes;for(var r in o)for(var a=o[r],s=0,c=a.length;s<c;s++)e.update(a[s],34962)},getWireframeAttribute:function(t){var e=r.get(t);if(e){var i=t.index;null!==i&&e.version<i.version&&a(t)}else a(t);return r.get(t)}}}function Gs(t,e,i,n){var r,o,a,s=n.isWebGL2;this.setMode=function(t){r=t},this.setIndex=function(t){o=t.type,a=t.bytesPerElement},this.render=function(e,n){t.drawElements(r,n,o,e*a),i.update(n,r)},this.renderInstances=function(n,c,l,h){if(0!==h){var u,d;if(s)u=t,d="drawElementsInstanced";else if(d="drawElementsInstancedANGLE",null===(u=e.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 js(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(n=n||1,e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Qs(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ws(t){var e={},i=new Float32Array(8);return{update:function(n,r,o,a){var s=n.morphTargetInfluences,c=void 0===s?0:s.length,l=e[r.id];if(void 0===l){l=[];for(var h=0;h<c;h++)l[h]=[h,0];e[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(Qs);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(t,"morphTargetBaseInfluence",v),a.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function qs(t,e,i,n){var r=new WeakMap;return{update:function(t){var o=n.render.frame,a=t.geometry,s=e.get(t,a);return r.get(s)!==o&&(a.isGeometry&&s.updateFromObject(t),e.update(s),r.set(s,o)),t.isInstancedMesh&&i.update(t.instanceMatrix,34962),s},dispose:function(){r=new WeakMap}}}function Ks(t,e,i,n,r,o,a,s,c,l){t=void 0!==t?t:[],e=void 0!==e?e:301,a=void 0!==a?a:1022,Wr.call(this,t,e,i,n,r,o,a,s,c,l),this.flipY=!1}function Xs(t,e,i,n){Wr.call(this,null),this.image={data:t||null,width:e||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 Ys(t,e,i,n){Wr.call(this,null),this.image={data:t||null,width:e||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}Ns.physical={uniforms:As([Ns.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ur(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new va(0)},transparency:{value:0}}]),vertexShader:Os.meshphysical_vert,fragmentShader:Os.meshphysical_frag},Ks.prototype=Object.create(Wr.prototype),Ks.prototype.constructor=Ks,Ks.prototype.isCubeTexture=!0,Object.defineProperty(Ks.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),Xs.prototype=Object.create(Wr.prototype),Xs.prototype.constructor=Xs,Xs.prototype.isDataTexture2DArray=!0,Ys.prototype=Object.create(Wr.prototype),Ys.prototype.constructor=Ys,Ys.prototype.isDataTexture3D=!0;var Zs=new Wr,Js=new Xs,$s=new Ys,tc=new Ks,ec=[],ic=[],nc=new Float32Array(16),rc=new Float32Array(9),oc=new Float32Array(4);function ac(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,o=ec[r];if(void 0===o&&(o=new Float32Array(r),ec[r]=o),0!==e){n.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=i,t[a].toArray(o,s)}return o}function sc(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function cc(t,e){for(var i=0,n=e.length;i<n;i++)t[i]=e[i]}function lc(t,e){var i=ic[e];void 0===i&&(i=new Int32Array(e),ic[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function hc(t,e){var i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function uc(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(sc(i,e))return;t.uniform2fv(this.addr,e),cc(i,e)}}function dc(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(sc(i,e))return;t.uniform3fv(this.addr,e),cc(i,e)}}function pc(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(sc(i,e))return;t.uniform4fv(this.addr,e),cc(i,e)}}function fc(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(sc(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),cc(i,e)}else{if(sc(i,n))return;oc.set(n),t.uniformMatrix2fv(this.addr,!1,oc),cc(i,n)}}function mc(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(sc(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),cc(i,e)}else{if(sc(i,n))return;rc.set(n),t.uniformMatrix3fv(this.addr,!1,rc),cc(i,n)}}function gc(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(sc(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),cc(i,e)}else{if(sc(i,n))return;nc.set(n),t.uniformMatrix4fv(this.addr,!1,nc),cc(i,n)}}function vc(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||Zs,r)}function yc(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||Js,r)}function Ac(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||$s,r)}function xc(t,e,i){var n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||tc,r)}function bc(t,e){var i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function wc(t,e){var i=this.cache;sc(i,e)||(t.uniform2iv(this.addr,e),cc(i,e))}function Mc(t,e){var i=this.cache;sc(i,e)||(t.uniform3iv(this.addr,e),cc(i,e))}function Ec(t,e){var i=this.cache;sc(i,e)||(t.uniform4iv(this.addr,e),cc(i,e))}function Sc(t,e){var i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function _c(t,e){t.uniform1fv(this.addr,e)}function Tc(t,e){t.uniform1iv(this.addr,e)}function Cc(t,e){t.uniform2iv(this.addr,e)}function Ic(t,e){t.uniform3iv(this.addr,e)}function Pc(t,e){t.uniform4iv(this.addr,e)}function Rc(t,e){var i=ac(e,this.size,2);t.uniform2fv(this.addr,i)}function Bc(t,e){var i=ac(e,this.size,3);t.uniform3fv(this.addr,i)}function Lc(t,e){var i=ac(e,this.size,4);t.uniform4fv(this.addr,i)}function Dc(t,e){var i=ac(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Oc(t,e){var i=ac(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Nc(t,e){var i=ac(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function kc(t,e,i){var n=e.length,r=lc(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.safeSetTexture2D(e[o]||Zs,r[o])}function Fc(t,e,i){var n=e.length,r=lc(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.safeSetTextureCube(e[o]||tc,r[o])}function Vc(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return hc;case 35664:return uc;case 35665:return dc;case 35666:return pc;case 35674:return fc;case 35675:return mc;case 35676:return gc;case 5124:case 35670:return bc;case 35667:case 35671:return wc;case 35668:case 35672:return Mc;case 35669:case 35673:return Ec;case 5125:return Sc;case 35678:case 36198:case 36298:case 36306:case 35682:return vc;case 35679:case 36299:case 36307:return Ac;case 35680:case 36300:case 36308:case 36293:return xc;case 36289:case 36303:case 36311:case 36292:return yc}}(e.type)}function zc(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return _c;case 35664:return Rc;case 35665:return Bc;case 35666:return Lc;case 35674:return Dc;case 35675:return Oc;case 35676:return Nc;case 5124:case 35670:return Tc;case 35667:case 35671:return Cc;case 35668:case 35672:return Ic;case 35669:case 35673:return Pc;case 35678:case 36198:case 36298:case 36306:case 35682:return kc;case 35680:case 36300:case 36308:case 36293:return Fc}}(e.type)}function Hc(t){this.id=t,this.seq=[],this.map={}}zc.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),cc(e,t)},Hc.prototype.setValue=function(t,e,i){for(var n=this.seq,r=0,o=n.length;r!==o;++r){var a=n[r];a.setValue(t,e[a.id],i)}};var Uc=/([\w\d_]+)(\])?(\[|\.)?/g;function Gc(t,e){t.seq.push(e),t.map[e.id]=e}function jc(t,e,i){var n=t.name,r=n.length;for(Uc.lastIndex=0;;){var o=Uc.exec(n),a=Uc.lastIndex,s=o[1],c="]"===o[2],l=o[3];if(c&&(s|=0),void 0===l||"["===l&&a+2===r){Gc(i,void 0===l?new Vc(s,t,e):new zc(s,t,e));break}var h=i.map[s];void 0===h&&Gc(i,h=new Hc(s)),i=h}}function Qc(t,e){this.seq=[],this.map={};for(var i=t.getProgramParameter(e,35718),n=0;n<i;++n){var r=t.getActiveUniform(e,n);jc(r,t.getUniformLocation(e,r.name),this)}}function Wc(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}Qc.prototype.setValue=function(t,e,i,n){var r=this.map[e];void 0!==r&&r.setValue(t,i,n)},Qc.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},Qc.upload=function(t,e,i,n){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,n)}},Qc.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var o=t[n];o.id in e&&i.push(o)}return i};var qc=0;function Kc(t){switch(t){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: "+t)}}function Xc(t,e,i){var n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return n&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){for(var e=t.split("\n"),i=0;i<e.length;i++)e[i]=i+1+": "+e[i];return e.join("\n")}(t.getShaderSource(e))}function Yc(t,e){var i=Kc(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Zc(t,e){var i;switch(e){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: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Jc(t){return""!==t}function $c(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function tl(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var el=/^[ \t]*#include +<([\w\d./]+)>/gm;function il(t){return t.replace(el,nl)}function nl(t,e){var i=Os[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return il(i)}var rl=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ol=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function al(t){return t.replace(ol,cl).replace(rl,sl)}function sl(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),cl(t,e,i,n)}function cl(t,e,i,n){for(var r="",o=parseInt(e);o<parseInt(i);o++)r+=n.replace(/\[ i \]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return r}function ll(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function hl(t,e,i){var n,r,o,a,s,c=t.getContext(),l=i.defines,h=i.vertexShader,u=i.fragmentShader,d=function(t){var e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),p=function(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:e="ENVMAP_TYPE_EQUIREC";break;case 305:e="ENVMAP_TYPE_SPHERE"}return e}(i),f=function(t){var e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 304:e="ENVMAP_MODE_REFRACTION"}return e}(i),m=function(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),g=t.gammaFactor>0?t.gammaFactor:1,v=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Jc).join("\n")}(i),y=function(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(l),A=c.createProgram();if(i.isRawShaderMaterial?((n=[y].filter(Jc).join("\n")).length>0&&(n+="\n"),(r=[v,y].filter(Jc).join("\n")).length>0&&(r+="\n")):(n=[ll(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(Jc).join("\n"),r=[v,ll(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?Os.tonemapping_pars_fragment:"",0!==i.toneMapping?Zc("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.matcapEncoding||i.envMapEncoding||i.emissiveMapEncoding||i.lightMapEncoding?Os.encodings_pars_fragment:"",i.mapEncoding?Yc("mapTexelToLinear",i.mapEncoding):"",i.matcapEncoding?Yc("matcapTexelToLinear",i.matcapEncoding):"",i.envMapEncoding?Yc("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?Yc("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMapEncoding?Yc("lightMapTexelToLinear",i.lightMapEncoding):"",i.outputEncoding?(o="linearToOutputTexel",a=i.outputEncoding,s=Kc(a),"vec4 "+o+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Jc).join("\n")),h=tl(h=$c(h=il(h),i),i),u=tl(u=$c(u=il(u),i),i),h=al(h),u=al(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=Wc(c,35633,n+h),_=Wc(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),t.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 B=Xc(c,S,"vertex"),L=Xc(c,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",c.getError(),"35715",c.getProgramParameter(A,35715),"gl.getProgramInfoLog",T,B,L)}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 Qc(c,A)),w},this.getAttributes=function(){return void 0===M&&(M=function(t,e){for(var i={},n=t.getProgramParameter(e,35721),r=0;r<n;r++){var o=t.getActiveAttrib(e,r).name;i[o]=t.getAttribLocation(e,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=e,this.usedTimes=1,this.program=A,this.vertexShader=S,this.fragmentShader=_,this}function ul(t,e,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(t){var e;return t?t.isTexture?e=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}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(t){var e=t.skeleton.bones;if(a)return 1024;var i=c,n=Math.floor((i-20)/4),r=Math.min(n,e.length);return r<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.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(t,e){var i;if(e){var n=Ns[e];i={name:t.type,uniforms:xs.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else i={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};return i}(n,b);n.onBeforeCompile(M,t);var E=t.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):t.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:t.maxMorphTargets,maxMorphNormals:t.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:t.shadowMap.enabled&&p.length>0,shadowMapType:t.shadowMap.type,toneMapping:n.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.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!==e.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==e.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==e.get("EXT_shader_texture_lod"),onBeforeCompile:n.onBeforeCompile}},this.getProgramCacheKey=function(e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)i.push(n),i.push(e.defines[n]);if(void 0===e.isRawShaderMaterial){for(var r=0;r<u.length;r++)i.push(e[u[r]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.onBeforeCompile.toString()),i.join()},this.acquireProgram=function(e,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 hl(t,i,e),n.push(r)),r},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function dl(){var t=new WeakMap;return{get:function(e){var i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function pl(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function fl(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function ml(){var t=[],e=0,i=[],n=[],r={id:-1};function o(i,n,o,a,s,c){var l=t[e];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},t[e]=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),e++,l}return{opaque:i,transparent:n,init:function(){e=0,i.length=0,n.length=0},push:function(t,e,r,a,s,c){var l=o(t,e,r,a,s,c);(!0===r.transparent?n:i).push(l)},unshift:function(t,e,r,a,s,c){var l=o(t,e,r,a,s,c);(!0===r.transparent?n:i).unshift(l)},finish:function(){for(var i=e,n=t.length;i<n;i++){var r=t[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(t,e){i.length>1&&i.sort(t||pl),n.length>1&&n.sort(e||fl)}}}function gl(){var t=new WeakMap;function e(i){var n=i.target;n.removeEventListener("dispose",e),t.delete(n)}return{get:function(i,n){var r,o=t.get(i);return void 0===o?(r=new ml,t.set(i,new WeakMap),t.get(i).set(n,r),i.addEventListener("dispose",e)):void 0===(r=o.get(n))&&(r=new ml,o.set(n,r)),r},dispose:function(){t=new WeakMap}}}function vl(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new $r,color:new va};break;case"SpotLight":i={position:new $r,direction:new $r,color:new va,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new $r,color:new va,distance:0,decay:0};break;case"HemisphereLight":i={direction:new $r,skyColor:new va,groundColor:new va};break;case"RectAreaLight":i={color:new va,position:new $r,halfWidth:new $r,halfHeight:new $r}}return t[e.id]=i,i}}}var yl=0;function Al(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function xl(){for(var t,e=new vl,i=(t={},{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowRadius:1,shadowMapSize:new Ur};break;case"PointLight":i={shadowBias:0,shadowRadius:1,shadowMapSize:new Ur,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.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 $r);var o=new $r,a=new so,s=new so;return{setup:function(t,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;t.sort(Al),d=0;for(var w=t.length;d<w;d++){var M=t[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=e.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=e.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=e.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=e.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=e.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 B=n.hash;B.directionalLength===p&&B.pointLength===f&&B.spotLength===m&&B.rectAreaLength===g&&B.hemiLength===v&&B.numDirectionalShadows===y&&B.numPointShadows===A&&B.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,B.directionalLength=p,B.pointLength=f,B.spotLength=m,B.rectAreaLength=g,B.hemiLength=v,B.numDirectionalShadows=y,B.numPointShadows=A,B.numSpotShadows=x,n.version=yl++)},state:n}}function bl(){var t=new xl,e=[],i=[];return{init:function(){e.length=0,i.length=0},state:{lightsArray:e,shadowsArray:i,lights:t},setupLights:function(n){t.setup(e,i,n)},pushLight:function(t){e.push(t)},pushShadow:function(t){i.push(t)}}}function wl(){var t=new WeakMap;function e(i){var n=i.target;n.removeEventListener("dispose",e),t.delete(n)}return{get:function(i,n){var r;return!1===t.has(i)?(r=new bl,t.set(i,new WeakMap),t.get(i).set(n,r),i.addEventListener("dispose",e)):!1===t.get(i).has(n)?(r=new bl,t.get(i).set(n,r)):r=t.get(i).get(n),r},dispose:function(){t=new WeakMap}}}function Ml(t){Ma.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(t)}function El(t){Ma.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new $r,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(t)}Ml.prototype=Object.create(Ma.prototype),Ml.prototype.constructor=Ml,Ml.prototype.isMeshDepthMaterial=!0,Ml.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},El.prototype=Object.create(Ma.prototype),El.prototype.constructor=El,El.prototype.isMeshDistanceMaterial=!0,El.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};function Sl(t,e,i){var n=new Is,r=new Ur,o=new Ur,a=new qr,s=[],c=[],l={},h={0:1,1:0,2:2},u=new bs({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ur},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 Qa;p.setAttribute("position",new _a(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new ls(p,u),m=this;function g(i,n){var r=e.update(f);u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.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,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,d,f,null)}function v(t,e,i){var n=t<<0|e<<1|i<<2,r=s[n];return void 0===r&&(r=new Ml({depthPacking:3201,morphTargets:t,skinning:e}),s[n]=r),r}function y(t,e,i){var n=t<<0|e<<1|i<<2,r=c[n];return void 0===r&&(r=new El({morphTargets:t,skinning:e}),c[n]=r),r}function A(e,i,n,r,o,a,s){var c=null,u=v,d=e.customDepthMaterial;if(!0===r.isPointLight&&(u=y,d=e.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===e.isSkinnedMesh&&(!0===n.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),c=u(p,f,!0===e.isInstancedMesh)}else c=d;if(t.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=e.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);t.renderBufferDirect(o,null,c,m,i,p)}}else if(l.visible){m=A(i,c,l,a,o.near,o.far,s);t.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(e,s,c){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==e.length){var l=t.getRenderTarget(),h=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.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=e.length;p<f;p++){var v=e[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 Kr(r.x,r.y,b),y.map.texture.name=v.name+".shadowMap",y.mapPass=new Kr(r.x,r.y,b),y.camera.updateProjectionMatrix()}if(null===y.map){b={minFilter:1003,magFilter:1003,format:1023};y.map=new Kr(r.x,r.y,b),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}t.setRenderTarget(y.map),t.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,t.setRenderTarget(l,h,u)}}}function _l(t,e,i){var n=i.isWebGL2;var r=new function(){var e=!1,i=new qr,n=null,r=new qr(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,o,a,s){!0===s&&(e*=a,n*=a,o*=a),i.set(e,n,o,a),!1===r.equals(i)&&(t.clearColor(e,n,o,a),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},o=new function(){var e=!1,i=null,n=null,r=null;return{setTest:function(t){t?F(2929):V(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},a=new function(){var e=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,l=null;return{setTest:function(t){e||(t?F(2960):V(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&r===i&&o===a||(t.stencilFunc(e,i,a),n=e,r=i,o=a)},setOp:function(e,i,n){a===e&&s===i&&c===n||(t.stencilOp(e,i,n),a=e,s=i,c=n)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,l=null}}},s=t.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=t.getParameter(35661),C=!1,I=0,P=t.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,B={},L=new qr,D=new qr;function O(e,i,n){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var a=0;a<n;a++)t.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]&&(t.enableVertexAttribArray(i),l[i]=1),h[i]!==r)&&((n?t:e.get("ANGLE_instanced_arrays"))[n?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),h[i]=r)}function F(e){!0!==u[e]&&(t.enable(e),u[e]=!0)}function V(e){!1!==u[e]&&(t.disable(e),u[e]=!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=e.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(e,i,n,r,o,a,s,c){if(0!==e){if(p||(F(3042),p=!0),5===e)o=o||i,a=a||n,s=s||r,i===m&&o===y||(t.blendEquationSeparate(z[i],z[o]),m=i,y=o),n===g&&r===v&&a===A&&s===x||(t.blendFuncSeparate(U[n],U[r],U[a],U[s]),g=n,v=r,A=a,x=s),f=e,b=null;else if(e!==f||c!==b){if(100===m&&100===y||(t.blendEquation(32774),m=100,y=100),c)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}g=null,v=null,A=null,x=null,f=e,b=c}}else p&&(V(3042),p=!1)}function j(e){w!==e&&(e?t.frontFace(2304):t.frontFace(2305),w=e)}function Q(e){0!==e?(F(2884),e!==M&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):V(2884),M=e}function W(e,i,n){e?(F(32823),S===i&&_===n||(t.polygonOffset(i,n),S=i,_=n)):V(32823)}function q(e){void 0===e&&(e=33984+T-1),R!==e&&(t.activeTexture(e),R=e)}return{buffers:{color:r,depth:o,stencil:a},initAttributes:function(){for(var t=0,e=c.length;t<e;t++)c[t]=0},enableAttribute:function(t){k(t,0)},enableAttributeAndDivisor:k,disableUnusedAttributes:function(){for(var e=0,i=l.length;e!==i;++e)l[e]!==c[e]&&(t.disableVertexAttribArray(e),l[e]=0)},vertexAttribPointer:function(e,i,r,o,a,s){!0!==n||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,o,a,s):t.vertexAttribIPointer(e,i,r,o,a,s)},enable:F,disable:V,useProgram:function(e){return d!==e&&(t.useProgram(e),d=e,!0)},setBlending:G,setMaterial:function(t,e){2===t.side?V(2884):F(2884);var i=1===t.side;e&&(i=!i),j(i),1===t.blending&&!1===t.transparent?G(0):G(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),r.setMask(t.colorWrite);var n=t.stencilWrite;a.setTest(n),n&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),W(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:j,setCullFace:Q,setLineWidth:function(e){e!==E&&(C&&t.lineWidth(e),E=e)},setPolygonOffset:W,setScissorTest:function(t){t?F(3089):V(3089)},activeTexture:q,bindTexture:function(e,i){null===R&&q();var n=B[R];void 0===n&&(n={type:void 0,texture:void 0},B[R]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||N[e]),n.type=e,n.texture=i)},unbindTexture:function(){var e=B[R];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===L.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),L.copy(e))},viewport:function(e){!1===D.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),D.copy(e))},reset:function(){for(var e=0;e<l.length;e++)1===l[e]&&(t.disableVertexAttribArray(e),l[e]=0);u={},R=null,B={},d=null,f=null,w=null,M=null,r.reset(),o.reset(),a.reset()}}}function Tl(t,e,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(t){}function m(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(t,e,i,n){var r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var o=e?Hr.floorPowerOfTwo:Math.floor,a=o(r*t.width),c=o(r*t.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(t,0,0,a,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+c+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function v(t){return Hr.isPowerOfTwo(t.width)&&Hr.isPowerOfTwo(t.height)}function y(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function A(e,i,r,o){t.generateMipmap(e),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!==t[i])return t[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||e.get("EXT_color_buffer_float"),o}function b(t){return 1003===t||1004===t||1005===t?9728:9729}function w(e){var i=e.target;i.removeEventListener("dispose",w),function(e){var i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&p.delete(i),a.memory.textures--}function M(e){var i=e.target;i.removeEventListener("dispose",M),function(e){var i=n.get(e),r=n.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);n.remove(e.texture),n.remove(e)}(i),a.memory.textures--}var E=0;function S(t,e){var r=n.get(t);if(t.isVideoTexture&&function(t){var e=a.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){var o=t.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void B(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function _(e,r){if(6===e.image.length){var a=n.get(e);if(e.version>0&&a.__version!==e.version){R(a,e),i.activeTexture(33984+r),i.bindTexture(34067,a.__webglTexture),t.pixelStorei(37440,e.flipY);for(var s=e&&(e.isCompressedTexture||e.image[0].isCompressedTexture),l=e.image[0]&&e.image[0].isDataTexture,u=[],d=0;d<6;d++)u[d]=s||l?l?e.image[d].image:e.image[d]:g(e.image[d],!1,!0,h);var p,f=u[0],m=v(f)||c,b=o.convert(e.format),w=o.convert(e.type),M=x(e.internalFormat,b,w);if(P(34067,e,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!==e.format&&1022!==e.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=e.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(e,m)&&A(34067,e,f.width,f.height),a.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(33984+r),i.bindTexture(34067,a.__webglTexture)}}function T(t,e){i.activeTexture(33984+e),i.bindTexture(34067,n.get(t).__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?(t.texParameteri(i,10242,C[o.wrapS]),t.texParameteri(i,10243,C[o.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,C[o.wrapR]),t.texParameteri(i,10240,I[o.magFilter]),t.texParameteri(i,10241,I[o.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.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."),t.texParameteri(i,10240,b(o.magFilter)),t.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=e.get("EXT_texture_filter_anisotropic");if(s){if(1015===o.type&&null===e.get("OES_texture_float_linear"))return;if(1016===o.type&&null===(c||e.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function R(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),a.memory.textures++)}function B(e,n,r){var a=3553;n.isDataTexture2DArray&&(a=35866),n.isDataTexture3D&&(a=32879),R(e,n),i.activeTexture(33984+r),i.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment);var s=function(t){return!c&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.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,e.__maxMipLevel=b.length-1}else i.texImage2D(3553,0,f,l.width,l.height,0,d,p,l.data),e.__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);e.__maxMipLevel=b.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,f,l.width,l.height,l.depth,0,d,p,l.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,f,l.width,l.height,l.depth,0,d,p,l.data),e.__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,e.__maxMipLevel=b.length-1}else i.texImage2D(3553,0,f,d,p,l),e.__maxMipLevel=0;y(n,h)&&A(a,n,l.width,l.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function L(e,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),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function D(e,i,n){if(t.bindRenderbuffer(36161,e),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);t.renderbufferStorageMultisample(36161,s,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){s=N(i);t.renderbufferStorageMultisample(36161,s,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}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);t.renderbufferStorageMultisample(36161,s,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height)}t.bindRenderbuffer(36161,null)}function O(e){var i=n.get(e),r=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!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)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(1027!==i.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(36160,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),D(i.__webglDepthbuffer[o],e,!1)}else t.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),D(i.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}function N(t){return c&&t.isWebGLMultisampleRenderTarget?Math.min(d,t.samples):0}var k=!1,F=!1;this.allocateTextureUnit=function(){var t=E;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),E+=1,t},this.resetTextureUnits=function(){E=0},this.setTexture2D=S,this.setTexture2DArray=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?B(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?B(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=_,this.setTextureCubeDynamic=T,this.setupRenderTarget=function(e){var r=n.get(e),s=n.get(e.texture);e.addEventListener("dispose",M),s.__webglTexture=t.createTexture(),a.memory.textures++;var l=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,u=v(e)||c;if(!c||1022!==e.texture.format||1015!==e.texture.type&&1016!==e.texture.type||(e.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]=t.createFramebuffer()}else if(r.__webglFramebuffer=t.createFramebuffer(),h)if(c){r.__webglMultisampledFramebuffer=t.createFramebuffer(),r.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var p=o.convert(e.texture.format),f=o.convert(e.texture.type),m=x(e.texture.internalFormat,p,f),g=N(e);t.renderbufferStorageMultisample(36161,g,m,e.width,e.height),t.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(r.__webglDepthRenderbuffer=t.createRenderbuffer(),D(r.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){i.bindTexture(34067,s.__webglTexture),P(34067,e.texture,u);for(d=0;d<6;d++)L(r.__webglFramebuffer[d],e,36064,34069+d);y(e.texture,u)&&A(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,s.__webglTexture),P(3553,e.texture,u),L(r.__webglFramebuffer,e,36064,3553),y(e.texture,u)&&A(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&O(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(y(e,v(t)||c)){var r=t.isWebGLCubeRenderTarget?34067:3553,o=n.get(e).__webglTexture;i.bindTexture(r,o),A(r,e,t.width,t.height),i.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(c){var i=n.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);var r=e.width,o=e.height,a=16384;e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024),t.blitFramebuffer(0,0,r,o,0,0,r,o,a,9728),t.bindFramebuffer(36160,i.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===k&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),k=!0),t=t.texture),S(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?_(t,e):T(t,e)}}function Cl(t,e,i){var n=i.isWebGL2;return{convert:function(t){var i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:null!==(i=e.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(null===(i=e.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(null===(i=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return null!==(i=e.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&null!==(i=e.get("WEBGL_compressed_texture_etc"))){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?null!==(i=e.get("WEBGL_compressed_texture_astc"))?t:null:36492===t?null!==(i=e.get("EXT_texture_compression_bptc"))?t:null:1020===t?n?34042:null!==(i=e.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Il(t){Ms.call(this),this.cameras=t||[]}function Pl(){_o.call(this),this.type="Group"}function Rl(){this._targetRay=null,this._grip=null}function Bl(t,e){var i=this,n=null,r=1,o=null,a="local-floor",s=null,c=[],l=new Map,h=new Ms;h.layers.enable(1),h.viewport=new qr;var u=new Ms;u.layers.enable(2),u.viewport=new qr;var d=[h,u],p=new Il;p.layers.enable(1),p.layers.enable(2);var f=null,m=null;function g(t){var e=l.get(t.inputSource);e&&e.dispatchEvent({type:t.type})}function v(){l.forEach((function(t,e){t.disconnect(e)})),l.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),E.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function y(t){o=t,E.setContext(n),E.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}function A(t){for(var e=n.inputSources,i=0;i<c.length;i++)l.set(e[i],c[i]);for(i=0;i<t.removed.length;i++){var r=t.removed[i];(o=l.get(r))&&(o.dispatchEvent({type:"disconnected",data:r}),l.delete(r))}for(i=0;i<t.added.length;i++){var o;r=t.added[i];(o=l.get(r))&&o.dispatchEvent({type:"connected",data:r})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){var e=c[t];return void 0===e&&(e=new Rl,c[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){var e=c[t];return void 0===e&&(e=new Rl,c[t]=e),e.getGripSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!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(t){if(null!==(n=t)){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=e.getContextAttributes();!0!==i.xrCompatible&&e.makeXRCompatible();var o={antialias:i.antialias,alpha:i.alpha,depth:i.depth,stencil:i.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(n,e,o);n.updateRenderState({baseLayer:s}),n.requestReferenceSpace(a).then(y),n.addEventListener("inputsourceschange",A)}};var x=new $r,b=new $r;function w(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}this.getCamera=function(t){p.near=u.near=h.near=t.near,p.far=u.far=h.far=t.far,f===p.near&&m===p.far||(n.updateRenderState({depthNear:p.near,depthFar:p.far}),f=p.near,m=p.far);var e=t.parent,i=p.cameras;w(p,e);for(var r=0;r<i.length;r++)w(i[r],e);t.matrixWorld.copy(p.matrixWorld);for(var o=t.children,a=(r=0,o.length);r<a;r++)o[r].updateMatrixWorld(!0);return 2===i.length?function(t,e,i){x.setFromMatrixPosition(e.matrixWorld),b.setFromMatrixPosition(i.matrixWorld);var n=x.distanceTo(b),r=e.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;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.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;t.projectionMatrix.makePerspective(y,A,w,M,g,v)}(p,h,u):p.projectionMatrix.copy(h.projectionMatrix),p};var M=null;var E=new Rs;E.setAnimationLoop((function(e,i){if(null!==(s=i.getViewerPose(o))){var r=s.views,a=n.renderState.baseLayer;t.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(e,i)})),this.setAnimationLoop=function(t){M=t},this.dispose=function(){}}function Ll(t){function e(e,i,n){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap);var r,o,a=i.envMap||n;a&&(e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture?-1:1,e.reflectivity.value=i.reflectivity,e.refractionRatio.value=i.refractionRatio,e.maxMipLevel.value=t.get(a).__maxMipLevel),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.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(),e.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(),e.uv2Transform.value.copy(o.matrix))}function i(t,e,i){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),(e.envMap||i)&&(t.envMapIntensity.value=e.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,o,a){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n,r),n.isMeshPhysicalMaterial?function(t,e,n){i(t,e,n),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate());t.transparency.value=e.transparency}(t,n,r):i(t,n,r)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,o,a):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Dl(t){var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat,u=null,d=null;this.domElement=e,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,B=this,L=!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=e.width,q=e.height,K=1,X=null,Y=null,Z=new qr(0,0,W,q),J=new qr(0,0,W,q),$=!1,tt=new Is,et=new zs,it=!1,nt=!1,rt=new so,ot=new $r;function at(){return null===k?K:1}try{var st={alpha:n,depth:r,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",ut,!1),e.addEventListener("webglcontextrestored",dt,!1),null===(p=i||e.getContext("webgl",st)||e.getContext("experimental-webgl",st)))throw null!==e.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(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function ct(){f=new Hs(p),!1===(m=new Vs(p,f,t)).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 Cl(p,f,m),(g=new _l(p,f,m)).scissor(j.copy(J).multiplyScalar(K).floor()),g.viewport(G.copy(Z).multiplyScalar(K).floor()),v=new js(p),y=new dl,A=new Tl(p,f,g,y,m,R,v),x=new Bs(p,m),b=new Us(p,x,v),w=new qs(p,b,x,v),C=new Ws(p),M=new ul(B,f,m),E=new Ll(y),S=new gl,_=new wl,T=new ks(B,g,w,s),I=new Fs(p,f,v,m),P=new Gs(p,f,v,m),v.programs=M.programs,B.capabilities=m,B.extensions=f,B.properties=y,B.renderLists=S,B.state=g,B.info=v}ct();var lt=new Bl(B,p);this.xr=lt;var ht=new Sl(B,w,m.maxTextureSize);function ut(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function dt(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1,ct()}function pt(t){var e=t.target;e.removeEventListener("dispose",pt),function(t){ft(t),y.remove(t)}(e)}function ft(t){var e=y.get(t).program;t.program=void 0,void 0!==e&&M.releaseProgram(e)}this.shadowMap=ht,this.getContext=function(){return p},this.getContextAttributes=function(){return p.getContextAttributes()},this.forceContextLoss=function(){var t=f.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=f.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return K},this.setPixelRatio=function(t){void 0!==t&&(K=t,this.setSize(W,q,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new Ur),t.set(W,q)},this.setSize=function(t,i,n){lt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(W=t,q=i,e.width=Math.floor(t*K),e.height=Math.floor(i*K),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new Ur),t.set(W*K,q*K).floor()},this.setDrawingBufferSize=function(t,i,n){W=t,q=i,K=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new qr),t.copy(G)},this.getViewport=function(t){return t.copy(Z)},this.setViewport=function(t,e,i,n){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,i,n),g.viewport(G.copy(Z).multiplyScalar(K).floor())},this.getScissor=function(t){return t.copy(J)},this.setScissor=function(t,e,i,n){t.isVector4?J.set(t.x,t.y,t.z,t.w):J.set(t,e,i,n),g.scissor(j.copy(J).multiplyScalar(K).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(t){g.setScissorTest($=t)},this.setOpaqueSort=function(t){X=t},this.setTransparentSort=function(t){Y=t},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(t,e,i){var n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(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(){e.removeEventListener("webglcontextlost",ut,!1),e.removeEventListener("webglcontextrestored",dt,!1),S.dispose(),_.dispose(),y.dispose(),w.dispose(),lt.dispose(),vt.stop()},this.renderBufferImmediate=function(t,e){g.initAttributes();var i=y.get(t);t.hasPositions&&!i.position&&(i.position=p.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=p.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=p.createBuffer()),t.hasColors&&!i.color&&(i.color=p.createBuffer());var n=e.getAttributes();t.hasPositions&&(p.bindBuffer(34962,i.position),p.bufferData(34962,t.positionArray,35048),g.enableAttribute(n.position),p.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(p.bindBuffer(34962,i.normal),p.bufferData(34962,t.normalArray,35048),g.enableAttribute(n.normal),p.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(p.bindBuffer(34962,i.uv),p.bufferData(34962,t.uvArray,35048),g.enableAttribute(n.uv),p.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(p.bindBuffer(34962,i.color),p.bufferData(34962,t.colorArray,35048),g.enableAttribute(n.color),p.vertexAttribPointer(n.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),p.drawArrays(4,0,t.count),t.count=0};var mt=new To;this.renderBufferDirect=function(t,e,i,n,r,o){null===e&&(e=mt);var a=r.isMesh&&r.matrixWorld.determinant()<0,s=wt(t,e,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(t,e,i,n){if(!1===m.isWebGL2&&(t.isInstancedMesh||e.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;g.initAttributes();var r=e.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===e._maxInstanceCount&&(e._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===e._maxInstanceCount&&(e._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(t.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*at()),v.setMode(1)):v.setMode(4);else if(r.isLine){var R=n.linewidth;void 0===R&&(R=1),g.setLineWidth(R*at()),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 B=Math.min(i.instanceCount,i._maxInstanceCount);v.renderInstances(i,S,T,B)}else v.render(S,T)}},this.compile=function(t,e){(d=_.get(t,e)).init(),t.traverse((function(t){t.isLight&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(e);const i={};t.traverse((function(e){let n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){let o=n[r];o.uuid in i==!1&&(bt(o,t,e),i[o.uuid]=!0)}else n.uuid in i==!1&&(bt(n,t,e),i[n.uuid]=!0)}))};var gt=null;var vt=new Rs;function yt(t,e,i,n){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||tt.intersectsSprite(t)){n&&ot.setFromMatrixPosition(t.matrixWorld).applyMatrix4(rt);var r=w.update(t);(o=t.material).visible&&u.push(t,r,o,i,ot.z,null)}}else if(t.isImmediateRenderObject)n&&ot.setFromMatrixPosition(t.matrixWorld).applyMatrix4(rt),u.push(t,null,t.material,i,ot.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==v.render.frame&&(t.skeleton.update(),t.skeleton.frame=v.render.frame),!t.frustumCulled||tt.intersectsObject(t))){n&&ot.setFromMatrixPosition(t.matrixWorld).applyMatrix4(rt);r=w.update(t);var o=t.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(t,r,h,i,ot.z,l)}else o.visible&&u.push(t,r,o,i,ot.z,null)}var p=t.children;for(s=0,c=p.length;s<c;s++)yt(p[s],e,i,n)}}function At(t,e,i,n){for(var r=0,o=t.length;r<o;r++){var a=t[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),xt(s,e,m,c,l,h))}}else U=null,xt(s,e,i,c,l,h)}}function xt(t,e,i,n,r,o){if(t.onBeforeRender(B,e,i,n,r,o),d=_.get(e,U||i),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){var a=wt(i,e,r,t);g.setMaterial(r),z.geometry=null,z.program=null,z.wireframe=!1,function(t,e){t.render((function(t){B.renderBufferImmediate(t,e)}))}(t,a)}else B.renderBufferDirect(i,e,n,r,t,o);t.onAfterRender(B,e,i,n,r,o),d=_.get(e,U||i)}function bt(t,e,i){var n=y.get(t),r=d.state.lights,o=d.state.shadowsArray,a=r.state.version,s=M.getParameters(t,r.state,o,e,et.numPlanes,et.numIntersection,i),c=M.getProgramCacheKey(s),l=n.program,h=!0;if(void 0===l)t.addEventListener("dispose",pt);else if(l.cacheKey!==c)ft(t);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,t.program=l);var u=l.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var p=0;p<B.maxMorphTargets;p++)u["morphTarget"+p]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(p=0;p<B.maxMorphNormals;p++)u["morphNormal"+p]>=0&&t.numSupportedMorphNormals++}var f=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=et.numPlanes,n.numIntersection=et.numIntersection,f.clippingPlanes=et.uniform),n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),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=Qc.seqWithValue(m.seq,f);n.uniformsList=g}function wt(t,e,i,n){A.resetTextureUnits();var r=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===k?B.outputEncoding:k.texture.encoding,s=y.get(i),c=d.state.lights;if(it&&(nt||t!==H)){var l=t===H&&i.id===V;et.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,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?bt(i,e,n):void 0===s.numClippingPlanes||s.numClippingPlanes===et.numPlanes&&s.numIntersection===et.numIntersection?s.outputEncoding!==a&&bt(i,e,n):bt(i,e,n):(bt(i,e,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!==t){if(x.setValue(p,"projectionMatrix",t.projectionMatrix),m.logarithmicDepthBuffer&&x.setValue(p,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),H!==t&&(H=t,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,ot.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&x.setValue(p,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&x.setValue(p,"viewMatrix",t.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);_=Hr.ceilPowerOfTwo(_),_=Math.max(_,4);var T=new Float32Array(_*_*4);T.set(M.boneMatrices);var C=new _s(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",B.toneMappingExposure),x.setValue(p,"toneMappingWhitePoint",B.toneMappingWhitePoint),s.needsLights&&function(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}(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=Ps.LTC_1),void 0!==b.ltc_2&&(b.ltc_2.value=Ps.LTC_2),Qc.upload(p,s.uniformsList,b,A)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Qc.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}vt.setAnimationLoop((function(t){lt.isPresenting||gt&&gt(t)})),"undefined"!=typeof window&&vt.setContext(window),this.setAnimationLoop=function(t){gt=t,lt.setAnimationLoop(t),vt.start()},this.render=function(t,e){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]),e&&e.isCamera){if(!L){z.geometry=null,z.program=null,z.wireframe=!1,V=-1,H=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),lt.enabled&&lt.isPresenting&&(e=lt.getCamera(e)),t.onBeforeRender(B,t,e,i||k),(d=_.get(t,e)).init(),rt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),tt.setFromProjectionMatrix(rt),nt=this.localClippingEnabled,it=et.init(this.clippingPlanes,nt,e),(u=S.get(t,e)).init(),yt(t,e,0,B.sortObjects),u.finish(),!0===B.sortObjects&&u.sort(X,Y),it&&et.beginShadows();var r=d.state.shadowsArray;ht.render(r,t,e),d.setupLights(e),it&&et.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),T.render(u,t,e,n);var o=u.opaque,a=u.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;o.length&&At(o,t,e,s),a.length&&At(a,t,e,s)}else o.length&&At(o,t,e),a.length&&At(a,t,e);t.onAfterRender(B,t,e),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(t){D!==t&&null===k&&p.bindFramebuffer(36160,t),D=t},this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return k},this.setRenderTarget=function(t,e,i){k=t,O=e,N=i,t&&void 0===y.get(t).__webglFramebuffer&&A.setupRenderTarget(t);var n=D,r=!1;if(t){var o=y.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=o[e||0],r=!0):n=t.isWebGLMultisampleRenderTarget?y.get(t).__webglMultisampledFramebuffer:o,G.copy(t.viewport),j.copy(t.scissor),Q=t.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(t.texture);p.framebufferTexture2D(36160,36064,34069+(e||0),a.__webglTexture,i||0)}},this.readRenderTargetPixels=function(t,e,i,n,r,o,a){if(t&&t.isWebGLRenderTarget){var s=y.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){var c=!1;s!==F&&(p.bindFramebuffer(36160,s),c=!0);try{var l=t.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)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&p.readPixels(e,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(t,e,i){void 0===i&&(i=0);var n=Math.pow(2,-i),r=Math.floor(e.image.width*n),o=Math.floor(e.image.height*n),a=R.convert(e.format);A.setTexture2D(e,0),p.copyTexImage2D(3553,i,a,t.x,t.y,r,o,0),g.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n){void 0===n&&(n=0);var r=e.image.width,o=e.image.height,a=R.convert(i.format),s=R.convert(i.type);A.setTexture2D(i,0),e.isDataTexture?p.texSubImage2D(3553,n,t.x,t.y,r,o,a,s,e.image.data):e.isCompressedTexture?p.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):p.texSubImage2D(3553,n,t.x,t.y,a,s,e.image),0===n&&i.generateMipmaps&&p.generateMipmap(3553),g.unbindTexture()},this.initTexture=function(t){A.setTexture2D(t,0),g.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ol(t,e){this.name="",this.color=new va(t),this.density=void 0!==e?e:25e-5}function Nl(t,e,i){this.name="",this.color=new va(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function kl(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}Il.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Il,isArrayCamera:!0}),Pl.prototype=Object.assign(Object.create(_o.prototype),{constructor:Pl,isGroup:!0}),Object.assign(Rl.prototype,{constructor:Rl,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Pl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Pl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(t,e,i){var n=null,r=null,o=this._targetRay,a=this._grip;return t&&(null!==o&&null!==(n=e.getPose(t.targetRaySpace,i))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(r=e.getPose(t.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(Bl.prototype,kr.prototype),Object.assign(Ol.prototype,{isFogExp2:!0,clone:function(){return new Ol(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Nl.prototype,{isFog:!0,clone:function(){return new Nl(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(kl.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(kl.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}});var Fl,Vl=new $r;function zl(t,e,i,n){this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function Hl(t){Ma.call(this),this.type="SpriteMaterial",this.color=new va(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}Object.defineProperties(zl.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(zl.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(var e=0,i=this.data.count;e<i;e++)Vl.x=this.getX(e),Vl.y=this.getY(e),Vl.z=this.getZ(e),Vl.applyMatrix4(t),this.setXYZ(e,Vl.x,Vl.y,Vl.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var t=[],e=0;e<this.count;e++)for(var i=e*this.data.stride+this.offset,n=0;n<this.itemSize;n++)t.push(this.data.array[i+n]);return new _a(new this.array.constructor(t),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var t=[],e=0;e<this.count;e++)for(var i=e*this.data.stride+this.offset,n=0;n<this.itemSize;n++)t.push(this.data.array[i+n]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}}),Hl.prototype=Object.create(Ma.prototype),Hl.prototype.constructor=Hl,Hl.prototype.isSpriteMaterial=!0,Hl.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};var Ul=new $r,Gl=new $r,jl=new $r,Ql=new Ur,Wl=new Ur,ql=new so,Kl=new $r,Xl=new $r,Yl=new $r,Zl=new Ur,Jl=new Ur,$l=new Ur;function th(t){if(_o.call(this),this.type="Sprite",void 0===Fl){Fl=new Qa;var e=new kl(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Fl.setIndex([0,1,2,0,2,3]),Fl.setAttribute("position",new zl(e,3,0,!1)),Fl.setAttribute("uv",new zl(e,2,3,!1))}this.geometry=Fl,this.material=void 0!==t?t:new Hl,this.center=new Ur(.5,.5)}function eh(t,e,i,n,r,o){Ql.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(Wl.x=o*Ql.x-r*Ql.y,Wl.y=r*Ql.x+o*Ql.y):Wl.copy(Ql),t.copy(e),t.x+=Wl.x,t.y+=Wl.y,t.applyMatrix4(ql)}th.prototype=Object.assign(Object.create(_o.prototype),{constructor:th,isSprite:!0,raycast:function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Gl.setFromMatrixScale(this.matrixWorld),ql.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),jl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Gl.multiplyScalar(-jl.z);var i,n,r=this.material.rotation;0!==r&&(n=Math.cos(r),i=Math.sin(r));var o=this.center;eh(Kl.set(-.5,-.5,0),jl,o,Gl,i,n),eh(Xl.set(.5,-.5,0),jl,o,Gl,i,n),eh(Yl.set(.5,.5,0),jl,o,Gl,i,n),Zl.set(0,0),Jl.set(1,0),$l.set(1,1);var a=t.ray.intersectTriangle(Kl,Xl,Yl,!1,Ul);if(null!==a||(eh(Xl.set(-.5,.5,0),jl,o,Gl,i,n),Jl.set(0,1),null!==(a=t.ray.intersectTriangle(Kl,Yl,Xl,!1,Ul)))){var s=t.ray.origin.distanceTo(Ul);s<t.near||s>t.far||e.push({distance:s,point:Ul.clone(),uv:pa.getUV(Ul,Kl,Xl,Yl,Zl,Jl,$l,new Ur),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return _o.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}});var ih,nh,rh,oh,ah,sh=new $r,ch=new $r;function lh(){_o.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function hh(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ls.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new so,this.bindMatrixInverse=new so}lh.prototype=Object.assign(Object.create(_o.prototype),{constructor:lh,isLOD:!0,copy:function(t){_o.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=t.autoUpdate,this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);return i.splice(n,0,{distance:e,object:t}),this.add(t),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(t){var e=this.levels;if(e.length>0){for(var i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object}return null},raycast:function(t,e){if(this.levels.length>0){sh.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(sh);this.getObjectForDistance(i).raycast(t,e)}},update:function(t){var e=this.levels;if(e.length>1){sh.setFromMatrixPosition(t.matrixWorld),ch.setFromMatrixPosition(this.matrixWorld);var i=sh.distanceTo(ch)/t.zoom;e[0].object.visible=!0;for(var n=1,r=e.length;n<r&&i>=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(this._currentLevel=n-1;n<r;n++)e[n].object.visible=!1}},toJSON:function(t){var e=_o.prototype.toJSON.call(this,t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var o=i[n];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),hh.prototype=Object.assign(Object.create(ls.prototype),{constructor:hh,isSkinnedMesh:!0,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var t=new qr,e=this.geometry.attributes.skinWeight,i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);var r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){ls.prototype.updateMatrixWorld.call(this,t),"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:(ih=new $r,nh=new qr,rh=new qr,oh=new $r,ah=new so,function(t,e){var i=this.skeleton,n=this.geometry;nh.fromBufferAttribute(n.attributes.skinIndex,t),rh.fromBufferAttribute(n.attributes.skinWeight,t),ih.fromBufferAttribute(n.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(var r=0;r<4;r++){var o=rh.getComponent(r);if(0!==o){var a=nh.getComponent(r);ah.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(oh.copy(ih).applyMatrix4(ah),o)}}return e.applyMatrix4(this.bindMatrixInverse)})});var uh=new so,dh=new so;function ph(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.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 so)}}function fh(){_o.call(this),this.type="Bone"}Object.assign(ph.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new so;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){var t,e,i;for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){for(var t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,r=0,o=t.length;r<o;r++){var a=t[r]?t[r].matrixWorld:dh;uh.multiplyMatrices(a,e[r]),uh.toArray(i,16*r)}void 0!==n&&(n.needsUpdate=!0)},clone:function(){return new ph(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,i=this.bones.length;e<i;e++){var n=this.bones[e];if(n.name===t)return n}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),fh.prototype=Object.assign(Object.create(_o.prototype),{constructor:fh,isBone:!0});var mh=new so,gh=new so,vh=[],yh=new ls;function Ah(t,e,i){ls.call(this,t,e),this.instanceMatrix=new _a(new Float32Array(16*i),16),this.count=i,this.frustumCulled=!1}function xh(t){Ma.call(this),this.type="LineBasicMaterial",this.color=new va(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}Ah.prototype=Object.assign(Object.create(ls.prototype),{constructor:Ah,isInstancedMesh:!0,getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){var i=this.matrixWorld,n=this.count;if(yh.geometry=this.geometry,yh.material=this.material,void 0!==yh.material)for(var r=0;r<n;r++){this.getMatrixAt(r,mh),gh.multiplyMatrices(i,mh),yh.matrixWorld=gh,yh.raycast(t,vh);for(var o=0,a=vh.length;o<a;o++){var s=vh[o];s.instanceId=r,s.object=this,e.push(s)}vh.length=0}},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){}}),xh.prototype=Object.create(Ma.prototype),xh.prototype.constructor=xh,xh.prototype.isLineBasicMaterial=!0,xh.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this};var bh=new $r,wh=new $r,Mh=new so,Eh=new Jo,Sh=new jo;function _h(t,e,i){1===i&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),_o.call(this),this.type="Line",this.geometry=void 0!==t?t:new Qa,this.material=void 0!==e?e:new xh,this.updateMorphTargets()}_h.prototype=Object.assign(Object.create(_o.prototype),{constructor:_h,isLine:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,i=[0],n=1,r=e.count;n<r;n++)bh.fromBufferAttribute(e,n-1),wh.fromBufferAttribute(e,n),i[n]=i[n-1],i[n]+=bh.distanceTo(wh);t.setAttribute("lineDistance",new Da(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var o=t.vertices;(i=t.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(t,e){var i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),Sh.copy(i.boundingSphere),Sh.applyMatrix4(n),Sh.radius+=r,!1!==t.ray.intersectsSphere(Sh)){Mh.getInverse(n),Eh.copy(t.ray).applyMatrix4(Mh);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,s=new $r,c=new $r,l=new $r,h=new $r,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),!(Eh.distanceSqToSegment(s,c,h,l)>a))h.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(h))<t.near||b>t.far||e.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),!(Eh.distanceSqToSegment(s,c,h,l)>a))h.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(h))<t.near||b>t.far||e.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(!(Eh.distanceSqToSegment(A[m],A[m+1],h,l)>a))h.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(h))<t.near||b>t.far||e.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var t,e,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={},t=0,e=a.length;t<e;t++)i=a[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}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 Th=new $r,Ch=new $r;function Ih(t,e){_h.call(this,t,e),this.type="LineSegments"}function Ph(t,e){_h.call(this,t,e),this.type="LineLoop"}function Rh(t){Ma.call(this),this.type="PointsMaterial",this.color=new va(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}Ih.prototype=Object.assign(Object.create(_h.prototype),{constructor:Ih,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,i=[],n=0,r=e.count;n<r;n+=2)Th.fromBufferAttribute(e,n),Ch.fromBufferAttribute(e,n+1),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+Th.distanceTo(Ch);t.setAttribute("lineDistance",new Da(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var o=t.vertices;for(i=t.lineDistances,n=0,r=o.length;n<r;n+=2)Th.copy(o[n]),Ch.copy(o[n+1]),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+Th.distanceTo(Ch)}return this}}),Ph.prototype=Object.assign(Object.create(_h.prototype),{constructor:Ph,isLineLoop:!0}),Rh.prototype=Object.create(Ma.prototype),Rh.prototype.constructor=Rh,Rh.prototype.isPointsMaterial=!0,Rh.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this};var Bh=new so,Lh=new Jo,Dh=new jo,Oh=new $r;function Nh(t,e){_o.call(this),this.type="Points",this.geometry=void 0!==t?t:new Qa,this.material=void 0!==e?e:new Rh,this.updateMorphTargets()}function kh(t,e,i,n,r,o,a){var s=Lh.distanceSqToPoint(t);if(s<i){var c=new $r;Lh.closestPointToPoint(t,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:e,face:null,object:a})}}function Fh(t,e,i,n,r,o,a,s,c){Wr.call(this,t,e,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 Vh(t,e,i,n,r,o,a,s,c,l,h,u){Wr.call(this,null,o,a,s,c,l,n,r,h,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function zh(t,e,i,n,r,o,a,s,c){Wr.call(this,t,e,i,n,r,o,a,s,c),this.needsUpdate=!0}function Hh(t,e,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),Wr.call(this,null,n,r,o,a,s,l,i,c),this.image={width:t,height:e},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}function Uh(t){Qa.call(this),this.type="WireframeGeometry";var e,i,n,r,o,a,s,c,l,h,u=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,n=m.length;e<n;e++){var g=m[e];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=t.vertices[a.index1],u.push(h.x,h.y,h.z),h=t.vertices[a.index2],u.push(h.x,h.y,h.z)}else if(t&&t.isBufferGeometry){var v,y,A,x,b,w,M;if(h=new $r,null!==t.index){for(v=t.attributes.position,y=t.index,0===(A=t.groups).length&&(A=[{start:0,count:y.count,materialIndex:0}]),r=0,o=A.length;r<o;++r)for(e=b=(x=A[r]).start,n=b+x.count;e<n;e+=3)for(i=0;i<3;i++)s=y.getX(e+i),c=y.getX(e+(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(e=0,n=(v=t.attributes.position).count/3;e<n;e++)for(i=0;i<3;i++)w=3*e+i,h.fromBufferAttribute(v,w),u.push(h.x,h.y,h.z),M=3*e+(i+1)%3,h.fromBufferAttribute(v,M),u.push(h.x,h.y,h.z)}this.setAttribute("position",new Da(u,3))}function Gh(t,e,i){gs.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new jh(t,e,i)),this.mergeVertices()}function jh(t,e,i){Qa.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,o=[],a=[],s=[],c=[],l=1e-5,h=new $r,u=new $r,d=new $r,p=new $r,f=new $r;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=e+1;for(n=0;n<=i;n++){var g=n/i;for(r=0;r<=e;r++){var v=r/e;t(v,g,u),a.push(u.x,u.y,u.z),v-l>=0?(t(v-l,g,d),p.subVectors(u,d)):(t(v+l,g,d),p.subVectors(d,u)),g-l>=0?(t(v,g-l,d),f.subVectors(u,d)):(t(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<e;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 Da(a,3)),this.setAttribute("normal",new Da(s,3)),this.setAttribute("uv",new Da(c,2))}function Qh(t,e,i,n){gs.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new Wh(t,e,i,n)),this.mergeVertices()}function Wh(t,e,i,n){Qa.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},i=i||1;var r=[],o=[];function a(t,e,i,n){var r,o,a=Math.pow(2,n),c=[];for(r=0;r<=a;r++){c[r]=[];var l=t.clone().lerp(i,r/a),h=e.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(t){r.push(t.x,t.y,t.z)}function c(e,i){var n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function l(t,e,i,n){n<0&&1===t.x&&(o[e]=t.x-1),0===i.x&&0===i.z&&(o[e]=n/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}!function(t){for(var i=new $r,n=new $r,r=new $r,o=0;o<e.length;o+=3)c(e[o+0],i),c(e[o+1],n),c(e[o+2],r),a(i,n,r,t)}(n=n||0),function(t){for(var e=new $r,i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}(i),function(){for(var t=new $r,e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];var i=h(t)/2/Math.PI+.5,n=u(t)/Math.PI+.5;o.push(i,1-n)}(function(){for(var t=new $r,e=new $r,i=new $r,n=new $r,a=new Ur,s=new Ur,c=new Ur,u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.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(t).add(e).add(i).divideScalar(3);var p=h(n);l(a,d+0,t,p),l(s,d+2,e,p),l(c,d+4,i,p)}})(),function(){for(var t=0;t<o.length;t+=6){var e=o[t+0],i=o[t+2],n=o[t+4],r=Math.max(e,i,n),a=Math.min(e,i,n);r>.9&&a<.1&&(e<.2&&(o[t+0]+=1),i<.2&&(o[t+2]+=1),n<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Da(r,3)),this.setAttribute("normal",new Da(r.slice(),3)),this.setAttribute("uv",new Da(o,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function qh(t,e){gs.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Kh(t,e)),this.mergeVertices()}function Kh(t,e){Wh.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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xh(t,e){gs.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Yh(t,e)),this.mergeVertices()}function Yh(t,e){Wh.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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Zh(t,e){gs.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Jh(t,e)),this.mergeVertices()}function Jh(t,e){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];Wh.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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function $h(t,e){gs.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new tu(t,e)),this.mergeVertices()}function tu(t,e){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];Wh.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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function eu(t,e,i,n,r,o){gs.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new iu(t,e,i,n,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function iu(t,e,i,n,r){Qa.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},e=e||64,i=i||1,n=n||8,r=r||!1;var o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new $r,l=new $r,h=new Ur,u=new $r,d=[],p=[],f=[],m=[];function g(r){u=t.getPointAt(r/e,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<e;a++)g(a);g(!1===r?e:0),function(){for(a=0;a<=e;a++)for(s=0;s<=n;s++)h.x=a/e,h.y=s/n,f.push(h.x,h.y)}(),function(){for(s=1;s<=e;s++)for(a=1;a<=n;a++){var t=(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(t,i,o),m.push(i,r,o)}}()}(),this.setIndex(m),this.setAttribute("position",new Da(d,3)),this.setAttribute("normal",new Da(p,3)),this.setAttribute("uv",new Da(f,2))}function nu(t,e,i,n,r,o,a){gs.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,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 ru(t,e,i,n,r,o)),this.mergeVertices()}function ru(t,e,i,n,r,o){Qa.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:o},t=t||1,e=e||.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 $r,p=new $r,f=new $r,m=new $r,g=new $r,v=new $r,y=new $r;for(a=0;a<=i;++a){var A=a/i*r*Math.PI*2;for(T(A,r,o,t,f),T(A+.01,r,o,t,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=-e*Math.cos(x),w=e*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(t,e,i,n,r){var o=Math.cos(t),a=Math.sin(t),s=i/e*t,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 Da(l,3)),this.setAttribute("normal",new Da(h,3)),this.setAttribute("uv",new Da(u,2))}function ou(t,e,i,n,r){gs.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new au(t,e,i,n,r)),this.mergeVertices()}function au(t,e,i,n,r){Qa.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||1,e=e||.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 $r,d=new $r,p=new $r;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=(t+e*Math.cos(m))*Math.cos(f),d.y=(t+e*Math.cos(m))*Math.sin(f),d.z=e*Math.sin(m),c.push(d.x,d.y,d.z),u.x=t*Math.cos(f),u.y=t*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 Da(c,3)),this.setAttribute("normal",new Da(l,3)),this.setAttribute("uv",new Da(h,2))}Nh.prototype=Object.assign(Object.create(_o.prototype),{constructor:Nh,isPoints:!0,raycast:function(t,e){var i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold;if(null===i.boundingSphere&&i.computeBoundingSphere(),Dh.copy(i.boundingSphere),Dh.applyMatrix4(n),Dh.radius+=r,!1!==t.ray.intersectsSphere(Dh)){Bh.getInverse(n),Lh.copy(t.ray).applyMatrix4(Bh);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];Oh.fromArray(c,3*d),kh(Oh,d,a,n,t,e,this)}else{h=0;for(var p=c.length/3;h<p;h++)Oh.fromArray(c,3*h),kh(Oh,h,a,n,t,e,this)}}else{var f=i.vertices;for(h=0,p=f.length;h<p;h++)kh(f[h],h,a,n,t,e,this)}}},updateMorphTargets:function(){var t,e,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={},t=0,e=a.length;t<e;t++)i=a[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}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)}}),Fh.prototype=Object.assign(Object.create(Wr.prototype),{constructor:Fh,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Vh.prototype=Object.create(Wr.prototype),Vh.prototype.constructor=Vh,Vh.prototype.isCompressedTexture=!0,zh.prototype=Object.create(Wr.prototype),zh.prototype.constructor=zh,zh.prototype.isCanvasTexture=!0,Hh.prototype=Object.create(Wr.prototype),Hh.prototype.constructor=Hh,Hh.prototype.isDepthTexture=!0,Uh.prototype=Object.create(Qa.prototype),Uh.prototype.constructor=Uh,Gh.prototype=Object.create(gs.prototype),Gh.prototype.constructor=Gh,jh.prototype=Object.create(Qa.prototype),jh.prototype.constructor=jh,Qh.prototype=Object.create(gs.prototype),Qh.prototype.constructor=Qh,Wh.prototype=Object.create(Qa.prototype),Wh.prototype.constructor=Wh,qh.prototype=Object.create(gs.prototype),qh.prototype.constructor=qh,Kh.prototype=Object.create(Wh.prototype),Kh.prototype.constructor=Kh,Xh.prototype=Object.create(gs.prototype),Xh.prototype.constructor=Xh,Yh.prototype=Object.create(Wh.prototype),Yh.prototype.constructor=Yh,Zh.prototype=Object.create(gs.prototype),Zh.prototype.constructor=Zh,Jh.prototype=Object.create(Wh.prototype),Jh.prototype.constructor=Jh,$h.prototype=Object.create(gs.prototype),$h.prototype.constructor=$h,tu.prototype=Object.create(Wh.prototype),tu.prototype.constructor=tu,eu.prototype=Object.create(gs.prototype),eu.prototype.constructor=eu,iu.prototype=Object.create(Qa.prototype),iu.prototype.constructor=iu,iu.prototype.toJSON=function(){var t=Qa.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},nu.prototype=Object.create(gs.prototype),nu.prototype.constructor=nu,ru.prototype=Object.create(Qa.prototype),ru.prototype.constructor=ru,ou.prototype=Object.create(gs.prototype),ou.prototype.constructor=ou,au.prototype=Object.create(Qa.prototype),au.prototype.constructor=au;var su=function(t,e,i){i=i||2;var n,r,o,a,s,c,l,h=e&&e.length,u=h?e[0]*i:t.length,d=cu(t,0,u,i,!0),p=[];if(!d||d.next===d.prev)return p;if(h&&(d=function(t,e,i,n){var r,o,a,s=[];for(r=0,o=e.length;r<o;r++)(a=cu(t,e[r]*n,r<o-1?e[r+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(Au(a));for(s.sort(mu),r=0;r<s.length;r++)gu(s[r],i),i=lu(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],r=a=t[1];for(var f=i;f<u;f+=i)(s=t[f])<n&&(n=s),(c=t[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 hu(d,p,i,n,r,l),p};function cu(t,e,i,n,r){var o,a;if(r===function(t,e,i,n){for(var r=0,o=e,a=i-n;o<i;o+=n)r+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return r}(t,e,i,n)>0)for(o=e;o<i;o+=n)a=Iu(o,t[o],t[o+1],a);else for(o=i-n;o>=e;o-=n)a=Iu(o,t[o],t[o+1],a);return a&&Mu(a,a.next)&&(Pu(a),a=a.next),a}function lu(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Mu(n,n.next)&&0!==wu(n.prev,n,n.next))n=n.next;else{if(Pu(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function hu(t,e,i,n,r,o,a){if(t){!a&&o&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=yu(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,a,s,c,l=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,n=i,s=0,e=0;e<l&&(s++,n=n.nextZ);e++);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:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,l*=2}while(a>1)}(r)}(t,n,r,o);for(var s,c,l=t;t.prev!==t.next;)if(s=t.prev,c=t.next,o?du(t,n,r,o):uu(t))e.push(s.i/i),e.push(t.i/i),e.push(c.i/i),Pu(t),t=c.next,l=c.next;else if((t=c)===l){a?1===a?hu(t=pu(lu(t),e,i),e,i,n,r,o,2):2===a&&fu(t,e,i,n,r,o):hu(lu(t),e,i,n,r,o,1);break}}}function uu(t){var e=t.prev,i=t,n=t.next;if(wu(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(xu(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&wu(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function du(t,e,i,n){var r=t.prev,o=t,a=t.next;if(wu(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=yu(s,c,e,i,n),d=yu(l,h,e,i,n),p=t.prevZ,f=t.nextZ;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&xu(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&wu(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&xu(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&wu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&xu(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&wu(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&xu(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&wu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function pu(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!Mu(r,o)&&Eu(r,n,n.next,o)&&Tu(r,o)&&Tu(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),Pu(n),Pu(n.next),n=t=o),n=n.next}while(n!==t);return lu(n)}function fu(t,e,i,n,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&bu(a,s)){var c=Cu(a,s);return a=lu(a,a.next),c=lu(c,c.next),hu(a,e,i,n,r,o),void hu(c,e,i,n,r,o)}s=s.next}a=a.next}while(a!==t)}function mu(t,e){return t.x-e.x}function gu(t,e){if(e=function(t,e){var i,n=e,r=t.x,o=t.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!==e);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&&xu(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),Tu(n,t)&&(c<d||c===d&&(n.x>i.x||n.x===i.x&&vu(i,n)))&&(i=n,d=c)),n=n.next}while(n!==l);return i}(t,e)){var i=Cu(e,t);lu(e,e.next),lu(i,i.next)}}function vu(t,e){return wu(t.prev,t,e.prev)<0&&wu(e.next,t,t.next)<0}function yu(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Au(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function xu(t,e,i,n,r,o,a,s){return(r-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(r-a)*(n-s)>=0}function bu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Eu(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Tu(t,e)&&Tu(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.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!==t);return n}(t,e)&&(wu(t.prev,t,e.prev)||wu(t,e.prev,e))||Mu(t,e)&&wu(t.prev,t,t.next)>0&&wu(e.prev,e,e.next)>0)}function wu(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Mu(t,e){return t.x===e.x&&t.y===e.y}function Eu(t,e,i,n){var r=_u(wu(t,e,i)),o=_u(wu(t,e,n)),a=_u(wu(i,n,t)),s=_u(wu(i,n,e));return r!==o&&a!==s||(!(0!==r||!Su(t,i,e))||(!(0!==o||!Su(t,n,e))||(!(0!==a||!Su(i,t,n))||!(0!==s||!Su(i,e,n)))))}function Su(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function _u(t){return t>0?1:t<0?-1:0}function Tu(t,e){return wu(t.prev,t,t.next)<0?wu(t,e,t.next)>=0&&wu(t,t.prev,e)>=0:wu(t,e,t.prev)<0||wu(t,t.next,e)<0}function Cu(t,e){var i=new Ru(t.i,t.x,t.y),n=new Ru(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function Iu(t,e,i,n){var r=new Ru(t,e,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 Pu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ru(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Bu={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return Bu.area(t)<0},triangulateShape:function(t,e){var i=[],n=[],r=[];Lu(t),Du(i,t);var o=t.length;e.forEach(Lu);for(var a=0;a<e.length;a++)n.push(o),o+=e[a].length,Du(i,e[a]);var s=su(i,n);for(a=0;a<s.length;a+=3)r.push(s.slice(a,a+3));return r}};function Lu(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Du(t,e){for(var i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function Ou(t,e){gs.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new Nu(t,e)),this.mergeVertices()}function Nu(t,e){Qa.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];for(var i=this,n=[],r=[],o=0,a=t.length;o<a;o++){s(t[o])}function s(t){var o=[],a=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,c=void 0!==e.depth?e.depth:100,l=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:6,u=void 0!==e.bevelSize?e.bevelSize:h-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3,f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:ku;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=e.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 $r,A=new $r,x=new $r),l||(p=0,h=0,u=0,d=0);var S=t.extractPoints(a),_=S.shape,T=S.holes;if(!Bu.isClockWise(_))for(_=_.reverse(),w=0,M=T.length;w<M;w++)b=T[w],Bu.isClockWise(b)&&(T[w]=b.reverse());var C=Bu.triangulateShape(_,T),I=_;for(w=0,M=T.length;w<M;w++)b=T[w],_=_.concat(b);function P(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}var R,B,L,D,O,N,k=_.length,F=C.length;function V(t,e,i){var n,r,o,a=t.x-e.x,s=t.y-e.y,c=i.x-t.x,l=i.y-t.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=e.x-s/d,m=e.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-t.x)*n+(r=m+s*g-t.y)*r;if(v<=2)return new Ur(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 Ur(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(L=R/p,D=h*Math.cos(L*Math.PI/2),B=u*Math.sin(L*Math.PI/2)+d,H=0,U=I.length;H<U;H++)Y((O=P(I[H],z[H],B)).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],B)).x,O.y,-D)}for(B=u+d,H=0;H<k;H++)O=l?P(_[H],K[H],B):_[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],B):_[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(L=R/p,D=h*Math.cos(L*Math.PI/2),B=u*Math.sin(L*Math.PI/2)+d,H=0,U=I.length;H<U;H++)Y((O=P(I[H],z[H],B)).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],B),E?Y(O.x,O.y+g[s-1].y,g[s-1].x+D):Y(O.x,O.y,c+D)}function X(t,e){var i,n;for(H=t.length;--H>=0;){i=H,(n=H-1)<0&&(n=t.length-1);var r=0,o=s+2*p;for(r=0;r<o;r++){var a=k*r,c=k*(r+1);J(e+i+a,e+n+a,e+n+c,e+i+c)}}}function Y(t,e,i){o.push(t),o.push(e),o.push(i)}function Z(t,e,r){$(t),$(e),$(r);var o=n.length/3,a=m.generateTopUV(i,n,o-3,o-2,o-1);tt(a[0]),tt(a[1]),tt(a[2])}function J(t,e,r,o){$(t),$(e),$(o),$(e),$(r),$(o);var a=n.length/3,s=m.generateSideWallUV(i,n,a-6,a-3,a-2,a-1);tt(s[0]),tt(s[1]),tt(s[3]),tt(s[1]),tt(s[2]),tt(s[3])}function $(t){n.push(o[3*t+0]),n.push(o[3*t+1]),n.push(o[3*t+2])}function tt(t){r.push(t.x),r.push(t.y)}!function(){var t=n.length/3;if(l){var e=0,r=k*e;for(H=0;H<F;H++)Z((N=C[H])[2]+r,N[1]+r,N[0]+r);for(r=k*(e=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(t,n.length/3-t,0)}(),function(){var t=n.length/3,e=0;for(X(I,e),e+=I.length,w=0,M=T.length;w<M;w++)X(b=T[w],e),e+=b.length;i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new Da(n,3)),this.setAttribute("uv",new Da(r,2)),this.computeVertexNormals()}Ou.prototype=Object.create(gs.prototype),Ou.prototype.constructor=Ou,Ou.prototype.toJSON=function(){var t=gs.prototype.toJSON.call(this);return Fu(this.parameters.shapes,this.parameters.options,t)},Nu.prototype=Object.create(Qa.prototype),Nu.prototype.constructor=Nu,Nu.prototype.toJSON=function(){var t=Qa.prototype.toJSON.call(this);return Fu(this.parameters.shapes,this.parameters.options,t)};var ku={generateTopUV:function(t,e,i,n,r){var o=e[3*i],a=e[3*i+1],s=e[3*n],c=e[3*n+1],l=e[3*r],h=e[3*r+1];return[new Ur(o,a),new Ur(s,c),new Ur(l,h)]},generateSideWallUV:function(t,e,i,n,r,o){var a=e[3*i],s=e[3*i+1],c=e[3*i+2],l=e[3*n],h=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(s-h)<.01?[new Ur(a,1-c),new Ur(l,1-u),new Ur(d,1-f),new Ur(m,1-v)]:[new Ur(s,1-c),new Ur(h,1-u),new Ur(p,1-f),new Ur(g,1-v)]}};function Fu(t,e,i){if(i.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var o=t[n];i.shapes.push(o.uuid)}else i.shapes.push(t.uuid);return void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}function Vu(t,e){gs.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new zu(t,e)),this.mergeVertices()}function zu(t,e){var i=(e=e||{}).font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new gs;var n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),Nu.call(this,n,e),this.type="TextBufferGeometry"}function Hu(t,e,i,n,r,o,a){gs.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Uu(t,e,i,n,r,o,a)),this.mergeVertices()}function Uu(t,e,i,n,r,o,a){Qa.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},t=t||1,e=Math.max(3,Math.floor(e)||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 $r,p=new $r,f=[],m=[],g=[],v=[];for(c=0;c<=i;c++){var y=[],A=c/i,x=0;for(0==c&&0==o?x=.5/e:c==i&&l==Math.PI&&(x=-.5/e),s=0;s<=e;s++){var b=s/e;d.x=-t*Math.cos(n+b*r)*Math.sin(o+A*a),d.y=t*Math.cos(o+A*a),d.z=t*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<e;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 Da(m,3)),this.setAttribute("normal",new Da(g,3)),this.setAttribute("uv",new Da(v,2))}function Gu(t,e,i,n,r,o){gs.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new ju(t,e,i,n,r,o)),this.mergeVertices()}function ju(t,e,i,n,r,o){Qa.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},t=t||.5,e=e||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=t,f=(e-t)/(n=void 0!==n?Math.max(1,n):1),m=new $r,g=new Ur;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/e+1)/2,g.y=(m.y/e+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 Da(h,3)),this.setAttribute("normal",new Da(u,3)),this.setAttribute("uv",new Da(d,2))}function Qu(t,e,i,n){gs.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new Wu(t,e,i,n)),this.mergeVertices()}function Wu(t,e,i,n){Qa.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e)||12,i=i||0,n=n||2*Math.PI,n=Hr.clamp(n,0,2*Math.PI);var r,o,a,s=[],c=[],l=[],h=1/e,u=new $r,d=new Ur;for(o=0;o<=e;o++){var p=i+o*h*n,f=Math.sin(p),m=Math.cos(p);for(a=0;a<=t.length-1;a++)u.x=t[a].x*f,u.y=t[a].y,u.z=t[a].x*m,c.push(u.x,u.y,u.z),d.x=o/e,d.y=a/(t.length-1),l.push(d.x,d.y)}for(o=0;o<e;o++)for(a=0;a<t.length-1;a++){var g=r=a+o*t.length,v=r+t.length,y=r+t.length+1,A=r+1;s.push(g,v,A),s.push(v,y,A)}if(this.setIndex(s),this.setAttribute("position",new Da(c,3)),this.setAttribute("uv",new Da(l,2)),this.computeVertexNormals(),n===2*Math.PI){var x=this.attributes.normal.array,b=new $r,w=new $r,M=new $r;for(r=e*t.length*3,o=0,a=0;o<t.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(t,e){gs.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new Ku(t,e)),this.mergeVertices()}function Ku(t,e){Qa.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var i=[],n=[],r=[],o=[],a=0,s=0;if(!1===Array.isArray(t))l(t);else for(var c=0;c<t.length;c++)l(t[c]),this.addGroup(a,s,c),a+=s,s=0;function l(t){var a,c,l,h=n.length/3,u=t.extractPoints(e),d=u.shape,p=u.holes;for(!1===Bu.isClockWise(d)&&(d=d.reverse()),a=0,c=p.length;a<c;a++)l=p[a],!0===Bu.isClockWise(l)&&(p[a]=l.reverse());var f=Bu.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 Da(n,3)),this.setAttribute("normal",new Da(r,3)),this.setAttribute("uv",new Da(o,2))}function Xu(t,e){if(e.shapes=[],Array.isArray(t))for(var i=0,n=t.length;i<n;i++){var r=t[i];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}function Yu(t,e){Qa.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var i,n,r,o,a=[],s=Math.cos(Hr.DEG2RAD*e),c=[0,0],l={},h=["a","b","c"];t.isBufferGeometry?(o=new gs).fromBufferGeometry(t):o=t.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 Da(a,3))}function Zu(t,e,i,n,r,o,a,s){gs.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Ju(t,e,i,n,r,o,a,s)),this.mergeVertices()}function Ju(t,e,i,n,r,o,a,s){Qa.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s};var c=this;t=void 0!==t?t:1,e=void 0!==e?e: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 Ur,y=new $r,A=0,x=!0===i?t:e,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 $r,A=new $r,x=0,b=(e-t)/i;for(v=0;v<=r;v++){var w=[],M=v/r,E=M*(e-t)+t;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],B=f[v][o+1];l.push(I,P,B),l.push(P,R,B),x+=6}c.addGroup(g,x,0),g+=x}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new Da(h,3)),this.setAttribute("normal",new Da(u,3)),this.setAttribute("uv",new Da(d,2))}function $u(t,e,i,n,r,o,a){Zu.call(this,0,t,e,i,n,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a}}function td(t,e,i,n,r,o,a){Ju.call(this,0,t,e,i,n,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a}}function ed(t,e,i,n){gs.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new id(t,e,i,n)),this.mergeVertices()}function id(t,e,i,n){Qa.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,o,a=[],s=[],c=[],l=[],h=new $r,u=new Ur;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),o=0,r=3;o<=e;o++,r+=3){var d=i+o/e*n;h.x=t*Math.cos(d),h.y=t*Math.sin(d),s.push(h.x,h.y,h.z),c.push(0,0,1),u.x=(s[r]/t+1)/2,u.y=(s[r+1]/t+1)/2,l.push(u.x,u.y)}for(r=1;r<=e;r++)a.push(r,r+1,0);this.setIndex(a),this.setAttribute("position",new Da(s,3)),this.setAttribute("normal",new Da(c,3)),this.setAttribute("uv",new Da(l,2))}Vu.prototype=Object.create(gs.prototype),Vu.prototype.constructor=Vu,zu.prototype=Object.create(Nu.prototype),zu.prototype.constructor=zu,Hu.prototype=Object.create(gs.prototype),Hu.prototype.constructor=Hu,Uu.prototype=Object.create(Qa.prototype),Uu.prototype.constructor=Uu,Gu.prototype=Object.create(gs.prototype),Gu.prototype.constructor=Gu,ju.prototype=Object.create(Qa.prototype),ju.prototype.constructor=ju,Qu.prototype=Object.create(gs.prototype),Qu.prototype.constructor=Qu,Wu.prototype=Object.create(Qa.prototype),Wu.prototype.constructor=Wu,qu.prototype=Object.create(gs.prototype),qu.prototype.constructor=qu,qu.prototype.toJSON=function(){var t=gs.prototype.toJSON.call(this);return Xu(this.parameters.shapes,t)},Ku.prototype=Object.create(Qa.prototype),Ku.prototype.constructor=Ku,Ku.prototype.toJSON=function(){var t=Qa.prototype.toJSON.call(this);return Xu(this.parameters.shapes,t)},Yu.prototype=Object.create(Qa.prototype),Yu.prototype.constructor=Yu,Zu.prototype=Object.create(gs.prototype),Zu.prototype.constructor=Zu,Ju.prototype=Object.create(Qa.prototype),Ju.prototype.constructor=Ju,$u.prototype=Object.create(Zu.prototype),$u.prototype.constructor=$u,td.prototype=Object.create(Ju.prototype),td.prototype.constructor=td,ed.prototype=Object.create(gs.prototype),ed.prototype.constructor=ed,id.prototype=Object.create(Qa.prototype),id.prototype.constructor=id;var nd=Object.freeze({__proto__:null,WireframeGeometry:Uh,ParametricGeometry:Gh,ParametricBufferGeometry:jh,TetrahedronGeometry:qh,TetrahedronBufferGeometry:Kh,OctahedronGeometry:Xh,OctahedronBufferGeometry:Yh,IcosahedronGeometry:Zh,IcosahedronBufferGeometry:Jh,DodecahedronGeometry:$h,DodecahedronBufferGeometry:tu,PolyhedronGeometry:Qh,PolyhedronBufferGeometry:Wh,TubeGeometry:eu,TubeBufferGeometry:iu,TorusKnotGeometry:nu,TorusKnotBufferGeometry:ru,TorusGeometry:ou,TorusBufferGeometry:au,TextGeometry:Vu,TextBufferGeometry:zu,SphereGeometry:Hu,SphereBufferGeometry:Uu,RingGeometry:Gu,RingBufferGeometry:ju,PlaneGeometry:Ls,PlaneBufferGeometry:Ds,LatheGeometry:Qu,LatheBufferGeometry:Wu,ShapeGeometry:qu,ShapeBufferGeometry:Ku,ExtrudeGeometry:Ou,ExtrudeBufferGeometry:Nu,EdgesGeometry:Yu,ConeGeometry:$u,ConeBufferGeometry:td,CylinderGeometry:Zu,CylinderBufferGeometry:Ju,CircleGeometry:ed,CircleBufferGeometry:id,BoxGeometry:class extends gs{constructor(t,e,i,n,r,o){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new vs(t,e,i,n,r,o)),this.mergeVertices()}},BoxBufferGeometry:vs});function rd(t){Ma.call(this),this.type="ShadowMaterial",this.color=new va(0),this.transparent=!0,this.setValues(t)}function od(t){bs.call(this,t),this.type="RawShaderMaterial"}function ad(t){Ma.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new va(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 va(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ur(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(t)}function sd(t){ad.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ur(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(t)}function cd(t){Ma.call(this),this.type="MeshPhongMaterial",this.color=new va(16777215),this.specular=new va(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new va(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ur(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(t)}function ld(t){Ma.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new va(16777215),this.specular=new va(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 va(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ur(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(t)}function hd(t){Ma.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ur(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(t)}function ud(t){Ma.call(this),this.type="MeshLambertMaterial",this.color=new va(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new va(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(t)}function dd(t){Ma.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new va(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ur(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(t)}function pd(t){xh.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}rd.prototype=Object.create(Ma.prototype),rd.prototype.constructor=rd,rd.prototype.isShadowMaterial=!0,rd.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this},od.prototype=Object.create(bs.prototype),od.prototype.constructor=od,od.prototype.isRawShaderMaterial=!0,ad.prototype=Object.create(Ma.prototype),ad.prototype.constructor=ad,ad.prototype.isMeshStandardMaterial=!0,ad.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},sd.prototype=Object.create(ad.prototype),sd.prototype.constructor=sd,sd.prototype.isMeshPhysicalMaterial=!0,sd.prototype.copy=function(t){return ad.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new va).copy(t.sheen):this.sheen=null,this.transparency=t.transparency,this},cd.prototype=Object.create(Ma.prototype),cd.prototype.constructor=cd,cd.prototype.isMeshPhongMaterial=!0,cd.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ld.prototype=Object.create(Ma.prototype),ld.prototype.constructor=ld,ld.prototype.isMeshToonMaterial=!0,ld.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},hd.prototype=Object.create(Ma.prototype),hd.prototype.constructor=hd,hd.prototype.isMeshNormalMaterial=!0,hd.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ud.prototype=Object.create(Ma.prototype),ud.prototype.constructor=ud,ud.prototype.isMeshLambertMaterial=!0,ud.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},dd.prototype=Object.create(Ma.prototype),dd.prototype.constructor=dd,dd.prototype.isMeshMatcapMaterial=!0,dd.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},pd.prototype=Object.create(xh.prototype),pd.prototype.constructor=pd,pd.prototype.isLineDashedMaterial=!0,pd.prototype.copy=function(t){return xh.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var fd=Object.freeze({__proto__:null,ShadowMaterial:rd,SpriteMaterial:Hl,RawShaderMaterial:od,ShaderMaterial:bs,PointsMaterial:Rh,MeshPhysicalMaterial:sd,MeshStandardMaterial:ad,MeshPhongMaterial:cd,MeshToonMaterial:ld,MeshNormalMaterial:hd,MeshLambertMaterial:ud,MeshDepthMaterial:Ml,MeshDistanceMaterial:El,MeshBasicMaterial:Ea,MeshMatcapMaterial:dd,LineDashedMaterial:pd,LineBasicMaterial:xh,Material:Ma}),md={arraySlice:function(t,e,i){return md.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,i=new Array(e),n=0;n!==e;++n)i[n]=n;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[n])&&(e.push(o.time),i.push.apply(i,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[n])&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(a=o[n])&&(e.push(o.time),i.push(a)),o=t[r++]}while(void 0!==o)}},subclip:function(t,e,i,n,r){r=r||30;var o=t.clone();o.name=e;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=md.convertArray(h,c.times.constructor),c.values=md.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(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=t),(void 0===n||n<=0)&&(n=30);for(var r=t.tracks.length,o=e/n,a=0;a<r;++a){var s=i.tracks[a],c=s.ValueTypeName;if("bool"!==c&&"string"!==c){var l=t.tracks.find((function(t){return t.name===s.name&&t.ValueTypeName===c}));if(void 0!==l){var h,u=s.getValueSize(),d=s.times.length-1;if(o<=s.times[0])h=md.arraySlice(s.values,0,s.valueSize);else if(o>=s.times[d]){var p=d*u;h=md.arraySlice(s.values,p)}else{var f=s.createInterpolant();f.evaluate(o),h=f.resultBuffer}if("quaternion"===c)new Yr(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)Yr.multiplyQuaternionsFlat(l.values,v,h,0,l.values,v);else for(var y=0;y<u;++y)l.values[v+y]-=h[y]}}}}return t.blendMode=2501,t}};function gd(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function vd(t,e,i,n){gd.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function yd(t,e,i,n){gd.call(this,t,e,i,n)}function Ad(t,e,i,n){gd.call(this,t,e,i,n)}function xd(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=md.convertArray(e,this.TimeBufferType),this.values=md.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function bd(t,e,i){xd.call(this,t,e,i)}function wd(t,e,i,n){xd.call(this,t,e,i,n)}function Md(t,e,i,n){xd.call(this,t,e,i,n)}function Ed(t,e,i,n){gd.call(this,t,e,i,n)}function Sd(t,e,i,n){xd.call(this,t,e,i,n)}function _d(t,e,i,n){xd.call(this,t,e,i,n)}function Td(t,e,i,n){xd.call(this,t,e,i,n)}function Cd(t,e,i,n){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.blendMode=void 0!==n?n:2500,this.uuid=Hr.generateUUID(),this.duration<0&&this.resetDuration()}function Id(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Md;case"vector":case"vector2":case"vector3":case"vector4":return Td;case"color":return wd;case"quaternion":return Sd;case"bool":case"boolean":return bd;case"string":return _d}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var i=[],n=[];md.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(gd.prototype,{evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var o;i:{n:if(!(t<n)){for(var a=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===a)break;if(r=n,t<(n=e[++i]))break e}o=e.length;break i}if(t>=r)break t;var s=e[1];t<s&&(i=2,r=s);for(a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===a)break;if(n=r,t>=(r=e[--i-1]))break e}o=i,i=0}for(;i<o;){var c=i+o>>>1;t<e[c]?o=c:i=c+1}if(n=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,o=0;o!==n;++o)e[o]=i[r+o];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(gd.prototype,{beforeStart_:gd.prototype.copySampleValue_,afterEnd_:gd.prototype.copySampleValue_}),vd.prototype=Object.assign(Object.create(gd.prototype),{constructor:vd,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,o=t+1,a=n[r],s=n[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=t,a=2*e-i;break;case 2402:a=e+n[r=n.length-2]-n[r+1];break;default:r=t,a=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*i-e;break;case 2402:o=1,s=i+n[1]-n[0];break;default:o=t-1,s=e}var c=.5*(i-e),l=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-i),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),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}}),yd.prototype=Object.assign(Object.create(gd.prototype),{constructor:yd,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=(i-e)/(n-e),h=1-l,u=0;u!==a;++u)r[u]=o[c+u]*h+o[s+u]*l;return r}}),Ad.prototype=Object.assign(Object.create(gd.prototype),{constructor:Ad,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(xd,{toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:md.convertArray(t.times,Array),values:md.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e}}),Object.assign(xd.prototype,{constructor:xd,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Ad(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new yd(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new vd(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=e,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(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,o=n-1;r!==n&&i[r]<t;)++r;for(;-1!==o&&i[o]>e;)--o;if(++o,0!==r||o!==n){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=md.arraySlice(i,r,o),this.values=md.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!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),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==n&&md.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),t=!1;break}}}return t},optimize:function(){for(var t=md.arraySlice(this.times),e=md.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[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=e[l+d];if(p!==e[h+d]||p!==e[u+d]){s=!0;break}}if(s){if(a!==r){t[r]=t[a];var f=a*i,m=r*i;for(d=0;d!==i;++d)e[m+d]=e[f+d]}++r}}if(o>0){t[r]=t[o];for(f=o*i,m=r*i,d=0;d!==i;++d)e[m+d]=e[f+d];++r}return r!==t.length?(this.times=md.arraySlice(t,0,r),this.values=md.arraySlice(e,0,r*i)):(this.times=t,this.values=e),this},clone:function(){var t=md.arraySlice(this.times,0),e=md.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),bd.prototype=Object.assign(Object.create(xd.prototype),{constructor:bd,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),wd.prototype=Object.assign(Object.create(xd.prototype),{constructor:wd,ValueTypeName:"color"}),Md.prototype=Object.assign(Object.create(xd.prototype),{constructor:Md,ValueTypeName:"number"}),Ed.prototype=Object.assign(Object.create(gd.prototype),{constructor:Ed,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(i-e)/(n-e),l=s+a;s!==l;s+=4)Yr.slerpFlat(r,0,o,s-a,o,s,c);return r}}),Sd.prototype=Object.assign(Object.create(xd.prototype),{constructor:Sd,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Ed(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),_d.prototype=Object.assign(Object.create(xd.prototype),{constructor:_d,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Td.prototype=Object.assign(Object.create(xd.prototype),{constructor:Td,ValueTypeName:"vector"}),Object.assign(Cd,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,o=i.length;r!==o;++r)e.push(Id(i[r]).scale(n));return new Cd(t.name,t.duration,e,t.blendMode)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode},r=0,o=i.length;r!==o;++r)e.push(xd.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.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=md.getKeyframeOrder(s);s=md.sortedArray(s,1,l),c=md.sortedArray(c,1,l),n||0!==s[0]||(s.push(r),c.push(c[0])),o.push(new Md(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/i))}return new Cd(t,-1,o)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[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(Cd.CreateFromMorphTargetSequence(u,n[u],e,i));return h},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(t,e,i,n,r){if(0!==i.length){var o=[],a=[];md.flattenJSON(i,o,a,n),0!==o.length&&r.push(new t(e,o,a))}},n=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.blendMode,c=t.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 Md(".morphTargetInfluence["+f+"]",m,g))}o=u.length*(a||1)}else{var y=".bones["+e[l].name+"]";i(Td,y+".position",h,"pos",n),i(Sd,y+".quaternion",h,"rot",n),i(Td,y+".scale",h,"scl",n)}}return 0===n.length?null:new Cd(r,o,n,s)}}),Object.assign(Cd.prototype,{resetDuration:function(){for(var t=0,e=0,i=this.tracks.length;e!==i;++e){var n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new Cd(this.name,this.duration,t,this.blendMode)}});var Pd={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Rd(t,e,i){var n=this,r=!1,o=0,a=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){a++,!1===r&&void 0!==n.onStart&&n.onStart(t,o,a),r=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,a),o===a&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){var e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(var e=0,i=c.length;e<i;e+=2){var n=c[e],r=c[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}var Bd=new Rd;function Ld(t){this.manager=void 0!==t?t:Bd,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Ld.prototype,{load:function(){},loadAsync:function(t,e){var i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});var Dd={};function Od(t){Ld.call(this,t)}function Nd(t){Ld.call(this,t)}function kd(t){Ld.call(this,t)}function Fd(t){Ld.call(this,t)}function Vd(t){Ld.call(this,t)}function zd(t){Ld.call(this,t)}function Hd(t){Ld.call(this,t)}function Ud(){this.type="Curve",this.arcLengthDivisions=200}function Gd(t,e,i,n,r,o,a,s){Ud.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||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 jd(t,e,i,n,r,o){Gd.call(this,t,e,i,i,n,r,o),this.type="ArcCurve"}function Qd(){var t=0,e=0,i=0,n=0;function r(r,o,a,s){t=r,e=a,i=-3*r+3*o-2*a-s,n=2*r-2*o+a+s}return{initCatmullRom:function(t,e,i,n,o){r(e,i,o*(i-t),o*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,o,a,s){var c=(e-t)/o-(i-t)/(o+a)+(i-e)/a,l=(i-e)/a-(n-e)/(a+s)+(n-i)/s;r(e,i,c*=a,l*=a)},calc:function(r){var o=r*r;return t+e*r+i*o+n*(o*r)}}}Od.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Od,load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,o=Pd.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;if(void 0===Dd[t]){var a=t.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(){e&&e(h),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{Dd[t]=[],Dd[t].push({onLoad:e,onProgress:i,onError:n});var m=new XMLHttpRequest;for(var g in m.open("GET",t,!0),m.addEventListener("load",(function(e){var i=this.response,n=Dd[t];if(delete Dd[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Pd.add(t,i);for(var o=0,a=n.length;o<a;o++){(s=n[o]).onLoad&&s.onLoad(i)}r.manager.itemEnd(t)}else{for(o=0,a=n.length;o<a;o++){var s;(s=n[o]).onError&&s.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),m.addEventListener("progress",(function(e){for(var i=Dd[t],n=0,r=i.length;n<r;n++){var o=i[n];o.onProgress&&o.onProgress(e)}}),!1),m.addEventListener("error",(function(e){var i=Dd[t];delete Dd[t];for(var n=0,o=i.length;n<o;n++){var a=i[n];a.onError&&a.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),m.addEventListener("abort",(function(e){var i=Dd[t];delete Dd[t];for(var n=0,o=i.length;n<o;n++){var a=i[n];a.onError&&a.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!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(t),m}Dd[t].push({onLoad:e,onProgress:i,onError:n})},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this}}),Nd.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Nd,load:function(t,e,i,n){var r=this,o=new Od(r.manager);o.setPath(r.path),o.load(t,(function(i){try{e(r.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)},parse:function(t){for(var e=[],i=0;i<t.length;i++){var n=Cd.parse(t[i]);e.push(n)}return e}}),kd.prototype=Object.assign(Object.create(Ld.prototype),{constructor:kd,load:function(t,e,i,n){var r=this,o=[],a=new Vh;a.image=o;var s=new Od(this.manager);function c(c){s.load(t[c],(function(t){var i=r.parse(t,!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,e&&e(a))}),i,n)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var l=0,h=0,u=t.length;h<u;++h)c(h);else s.load(t,(function(t){var i=r.parse(t,!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,e&&e(a)}),i,n);return a}}),Fd.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Fd,load:function(t,e,i,n){var r=this,o=new _s,a=new Od(this.manager);return a.setResponseType("arraybuffer"),a.setPath(this.path),a.load(t,(function(t){var i=r.parse(t);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,e&&e(o,i))}),i,n),o}}),Vd.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Vd,load:function(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,o=Pd.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),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),Pd.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(e){a.removeEventListener("load",s,!1),a.removeEventListener("error",c,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return a.addEventListener("load",s,!1),a.addEventListener("error",c,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}),zd.prototype=Object.assign(Object.create(Ld.prototype),{constructor:zd,load:function(t,e,i,n){var r=new Ks,o=new Vd(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;function s(i){o.load(t[i],(function(t){r.images[i]=t,6===++a&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(var c=0;c<t.length;++c)s(c);return r}}),Hd.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Hd,load:function(t,e,i,n){var r=new Wr,o=new Vd(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(i){r.image=i;var n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}),Object.assign(Ud.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),o=0;for(n.push(0),i=1;i<=t;i++)o+=(e=this.getPoint(i/t)).distanceTo(r),n.push(o),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,o=n.length;i=e||t*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(t,e){var i=1e-4,n=t-i,r=t+i;n<0&&(n=0),r>1&&(r=1);var o=this.getPoint(n),a=this.getPoint(r),s=e||(o.isVector2?new Ur:new $r);return s.copy(a).sub(o).normalize(),s},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},computeFrenetFrames:function(t,e){var i,n,r,o=new $r,a=[],s=[],c=[],l=new $r,h=new so;for(i=0;i<=t;i++)n=i/t,a[i]=this.getTangentAt(n,new $r),a[i].normalize();s[0]=new $r,c[0]=new $r;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<=t;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(Hr.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===e)for(r=Math.acos(Hr.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;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(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Gd.prototype=Object.create(Ud.prototype),Gd.prototype.constructor=Gd,Gd.prototype.isEllipseCurve=!0,Gd.prototype.getPoint=function(t,e){for(var i=e||new Ur,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+t*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)},Gd.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Gd.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Gd.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},jd.prototype=Object.create(Gd.prototype),jd.prototype.constructor=jd,jd.prototype.isArcCurve=!0;var Wd=new $r,qd=new Qd,Kd=new Qd,Xd=new Qd;function Yd(t,e,i,n){Ud.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=i||"centripetal",this.tension=n||.5}function Zd(t,e,i,n,r){var o=.5*(n-e),a=.5*(r-i),s=t*t;return(2*i-2*n+o+a)*(t*s)+(-3*i+3*n-2*o-a)*s+o*t+i}function Jd(t,e,i,n){return function(t,e){var i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function $d(t,e,i,n,r){return function(t,e){var i=1-t;return i*i*i*e}(t,e)+function(t,e){var i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}function tp(t,e,i,n){Ud.call(this),this.type="CubicBezierCurve",this.v0=t||new Ur,this.v1=e||new Ur,this.v2=i||new Ur,this.v3=n||new Ur}function ep(t,e,i,n){Ud.call(this),this.type="CubicBezierCurve3",this.v0=t||new $r,this.v1=e||new $r,this.v2=i||new $r,this.v3=n||new $r}function ip(t,e){Ud.call(this),this.type="LineCurve",this.v1=t||new Ur,this.v2=e||new Ur}function np(t,e){Ud.call(this),this.type="LineCurve3",this.v1=t||new $r,this.v2=e||new $r}function rp(t,e,i){Ud.call(this),this.type="QuadraticBezierCurve",this.v0=t||new Ur,this.v1=e||new Ur,this.v2=i||new Ur}function op(t,e,i){Ud.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new $r,this.v1=e||new $r,this.v2=i||new $r}function ap(t){Ud.call(this),this.type="SplineCurve",this.points=t||[]}Yd.prototype=Object.create(Ud.prototype),Yd.prototype.constructor=Yd,Yd.prototype.isCatmullRomCurve3=!0,Yd.prototype.getPoint=function(t,e){var i,n,r,o,a=e||new $r,s=this.points,c=s.length,l=(c-(this.closed?0:1))*t,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]:(Wd.subVectors(s[0],s[1]).add(s[0]),i=Wd),n=s[h%c],r=s[(h+1)%c],this.closed||h+2<c?o=s[(h+2)%c]:(Wd.subVectors(s[c-1],s[c-2]).add(s[c-1]),o=Wd),"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),Kd.initNonuniformCatmullRom(i.y,n.y,r.y,o.y,p,f,m),Xd.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),Kd.initCatmullRom(i.y,n.y,r.y,o.y,this.tension),Xd.initCatmullRom(i.z,n.z,r.z,o.z,this.tension));return a.set(qd.calc(u),Kd.calc(u),Xd.calc(u)),a},Yd.prototype.copy=function(t){Ud.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Yd.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Yd.prototype.fromJSON=function(t){Ud.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new $r).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},tp.prototype=Object.create(Ud.prototype),tp.prototype.constructor=tp,tp.prototype.isCubicBezierCurve=!0,tp.prototype.getPoint=function(t,e){var i=e||new Ur,n=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set($d(t,n.x,r.x,o.x,a.x),$d(t,n.y,r.y,o.y,a.y)),i},tp.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},tp.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},tp.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},ep.prototype=Object.create(Ud.prototype),ep.prototype.constructor=ep,ep.prototype.isCubicBezierCurve3=!0,ep.prototype.getPoint=function(t,e){var i=e||new $r,n=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set($d(t,n.x,r.x,o.x,a.x),$d(t,n.y,r.y,o.y,a.y),$d(t,n.z,r.z,o.z,a.z)),i},ep.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},ep.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},ep.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},ip.prototype=Object.create(Ud.prototype),ip.prototype.constructor=ip,ip.prototype.isLineCurve=!0,ip.prototype.getPoint=function(t,e){var i=e||new Ur;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},ip.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},ip.prototype.getTangent=function(t,e){return(e||new Ur).copy(this.v2).sub(this.v1).normalize()},ip.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},ip.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},ip.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},np.prototype=Object.create(Ud.prototype),np.prototype.constructor=np,np.prototype.isLineCurve3=!0,np.prototype.getPoint=function(t,e){var i=e||new $r;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},np.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},np.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},np.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},np.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},rp.prototype=Object.create(Ud.prototype),rp.prototype.constructor=rp,rp.prototype.isQuadraticBezierCurve=!0,rp.prototype.getPoint=function(t,e){var i=e||new Ur,n=this.v0,r=this.v1,o=this.v2;return i.set(Jd(t,n.x,r.x,o.x),Jd(t,n.y,r.y,o.y)),i},rp.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},rp.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},rp.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},op.prototype=Object.create(Ud.prototype),op.prototype.constructor=op,op.prototype.isQuadraticBezierCurve3=!0,op.prototype.getPoint=function(t,e){var i=e||new $r,n=this.v0,r=this.v1,o=this.v2;return i.set(Jd(t,n.x,r.x,o.x),Jd(t,n.y,r.y,o.y),Jd(t,n.z,r.z,o.z)),i},op.prototype.copy=function(t){return Ud.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},op.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},op.prototype.fromJSON=function(t){return Ud.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},ap.prototype=Object.create(Ud.prototype),ap.prototype.constructor=ap,ap.prototype.isSplineCurve=!0,ap.prototype.getPoint=function(t,e){var i=e||new Ur,n=this.points,r=(n.length-1)*t,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(Zd(a,s.x,c.x,l.x,h.x),Zd(a,s.y,c.y,l.y,h.y)),i},ap.prototype.copy=function(t){Ud.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this},ap.prototype.toJSON=function(){var t=Ud.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t},ap.prototype.fromJSON=function(t){Ud.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new Ur).fromArray(n))}return this};var sp=Object.freeze({__proto__:null,ArcCurve:jd,CatmullRomCurve3:Yd,CubicBezierCurve:tp,CubicBezierCurve3:ep,EllipseCurve:Gd,LineCurve:ip,LineCurve3:np,QuadraticBezierCurve:rp,QuadraticBezierCurve3:op,SplineCurve:ap});function cp(){Ud.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function lp(t){cp.call(this),this.type="Path",this.currentPoint=new Ur,t&&this.setFromPoints(t)}function hp(t){lp.call(this,t),this.uuid=Hr.generateUUID(),this.type="Shape",this.holes=[]}function up(t,e){_o.call(this),this.type="Light",this.color=new va(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function dp(t,e,i){up.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(_o.DefaultUp),this.updateMatrix(),this.groundColor=new va(e)}function pp(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new Ur(512,512),this.map=null,this.mapPass=null,this.matrix=new so,this._frustum=new Is,this._frameExtents=new Ur(1,1),this._viewportCount=1,this._viewports=[new qr(0,0,1,1)]}function fp(){pp.call(this,new Ms(50,1,.5,500))}function mp(t,e,i,n,r,o){up.call(this,t,e),this.type="SpotLight",this.position.copy(_o.DefaultUp),this.updateMatrix(),this.target=new _o,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/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 fp}function gp(){pp.call(this,new Ms(90,1,.5,500)),this._frameExtents=new Ur(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 $r(1,0,0),new $r(-1,0,0),new $r(0,0,1),new $r(0,0,-1),new $r(0,1,0),new $r(0,-1,0)],this._cubeUps=[new $r(0,1,0),new $r(0,1,0),new $r(0,1,0),new $r(0,1,0),new $r(0,0,1),new $r(0,0,-1)]}function vp(t,e,i,n){up.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new gp}function yp(t,e,i,n,r,o){ws.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==t?t:-1,this.right=void 0!==e?e: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 Ap(){pp.call(this,new yp(-5,5,5,-5,.5,500))}function xp(t,e){up.call(this,t,e),this.type="DirectionalLight",this.position.copy(_o.DefaultUp),this.updateMatrix(),this.target=new _o,this.shadow=new Ap}function bp(t,e){up.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function wp(t,e,i,n){up.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}function Mp(){this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new $r)}function Ep(t,e){up.call(this,void 0,e),this.type="LightProbe",this.sh=void 0!==t?t:new Mp}function Sp(t){Ld.call(this,t),this.textures={}}cp.prototype=Object.assign(Object.create(Ud.prototype),{constructor:cp,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new ip(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.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 t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var o=r[n],a=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++){var l=s[c];e&&e.equals(l)||(i.push(l),e=l)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(t){Ud.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=Ud.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,i=this.curves.length;e<i;e++){var n=this.curves[e];t.curves.push(n.toJSON())}return t},fromJSON:function(t){Ud.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push((new sp[n.type]).fromJSON(n))}return this}}),lp.prototype=Object.assign(Object.create(cp.prototype),{constructor:lp,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){var i=new ip(this.currentPoint.clone(),new Ur(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,i,n){var r=new rp(this.currentPoint.clone(),new Ur(t,e),new Ur(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this},bezierCurveTo:function(t,e,i,n,r,o){var a=new tp(this.currentPoint.clone(),new Ur(t,e),new Ur(i,n),new Ur(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this},splineThru:function(t){var e=new ap([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,i,n,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+a,e+s,i,n,r,o),this},absarc:function(t,e,i,n,r,o){return this.absellipse(t,e,i,i,n,r,o),this},ellipse:function(t,e,i,n,r,o,a,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,i,n,r,o,a,s),this},absellipse:function(t,e,i,n,r,o,a,s){var c=new Gd(t,e,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(t){return cp.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=cp.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return cp.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),hp.prototype=Object.assign(Object.create(lp.prototype),{constructor:hp,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){lp.prototype.copy.call(this,t),this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push(n.clone())}return this},toJSON:function(){var t=lp.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,i=this.holes.length;e<i;e++){var n=this.holes[e];t.holes.push(n.toJSON())}return t},fromJSON:function(t){lp.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push((new lp).fromJSON(n))}return this}}),up.prototype=Object.assign(Object.create(_o.prototype),{constructor:up,isLight:!0,copy:function(t){return _o.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=_o.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),dp.prototype=Object.assign(Object.create(up.prototype),{constructor:dp,isHemisphereLight:!0,copy:function(t){return up.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(pp.prototype,{_projScreenMatrix:new so,_lightPositionWorld:new $r,_lookTarget:new $r,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){var e=this.camera,i=this.matrix,n=this._projScreenMatrix,r=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(t.matrixWorld),e.position.copy(o),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),n.multiplyMatrices(e.projectionMatrix,e.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(e.projectionMatrix),i.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),fp.prototype=Object.assign(Object.create(pp.prototype),{constructor:fp,isSpotLightShadow:!0,updateMatrices:function(t){var e=this.camera,i=2*Hr.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),pp.prototype.updateMatrices.call(this,t)}}),mp.prototype=Object.assign(Object.create(up.prototype),{constructor:mp,isSpotLight:!0,copy:function(t){return up.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),gp.prototype=Object.assign(Object.create(pp.prototype),{constructor:gp,isPointLightShadow:!0,updateMatrices:function(t,e){void 0===e&&(e=0);var i=this.camera,n=this.matrix,r=this._lightPositionWorld,o=this._lookTarget,a=this._projScreenMatrix;r.setFromMatrixPosition(t.matrixWorld),i.position.copy(r),o.copy(i.position),o.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(o),i.updateMatrixWorld(),n.makeTranslation(-r.x,-r.y,-r.z),a.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a)}}),vp.prototype=Object.assign(Object.create(up.prototype),{constructor:vp,isPointLight:!0,copy:function(t){return up.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),yp.prototype=Object.assign(Object.create(ws.prototype),{constructor:yp,isOrthographicCamera:!0,copy:function(t,e){return ws.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,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=t,this.view.fullHeight=e,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 t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,o=i+t,a=n+e,s=n-e;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(t){var e=_o.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Ap.prototype=Object.assign(Object.create(pp.prototype),{constructor:Ap,isDirectionalLightShadow:!0,updateMatrices:function(t){pp.prototype.updateMatrices.call(this,t)}}),xp.prototype=Object.assign(Object.create(up.prototype),{constructor:xp,isDirectionalLight:!0,copy:function(t){return up.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),bp.prototype=Object.assign(Object.create(up.prototype),{constructor:bp,isAmbientLight:!0}),wp.prototype=Object.assign(Object.create(up.prototype),{constructor:wp,isRectAreaLight:!0,copy:function(t){return up.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=up.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),Object.assign(Mp.prototype,{isSphericalHarmonics3:!0,set:function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},zero:function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},getAt:function(t,e){var i=t.x,n=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*n),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*i),e.addScaledVector(o[4],i*n*1.092548),e.addScaledVector(o[5],n*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],i*r*1.092548),e.addScaledVector(o[8],.546274*(i*i-n*n)),e},getIrradianceAt:function(t,e){var i=t.x,n=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*n),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*i),e.addScaledVector(o[4],.858086*i*n),e.addScaledVector(o[5],.858086*n*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*i*r),e.addScaledVector(o[8],.429043*(i*i-n*n)),e},add:function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},addScaledSH:function(t,e){for(var i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this},scale:function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},lerp:function(t,e){for(var i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this},equals:function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0},copy:function(t){return this.set(t.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(t,e){void 0===e&&(e=0);for(var i=this.coefficients,n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);for(var i=this.coefficients,n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}}),Object.assign(Mp,{getBasisAt:function(t,e){var i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}),Ep.prototype=Object.assign(Object.create(up.prototype),{constructor:Ep,isLightProbe:!0,copy:function(t){return up.prototype.copy.call(this,t),this.sh.copy(t.sh),this},fromJSON:function(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this},toJSON:function(t){var e=up.prototype.toJSON.call(this,t);return e.object.sh=this.sh.toArray(),e}}),Sp.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Sp,load:function(t,e,i,n){var r=this,o=new Od(r.manager);o.setPath(r.path),o.load(t,(function(i){try{e(r.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)},parse:function(t){var e=this.textures;function i(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var n=new fd[t.type];if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.sheen&&(n.sheen=(new va).setHex(t.sheen)),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearcoat&&(n.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(n.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.flatShading&&(n.flatShading=t.flatShading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.combine&&(n.combine=t.combine),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(n.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(n.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(n.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(n.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(n.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(n.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(n.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(n.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(n.rotation=t.rotation),1!==t.linewidth&&(n.linewidth=t.linewidth),void 0!==t.dashSize&&(n.dashSize=t.dashSize),void 0!==t.gapSize&&(n.gapSize=t.gapSize),void 0!==t.scale&&(n.scale=t.scale),void 0!==t.polygonOffset&&(n.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(n.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(n.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(n.skinning=t.skinning),void 0!==t.morphTargets&&(n.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(n.morphNormals=t.morphNormals),void 0!==t.dithering&&(n.dithering=t.dithering),void 0!==t.vertexTangents&&(n.vertexTangents=t.vertexTangents),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.toneMapped&&(n.toneMapped=t.toneMapped),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?n.vertexColors=t.vertexColors>0:n.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var r in t.uniforms){var o=t.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 va).setHex(o.value);break;case"v2":n.uniforms[r].value=(new Ur).fromArray(o.value);break;case"v3":n.uniforms[r].value=(new $r).fromArray(o.value);break;case"v4":n.uniforms[r].value=(new qr).fromArray(o.value);break;case"m3":n.uniforms[r].value=(new Gr).fromArray(o.value);case"m4":n.uniforms[r].value=(new so).fromArray(o.value);break;default:n.uniforms[r].value=o.value}}if(void 0!==t.defines&&(n.defines=t.defines),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var a in t.extensions)n.extensions[a]=t.extensions[a];if(void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.matcap&&(n.matcap=i(t.matcap)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new Ur).fromArray(s)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(n.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(n.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(n.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(n.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(n.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Ur).fromArray(t.clearcoatNormalScale)),n},setTextures:function(t){return this.textures=t,this}});var _p=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}},Tp=function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)};function Cp(){Qa.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Ip(t,e,i,n){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),_a.call(this,t,e,i),this.meshPerAttribute=n||1}function Pp(t){Ld.call(this,t)}Cp.prototype=Object.assign(Object.create(Qa.prototype),{constructor:Cp,isInstancedBufferGeometry:!0,copy:function(t){return Qa.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=Qa.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),Ip.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ip,isInstancedBufferAttribute:!0,copy:function(t){return _a.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=_a.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}),Pp.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Pp,load:function(t,e,i,n){var r=this,o=new Od(r.manager);o.setPath(r.path),o.load(t,(function(i){try{e(r.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)},parse:function(t){var e=t.isInstancedBufferGeometry?new Cp:new Qa,i=t.data.index;if(void 0!==i){var n=new Rp[i.type](i.array);e.setIndex(new _a(n,1))}var r=t.data.attributes;for(var o in r){var a=r[o],s=(n=new Rp[a.type](a.array),new(a.isInstancedBufferAttribute?Ip:_a)(n,a.itemSize,a.normalized));void 0!==a.name&&(s.name=a.name),e.setAttribute(o,s)}var c=t.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 _a(n=new Rp[a.type](a.array),a.itemSize,a.normalized);void 0!==a.name&&(s.name=a.name),h.push(s)}e.morphAttributes[o]=h}t.data.morphTargetsRelative&&(e.morphTargetsRelative=!0);var p=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==p){u=0;for(var f=p.length;u!==f;++u){var m=p[u];e.addGroup(m.start,m.count,m.materialIndex)}}var g=t.data.boundingSphere;if(void 0!==g){var v=new $r;void 0!==g.center&&v.fromArray(g.center),e.boundingSphere=new jo(v,g.radius)}return t.name&&(e.name=t.name),t.userData&&(e.userData=t.userData),e}});var Rp={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Bp(t){Ld.call(this,t)}Bp.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Bp,load:function(t,e,i,n){var r=this,o=""===this.path?Tp(t):this.path;this.resourcePath=this.resourcePath||o;var a=new Od(r.manager);a.setPath(this.path),a.load(t,(function(i){var o=null;try{o=JSON.parse(i)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t)}),i,n)},parse:function(t,e){var i=this.parseShape(t.shapes),n=this.parseGeometries(t.geometries,i),r=this.parseImages(t.images,(function(){void 0!==e&&e(s)})),o=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,o),s=this.parseObject(t.object,n,a);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var i=0,n=t.length;i<n;i++){var r=(new hp).fromJSON(t[i]);e[r.uuid]=r}return e},parseGeometries:function(t,e){var i={};if(void 0!==t)for(var n=new Pp,r=0,o=t.length;r<o;r++){var a,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new nd[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new nd[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new nd[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new nd[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 nd[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new nd[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 nd[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new nd[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new nd[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new nd[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":a=new nd[s.type]((new sp[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":a=new nd[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":a=new nd[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=e[s.shapes[l]];c.push(u)}a=new nd[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,h=s.shapes.length;l<h;l++){u=e[s.shapes[l]];c.push(u)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new sp[d.type]).fromJSON(d)),a=new nd[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(t,e){var i={},n={};if(void 0!==t){var r=new Sp;r.setTextures(e);for(var o=0,a=t.length;o<a;o++){var s=t[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(t){for(var e=[],i=0;i<t.length;i++){var n=t[i],r=Cd.parse(n);void 0!==n.uuid&&(r.uuid=n.uuid),e.push(r)}return e},parseImages:function(t,e){var i=this,n={};function r(t){return i.manager.itemStart(t),o.load(t,(function(){i.manager.itemEnd(t)}),void 0,(function(){i.manager.itemError(t),i.manager.itemEnd(t)}))}if(void 0!==t&&t.length>0){var o=new Vd(new Rd(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a<s;a++){var c=t[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(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var n={};if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var a,s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(a=Array.isArray(e[s.image])?new Ks(e[s.image]):new Wr(e[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,Dp)),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],Op),a.wrapT=i(s.wrap[1],Op)),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,Np)),void 0!==s.magFilter&&(a.magFilter=i(s.magFilter,Np)),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(t,e,i){var n;function r(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function o(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];void 0===i[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(i[o])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}switch(t.type){case"Scene":n=new To,void 0!==t.background&&Number.isInteger(t.background)&&(n.background=new va(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?n.fog=new Nl(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(n.fog=new Ol(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":n=new Ms(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(n.focus=t.focus),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.filmGauge&&(n.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(n.filmOffset=t.filmOffset),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"OrthographicCamera":n=new yp(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"AmbientLight":n=new bp(t.color,t.intensity);break;case"DirectionalLight":n=new xp(t.color,t.intensity);break;case"PointLight":n=new vp(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":n=new wp(t.color,t.intensity,t.width,t.height);break;case"SpotLight":n=new mp(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":n=new dp(t.color,t.groundColor,t.intensity);break;case"LightProbe":n=(new Ep).fromJSON(t);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":n=new ls(a=r(t.geometry),s=o(t.material));break;case"InstancedMesh":var a=r(t.geometry),s=o(t.material),c=t.count,l=t.instanceMatrix;(n=new Ah(a,s,c)).instanceMatrix=new _a(new Float32Array(l.array),16);break;case"LOD":n=new lh;break;case"Line":n=new _h(r(t.geometry),o(t.material),t.mode);break;case"LineLoop":n=new Ph(r(t.geometry),o(t.material));break;case"LineSegments":n=new Ih(r(t.geometry),o(t.material));break;case"PointCloud":case"Points":n=new Nh(r(t.geometry),o(t.material));break;case"Sprite":n=new th(o(t.material));break;case"Group":n=new Pl;break;default:n=new _o}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children)for(var h=t.children,u=0;u<h.length;u++)n.add(this.parseObject(h[u],e,i));if("LOD"===t.type){void 0!==t.autoUpdate&&(n.autoUpdate=t.autoUpdate);for(var d=t.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 Lp,Dp={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Op={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Np={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};function kp(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Ld.call(this,t),this.options=void 0}function Fp(){this.type="ShapePath",this.color=new va,this.subPaths=[],this.currentPath=null}function Vp(t){this.type="Font",this.data=t}function zp(t,e,i,n,r){var o=r.glyphs[t]||r.glyphs["?"];if(o){var a,s,c,l,h,u,d,p,f=new Fp;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++]*e+i,s=m[g++]*e+n,f.moveTo(a,s);break;case"l":a=m[g++]*e+i,s=m[g++]*e+n,f.lineTo(a,s);break;case"q":c=m[g++]*e+i,l=m[g++]*e+n,h=m[g++]*e+i,u=m[g++]*e+n,f.quadraticCurveTo(h,u,c,l);break;case"b":c=m[g++]*e+i,l=m[g++]*e+n,h=m[g++]*e+i,u=m[g++]*e+n,d=m[g++]*e+i,p=m[g++]*e+n,f.bezierCurveTo(h,u,d,p,c,l)}}return{offsetX:o.ha*e,path:f}}console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".")}function Hp(t){Ld.call(this,t)}kp.prototype=Object.assign(Object.create(Ld.prototype),{constructor:kp,setOptions:function(t){return this.options=t,this},load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,o=Pd.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;fetch(t).then((function(t){return t.blob()})).then((function(t){return void 0===r.options?createImageBitmap(t):createImageBitmap(t,r.options)})).then((function(i){Pd.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}),Object.assign(Fp.prototype,{moveTo:function(t,e){return this.currentPath=new lp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this},bezierCurveTo:function(t,e,i,n,r,o){return this.currentPath.bezierCurveTo(t,e,i,n,r,o),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],o=new hp;o.curves=r.curves,e.push(o)}return e}function n(t,e){for(var i=e.length,n=!1,r=i-1,o=0;o<i;r=o++){var a=e[r],s=e[o],c=s.x-a.x,l=s.y-a.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(a=e[o],c=-c,s=e[r],l=-l),t.y<a.y||t.y>s.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var h=l*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;n=!n}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return n}var r=Bu.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return i(o);var a,s,c,l=[];if(1===o.length)return s=o[0],(c=new hp).curves=s.curves,l.push(c),l;var h=!r(o[0].getPoints());h=t?!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=t?!a:a)?(!h&&f[g]&&g++,f[g]={s:new hp,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(Vp.prototype,{isFont:!0,generateShapes:function(t,e){void 0===e&&(e=100);for(var i=[],n=function(t,e,i){for(var n=Array.from?Array.from(t):String(t).split(""),r=e/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=zp(h,r,s,c,i);s+=u.offsetX,a.push(u.path)}}return a}(t,e,this.data),r=0,o=n.length;r<o;r++)Array.prototype.push.apply(i,n[r].toShapes());return i}}),Hp.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Hp,load:function(t,e,i,n){var r=this,o=new Od(this.manager);o.setPath(this.path),o.load(t,(function(t){var i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}var n=r.parse(i);e&&e(n)}),i,n)},parse:function(t){return new Vp(t)}});var Up=function(){return void 0===Lp&&(Lp=new(window.AudioContext||window.webkitAudioContext)),Lp};function Gp(t){Ld.call(this,t)}function jp(t,e,i){Ep.call(this,void 0,i);var n=(new va).set(t),r=(new va).set(e),o=new $r(n.r,n.g,n.b),a=new $r(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 Qp(t,e){Ep.call(this,void 0,e);var i=(new va).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}Gp.prototype=Object.assign(Object.create(Ld.prototype),{constructor:Gp,load:function(t,e,i,n){var r=this,o=new Od(r.manager);o.setResponseType("arraybuffer"),o.setPath(r.path),o.load(t,(function(i){try{var o=i.slice(0);Up().decodeAudioData(o,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)}}),jp.prototype=Object.assign(Object.create(Ep.prototype),{constructor:jp,isHemisphereLightProbe:!0,copy:function(t){return Ep.prototype.copy.call(this,t),this},toJSON:function(t){return Ep.prototype.toJSON.call(this,t)}}),Qp.prototype=Object.assign(Object.create(Ep.prototype),{constructor:Qp,isAmbientLightProbe:!0,copy:function(t){return Ep.prototype.copy.call(this,t),this},toJSON:function(t){return Ep.prototype.toJSON.call(this,t)}});var Wp=new so,qp=new so;function Kp(t){this.autoStart=void 0===t||t,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 Ms,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ms,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(t){var e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;var i,n,r=t.projectionMatrix.clone(),o=e.eyeSep/2,a=o*e.near/e.focus,s=e.near*Math.tan(Hr.DEG2RAD*e.fov*.5)/e.zoom;qp.elements[12]=-o,Wp.elements[12]=o,i=-s*e.aspect+a,n=s*e.aspect+a,r.elements[0]=2*e.near/(n-i),r.elements[8]=(n+i)/(n-i),this.cameraL.projectionMatrix.copy(r),i=-s*e.aspect-a,n=s*e.aspect-a,r.elements[0]=2*e.near/(n-i),r.elements[8]=(n+i)/(n-i),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(qp),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Wp)}}),Object.assign(Kp.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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}});var Xp=new $r,Yp=new Yr,Zp=new $r,Jp=new $r;function $p(){_o.call(this),this.type="AudioListener",this.context=Up(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Kp}function tf(t){_o.call(this),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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=[]}$p.prototype=Object.assign(Object.create(_o.prototype),{constructor:$p,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(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:function(t){_o.prototype.updateMatrixWorld.call(this,t);var e=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xp,Yp,Zp),Jp.set(0,0,-1).applyQuaternion(Yp),e.positionX){var n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Xp.x,n),e.positionY.linearRampToValueAtTime(Xp.y,n),e.positionZ.linearRampToValueAtTime(Xp.z,n),e.forwardX.linearRampToValueAtTime(Jp.x,n),e.forwardY.linearRampToValueAtTime(Jp.y,n),e.forwardZ.linearRampToValueAtTime(Jp.z,n),e.upX.linearRampToValueAtTime(i.x,n),e.upY.linearRampToValueAtTime(i.y,n),e.upZ.linearRampToValueAtTime(i.z,n)}else e.setPosition(Xp.x,Xp.y,Xp.z),e.setOrientation(Jp.x,Jp.y,Jp.z,i.x,i.y,i.z)}}),tf.prototype=Object.assign(Object.create(_o.prototype),{constructor:tf,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setMediaStreamSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(t){if(void 0===t&&(t=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+t;var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,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 t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);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 t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},setDetune:function(t){if(this.detune=t,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(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!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(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(t){return this.loopStart=t,this},setLoopEnd:function(t){return this.loopEnd=t,this},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}});var ef=new $r,nf=new Yr,rf=new $r,of=new $r;function af(t){tf.call(this,t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function sf(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function cf(t,e,i){var n,r,o;switch(this.binding=t,this.valueSize=i,e){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}af.prototype=Object.assign(Object.create(tf.prototype),{constructor:af,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this},updateMatrixWorld:function(t){if(_o.prototype.updateMatrixWorld.call(this,t),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(ef,nf,rf),of.set(0,0,1).applyQuaternion(nf);var e=this.panner;if(e.positionX){var i=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(ef.x,i),e.positionY.linearRampToValueAtTime(ef.y,i),e.positionZ.linearRampToValueAtTime(ef.z,i),e.orientationX.linearRampToValueAtTime(of.x,i),e.orientationY.linearRampToValueAtTime(of.y,i),e.orientationZ.linearRampToValueAtTime(of.z,i)}else e.setPosition(ef.x,ef.y,ef.z),e.setOrientation(of.x,of.y,of.z)}}}),Object.assign(sf.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.assign(cf.prototype,{accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==n;++a)i[r+a]=i[a];o=e}else{var s=e/(o+=e);this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=o},accumulateAdditive:function(t){var e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=e*this._origIndex;this._mixBufferRegion(i,n,s,1-r,e)}o>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(var c=e,l=e+e;c!==l;++c)if(i[c]!==i[c+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(var r=i,o=n;r!==o;++r)e[r]=e[n+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_setAdditiveIdentityNumeric:function(){for(var t=this._addIndex*this.valueSize,e=t+this.valueSize,i=t;i<e;i++)this.buffer[i]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize,i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]},_select:function(t,e,i,n,r){if(n>=.5)for(var o=0;o!==r;++o)t[e+o]=t[i+o]},_slerp:function(t,e,i,n){Yr.slerpFlat(t,e,t,e,t,i,n)},_slerpAdditive:function(t,e,i,n,r){var o=this._workIndex*r;Yr.multiplyQuaternionsFlat(t,o,t,e,t,i),Yr.slerpFlat(t,e,t,e,t,o,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}},_lerpAdditive:function(t,e,i,n,r){for(var o=0;o!==r;++o){var a=e+o;t[a]=t[a]+t[i+o]*n}}});var lf=new RegExp("[\\[\\]\\.:\\/]","g"),hf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",uf=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),df=/(WCOD+)?/.source.replace("WCOD",hf),pf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),ff=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),mf=new RegExp("^"+uf+df+pf+ff+"$"),gf=["material","materials","bones"];function vf(t,e,i){var n=i||yf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function yf(t,e,i){this.path=e,this.parsedPath=i||yf.parseTrackName(e),this.node=yf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Af(t,e,i,n){this._mixer=t,this._clip=e,this._localRoot=i||null,this.blendMode=n||e.blendMode;for(var r=e.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 xf(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function bf(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function wf(t,e,i){kl.call(this,t,e),this.meshPerAttribute=i||1}function Mf(t,e,i,n){this.ray=new Jo(t,e),this.near=i||0,this.far=n||1/0,this.camera=null,this.layers=new uo,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 Ef(t,e){return t.distance-e.distance}function Sf(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n)for(var r=t.children,o=0,a=r.length;o<a;o++)Sf(r[o],e,i,!0)}Object.assign(vf.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(yf,{Composite:vf,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new yf.Composite(t,e,i):new yf(t,e,i)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(lf,"")},parseTrackName:function(t){var e=mf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var r=i.nodeName.substring(n+1);-1!==gf.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: "+t);return i},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){var n=function(t){for(var i=0;i<t.length;i++){var r=t[i];if(r.name===e||r.uuid===e)return r;var o=n(r.children);if(o)return o}return null},r=n(t.children);if(r)return r}return null}}),Object.assign(yf.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(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=yf.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var o=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var a=0;a<t.length;a++)if(t[a].name===o){o=a;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var s=t[n];if(void 0!==s){var c=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.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=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+n+" but it wasn't found.",t)}}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(yf.prototype,{_getValue_unbound:yf.prototype.getValue,_setValue_unbound:yf.prototype.setValue}),Object.assign(function(){this.uuid=Hr.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;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 t=this._objects,e=t.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=e++,n[d]=p,t.push(u);for(var f=0,m=s;f!==m;++f)a[f].push(new yf(u,r[f],o[f]))}else if(p<i){c=t[p];var g=--i,v=t[g];n[v.uuid]=p,t[p]=v,n[d]=g,t[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 yf(u,r[f],o[f])),y[g]=x}}else t[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 t=this._objects,e=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>=e){var h=e++,u=t[h];i[u.uuid]=l,t[l]=u,i[c]=h,t[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_=e},uncache:function(){for(var t=this._objects,e=t.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=t[u],p=t[y=--e];n[d.uuid]=h,t[h]=d,n[p.uuid]=u,t[u]=p,t.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=t[y=--e]).uuid]=h,t[h]=p,t.pop();for(f=0,m=o;f!==m;++f){var A;(A=r[f])[h]=A[y],A.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],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[t]=n,o.push(t),a.push(e),r.push(h);for(var u=l,d=s.length;u!==d;++u){var p=s[u];h[u]=new yf(p,t,e)}return h},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=i,o[i]=s,o.pop(),r[i]=r[a],r.pop(),n[i]=n[a],n.pop()}}}),Object.assign(Af.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(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,o=r/n,a=n/r;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,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]=t/a,c[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){if(this.enabled){var r=this._startTime;if(null!==r){var o=(t-r)*i;if(o<0||0===i)return;this._startTime=null,e=i*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);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(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,i=this._clip.duration,n=this.loop,r=this._loopCount,o=2202===n;if(0===t)return-1===r?e:o&&1==(1&r)?i-e:e;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var a=Math.floor(e/i);e-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=e;if(o&&1==(1&r))return i-e}return e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,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]=e,a[1]=r+t,s[1]=i,this}}),xf.prototype=Object.assign(Object.create(kr.prototype),{constructor:xf,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,a=t._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=e&&e._propertyBindings[h].binding.parsedPath;++(p=new cf(yf.create(i,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[h]=p}a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{var a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=n.length,n.push(t),o.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,o=this._actionsByClip,a=o[r],s=a.knownActions,c=s[s.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],o=this._bindings;void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,o=this._bindingsByRootAndName,a=o[n],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[r],0===Object.keys(a).length&&delete o[n]},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&((i=new yd(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e,i){var n=e||this._root,r=n.uuid,o="string"==typeof t?Cd.findByName(n,t):t,a=null!==o?o.uuid:t,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 Af(this,o,e,i);return this._bindAction(h,c),this._addInactiveAction(h,a,r),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Cd.findByName(i,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[n]||null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==i;++a){e[a]._update(n,t,r,o)}var s=this._bindings,c=this._nActiveBindings;for(a=0;a!==c;++a)s[a].apply(o);return this},setTime:function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.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=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=l,e[l]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName[e];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),bf.prototype.clone=function(){return new bf(void 0===this.value.clone?this.value:this.value.clone())},wf.prototype=Object.assign(Object.create(kl.prototype),{constructor:wf,isInstancedInterleavedBuffer:!0,copy:function(t){return kl.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Mf.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,i){var n=i||[];return Sf(t,this,n,e),n.sort(Ef),n},intersectObjects:function(t,e,i){var n=i||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var r=0,o=t.length;r<o;r++)Sf(t[r],this,n,e);return n.sort(Ef),n}}),Object.assign(function(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}.prototype,{set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Hr.clamp(e/this.radius,-1,1))),this}}),Object.assign(function(t,e,i){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==i?i:0,this}.prototype,{set:function(t,e,i){return this.radius=t,this.theta=e,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}});var _f=new Ur;function Tf(t,e){this.min=void 0!==t?t:new Ur(1/0,1/0),this.max=void 0!==e?e:new Ur(-1/0,-1/0)}Object.assign(Tf.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var i=_f.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.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(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new Ur),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new Ur),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Ur),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Ur),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return _f.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Cf=new $r,If=new $r;function Pf(t,e){this.start=void 0!==t?t:new $r,this.end=void 0!==e?e:new $r}function Rf(t){_o.call(this),this.material=t,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(Pf.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new $r),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new $r),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new $r),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){Cf.subVectors(t,this.start),If.subVectors(this.end,this.start);var i=If.dot(If),n=If.dot(Cf)/i;return e&&(n=Hr.clamp(n,0,1)),n},closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new $r),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Rf.prototype=Object.create(_o.prototype),Rf.prototype.constructor=Rf,Rf.prototype.isImmediateRenderObject=!0;var Bf=new $r;function Lf(t,e){_o.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var i=new Qa,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 Da(n,3));var c=new xh({fog:!1,toneMapped:!1});this.cone=new Ih(i,c),this.add(this.cone),this.update()}Lf.prototype=Object.create(_o.prototype),Lf.prototype.constructor=Lf,Lf.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Lf.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Bf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Bf),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Df=new $r,Of=new so,Nf=new so;function kf(t){var e=[];t&&t.isBone&&e.push(t);for(var i=0;i<t.children.length;i++)e.push.apply(e,kf(t.children[i]));return e}function Ff(t){for(var e=kf(t),i=new Qa,n=[],r=[],o=new va(0,0,1),a=new va(0,1,0),s=0;s<e.length;s++){var c=e[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 Da(n,3)),i.setAttribute("color",new Da(r,3));var l=new xh({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Ih.call(this,i,l),this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function Vf(t,e,i){this.light=t,this.light.updateMatrixWorld(),this.color=i;var n=new Uu(e,4,2),r=new Ea({wireframe:!0,fog:!1,toneMapped:!1});ls.call(this,n,r),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Ff.prototype=Object.create(Ih.prototype),Ff.prototype.constructor=Ff,Ff.prototype.isSkeletonHelper=!0,Ff.prototype.updateMatrixWorld=function(t){var e=this.bones,i=this.geometry,n=i.getAttribute("position");Nf.getInverse(this.root.matrixWorld);for(var r=0,o=0;r<e.length;r++){var a=e[r];a.parent&&a.parent.isBone&&(Of.multiplyMatrices(Nf,a.matrixWorld),Df.setFromMatrixPosition(Of),n.setXYZ(o,Df.x,Df.y,Df.z),Of.multiplyMatrices(Nf,a.parent.matrixWorld),Df.setFromMatrixPosition(Of),n.setXYZ(o+1,Df.x,Df.y,Df.z),o+=2)}i.getAttribute("position").needsUpdate=!0,_o.prototype.updateMatrixWorld.call(this,t)},Vf.prototype=Object.create(ls.prototype),Vf.prototype.constructor=Vf,Vf.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Vf.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var zf=new $r,Hf=new va,Uf=new va;function Gf(t,e,i){_o.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;var n=new Yh(e);n.rotateY(.5*Math.PI),this.material=new Ea({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 _a(o,3)),this.add(new ls(n,this.material)),this.update()}function jf(t,e,i,n){t=t||10,e=e||10,i=new va(void 0!==i?i:4473924),n=new va(void 0!==n?n:8947848);for(var r=e/2,o=t/e,a=t/2,s=[],c=[],l=0,h=0,u=-a;l<=e;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 Qa;p.setAttribute("position",new Da(s,3)),p.setAttribute("color",new Da(c,3));var f=new xh({vertexColors:!0,toneMapped:!1});Ih.call(this,p,f),this.type="GridHelper"}function Qf(t,e,i,n,r,o){t=t||10,e=e||16,i=i||8,n=n||64,r=new va(void 0!==r?r:4473924),o=new va(void 0!==o?o:8947848);var a,s,c,l,h,u,d,p=[],f=[];for(l=0;l<=e;l++)c=l/e*(2*Math.PI),a=Math.sin(c)*t,s=Math.cos(c)*t,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=t-t/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 Qa;m.setAttribute("position",new Da(p,3)),m.setAttribute("color",new Da(f,3));var g=new xh({vertexColors:!0,toneMapped:!1});Ih.call(this,m,g),this.type="PolarGridHelper"}Gf.prototype=Object.create(_o.prototype),Gf.prototype.constructor=Gf,Gf.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Gf.prototype.update=function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");Hf.copy(this.light.color),Uf.copy(this.light.groundColor);for(var i=0,n=e.count;i<n;i++){var r=i<n/2?Hf:Uf;e.setXYZ(i,r.r,r.g,r.b)}e.needsUpdate=!0}t.lookAt(zf.setFromMatrixPosition(this.light.matrixWorld).negate())},jf.prototype=Object.assign(Object.create(Ih.prototype),{constructor:jf,copy:function(t){return Ih.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),Qf.prototype=Object.create(Ih.prototype),Qf.prototype.constructor=Qf;var Wf=new $r,qf=new $r,Kf=new $r;function Xf(t,e,i){_o.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,void 0===e&&(e=1);var n=new Qa;n.setAttribute("position",new Da([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new xh({fog:!1,toneMapped:!1});this.lightPlane=new _h(n,r),this.add(this.lightPlane),(n=new Qa).setAttribute("position",new Da([0,0,0,0,0,1],3)),this.targetLine=new _h(n,r),this.add(this.targetLine),this.update()}Xf.prototype=Object.create(_o.prototype),Xf.prototype.constructor=Xf,Xf.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Xf.prototype.update=function(){Wf.setFromMatrixPosition(this.light.matrixWorld),qf.setFromMatrixPosition(this.light.target.matrixWorld),Kf.subVectors(qf,Wf),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=Kf.length()};var Yf=new $r,Zf=new ws;function Jf(t){var e=new Qa,i=new xh({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],o={},a=new va(16755200),s=new va(16711680),c=new va(43775),l=new va(16777215),h=new va(3355443);function u(t,e,i){d(t,i),d(e,i)}function d(t,e){n.push(0,0,0),r.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].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),e.setAttribute("position",new Da(n,3)),e.setAttribute("color",new Da(r,3)),Ih.call(this,e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}function $f(t,e,i,n,r,o,a){Yf.set(r,o,a).unproject(n);var s=e[t];if(void 0!==s)for(var c=i.getAttribute("position"),l=0,h=s.length;l<h;l++)c.setXYZ(s[l],Yf.x,Yf.y,Yf.z)}Jf.prototype=Object.create(Ih.prototype),Jf.prototype.constructor=Jf,Jf.prototype.update=function(){var t=this.geometry,e=this.pointMap;Zf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),$f("c",e,t,Zf,0,0,-1),$f("t",e,t,Zf,0,0,1),$f("n1",e,t,Zf,-1,-1,-1),$f("n2",e,t,Zf,1,-1,-1),$f("n3",e,t,Zf,-1,1,-1),$f("n4",e,t,Zf,1,1,-1),$f("f1",e,t,Zf,-1,-1,1),$f("f2",e,t,Zf,1,-1,1),$f("f3",e,t,Zf,-1,1,1),$f("f4",e,t,Zf,1,1,1),$f("u1",e,t,Zf,.7,1.1,-1),$f("u2",e,t,Zf,-.7,1.1,-1),$f("u3",e,t,Zf,0,2,-1),$f("cf1",e,t,Zf,-1,0,1),$f("cf2",e,t,Zf,1,0,1),$f("cf3",e,t,Zf,0,-1,1),$f("cf4",e,t,Zf,0,1,1),$f("cn1",e,t,Zf,-1,0,-1),$f("cn2",e,t,Zf,1,0,-1),$f("cn3",e,t,Zf,0,-1,-1),$f("cn4",e,t,Zf,0,1,-1),t.getAttribute("position").needsUpdate=!0};var tm=new Ho;function em(t,e){this.object=t,void 0===e&&(e=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 Qa;r.setIndex(new _a(i,1)),r.setAttribute("position",new _a(n,3)),Ih.call(this,r,new xh({color:e,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function im(t,e){this.type="Box3Helper",this.box=t,e=e||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 Qa;n.setIndex(new _a(i,1)),n.setAttribute("position",new Da([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)),Ih.call(this,n,new xh({color:e,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function nm(t,e,i){this.plane=t,this.size=void 0===e?1:e;var n=void 0!==i?i:16776960,r=new Qa;r.setAttribute("position",new Da([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(),_h.call(this,r,new xh({color:n,toneMapped:!1})),this.type="PlaneHelper";var o=new Qa;o.setAttribute("position",new Da([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new ls(o,new Ea({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}em.prototype=Object.create(Ih.prototype),em.prototype.constructor=em,em.prototype.update=function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&tm.setFromObject(this.object),!tm.isEmpty()){var e=tm.min,i=tm.max,n=this.geometry.attributes.position,r=n.array;r[0]=i.x,r[1]=i.y,r[2]=i.z,r[3]=e.x,r[4]=i.y,r[5]=i.z,r[6]=e.x,r[7]=e.y,r[8]=i.z,r[9]=i.x,r[10]=e.y,r[11]=i.z,r[12]=i.x,r[13]=i.y,r[14]=e.z,r[15]=e.x,r[16]=i.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=i.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}},em.prototype.setFromObject=function(t){return this.object=t,this.update(),this},em.prototype.copy=function(t){return Ih.prototype.copy.call(this,t),this.object=t.object,this},em.prototype.clone=function(){return(new this.constructor).copy(this)},im.prototype=Object.create(Ih.prototype),im.prototype.constructor=im,im.prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),_o.prototype.updateMatrixWorld.call(this,t))},nm.prototype=Object.create(_h.prototype),nm.prototype.constructor=nm,nm.prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?1:0,this.lookAt(this.plane.normal),_o.prototype.updateMatrixWorld.call(this,t)};var rm,om,am=new $r;function sm(t,e,i,n,r,o){_o.call(this),this.type="ArrowHelper",void 0===t&&(t=new $r(0,0,1)),void 0===e&&(e=new $r(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===rm&&((rm=new Qa).setAttribute("position",new Da([0,0,0,0,1,0],3)),(om=new Ju(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new _h(rm,new xh({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ls(om,new Ea({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,o)}function cm(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Qa;i.setAttribute("position",new Da(e,3)),i.setAttribute("color",new Da([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new xh({vertexColors:!0,toneMapped:!1});Ih.call(this,i,n),this.type="AxesHelper"}sm.prototype=Object.create(_o.prototype),sm.prototype.constructor=sm,sm.prototype.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{am.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(am,e)}},sm.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},sm.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},sm.prototype.copy=function(t){return _o.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},sm.prototype.clone=function(){return(new this.constructor).copy(this)},cm.prototype=Object.create(Ih.prototype),cm.prototype.constructor=cm;var lm=[.125,.215,.35,.446,.526,.582],hm=5+lm.length;new yp,function(){for(var t=[],e=[],i=[],n=8,r=0;r<hm;r++){var o=Math.pow(2,n);e.push(o);var a=1/o;r>4?a=lm[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 Qa;A.setAttribute("position",new _a(u,3)),A.setAttribute("uv",new _a(d,2)),A.setAttribute("faceIndex",new _a(p,1)),t.push(A),n>4&&n--}}();var um=(1+Math.sqrt(5))/2,dm=1/um;function pm(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Yd.call(this,t),this.type="catmullrom"}new $r(1,1,1),new $r(-1,1,1),new $r(1,1,-1),new $r(-1,1,-1),new $r(0,um,dm),new $r(0,um,-dm),new $r(dm,0,um),new $r(-dm,0,um),new $r(um,dm,0),new $r(-um,dm,0),Ud.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ud.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(cp.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new gs,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new $r(r.x,r.y,r.z||0))}return e}}),Object.assign(lp.prototype,{fromPoints:function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),pm.prototype=Object.create(Yd.prototype),Object.assign(pm.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.")}}),jf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Ff.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Ld.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Tp(t)}}),Ld.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(Bp.prototype,{setTexturePath:function(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}),Object.assign(Tf.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Ho.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(jo.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Is.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Pf.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(Hr,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Hr.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Hr.ceilPowerOfTwo(t)}}),Object.assign(Gr.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(so.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new $r).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.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(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,i,n,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,o)}}),ia.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Yr.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Jo.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(pa.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(pa,{barycoordFromPoint:function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),pa.getBarycoord(t,e,i,n,r)},normal:function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),pa.getNormal(t,e,i,n)}}),Object.assign(hp.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ou(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new qu(this,t)}}),Object.assign(Ur.prototype,{fromAttribute:function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign($r.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(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(qr.prototype,{fromAttribute:function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(gs.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(t){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.assign(_o.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.defineProperties(_o.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},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(ls.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(ls.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(lh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ph.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),hh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Ud.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Ms.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(up.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(_a.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(_a.prototype,{setDynamic:function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?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(Qa.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addAttribute:function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new _a(arguments[1],arguments[2])))},addDrawCall:function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},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(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},applyMatrix:function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.defineProperties(Qa.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(Cp.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(Mf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(kl.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),Object.assign(kl.prototype,{setDynamic:function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Nu.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(bf.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(Ma.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 va}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(cd.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(bs.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(Dl.prototype,{clearTarget:function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},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(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},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(Dl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},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(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}}}),Object.defineProperties(Sl.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(Kr.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(tf.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Gp).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),sf.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Es.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},jr.crossOrigin=void 0,jr.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Hd;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},jr.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new zd;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},jr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},jr.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 fm=new(function(){function t(t){Ld.call(this,t),this.dracoLoader=null,this.ddsLoader=null}function e(){var t={};return{get:function(e){return t[e]},add:function(e,i){t[e]=i},remove:function(e){delete t[e]},removeAll:function(){t={}}}}t.prototype=Object.assign(Object.create(Ld.prototype),{constructor:t,load:function(t,e,i,n){var r,o=this;r=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:Tp(t),o.manager.itemStart(t);var a=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},s=new Od(o.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&s.setWithCredentials(!0),s.load(t,(function(i){try{o.parse(i,r,(function(i){e(i),o.manager.itemEnd(t)}),a)}catch(t){a(t)}}),i,a)},setDRACOLoader:function(t){return this.dracoLoader=t,this},setDDSLoader:function(t){return this.ddsLoader=t,this},parse:function(t,e,c,l){var p,g={};if("string"==typeof t)p=t;else if(_p(new Uint8Array(t,0,4))===s){try{g[i.KHR_BINARY_GLTF]=new h(t)}catch(t){return void(l&&l(t))}p=g[i.KHR_BINARY_GLTF].content}else p=_p(new Uint8Array(t));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:e||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(t){if(!t)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=i.MSFT_TEXTURE_DDS,this.ddsLoader=t}function r(t){this.name=i.KHR_LIGHTS_PUNCTUAL;var e=t.extensions&&t.extensions[i.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=e.lights||[]}function o(){this.name=i.KHR_MATERIALS_UNLIT}function a(){this.name=i.KHR_MATERIALS_CLEARCOAT}r.prototype.loadLight=function(t){var e,i=this.lightDefs[t],n=new va(16777215);void 0!==i.color&&n.fromArray(i.color);var r=void 0!==i.range?i.range:0;switch(i.type){case"directional":(e=new xp(n)).target.position.set(0,0,-1),e.add(e.target);break;case"point":(e=new vp(n)).distance=r;break;case"spot":(e=new mp(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,e.angle=i.spot.outerConeAngle,e.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,e.target.position.set(0,0,-1),e.add(e.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+i.type+'".')}return e.position.set(0,0,0),e.decay=2,void 0!==i.intensity&&(e.intensity=i.intensity),e.name=i.name||"light_"+t,Promise.resolve(e)},o.prototype.getMaterialType=function(){return Ea},o.prototype.extendParams=function(t,e,i){var n=[];t.color=new va(1,1,1),t.opacity=1;var r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var o=r.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(t,"map",r.baseColorTexture))}return Promise.all(n)},a.prototype.getMaterialType=function(){return sd},a.prototype.extendParams=function(t,e,i){var n=[],r=e.extensions[this.name];if(void 0!==r.clearcoatFactor&&(t.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&n.push(i.assignTexture(t,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(t.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&n.push(i.assignTexture(t,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(n.push(i.assignTexture(t,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale)){var o=r.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ur(o,o)}return Promise.all(n)};var s="glTF",c=1313821514,l=5130562;function h(t){this.name=i.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,12);if(this.header={magic:_p(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.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(t,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(t,12+r,o);this.content=_p(h)}else if(a===l){var u=12+r;this.body=t.slice(u,u+o)}r+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function u(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=i.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}function d(){this.name=i.KHR_TEXTURE_TRANSFORM}function p(t){ad.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var e=["#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 va).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(t){for(var s in a)t.uniforms[s]=a[s];t.fragmentShader=t.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),t.fragmentShader=t.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),t.fragmentShader=t.fragmentShader.replace("#include <roughnessmap_pars_fragment>",e),t.fragmentShader=t.fragmentShader.replace("#include <metalnessmap_pars_fragment>",i),t.fragmentShader=t.fragmentShader.replace("#include <roughnessmap_fragment>",n),t.fragmentShader=t.fragmentShader.replace("#include <metalnessmap_fragment>",r),t.fragmentShader=t.fragmentShader.replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(t){a.specular.value=t}},specularMap:{get:function(){return a.specularMap.value},set:function(t){a.specularMap.value=t}},glossiness:{get:function(){return a.glossiness.value},set:function(t){a.glossiness.value=t}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(t){a.glossinessMap.value=t,t?(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(t)}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(t,e,i){var n=e.extensions[this.name];t.color=new va(1,1,1),t.opacity=1;var r=[];if(Array.isArray(n.diffuseFactor)){var o=n.diffuseFactor;t.color.fromArray(o),t.opacity=o[3]}if(void 0!==n.diffuseTexture&&r.push(i.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new va(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new va(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var a=n.specularGlossinessTexture;r.push(i.assignTexture(t,"glossinessMap",a)),r.push(i.assignTexture(t,"specularMap",a))}return Promise.all(r)},createMaterial:function(t){var e=new p(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=0,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}}function m(){this.name=i.KHR_MESH_QUANTIZATION}function g(t,e,i,n){gd.call(this,t,e,i,n)}u.prototype.decodePrimitive=function(t,e){var i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,o=t.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 t.attributes){h=C[l]||l.toLowerCase();if(void 0!==o[l]){var u=i.accessors[t.attributes[l]],d=E[u.componentType];c[h]=d,s[h]=!0===u.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e){n.decodeDracoFile(t,(function(t){for(var i in t.attributes){var n=t.attributes[i],r=s[i];void 0!==r&&(n.normalized=r)}e(t)}),a,c)}))}))},d.prototype.extendTexture=function(t,e){return t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.needsUpdate=!0,t},p.prototype=Object.create(ad.prototype),p.prototype.constructor=p,p.prototype.copy=function(t){return ad.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},g.prototype=Object.create(gd.prototype),g.prototype.constructor=g,g.prototype.copySampleValue_=function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n,o=0;o!==n;o++)e[o]=i[r+o];return e},g.prototype.beforeStart_=g.prototype.copySampleValue_,g.prototype.afterEnd_=g.prototype.copySampleValue_,g.prototype.interpolate_=function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,c=3*a,l=n-e,h=(i-e)/l,u=h*h,d=u*h,p=t*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",B="MASK",L="BLEND",D={"image/png":1023,"image/jpeg":1022};function O(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}function N(t,e,i){for(var n in i.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=i.extensions[n])}function k(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function F(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var i=0,n=e.weights.length;i<n;i++)t.morphTargetInfluences[i]=e.weights[i];if(e.extras&&Array.isArray(e.extras.targetNames)){var r=e.extras.targetNames;if(t.morphTargetInfluences.length===r.length){t.morphTargetDictionary={};for(i=0,n=r.length;i<n;i++)t.morphTargetDictionary[r[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function V(t){for(var e="",i=Object.keys(t).sort(),n=0,r=i.length;n<r;n++)e+=i[n]+":"+t[i[n]]+";";return e}function z(t,i,n){this.json=t||{},this.extensions=i||{},this.options=n||{},this.cache=new e,this.associations=new Map,this.primitiveCache={},this.textureLoader=new Hd(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new Od(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function H(t,e,i){var n=e.attributes,r=[];function o(e,n){return i.getDependency("accessor",e).then((function(e){t.setAttribute(n,e)}))}for(var a in n){var s=C[a]||a.toLowerCase();s in t.attributes||r.push(o(n[a],s))}if(void 0!==e.indices&&!t.index){var c=i.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(c)}return k(t,e),function(t,e,i){var n=e.attributes,r=new Ho;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 $r(o[0],o[1],o[2]),new $r(a[0],a[1],a[2]));var s=e.targets;if(void 0!==s){for(var c=new $r,l=new $r,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)}t.boundingBox=r;var f=new jo;r.getCenter(f.center),f.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,i),Promise.all(r).then((function(){return void 0!==e.targets?function(t,e,i){for(var n=!1,r=!1,o=0,a=e.length;o<a&&(void 0!==(l=e[o]).POSITION&&(n=!0),void 0!==l.NORMAL&&(r=!0),!n||!r);o++);if(!n&&!r)return Promise.resolve(t);var s=[],c=[];for(o=0,a=e.length;o<a;o++){var l=e[o];if(n){var h=void 0!==l.POSITION?i.getDependency("accessor",l.POSITION):t.attributes.position;s.push(h)}r&&(h=void 0!==l.NORMAL?i.getDependency("accessor",l.NORMAL):t.attributes.normal,c.push(h))}return Promise.all([Promise.all(s),Promise.all(c)]).then((function(e){var i=e[0],o=e[1];return n&&(t.morphAttributes.position=i),r&&(t.morphAttributes.normal=o),t.morphTargetsRelative=!0,t}))}(t,e.targets,i):t}))}function U(t,e){var i=t.getIndex();if(null===i){var n=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<r.count;o++)n.push(o);t.setIndex(n),i=t.getIndex()}var a=i.count-2,s=[];if(2===e)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=t.clone();return c.setIndex(s),c}return z.prototype.parse=function(t,e){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(e){var o={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:i,userData:{}};N(r,o,n),k(o,n),t(o)})).catch(e)},z.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[],n={},r={},o=0,a=e.length;o<a;o++)for(var s=e[o].joints,c=0,l=s.length;c<l;c++)t[s[c]].isBone=!0;for(var h=0,u=t.length;h<u;h++){var d=t[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(t,e){var n=t+":"+e,r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this.loadNode(e);break;case"mesh":r=this.loadMesh(e);break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this.loadBufferView(e);break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this.loadMaterial(e);break;case"texture":r=this.loadTexture(e);break;case"skin":r=this.loadSkin(e);break;case"animation":r=this.loadAnimation(e);break;case"camera":r=this.loadCamera(e);break;case"light":r=this.extensions[i.KHR_LIGHTS_PUNCTUAL].loadLight(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r},z.prototype.getDependencies=function(t){var e=this.cache.get(t);if(!e){var i=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map((function(e,n){return i.getDependency(t,n)}))),this.cache.add(t,e)}return e},z.prototype.loadBuffer=function(t){var e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[i.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(t,i){n.load(O(e.uri,r.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))},z.prototype.loadBufferView=function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var i=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+i)}))},z.prototype.loadAccessor=function(t){var e=this,i=this.json,n=this.json.accessors[t];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(t){var r,o=t[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=e.cache.get(f);m||(m=new kl(new s(o,p*u,n.count*u/c),u/c),e.cache.add(f,m)),r=new zl(m,a,h%u/c,d)}else r=new _a(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(t[1],y,n.sparse.count*g),b=new s(t[2],A,n.sparse.count*a);null!==o&&(r=new _a(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(t){var e,n=this,r=this.json,o=this.options,a=this.textureLoader,s=self.URL||self.webkitURL,c=r.textures[t],l=c.extensions||{},h=(e=l[i.MSFT_TEXTURE_DDS]?r.images[l[i.MSFT_TEXTURE_DDS].source]:r.images[c.source]).uri,u=!1;return void 0!==e.bufferView&&(h=n.getDependency("bufferView",e.bufferView).then((function(t){u=!0;var i=new Blob([t],{type:e.mimeType});return h=s.createObjectURL(i)}))),Promise.resolve(h).then((function(t){var e=o.manager.getHandler(t);return e||(e=l[i.MSFT_TEXTURE_DDS]?n.extensions[i.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise((function(i,n){e.load(O(t,o.path),i,void 0,n)}))})).then((function(i){!0===u&&s.revokeObjectURL(h),i.flipY=!1,c.name&&(i.name=c.name),e.mimeType in D&&(i.format=D[e.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:t}),i}))},z.prototype.assignTexture=function(t,e,n){var r=this;return this.getDependency("texture",n.index).then((function(o){if(!o.isCompressedTexture)switch(e){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=1022}if(void 0===n.texCoord||0==n.texCoord||"aoMap"===e&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+e+" 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)}}t[e]=o}))},z.prototype.assignFinalMaterial=function(t){var e=t.geometry,i=t.material,n=void 0!==e.attributes.tangent,r=void 0!==e.attributes.color,o=void 0===e.attributes.normal,a=!0===t.isSkinnedMesh,s=Object.keys(e.morphAttributes).length>0,c=s&&void 0!==e.morphAttributes.normal;if(t.isPoints){var l="PointsMaterial:"+i.uuid,h=this.cache.get(l);h||(h=new Rh,Ma.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(t.isLine){l="LineBasicMaterial:"+i.uuid;var u=this.cache.get(l);u||(u=new xh,Ma.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===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),i.normalScale&&!n&&(i.normalScale.y=-i.normalScale.y),i.clearcoatNormalScale&&!n&&(i.clearcoatNormalScale.y=-i.clearcoatNormalScale.y),t.material=i},z.prototype.loadMaterial=function(t){var e,n=this,r=this.json,o=this.extensions,a=r.materials[t],s={},c=a.extensions||{},l=[];if(c[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=o[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=h.getMaterialType(),l.push(h.extendParams(s,a,n))}else if(c[i.KHR_MATERIALS_UNLIT]){var u=o[i.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),l.push(u.extendParams(s,a,n))}else{e=ad;var d=a.pbrMetallicRoughness||{};if(s.color=new va(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===L?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,m===B&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&e!==Ea&&(l.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new Ur(1,1),void 0!==a.normalTexture.scale&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&e!==Ea&&(l.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&e!==Ea&&(s.emissive=(new va).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&e!==Ea&&l.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture)),c[i.KHR_MATERIALS_CLEARCOAT]){var g=o[i.KHR_MATERIALS_CLEARCOAT];e=g.getMaterialType(),l.push(g.extendParams(s,{extensions:c},n))}return Promise.all(l).then((function(){var r;return r=e===p?o[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new e(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:t}),a.extensions&&N(o,r,a),r}))},z.prototype.loadGeometries=function(t){var e=this,n=this.extensions,r=this.primitiveCache;function o(t){return n[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(i){return H(i,t,e)}))}for(var a,s,c=[],l=0,h=t.length;l<h;l++){var u,d=t[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 Qa,d,e),r[p]={primitive:d,promise:u},c.push(u)}return Promise.all(c)},z.prototype.loadMesh=function(t){for(var e,i=this,n=this.json.meshes[t],r=n.primitives,o=[],a=0,s=r.length;a<s;a++){var c=void 0===r[a].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new ad({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial):this.getDependency("material",r[a].material);o.push(c)}return o.push(i.loadGeometries(r)),Promise.all(o).then((function(e){for(var o=e.slice(0,e.length-1),a=e[e.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 hh(u,p):new ls(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 Ih(u,p);else if(d.mode===x)h=new _h(u,p);else if(d.mode===A)h=new Ph(u,p);else{if(d.mode!==v)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);h=new Nh(u,p)}Object.keys(h.geometry.morphAttributes).length>0&&F(h,n),h.name=n.name||"mesh_"+t,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 Pl;for(c=0,l=s.length;c<l;c++)f.add(s[c]);return f}))},z.prototype.loadCamera=function(t){var e,i=this.json.cameras[t],n=i[i.type];if(n)return"perspective"===i.type?e=new Ms(Hr.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(e=new yp(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=i.name),k(e,i),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")},z.prototype.loadSkin=function(t){var e=this.json.skins[t],i={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(i):this.getDependency("accessor",e.inverseBindMatrices).then((function(t){return i.inverseBindMatrices=t,i}))},z.prototype.loadAnimation=function(t){for(var e=this.json.animations[t],i=[],n=[],r=[],o=[],a=[],s=0,c=e.channels.length;s<c;s++){var l=e.channels[s],h=e.samplers[l.sampler],u=l.target,d=void 0!==u.node?u.node:u.id,p=void 0!==e.parameters?e.parameters[h.input]:h.input,f=void 0!==e.parameters?e.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=Md;break;case I.rotation:v=Sd;break;case I.position:case I.scale:default:v=Td}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(t){!0===t.isMesh&&t.morphTargetInfluences&&x.push(t.name?t.name:t.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(t){return new g(this.times,this.values,this.getValueSize()/3,t)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(_)}}}return new Cd(e.name?e.name:"animation_"+t,void 0,c)}))},z.prototype.loadNode=function(t){var e,n=this.json,r=this.extensions,o=this,a=n.meshReferences,s=n.meshUses,c=n.nodes[t];return(e=[],void 0!==c.mesh&&e.push(o.getDependency("mesh",c.mesh).then((function(t){var e;if(a[c.mesh]>1){var i=s[c.mesh]++;(e=t.clone()).name+="_instance_"+i}else e=t;return void 0!==c.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,i=c.weights.length;e<i;e++)t.morphTargetInfluences[e]=c.weights[e]})),e}))),void 0!==c.camera&&e.push(o.getDependency("camera",c.camera)),c.extensions&&c.extensions[i.KHR_LIGHTS_PUNCTUAL]&&void 0!==c.extensions[i.KHR_LIGHTS_PUNCTUAL].light&&e.push(o.getDependency("light",c.extensions[i.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(e)).then((function(e){var i;if((i=!0===c.isBone?new fh:e.length>1?new Pl:1===e.length?e[0]:new _o)!==e[0])for(var n=0,a=e.length;n<a;n++)i.add(e[n]);if(c.name&&(i.userData.name=c.name,i.name=yf.sanitizeNodeName(c.name)),k(i,c),c.extensions&&N(r,i,c),void 0!==c.matrix){var s=new so;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:t}),i}))},z.prototype.loadScene=function(){function t(e,i,n,r){var o=n.nodes[e];return r.getDependency("node",e).then((function(t){return void 0===o.skin?t:r.getDependency("skin",o.skin).then((function(t){for(var i=[],n=0,o=(e=t).joints.length;n<o;n++)i.push(r.getDependency("node",e.joints[n]));return Promise.all(i)})).then((function(i){return t.traverse((function(t){if(t.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 so;void 0!==e.inverseBindMatrices&&c.fromArray(e.inverseBindMatrices.array,16*o),r.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[o])}t.bind(new ph(n,r),t.matrixWorld)}})),t}));var e})).then((function(e){i.add(e);var a=[];if(o.children)for(var s=o.children,c=0,l=s.length;c<l;c++){var h=s[c];a.push(t(h,e,n,r))}return Promise.all(a)}))}return function(e){var i=this.json,n=this.extensions,r=this.json.scenes[e],o=new Pl;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(t(a[c],o,i,this));return Promise.all(s).then((function(){return o}))}}(),t}()),mm=(new r.Matrix4).makeRotationAxis(new r.Vector3(1,0,0),Math.PI/2);function gm(t){function e(t){if(t.isMesh)return function(t){var e=new oe;e.geometry=t.geometry,e.geometry.computeVertexNormals(),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),e.geometry.addGroup(0,t.geometry.index.count,0);var i=new me;return i.uniforms.map.value=t.material.map,i.uniforms.exposure.value=3.3,i.opacity=1,t.material.dispose(),e.material=[i],e.position.copy(t.position),e.quaternion.copy(t.quaternion),e.scale.copy(t.scale),e.matrix.compose(e.position,e.quaternion,e.scale),e}(t);if(t.isGroup){for(var i=function(t){var e=new se;return e.position.copy(t.position),e.quaternion.copy(t.quaternion),e.scale.copy(t.scale),e.matrix.compose(e.position,e.quaternion,e.scale),e}(t),n=0;n<t.children.length;n++){var r=e(t.children[n]);i.add(r)}return i}return new se}return new Promise((function(i,n){var o,a=(new r.Matrix4).fromArray(t.computedTransform);if("Z"!==(null===(o=t.tileset.asset)||void 0===o?void 0:o.gltfUpAxis)&&a.multiply(mm),t.content){var s=t.content.gltfArrayBuffer,c=t.contentUrl?t.contentUrl.slice(0,t.contentUrl.lastIndexOf("/")+1):"";fm.parse(s,c,(function(t){var n=t.scene,r=new se,o=e(n);o.applyMatrix4(a),r.add(o),i(r)}),(function(e){n(new Error("error parsing gltf in tile ".concat(t.id,": ").concat(e.message)))}))}else i(new se)}))}function vm(t){t.traverse((function(t){if(t instanceof oe){t.geometry.dispose();for(var e=0,i=t.material;e<i.length;e++){var n=i[e];n.uniforms.map&&n.uniforms.map.value&&(n.uniforms.map.value.dispose(),n.uniforms.map.value=null)}}}))}function ym(t){return(new r.Matrix4).fromArray([2*t[0],2*t[1],2*t[2],0,2*t[3],2*t[4],2*t[5],0,2*t[6],2*t[7],2*t[8],0,0,0,0,1])}function Am(t){return new An(t.toArray())}function xm(t){var e=t.planes.map((function(t){return new wn(t.normal.toArray(),t.constant)}));return new Tn(e)}var bm=new r.EdgesGeometry(new r.BoxBufferGeometry(1,1,1)),wm=new r.LineBasicMaterial({color:new r.Color(1,1,0),transparent:!0});function Mm(t){t.updateMatrix(),t.updateMatrixWorld(),t.matrixWorld.getInverse(t.matrixWorldInverse);var e=(new r.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);return(new r.Frustum).setFromProjectionMatrix(e)}var Em={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxScreenSpaceError:8,maxMemoryUsage:32,viewDistanceScale:.2,onNodeCreated:function(){}},Sm=function(t){function i(i){void 0===i&&(i={});var n=t.call(this)||this;return n.options=e.__assign(e.__assign({},Em),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 e.__extends(i,t),Object.defineProperty(i.prototype,"enable",{get:function(){return this.enabled},set:function(t){this.enabled!==t&&(this.enabled=t,!1===this.enabled?this.reset():(this.timer=0,this.clock.getDelta()))},enumerable:!1,configurable:!0}),i.prototype.load=function(t){var e=this,i=t.tileset_url;t.tileset_url_md5;var n=t.b3md_mappings_url;t.b3md_mappings_url_md5;var o={modelMatrix:Am((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(t){var i=function(t){var e=t.boundingVolume,i=new r.LineSegments(bm,wm);return i.applyMatrix4(ym(e.halfAxes)),i.position.set(e.center[0],e.center[1],e.center[2]),i}(t);return i.visible=!1,e.boundings[t.id]=i,e.boundingGroup.add(i),i.updateMatrixWorld(!0),"SCENEGRAPH"===t.type||"MESH"===t.type?gm(t).then((function(i){void 0===e.tileset?vm(i):(i.visible=!1,e.nodes[t.id]=i,e.nodeGroup.add(i),e.options.onNodeCreated(i),i.updateMatrixWorld(!0))})):Promise.resolve()},onTileLoad:function(){e.enabled&&e.tileset&&e.lastRenderer&&e.lastCamera&&(e.tileset.frameNumber++,e.tilesetUpdate(e.tileset,e.lastRenderer,e.lastCamera)),e.enabled||e.reset()},onTileUnload:function(t){e.unloadTileQueue.push(t)},onTileError:function(t,e){console.error("Tile error",t.id,e)},onTraversalComplete:function(t){return t},allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,maxDepth:this.options.maxDepth},a=i.split("/").slice(0,-1).join("/"),s=qt(i,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe}).then((function(t){return JSON.parse(t.body)})).then((function(t){return Nr(t,a)})),c=qt(n,{allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe}).then((function(t){return JSON.parse(t.body)}));Promise.all([s,c]).then((function(t){var i=t[0],n=t[1];i.b3dmMapping=n;var a=e.tileset=new Br(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(ym(l)),s.setPosition(h[0],h[1],h[2])}a.modelMatrix.copy(Am((new r.Matrix4).getInverse(s)))}))},i.prototype.update=function(t,e){this.lastCamera=e,this.lastRenderer=t,!1!==this.enabled&&(this.timer+=this.clock.getDelta(),this.tileset&&this.timer>=this.options.updateInterval&&(e.matrixWorld.equals(this.lastCameraTransform)&&e.aspect===this.lastCameraAspect&&e.fov===this.lastCameraFov||(this.timer=0,this.tileset.frameNumber++,this.lastCameraTransform.copy(e.matrixWorld),this.tilesetUpdate(this.tileset,t,e))))},i.prototype.tilesetUpdate=function(t,e,i){this.sseDenominator&&i.aspect===this.lastCameraAspect&&i.fov===this.lastCameraFov||(this.sseDenominator=function(t){var e=t.aspect,i=t.fov/180*Math.PI,n=t.aspect<=1?i:2*Math.atan(Math.tan(.5*i)/e);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:e.getSize(new r.Vector2).height,frameNumber:t.frameNumber,sseDenominator:this.sseDenominator,cullingVolume:xm(Mm(i))};t.cache.reset(),t.traverser.traverse(t.root,o);for(var a=0,s=t.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),vm(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 t=void 0;t=this.unloadTileQueue.pop();)if("UNLOADED"!==t.contentState){var e=t.id;if(this.nodes[e]){var i=this.nodes[e];this.nodeGroup.remove(i),vm(i),delete this.nodes[e]}if(this.boundings[e]){i=this.boundings[e];this.boundingGroup.remove(i),delete this.boundings[e]}}for(var n=0,r=Object.keys(this.nodes);n<r.length;n++){e=r[n];var o=this.nodes[e];this.nodeGroup.remove(o),vm(o),delete this.nodes[e]}for(var a=0,s=Object.keys(this.boundings);a<s.length;a++){e=s[a],o=this.boundings[e];this.boundingGroup.remove(o),delete this.boundings[e]}}},i}(ae);function _m(t){return null==t}var Tm=function(t,e){void 0===e&&(e=1e-4),e=Math.max(e,Number.EPSILON);for(var i={},n=t.getIndex(),o=t.getAttribute("position"),a=n?n.count:o.count,s=0,c=Object.keys(t.attributes),l={},h={},u=[],d=["getX","getY","getZ","getW"],p=0,f=c.length;p<f;p++){l[x=c[p]]=[],(E=t.morphAttributes[x])&&(h[x]=new Array(E.length).fill().map((function(){return[]})))}var m=Math.log10(1/e),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=t.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=t.getAttribute(x),E=t.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=t.clone();for(p=0,f=c.length;p<f;p++){x=c[p];var R=t.getAttribute(x),B=new R.array.constructor(l[x]);M=new r.BufferAttribute(B,R.itemSize,R.normalized);if(P.setAttribute(x,M),x in h)for(A=0;A<h[x].length;A++){var L=t.morphAttributes[x][A],D=(B=new L.array.constructor(h[x][A]),new r.BufferAttribute(B,L.itemSize,L.normalized));P.morphAttributes[x][A]=D}}return P.setIndex(u),P};function Cm(t){var i;return new((i=r.Triangle).bind.apply(i,e.__spreadArray([void 0],t.map((function(t){return new r.Vector3(t.x,t.y,t.z)})),!1)))}var Im={at3d:function(t,e){for(var i=_i(e.textureOptions,t.textures.length),n={},r=0,o=t.textures;r<o.length;r++){var a=o[r];n[a]=Ei(a,i,e.allowHosts,e.networkSubscribe)}return Promise.resolve().then((function(){return qt(t.file,{responseType:"arraybuffer",allowHosts:e.allowHosts,networkSubscribe:e.networkSubscribe})})).then((function(t){return Ke(t.body)})).then((function(t){return Ve((function(){for(var e,i={chunks:[]},n=0,r=t;n<r.length;n++){var o=r[n],a=wi.decode(o);a.chunks.length&&(e=i.chunks).push.apply(e,a.chunks)}return i}))})).then((function(r){return Ve((function(){return Si(r,t.textureBase,t.textures.slice(),i,n,e.allowHosts,e.networkSubscribe)}))}))},pbm:function(t,e){for(var i=_i(e.textureOptions,t.textures.length),n={},r=0,o=t.textures;r<o.length;r++){var a=o[r];n[a]=Ei(a,i,e.allowHosts,e.networkSubscribe)}return Promise.resolve().then((function(){return qt(t.file,{responseType:"arraybuffer",allowHosts:e.allowHosts,networkSubscribe:e.networkSubscribe})})).then((function(t){return Ve((function(){var e=new Uint8Array(t.body);return wi.decode(e)}))})).then((function(r){return Ve((function(){return Si(r,t.textureBase,t.textures.slice(),i,n,e.allowHosts,e.networkSubscribe)}))}))},dome:function(t,e){return Promise.resolve().then((function(){return qt(t.file,{responseType:"arraybuffer",allowHosts:e.allowHosts,networkSubscribe:e.networkSubscribe})})).then((function(i){return Ni(new Uint8Array(i.body),t.textureBase,e.textureOptions,e.allowHosts,e.networkSubscribe)}))},domez:function(t,e){return Promise.resolve().then((function(){return qt(t.file,{responseType:"arraybuffer",allowHosts:e.allowHosts,networkSubscribe:e.networkSubscribe})})).then((function(t){return Ke(t.body)})).then((function(t){var e=t.reduce((function(t,e){return t+e.length}),0),i=new Uint8Array(e),n=0;return t.forEach((function(t){i.set(t,n),n+=t.length})),i})).then((function(i){return Ni(i,t.textureBase,e.textureOptions,e.allowHosts,e.networkSubscribe)}))}},Pm=function(t){function i(e){void 0===e&&(e={});var i=t.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.networkSubscribe=e.networkSubscribe,i.allowHosts=e.allowHosts,i.renderOrder=-3,i}return e.__extends(i,t),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(t){this.tiledModel&&(this.tiledModel.enable=t)},enumerable:!1,configurable:!0}),i.prototype.getEdges=function(t){var e;if(void 0===t&&(t=30/180*Math.PI),!this.originModel)return[];for(var i=Math.cos(t),n=[],o=0,a=this.originModel.children;o<a.length;o++){var s=a[o];if(s instanceof oe){for(var c={},l=["a","b","c"],h=Tm(s.geometry),u=h.getAttribute("position").array,d=(null===(e=h.getIndex())||void 0===e?void 0:e.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 t=[];return this.traverse((function(e){e instanceof oe&&(t[e.floorIndex]=!0)})),t.length},i.prototype.show=function(){for(var t,e,i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var o=this.shownFloor,a=null,s=null!==(t=i[1])&&void 0!==t?t:.1,c=0!==i.length;this.shownFloor=a=c?i[0]:null,this.setMaterial({opacity:1,floorInfo:new r.Vector3(0,0,0)}),(null===(e=this.tiledModel)||void 0===e?void 0:e.enable)?this.b3dmShow(o,a):this.at3dShow(o,a,s)},i.prototype.at3dShow=function(t,e,i){var n,r;(null===(r=null===(n=this.tiledModel)||void 0===n?void 0:n.tileset)||void 0===r?void 0:r.root)&&this.traverse((function(t){t instanceof oe&&t.material.forEach((function(n){null===e||e===t.floorIndex?n.opacity=1*n.originOpacity:n.opacity=n.originOpacity*i}))})),t!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0},i.prototype.b3dmShow=function(t,e){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 e&&e>=0&&e<this.tiledModel.tileset.floorInfo.length){var o=this.tiledModel.tileset.floorInfo,a=-o[e].ground,s=o[e].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)});t!==this.shownFloor&&this.emit("shownFloorChange",this.shownFloor,this.floorLength),this.needsRender=!0}},i.prototype.intersectRaycaster=function(t,e){var i=t.ray,n=i.origin,o=i.direction;if(_m(e))if(_m(this.shownFloor)){var a=this.floorLength;e=[];for(var s=-1;s<a;s++)e.push(s)}else e=[this.shownFloor];var c=[],l=[];Array.isArray(e)?l.push.apply(l,e):l.push(e);for(var h=function(e){var i=u.bvhs&&u.bvhs[e];if(i){var a=new _e(n.x,n.y,n.z),s=new _e(o.x,o.y,o.z);(l=i.intersectRay(a,s,!0).map((function(t){var e=t.intersectionPoint,i=t.triangle,o=new r.Vector3(e.x,e.y,e.z);return{point:o,face:{normal:Cm(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(t){t instanceof oe&&t.floorIndex===e&&h.push(t)})),(l=t.intersectObjects(h).map((function(t){return{face:t.face?{normal:t.face.normal}:void 0,point:t.point,distance:t.distance}}))).length&&c.push.apply(c,l)}},u=this,d=0,p=l;d<p.length;d++){h(p[d])}return c.filter((function(e){var i=e.distance;return i<=t.far&&i>=t.near})).sort((function(t,e){return t.distance-e.distance}))},i.prototype.buildBVH=function(){if(!this.bvhs.loaded&&this.originModel){var t=[];this.originModel.traverse((function(e){e instanceof oe&&(t[e.floorIndex]=t[e.floorIndex]||[],t[e.floorIndex].push(e.geometry))})),this.bvhs.length=0;for(var e=0,i=t;e<i.length;e++){var n=i[e],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 Le).create(c).splitNode(50);this.bvhs.push(A)}}this.bvhs.loaded=!0,this.emit("bvhLoaded")}},i.prototype.load=function(t,e){var i=this;if(void 0===e&&(e={}),!0===this.loaded)throw new Error("[MODEL LOAD ERROR]: model cannot load twice.");var n=function(t,e){if(void 0===e&&(e=[]),/^blob\:/.test(t))return"at3d";var i=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(t);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=e.indexOf(o);if(a>=0)return e[a]}return""}(t.file,Object.keys(Im)),o=Im[n];if(!o)throw new Error("[MODEL LOAD ERROR]: file type(".concat(n,") does not support."));return this.name=t.file,o(t,{textureOptions:e,allowHosts:this.allowHosts,networkSubscribe:this.networkSubscribe}).then((function(e){var n=e.objects,o=e.texturePromise;i.bounding.makeEmpty();var a=i.originModel=new ae;a.renderOrder=-3;for(var s=0,c=n;s<c.length;s++){(d=c[s]).traverse((function(t){if(t instanceof oe){var e=t.geometry;e.boundingBox||e.computeBoundingBox(),e.boundingSphere||e.computeBoundingSphere(),i.bounding.union(e.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(t){if(t instanceof oe)for(var e=0,i=t.material;e<i.length;e++){i[e].uniforms.modelCenter.value=l}}))}if(i.add(a),i.floorLength=i.hasFloors_(),i.empty=!1,i.loaded=!0,t.tiles&&t.tiles.tileset_url&&t.tiles.b3md_mappings_url){var p=i.tiledModel=new Sm({onNodeCreated:function(t){var e=a.getMaterial();e&&(t.setMaterial(e),t.renderOrder=-3),t.traverse((function(t){if(t instanceof oe)for(var e=0,i=t.material;e<i.length;e++){i[e].uniforms.modelCenter.value=l}}))},allowHosts:i.allowHosts,networkSubscribe:i.networkSubscribe});p.renderOrder=-3,i.add(p),p.load(t.tiles)}t.bvh&&i.buildBVH(),Ve((function(){i.emit("geometryLoaded"),o.then((function(){i.emit("materialLoaded"),i.emit("loaded")}))}))})).catch((function(t){return i.name="",i.emit("error",t),Promise.reject(t)}))},i.prototype.update=function(t,e){if(this.originModel){var i=this.originModel.visible;if(this.tiledModel&&this.tiledModel.enable&&this.tiledModel.tileset){this.tiledModel.update(t,e);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 t=this.originModel,e=this.tiledModel;if(e&&(e.enable=!1,e.reset()),t)for(t.disposeGeometry(),t.disposeMaterial();t.children.length;)t.remove(t.children[0]);this.bvhs.length=0,this.bvhs.loaded=!1},i}(ae);Object.assign(Pm.prototype,{on:It.prototype.on,once:It.prototype.once,off:It.prototype.off,emit:It.prototype.emit,hasListener:It.prototype.hasListener});function Rm(t,e,i){return t<e?e:t>i?i:t}function Bm(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=[];t=t.map((function(t){return(null!=t?t:"").trim()})).filter((function(t){return t.length>0&&!/^\/+$/.test(t)}));for(var n=0;n<t.length;n++){var r=0===n,o=n===t.length-1,a=t[n];r||(a=a.replace(/^\/+/,"")),o||(a=a.replace(/\/+$/,"")),i.push(a)}return i.join("/")}function Lm(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var i,n,r;if(Array.isArray(t)){if((i=t.length)!=e.length)return!1;for(n=i;0!=n--;)if(!Lm(t[n],e[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if((i=(r=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(e,r[n]))return!1;for(n=i;0!=n--;){var o=r[n];if(!Lm(t[o],e[o]))return!1}return!0}return t!=t&&e!=e}function Dm(t){return"number"==typeof t}function Om(t){return 0==(t&t-1)&&0!==t}var Nm=function(){return new Error("Invalid input.")},km=function(){return new Error("Invalid certificate.")},Fm=function(){return new Error("Invalid signature.")};function Vm(t,e){void 0===e&&(e=!1);var i=typeof t;if("string"===i)return JSON.stringify(t);if(!0===t)return"true";if(!1===t)return"false";if(null===t)return"null";if(t instanceof Array){for(var n="[",r=t.length-1,o=0;o<r;o++)n+=Vm(t[o],!1)+",";return r>-1&&(n+=Vm(t[o],!1)),n+"]"}if(t instanceof Object){if("function"==typeof t.toJSON)return Vm(t.toJSON(),e);var a=Object.keys(t).sort(),s=a.length;for(n="",o=0;o<s;){var c=a[o],l=Vm(t[c],!0);void 0!==l&&(o&&""!==n&&(n+=","),n+=JSON.stringify(c)+":"+l),o++}return"{"+n+"}"}switch(i){case"function":case"undefined":return e?void 0:null;case"number":return 0;default:return isFinite(t)?t:null}}function zm(t){return String(Vm(t,!1))}function Hm(t){var e,i,n;if(Array.isArray(t)){var r,o,a=void 0;if(t.length<=0)return Nm();for(var s=function(e){var i=Hm(t[e]);if(i instanceof Error)return{value:i};if(a){if(a!==i.issuer)return{value:km()}}else a=i.issuer;r?i.expire.getTime()<r.getTime()&&(r=i.expire):r=i.expire,o=o?o.filter((function(t){return-1!==i.allowHosts.indexOf(t)})):i.allowHosts},c=0;c<t.length;c++){var l=s(c);if("object"==typeof l)return l.value}return Lt({issuer:a,expire:r,allowHosts:o})}var h=JSON.parse(t),u="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof h)return Nm();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||Ot(u)||Ft.filter((function(t){return Nt(t,u)})).length>0){var m=String(null!==(e=h.certificate)&&void 0!==e?e:"");if(m){var g=new xt;return g.readCertPEM(m),Lt({issuer:g.getSubjectString(),expire:p,allowHosts:f})}return Lt({issuer:"none",expire:p,allowHosts:f})}var v=String(null!==(i=h.certificate)&&void 0!==i?i:"");if(!v)return km();var y=new xt;y.readCertPEM(v);var A=String(null!==(n=h._signature)&&void 0!==n?n:"");return A?!1===function(t,e,i){var n=new xt;if("string"==typeof i?n.readCertPEM(i):n.readCertHex(i.hex),!1===St(n))return!1;var r=new X;return r.readCertPubKeyHex(n.hex,6),!!r.verify(t,O(e))}(zm(function(t,e){for(var i={},n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];-1===e.indexOf(o)&&(i[o]=t[o])}return i}(h,["_signature"])),A,y)?Fm():d<p.getTime()?0===f.filter((function(t){return Nt(t,u)})).length?function(t){return new Error("host(".concat(JSON.stringify(t),") is not allowed."))}(u):Lt({issuer:y.getSubjectString(),expire:p,allowHosts:f}):function(t){return new Error("date(".concat(t.toString(),") expired."))}(p):Fm()}var Um=new WeakMap,Gm=function(){function t(){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 t.prototype.toJSON=function(){return this.raw.works},t.parse=qm,t}();function jm(t){return null==t?"null":Array.isArray(t)?"array":"object"==typeof t?"dict":"value"}function Qm(t,e){var i=jm(t),n=jm(e);if("null"===n)return t;if("value"===n)return e;if(n!==i)return JSON.parse(JSON.stringify(e));if("array"===n)for(var r=0;r<e.length;r++)t[r]=Qm(t[r],e[r]);else if("dict"===n)for(var o in e)t[o]=Qm(t[o],e[o]);return t}function Wm(t,e,i){for(var n,o=JSON.stringify(e),a=[],s=0,c=[].concat(t);s<c.length;s++){var l=c[s];l instanceof Gm?a.push.apply(a,l.raw.works):"string"==typeof l?a.push(l):a.push(JSON.stringify(l))}var h=Hm(a);if(h instanceof Error)return h;e=JSON.parse(o),t=a.map((function(t){return JSON.parse(t)})).reduce((function(t,e){return Qm(t,e)}));var u=new Gm;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=t.base_url)&&void 0!==n?n:"";d&&"/"!==d[d.length-1]&&(d+="/");var p=function(t,e){return 0===t.indexOf(e)},f=function(t,n){var r,o=t;if(!0===e.jsonp){o=t.replace(/([\?\#].*)?$/i,"");var a=bt("".concat(o)).slice(0,7);o="".concat(o,".").concat(a,".jsonp")}if(!0===e.shortPath){var s=o.replace(d,"").split("."),c=null!==(r=s.shift())&&void 0!==r?r:"",l=s.join(".");o=Bm(d,bt(c))+(l?"."+l:"")}var h=o.replace(d,"");return e.baseURL&&(o=Bm(e.baseURL,h)),i&&i(t,o,h,n),o},m=function(e,i){var n,r,o,a,s,c,l=e;if(!Ti(e)){var h=null!==(c=null!==(a=null!==(r=null===(n=t.panorama)||void 0===n?void 0:n.pano_high_cube_base_url)&&void 0!==r?r:null===(o=t.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==a?a:null===(s=t.panorama)||void 0===s?void 0:s.base_url)&&void 0!==c?c:"";h&&(h=Bm(h,String(i))),l=Bm(h,l)}return Ti(l)||(l=Bm(d,l)),p(l,d)||console.warn("".concat(l," is not start with base_url(").concat(d,").")),f(l,"panorama")},g=function(t){var e=t;return Ti(e)||(e=Bm(d,t)),p(e,d)||console.warn("".concat(e," is not start with base_url(").concat(d,").")),f(e,"model")},v=function(t,e){void 0===e&&(e="");var i=t;return Ti(i)||(i=Bm(e,i)),Ti(i)||(i=Bm(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(t.work_code||t.code||t.vr_code||t.workCode),u.name=String(t.name),h instanceof Error)return h;if(t.model){var y={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof e.modelBvh?y.bvh=e.modelBvh:"boolean"==typeof t.model.bvh?y.bvh=t.model.bvh:"boolean"==typeof t.bvh&&(y.bvh=t.bvh),t.model.file?y.file=g(t.model.file):t.model.file_url&&(y.file=g(t.model.file_url)),t.model.textureBase?y.textureBase=t.model.textureBase:t.model.material_base_url&&(y.textureBase=t.model.material_base_url),Array.isArray(t.model.textures)?y.textures=t.model.textures.map((function(t){return v(t,y.textureBase)})):Array.isArray(t.model.material_textures)&&(y.textures=t.model.material_textures.map((function(t){return v(t,y.textureBase)}))),t.model.tiles&&(y.tiles=t.model.tiles),y.file&&(u.model=y)}if(h instanceof Error)return h;if(t.observers&&Array.isArray(t.observers)){var A=[];t.panorama&&(Array.isArray(t.panorama)?A=t.panorama:Array.isArray(t.panorama.list)?A=t.panorama.list:Array.isArray(t.panorama.info)&&(A=t.panorama.info));for(var x=0;x<t.observers.length;x++){var b={},w=t.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(t){var e=t.match(/\/cube_(\d+)\//);if(e){var i=Number(e[1]);if(Om(i))return i}return!1},I=function(t,e){return t.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(e,"/")}))},P=0,R=_;P<R.length;P++){var B=R[P];if("number"==typeof B){var L=B,D=C(b.images.front);if(!1===D)continue;if((H=Math.max(D,512*Math.pow(2,L)))>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:L,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:L,size:H,up:O,down:N,right:k,left:F,front:V,back:z})}}else{var H;if("number"!=typeof(L=B.level))continue;if("number"!=typeof(H=B.size))continue;O=m(B.up,x),N=m(B.down,x),k=m(B.right,x),F=m(B.left,x),V=m(B.front,x),z=m(B.back,x);T.push({level:L,size:H,up:O,down:N,right:k,left:F,front:V,back:z})}}T.sort((function(t,e){return t.level-e.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()),Dm(w.floorIndex)?b.floorIndex=w.floorIndex:Dm(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(t){return t<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(t){return t<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(t.initial)if("Floorplan"!==t.initial.mode&&"Topview"!==t.initial.mode&&"Panorama"!==t.initial.mode&&"VRPanorama"!==t.initial.mode&&"Model"!==t.initial.mode&&"DepthPanorama"!==t.initial.mode||(u.initial.mode=t.initial.mode),Dm(t.initial.latitude)&&(u.initial.latitude=t.initial.latitude),Dm(t.initial.longitude)?u.initial.longitude=t.initial.longitude:Dm(t.initial.heading)&&(u.initial.longitude=-(360*(t.initial.heading-.25)+90)/180*Math.PI),Dm(t.initial.fov)&&(u.initial.fov=t.initial.fov),Dm(t.initial.panoIndex)){var Z=u.observers.length>0?u.observers.length-1:0;u.initial.panoIndex=Rm(t.initial.panoIndex,0,Z)}else if(Dm(t.initial.pano_index)){Z=u.observers.length>0?u.observers.length-1:0;u.initial.panoIndex=Rm(t.initial.pano_index,0,Z)}else if(Dm(t.initial.pano)){Z=u.observers.length>0?u.observers.length-1:0;u.initial.panoIndex=Rm(t.initial.pano,0,Z)}if(h instanceof Error)return h;var J=Lt(u);return Um.set(J,{works:a,options:o}),J}function qm(t,e,i){"string"==typeof t&&"{"===t.trim()[0]&&(t=JSON.parse(t));var n=Um.get(t);if(n){if(e&&!Lm(JSON.parse(n.options),e))throw new Error("[PARSE FAILED]: work is parsed with different options.");return t}var r=Wm(t,null!=e?e:{},i);if(r instanceof Error)throw new Error("[PARSE FAILED]: "+r.message);return r}function Km(t,e,i){return t+(e-t)*i}function Xm(t,e){var i=e[1]-e[0];return t<e[0]?Xm(t+i,e):t>=e[1]?Xm(t-i,e):t}function Ym(t,e,i,n){return n?function(t,e,i,n){var r=n[1]-n[0];return t=Xm(t,n),Km((e=Xm(e,n))-t>r/2?t+r:t-e>r/2?t-r:t,e,i)}(t,e,i,n):Km(t,e,i)}var Zm=function(){function t(t){for(var i in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=Bt(),this.startVelocity=0,this.duration=0,this.keyframes=[],t){var n=t[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:e.__assign({},this.value)},{progress:1,value:e.__assign({},this.value)}]}return t.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-function(t,e,i,n){var r=(e*i+2*t)/Math.pow(i,3),o=-(2*e*i+3*t)/Math.pow(i,2),a=e,s=t;return r*Math.pow(n,3)+o*Math.pow(n,2)+a*n+s}(1,this.startVelocity,this.duration,e)},t.prototype.getValue=function(t){for(var i=1;i<this.keyframes.length;i++)if(this.keyframes[i].progress>t){var n=this.keyframes[i-1],r=this.keyframes[i],o={};for(var a in this.config){var s=(t-n.progress)/(r.progress-n.progress);o[a]=Ym(n.value[a],r.value[a],s,this.config[a].circle)}return o}return e.__assign({},this.keyframes[this.keyframes.length-1].value)},t.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:function(t,e,i,n){var r=(e*i+2*t)/Math.pow(i,3),o=-(2*e*i+3*t)/Math.pow(i,2),a=e;return 3*r*Math.pow(n,2)+2*o*n+a}(1,this.startVelocity,this.duration,e)},t.prototype.update=function(t){return!!this.ended||(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},t.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),i=1;i<this.keyframes.length;i++)if(this.keyframes[i].progress>e)return[this.keyframes[i-1],this.keyframes[i]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},t.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},t.prototype.set=function(t,e,i,n){var r;void 0===i&&(i=0),isNaN(e)&&(e=0),isNaN(i)&&(i=0),n=null!=n?n:Bt();var o=this.getProgress(n),a=this.getValue(o),s={};for(var c in this.config)s[c]=null!==(r=t[c])&&void 0!==r?r:a[c];var l=[{progress:0,value:a},{progress:1,value:s}];return this.setKeyframes(l,e,i,n)},t.prototype.setKeyframes=function(t,i,n,r){var o=this;if(void 0===n&&(n=0),t.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:Bt(),o.progress=0,o.ended=!1,o.startTime=r,o.startVelocity=n,o.keyframes=t,o.duration=i,0===i?(o.progress=1,o.value=e.__assign({},t[t.length-1].value)):o.value=e.__assign({},t[0].value),o.callbacks=[a,s]}))},t.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},t}(),Jm=he(),$m=new r.Texture(Jm);Jm.onload=function(){return $m.needsUpdate=!0},Jm.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC";var tg=new r.RingBufferGeometry(.06,.07,32).rotateX(-Math.PI/2),eg=new r.MeshBasicMaterial({map:$m,transparent:!0}),ig=new r.SphereBufferGeometry(.12,16,16),ng=new r.MeshBasicMaterial({color:16777215,opacity:0,transparent:!0});function rg(){if("undefined"==typeof document){var t=new r.Texture;return Object.assign(t,{draw:function(t){},retain:!1,pool:!1})}var e=document.createElement("canvas"),i=512,n=256,o=190;e.setAttribute("width",String(i)),e.setAttribute("height",String(i));var a=new r.Texture(e),s=e.getContext("2d");if(!s)throw Error("cannot create canvas context");var c=s.createRadialGradient(n,n,150,n,n,0);function l(){var t=Math.PI/12,e=2*Math.PI/3;s&&(s.beginPath(),s.arc(n,n,o,0*e,1*e-t),s.stroke(),s.beginPath(),s.arc(n,n,o,1*e,2*e-t),s.stroke(),s.beginPath(),s.arc(n,n,o,2*e,3*e-t),s.stroke())}function h(t){s&&(s.clearRect(0,0,i,i),s.lineWidth=20,-1!==t&&(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*t),s.strokeStyle="rgba(255, 255, 255, 1)",s.stroke(),s.globalCompositeOperation="source-over",s.strokeStyle="rgba(255, 255, 255, "+(t?.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 og=[];var ag=rg();ag.draw(0);var sg=rg();sg.draw(1);var cg=rg();cg.draw(-1);var lg=new r.CircleBufferGeometry(.12,32).rotateX(-Math.PI/2);function hg(){return new r.Mesh(lg,new r.MeshBasicMaterial({map:ag,transparent:!0}))}function ug(t,e){var i=t.map;0===e||1===e?(!0===i.pool&&(i.retain=!1),0===e&&(t.map=ag),1===e&&(t.map=sg)):(!0!==i.pool&&(t.map=function(){for(var t=0,e=og;t<e.length;t++){var i=e[t];if(!1===i.retain)return i}var n=rg();return n.pool=!0,n.retain=!0,og.push(n),n}()),t.map.draw(e))}var dg=function(t){function i(){var e=t.call(this)||this;return e.loading=!1,e.disabled=!1,e.current=!1,e.progress=0,e.opacity=0,e.hitTestMesh=new r.Mesh(ig,ng),e.add(e.hitTestMesh),e.centerMesh=hg(),e.centerMesh.position.y+=.01,e.add(e.centerMesh),e.loadingMesh=new r.Mesh(tg,eg),e.loadingMesh.position.y+=.011,e.progressMotion=new Zm({progress:e.progress}),e.opacityMotion=new Zm({opacity:e.opacity}),e.needsRender=!0,e.renderOrder=-2,e}return e.__extends(i,t),i.prototype.setLoading=function(t){var e=this;this.loading=t,this.stopInterval&&this.stopInterval(),t?(this.add(this.loadingMesh),this.stopInterval=Jt.shared.add((function(){e.loadingMesh.rotateOnAxis(new r.Vector3(0,1,0),.1),e.needsRender=!0}))):this.remove(this.loadingMesh),this.needsRender=!0},i.prototype.setDisabled=function(t){this.disabled=t,function(t,e){var i=t.map;!0===i.pool&&(i.retain=!1),t.map=e?cg:ag}(this.centerMesh.material,t),this.needsRender=!0},i.prototype.setProgress=function(t){this.setLoading(!1),this.setDisabled(!1),this.progress=t=Rm(t,0,1),t!==this.progressMotion.getTargetKeyframe().value.progress&&this.progressMotion.set({progress:t},120).catch(Pt)},i.prototype.setOpacity=function(t){this.opacity=t=Rm(t,0,1),this.current&&(t=1),t!==this.opacityMotion.getTargetKeyframe().value.opacity&&this.opacityMotion.set({opacity:t},500).catch(Pt)},i.prototype.setCurrent=function(t){this.current!==t&&(this.current=t,this.setOpacity(this.opacity))},i.prototype.updateTime=function(t,e){this.opacityMotion.ended||(this.opacityMotion.update(t),this.centerMesh.material.opacity=this.opacityMotion.value.opacity,this.needsRender=!0),this.progressMotion.ended||(this.progressMotion.update(t),ug(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),pg=new Float32Array([-.13,0,-.13,.13,0,-.13,-.13,0,.13,.13,0,.13]),fg=new Float32Array([0,1,1,1,0,0,1,0]),mg=new Uint8Array([0,2,1,2,3,1]),gg=new r.BufferGeometry;gg.setAttribute("position",new r.BufferAttribute(pg,3)),gg.setAttribute("uv",new r.BufferAttribute(fg,2)),gg.setIndex(new r.BufferAttribute(mg,1));var vg,yg,Ag=(vg=he(),yg=new r.Texture,vg.onload=function(){if("undefined"!=typeof document){var t=256,e=document.createElement("canvas");e.setAttribute("width",String(t)),e.setAttribute("height",String(t));var i=e.getContext("2d");if(i){i.drawImage(vg,0,0,t,t),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(),yg.image=e,yg.needsUpdate=!0}}},vg.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",yg),xg=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var e=t.getContext("2d");if(e){var i=256,n=199.68;return e.beginPath(),e.arc(i,i,n,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.1)",e.closePath(),e.fill(),e.save(),e.beginPath(),e.arc(i,i,n,0,2*Math.PI),e.strokeStyle="rgba(255, 255, 255, 0.5)",e.lineWidth=10.24,e.closePath(),e.stroke(),new r.CanvasTexture(t)}}return null}(),bg=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var e=t.getContext("2d");if(e){var i=256,n=138.24,o=e.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)"),e.beginPath(),e.lineWidth=33.28,e.arc(i,i,n,0,2*Math.PI),e.strokeStyle=o,e.shadowBlur=38.4,e.shadowColor="rgba(0, 0, 0, 0.3)",e.closePath(),e.stroke(),new r.CanvasTexture(t)}}return null}(),wg=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var e=t.getContext("2d");if(e){var i=256,n=199.68,o=e.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)"),e.beginPath(),e.lineWidth=15.36,e.arc(i,i,n,0,2*Math.PI),e.strokeStyle=o,e.shadowBlur=25.6,e.shadowColor="rgba(0, 0, 0, 0.5)",e.closePath(),e.stroke(),new r.CanvasTexture(t)}}return null}(),Mg=function(t,e){var i=128;t.clearRect(0,0,256,256),t.beginPath(),t.lineWidth=29.44,t.arc(i,i,84.48,0,2*Math.PI*e),t.strokeStyle="rgba(255, 255, 255, 0.2)",t.stroke()},Eg=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(256)),t.setAttribute("height",String(256));var e=t.getContext("2d");e&&Mg(e,2*Math.PI);var i=new r.CanvasTexture(t);return Object.assign(i,{setProgress:function(t){e&&(Mg(e,t),i.needsUpdate=!0)}})}return null},Sg=[],_g=Eg(),Tg=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.ringRotateMotion=new Zm({angle:0}),i.tapMotion=new Zm({scale:1,opacity:1}),i.progressMotion=new Zm({progress:0}),i.progressOpacityMotion=new Zm({opacity:0}),i.opacityMotion=new Zm({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(gg,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:bg,opacity:0}))),i.ringMesh=new r.Mesh(gg,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:wg,opacity:0}))),i.loadingMesh=new r.Mesh(gg,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:Ag,opacity:.5}))),i.disableMesh=new r.Mesh(gg,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:xg,opacity:0}))),i.progressMesh=new r.Mesh(gg,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:_g,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 e.__extends(i,t),i.prototype.setProgress=function(t){this.setDisabled(!1),this.setLoading(!1),this.progress!==t&&(t=Rm(t,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},300).catch(Pt),0===t?(this.progressOpacityMotion.set({opacity:0},300).catch(Pt),this.progressMotion.set({progress:Rm(1.2*t,0,1)},0).catch(Pt)):this.progressMotion.set({progress:Rm(1.2*t,0,1)},100).catch(Pt)),this.progress=t)},i.prototype.setOpacity=function(t){this.opacity!==t&&(this.opacity=t=Rm(t,0,1),this.opacityMotion.set({opacity:t},500).catch(Pt))},i.prototype.setCurrent=function(t){if(this.current!==t){if(!0===t&&this.ringRotateMotion.ended){var e=[{progress:0,value:{angle:0}},{progress:1,value:{angle:2*Math.PI}}];this.ringRotateMotion.setKeyframes(e,5e3).catch(Pt)}this.current=t}},i.prototype.setLoading=function(t){this.loading!==t&&(this.loading=t,!0===this.disabled&&this.setDisabled(!1),this.loadingMesh.visible=t,this.needsRender=!0)},i.prototype.setDisabled=function(t){this.disabled!==t&&(this.disabled=t,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=t,this.ringMesh.visible=!t,this.centerMesh.visible=!t,this.needsRender=!0)},i.prototype.tap=function(){var t=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(Pt),this.progressMotion.set({progress:0},0).catch(Pt),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(){t.progressOpacityMotion.set({opacity:t.progress>0?1:0},300).catch(Pt),t.progressMotion.set({progress:t.progress},120).catch(Pt)})).catch(Pt)},i.prototype.updateTime=function(t,e){var i;if(!this.progressMotion.ended){this.progressMotion.update(t);var n=this.progressMotion.value.progress;if(null!==this.progressMesh.material.map)if(0===n)this.progressMesh.material.map!==_g&&(Sg.push(this.progressMesh.material.map),this.progressMesh.material.map=_g);else if(1===n)this.progressMesh.material.map!==_g&&(Sg.push(this.progressMesh.material.map),this.progressMesh.material.map=_g);else{if(this.progressMesh.material.map===_g){var o=Sg.pop()||Eg();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(t);var a=this.progressOpacityMotion.value.opacity;this.progressMesh.material.opacity=a,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(t);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(-e/120),this.needsRender=!0),!this.tapMotion.ended){this.tapMotion.update(t);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(t),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!==_g&&(Sg.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),Cg=new r.CircleBufferGeometry(.1,16),Ig=function(){if("undefined"!=typeof document){var t=512,e=document.createElement("canvas");e.setAttribute("width",String(t)),e.setAttribute("height",String(t));var i=e.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,t,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(e)}}return null}(),Pg=new r.MeshBasicMaterial({map:Ig,transparent:!0}),Rg=function(t){function i(){var e=t.call(this)||this;return e.ringMesh=new r.Mesh(Cg,Pg),e.ringMesh.renderOrder=-3,e.add(e.ringMesh),e}return e.__extends(i,t),i.prototype.dispose=function(){this.remove(this.ringMesh)},i}(r.Object3D);function Bg(t,e,i){var n=Math.abs(t-e);return n<.001||void 0!==i&&Math.abs(i-n)<.001}function Lg(t,e,i){return!Bg(t,e,i)}function Dg(t,e){return t.distanceTo(e)<.001}function Og(t,e){return!Dg(t,e)}var Ng=new r.Vector3(0,0,0),kg=function(t){function i(e,i){void 0===i&&(i=Ng);var n=t.call(this)||this,o=new r.BoxBufferGeometry(e.max.x-e.min.x+2*i.x,e.max.y-e.min.y+2*i.y,e.max.z-e.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 me;a.defines.USE_MAP=!1,a.defines.USE_UV=!1,a.uniforms.diffuse.value=new r.Color(16777215);var s=new oe(o,[a]);return s.floorIndex=-1,s.position.copy(e.getCenter(new r.Vector3)),s.frustumCulled=!1,n.renderOrder=-3,n.add(s),n.boundingBox=new r.Box3,n.computeBoundingBox(),n}return e.__extends(i,t),i.prototype.computeBoundingBox=function(){this.boundingBox.setFromObject(this)},i.prototype.dispose=function(){this.disposeMaterial(),this.disposeGeometry()},i}(se);function Fg(t,e){return void 0===e&&(e=Ng),new kg(t,e)}var Vg=2*Math.PI;function zg(t){return t>=0&&t<Vg?t:(t%Vg+Vg)%Vg}var Hg=Math.PI,Ug=2*Hg;function Gg(t,e,i){if(t===e)return e;var n=e-t;return Math.abs(n)<=i?e:t+(n>0?1:-1)*i}!function(){try{var t=document.createElement("canvas");!window.WebGLRenderingContext||!t.getContext("webgl")&&t.getContext("experimental-webgl")}catch(t){return!1}}();var jg=function(){var t="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"node";return/android/i.test(t)||/webos/i.test(t)||/ipad|iphone|ipod/i.test(t)||/iemobile/i.test(t)||/opera mini/i.test(t)||/blackberry/i.test(t)||/windows phone/i.test(t)};function Qg(t,e){t.mode=e.mode,t.panoIndex=e.panoIndex,t.longitude=e.longitude,t.latitude=e.latitude,t.fov=e.fov,t.offset.copy(e.offset)}function Wg(t,e){return t.panoIndex===e.panoIndex&&t.mode===e.mode&&Bg(t.longitude,e.longitude,2*Math.PI)&&Bg(t.latitude,e.latitude)&&Bg(t.fov,e.fov)&&Dg(t.offset,e.offset)}var qg=function(t){return Number(t)};function Kg(t,e,i){var n;void 0===e&&(e=qg),void 0===i&&(i=!1);for(var r,o=1/0,a=0,s=t;a<s.length;a++){var c=s[a],l=e(c);l<=o&&(r=(n=[c,l])[0],o=n[1])}return i?[r,o]:r}function Xg(t){for(var e in t)return!1;return!0}function Yg(t){return{longitude:t.longitude,latitude:t.latitude,fov:t.fov,offset:t.offset.clone(),distance:t.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 Zg=function(t,e,i,n){var r,o=["","webkit","Moz","MS","ms","o"],a=e.createElement?e.createElement("div"):n,s=Math.round,c=Math.abs,l=Date.now;function h(t,e,i){return setTimeout(v(t,i),e)}function u(t,e,i){return!!Array.isArray(t)&&(d(t,i[e],i),!0)}function d(t,e,i){var r;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==n)for(r=0;r<t.length;)e.call(i,t[r],r,t),r++;else for(r in t)t.hasOwnProperty(r)&&e.call(i,t[r],r,t)}function p(e,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=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,r,n),e.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===n||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var r=arguments[i];if(r!==n&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(e[o]=r[o])}return e}:Object.assign;var f=p((function(t,e,i){for(var r=Object.keys(e),o=0;o<r.length;)(!i||i&&t[r[o]]===n)&&(t[r[o]]=e[r[o]]),o++;return t}),"extend","Use `assign`."),m=p((function(t,e){return f(t,e,!0)}),"merge","Use `assign`.");function g(t,e,i){var n,o=e.prototype;(n=t.prototype=Object.create(o)).constructor=t,n._super=o,i&&r(n,i)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){return"function"==typeof t?t.apply(e&&e[0]||n,e):t}function A(t,e){return t===n?e:t}function x(t,e,i){d(E(e),(function(e){t.addEventListener(e,i,!1)}))}function b(t,e,i){d(E(e),(function(e){t.removeEventListener(e,i,!1)}))}function w(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function M(t,e){return t.indexOf(e)>-1}function E(t){return t.trim().split(/\s+/g)}function S(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}function _(t){return Array.prototype.slice.call(t,0)}function T(t,e,i){for(var n=[],r=[],o=0;o<t.length;){var a=e?t[o][e]:t[o];S(r,a)<0&&n.push(t[o]),r[o]=a,o++}return i&&(n=e?n.sort((function(t,i){return t[e]>i[e]})):n.sort()),n}function C(t,e){for(var i,r,a=e[0].toUpperCase()+e.slice(1),s=0;s<o.length;){if((r=(i=o[s])?i+a:e)in t)return r;s++}return n}var I=1;function P(e){var i=e.ownerDocument||e;return i.defaultView||i.parentWindow||t}var R="ontouchstart"in t,B=C(t,"PointerEvent")!==n,L=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(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){y(t.options.enable,[t])&&i.handler(e)},this.init()}function z(t,e,i){var r=i.pointers.length,o=i.changedPointers.length,a=1&e&&r-o==0,s=12&e&&r-o==0;i.isFirst=!!a,i.isFinal=!!s,a&&(t.session={}),i.eventType=e,function(t,e){var i=t.session,r=e.pointers,o=r.length;i.firstInput||(i.firstInput=H(e));o>1&&!i.firstMultiple?i.firstMultiple=H(e):1===o&&(i.firstMultiple=!1);var a=i.firstInput,s=i.firstMultiple,h=s?s.center:a.center,u=e.center=U(r);e.timeStamp=l(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=W(h,u),e.distance=Q(h,u),function(t,e){var i=e.center,n=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};1!==e.eventType&&4!==o.eventType||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y});e.deltaX=r.x+(i.x-n.x),e.deltaY=r.y+(i.y-n.y)}(i,e),e.offsetDirection=j(e.deltaX,e.deltaY);var d=G(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,e.scale=s?function(t,e){return Q(e[0],e[1],F)/Q(t[0],t[1],F)}(s.pointers,r):1,e.rotation=s?function(t,e){return W(e[1],e[0],F)+W(t[1],t[0],F)}(s.pointers,r):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,r,o,a,s=t.lastInterval||e,l=e.timeStamp-s.timeStamp;if(8!=e.eventType&&(l>25||s.velocity===n)){var h=e.deltaX-s.deltaX,u=e.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),t.lastInterval=e}else i=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;e.velocity=i,e.velocityX=r,e.velocityY=o,e.direction=a}(i,e);var p=t.element;w(e.srcEvent.target,p)&&(p=e.srcEvent.target);e.target=p}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function H(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:s(t.pointers[i].clientX),clientY:s(t.pointers[i].clientY)},i++;return{timeStamp:l(),pointers:e,center:U(e),deltaX:t.deltaX,deltaY:t.deltaY}}function U(t){var e=t.length;if(1===e)return{x:s(t[0].clientX),y:s(t[0].clientY)};for(var i=0,n=0,r=0;r<e;)i+=t[r].clientX,n+=t[r].clientY,r++;return{x:s(i/e),y:s(n/e)}}function G(t,e,i){return{x:e/t||0,y:i/t||0}}function j(t,e){return t===e?1:c(t)>=c(e)?t<0?2:4:e<0?8:16}function Q(t,e,i){i||(i=k);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return Math.sqrt(n*n+r*r)}function W(t,e,i){i||(i=k);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[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(t){var e=q[t.type];1&e&&(0===t.button||2===t.button)&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:O,srcEvent:t}))}});var Z={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:D,3:"pen",4:O,5:"kinect"},$="pointerdown",tt="pointermove pointerup pointercancel";function et(){this.evEl=$,this.evWin=tt,V.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&($="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),g(et,V,{handler:function(t){var e=this.store,i=!1,n=!1,r=t.type.toLowerCase().replace("ms",""),o=Z[r],a=J[t.pointerType]||t.pointerType,s=a==D,c=S(e,t.pointerId,"pointerId");1&o&&(0===t.button||2===t.button||s)?c<0&&(e.push(t),c=e.length-1):12&o?i=!0:s||0!==t.buttons||(i=!0,n=!0,o=Z.pointerup),c<0||(n||(e[c]=t),this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:a,srcEvent:e[c]}),i&&e.splice(c,1))}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8},nt="touchstart",rt="touchstart touchmove touchend touchcancel";function ot(){this.evTarget=nt,this.evWin=rt,this.started=!1,V.apply(this,arguments)}function at(t,e){var i=_(t.touches),n=_(t.changedTouches);return 12&e&&(i=T(i.concat(n),"identifier",!0)),[i,n]}g(ot,V,{handler:function(t){var e=it[t.type];if(1===e&&(this.started=!0),this.started){var i=at.call(this,t,e);12&e&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:t})}}});var st={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ct="touchstart touchmove touchend touchcancel";function lt(){this.evTarget=ct,this.targetIds={},V.apply(this,arguments)}function ht(t,e){var i=_(t.touches),n=this.targetIds;if(3&e&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,o,a=_(t.changedTouches),s=[],c=this.target;if(o=i.filter((function(t){return w(t.target,c)})),1===e)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&e&&delete n[a[r].identifier],r++;return s.length?[T(o.concat(s),"identifier",!0),s]:void 0}g(lt,V,{handler:function(t){var e=st[t.type],i=ht.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:t})}});function ut(){V.apply(this,arguments);var t=v(this.handler,this);this.touch=new lt(this.manager,t),this.mouse=new Y(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function dt(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,pt.call(this,e)):12&t&&pt.call(this,e)}function pt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var t=n.indexOf(i);t>-1&&n.splice(t,1)}),2500)}}function ft(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],o=Math.abs(e-r.x),a=Math.abs(i-r.y);if(o<=25&&a<=25)return!0}return!1}g(ut,V,{handler:function(t,e,i){var n=i.pointerType==D,r=i.pointerType==O;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)dt.call(this,e,i);else if(r&&ft.call(this,i))return;this.callback(t,e,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var mt=a?C(a.style,"touchAction"):n,gt=mt!==n,vt="compute",yt="auto",At="manipulation",xt="none",bt="pan-x",wt="pan-y",Mt=function(){if(!gt)return!1;var e={},i=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){e[n]=!i||t.CSS.supports("touch-action",n)})),e}();function Et(t,e){this.manager=t,this.set(e)}Et.prototype={set:function(t){t==vt&&(t=this.compute()),gt&&this.manager.element.style&&Mt[t]&&(this.manager.element.style[mt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return d(this.manager.recognizers,(function(e){y(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(M(t,xt))return xt;var e=M(t,bt),i=M(t,wt);if(e&&i)return xt;if(e||i)return e?bt:wt;if(M(t,At))return At;return yt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var n=this.actions,r=M(n,xt)&&!Mt.none,o=M(n,wt)&&!Mt["pan-y"],a=M(n,bt)&&!Mt["pan-x"];if(r){var s=1===t.pointers.length,c=t.distance<2,l=t.deltaTime<250;if(s&&c&&l)return}if(!a||!o)return r||o&&6&i||a&&i&N?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var St=32;function _t(t){this.options=r({},this.defaults,t||{}),this.id=I++,this.manager=null,this.options.enable=A(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Tt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function Ct(t){return 16==t?"down":8==t?"up":2==t?"left":4==t?"right":""}function It(t,e){var i=e.manager;return i?i.get(t):t}function Pt(){_t.apply(this,arguments)}function Rt(){Pt.apply(this,arguments),this.pX=null,this.pY=null}function Bt(){Pt.apply(this,arguments)}function Lt(){_t.apply(this,arguments),this._timer=null,this._input=null}function Dt(){Pt.apply(this,arguments)}function Ot(){Pt.apply(this,arguments)}function Nt(){_t.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function kt(t,e){return(e=e||{}).recognizers=A(e.recognizers,kt.defaults.preset),new Ft(t,e)}_t.prototype={defaults:{},set:function(t){return r(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(u(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=It(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return u(t,"dropRecognizeWith",this)||(t=It(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(u(t,"requireFailure",this))return this;var e=this.requireFail;return-1===S(e,t=It(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(u(t,"dropRequireFailure",this))return this;t=It(t,this);var e=S(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,i=this.state;function n(i){e.manager.emit(i,t)}i<8&&n(e.options.event+Tt(i)),n(e.options.event),t.additionalEvent&&n(t.additionalEvent),i>=8&&n(e.options.event+Tt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=St},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=r({},t);if(!y(this.options.enable,[this,e]))return this.reset(),void(this.state=St);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},g(Pt,_t,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,n=6&e,r=this.attrTest(t);return n&&(8&i||!r)?16|e:n||r?4&i?8|e:2&e?4|e:2:St}}),g(Rt,Pt,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push(wt),t&N&&e.push(bt),e},directionTest:function(t){var e=this.options,i=!0,n=t.distance,r=t.direction,o=t.deltaX,a=t.deltaY;return r&e.direction||(6&e.direction?(r=0===o?1:o<0?2:4,i=o!=this.pX,n=Math.abs(t.deltaX)):(r=0===a?1:a<0?8:16,i=a!=this.pY,n=Math.abs(t.deltaY))),t.direction=r,i&&n>e.threshold&&r&e.direction},attrTest:function(t){return Pt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Ct(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),g(Bt,Pt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),g(Lt,_t,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,r=t.deltaTime>e.time;if(this._input=t,!n||!i||12&t.eventType&&!r)this.reset();else if(1&t.eventType)this.reset(),this._timer=h((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return St},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),g(Dt,Pt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),g(Ot,Pt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Rt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return 30&i?e=t.overallVelocity:6&i?e=t.overallVelocityX:i&N&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=Ct(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),g(Nt,_t,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[At]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,r=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(n&&r&&i){if(4!=t.eventType)return this.failTimeout();var o=!this.pTime||t.timeStamp-this.pTime<e.interval,a=!this.pCenter||Q(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,a&&o?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=h((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return St},failTimeout:function(){return this._timer=h((function(){this.state=St}),this.options.interval,this),St},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),kt.VERSION="2.0.7",kt.defaults={domEvents:!1,touchAction:vt,enable:!0,inputTarget:null,inputClass:null,preset:[[Dt,{enable:!1}],[Bt,{enable:!1},["rotate"]],[Ot,{direction:6}],[Rt,{direction:6},["swipe"]],[Nt],[Nt,{event:"doubletap",taps:2},["tap"]],[Lt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ft(t,e){var i;this.options=r({},kt.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(B?et:L?lt:R?ut:Y))(i,z),this.touchAction=new Et(this,this.options.touchAction),Vt(this,!0),d(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function Vt(t,e){var i,n=t.element;n.style&&(d(t.options.cssProps,(function(r,o){i=C(n.style,o),e?(t.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=t.oldCssProps[i]||""})),e||(t.oldCssProps={}))}return Ft.prototype={set:function(t){return r(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],2===e.stopped||r&&i!=r&&!i.canRecognizeWith(r)?i.reset():i.recognize(t),!r&&14&i.state&&(r=e.curRecognizer=i),o++}},get:function(t){if(t instanceof _t)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(u(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(u(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,i=S(e,t);-1!==i&&(e.splice(i,1),this.touchAction.update())}return this},on:function(t,e){if(t!==n&&e!==n){var i=this.handlers;return d(E(t),(function(t){i[t]=i[t]||[],i[t].push(e)})),this}},off:function(t,e){if(t!==n){var i=this.handlers;return d(E(t),(function(t){e?i[t]&&i[t].splice(S(i[t],e),1):delete i[t]})),this}},emit:function(t,i){this.options.domEvents&&function(t,i){var n=e.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}(t,i);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){i.type=t,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](i),r++}},destroy:function(){this.element&&Vt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(kt,{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:St,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:Ft,Input:V,TouchAction:Et,TouchInput:lt,MouseInput:Y,PointerEventInput:et,TouchMouseInput:ut,SingleTouchInput:ot,Recognizer:_t,AttrRecognizer:Pt,Tap:Nt,Pan:Rt,Swipe:Ot,Pinch:Bt,Rotate:Dt,Press:Lt,on:x,off:b,each:d,merge:m,extend:f,assign:r,inherit:g,bindFn:v,prefixed:C}),kt}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});function Jg(t,e,i){var n=e.offsetWidth,o=e.offsetHeight,a=e.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((t.x-c)/n*2-1,-(t.y-s)/o*2+1)}var $g=new r.OrthographicCamera(-1,1,1,-1,0,1),tv=new r.BufferGeometry;tv.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),tv.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));var ev=new r.Mesh(tv),iv=new r.Scene;iv.add(ev);var nv=function(){function t(t,e){var i;this.renderer=t,this.material=new r.ShaderMaterial({vertexShader:null!==(i=e.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:e.fragment,uniforms:Object.assign({inputBuffer:new r.Uniform(null)},e.uniforms),defines:Object.assign({},e.defines),blending:r.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(t,e){var i=this.renderer.getRenderTarget(),n=ev.material;this.material.uniforms.inputBuffer.value=t.texture,ev.material=this.material,this.renderer.setRenderTarget(e||null),this.renderer.render(iv,$g),this.renderer.setRenderTarget(i),ev.material=n},t.prototype.dispose=function(){this.material.dispose()},t}(),rv=function(){function t(t){this.renderer=t,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 t.prototype.render=function(t,e){var i=this.renderer.getRenderTarget(),n=ev.material;this.material.uniforms.inputValue.value.copy(t),ev.material=this.material,this.renderer.setRenderTarget(e||null),this.renderer.render(iv,$g),this.renderer.setRenderTarget(i),ev.material=n},t.prototype.dispose=function(){this.material.dispose()},t}(),ov=function(t){function i(e){return t.call(this,e,{fragment:"\nuniform sampler2D inputBuffer;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(inputBuffer, vUv);\n}\n"})||this}return e.__extends(i,t),i}(nv),av=function(){function t(t){this.enable=!0,this.renderer=t,this.copyPass=new ov(this.renderer)}return t.prototype.render=function(t,e){this.copyPass.render(t,e)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(),sv=function(t){function i(e){var n,r=this;r=t.call(this)||this;var o=i.parseArgs(e);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.needsRender=!0,r.maxFov=120,r.minFov=40,r.maxLatitude=+Math.PI/2,r.minLatitude=-Math.PI/2,r.cameraMotion=new Zm({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(t){return r.bindEvents(t)})),Jt.shared.add((function(){return r.initAnimation.apply(r,o.initial)}),!0),r}return e.__extends(i,t),i.parseArgs=function(t){return e.__assign({},t)},i.initAnimationEndState=function(t){var e=this.parseArgs(t);return{longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance}},i.prototype.destroy=function(){var t;this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var e=0,i=this.eventUnbinds;e<i.length;e++){(0,i[e])()}this.effect&&(this.effect.dispose(),delete this.effect),delete this.panState,null===(t=this.pressState)||void 0===t||t.stop(),delete this.pressState},i.prototype.isReady=function(){return!1===this.pending&&!0===this.cameraMotion.ended},i.prototype.bindExtraElement=function(t){for(var e=0,i=this.eventUnbinds;e<i.length;e++){if(i[e].element===t)return}this.eventUnbinds.push(this.bindEvents(t))},i.prototype.unbindExtraElement=function(t){for(var e=[],i=0,n=this.eventUnbinds;i<n.length;i++){var r=n[i];r.element===t?r():e.push(r)}this.eventUnbinds=e},i.prototype.updateRenderSize=function(){this.needsRender=!0},i.prototype.updateModel=function(t){this.model=t,this.needsRender=!0},i.prototype.updateWork=function(t,e,i,n,r){return this.work=t,this.userAction=r,!1},i.prototype.updateTime=function(t,e){if(!this.destroyed){var i={};this.cameraMotion.ended&&(this.cameraMotion.update(t),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),Xg(i)&&this.setCamera(i)}},i.prototype.render=function(){this.renderer.render(this.scene,this.camera)},i.prototype.postProcessing=function(t,e){this.destroyed||(this.effect||(this.effect=new av(this.renderer)),this.effect.render(t,e))},i.prototype.updateCamera=function(t,e,i){return this.userAction=i,this.cameraMotion.set(t,e)},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(Bt())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}},i.prototype.moveToPano=function(t,e,i){void 0===e&&(e={}),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};e.moveStartCallback&&e.moveStartCallback(t,n),this.emit("moveToPano",t,this.userAction),this.emit("panoWillArrive",t,n,this.userAction),this.emit("panoArrived",t,n,this.userAction),e.moveEndCallback&&e.moveEndCallback(t,n)},i.prototype.initAnimation=function(t,e,i,n){this.pending=!1,this.userAction=n},i.prototype.setCamera=function(t){var e,i,n,r,o;void 0===t&&(t={});var a=null!==(e=t.longitude)&&void 0!==e?e:this.camera.pose.longitude,s=null!==(i=t.latitude)&&void 0!==i?i:this.camera.pose.latitude,c=null!==(n=t.fov)&&void 0!==n?n:this.camera.pose.fov,l=null!==(r=t.distance)&&void 0!==r?r:this.camera.pose.distance,h=null!==(o=t.offset)&&void 0!==o?o:this.camera.pose.offset,u=this.camera.position.clone(),d=Lg(a,this.camera.pose.longitude,2*Math.PI)||Lg(s,this.camera.pose.latitude),p=Lg(c,this.camera.pose.fov),f=Lg(l,this.camera.pose.distance),m=Og(h,this.camera.pose.offset);this.camera.setFromPose({longitude:a,latitude:s,fov:c,distance:l,offset:h});var g=Og(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,(De||0!==Ne.length)&&(De&&clearTimeout(De),De=window.setTimeout(Fe,200))},i.prototype.onPanGesture=function(t){var e=this.panState,i=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:i,x:t.center.x,y:t.center.y},void 0!==e&&e.pointerLength===i){var n=t.pointers.map((function(t){return Xe(t,["x","y"])}));this.emit("wantsGesture","pan",n,t.isFinal)||this.emit("gesture","pan",n,t.isFinal)}},i.prototype.onTapGesture=function(t){var e=t.pointers.map((function(t){return Xe(t,["x","y"])}));this.emit("wantsGesture","tap",e,!0)||this.emit("gesture","tap",e,!0)},i.prototype.onPressGesture=function(t,e){var i,n=[t];if(this.emit("wantsGesture","press",n,e))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;this.emit("gesture","press",n,e)},i.prototype.onPinchGesture=function(t){var e=t.pointers.map((function(t){return Xe(t,["x","y"])}));this.emit("wantsGesture","pinch",e,t.isFinal)||this.emit("gesture","pinch",e,t.isFinal)},i.prototype.onMouseWheel=function(t){var e=(Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX)/-60,i=[{x:t.clientX,y:t.clientY,delta:e}];this.emit("wantsGesture","mouseWheel",i,!1)||this.emit("gesture","mouseWheel",i,!1)},i.prototype.onMouseMove=function(t){},i.prototype.onMouseOut=function(){},i.prototype.relativeClientPosition=function(t){return Jg(t,this.element,this.scissor)},i.prototype.bindEvents=function(t){var e=this,i=function(t){var i=Jg(t,e.element,e.scissor);return!(Math.abs(i.x)>1||Math.abs(i.y)>1)},n=new Zg.Manager(t),r=function(t){return t.session.firstInput||null};n.add(new Zg.Pan({threshold:10,pointers:0})),n.add(new Zg.Tap({interval:410})),n.add(new Zg.Pinch({threshold:0,pointers:2})),n.on("panstart pan",(function(t){var o=r(n);o&&!i(o.center)||(e.onPanGesture(t),u())})),n.on("tap",(function(t){if("mouse"!==t.pointerType||0===t.srcEvent.button){var o=r(n);o&&!i(o.center)||(e.onTapGesture(t),u())}})),n.on("pinchstart pinch pinchend",(function(t){var o=r(n);o&&!i(o.center)||(e.onPinchGesture(t),u())}));var o=function(t){var n={x:t.clientX,y:t.clientY};i(n)&&(e.onMouseWheel(t),u())},a=function(t){if(!jg()){var n={x:t.clientX,y:t.clientY};i(n)?(e.onMouseMove(t),e.pressState&&Math.abs(t.clientX-e.pressState.x)>10&&Math.abs(t.clientY-e.pressState.y)>10&&u()):e.onMouseOut()}},s=function(){e.onMouseOut(),u()},c=function(t,n){if(i(t)){e.pressState={x:t.x,y:t.y,time:e.pressState?e.pressState.time:n,stop:Pt};var r=n-e.pressState.time;e.onPressGesture({x:t.x,y:t.y,delta:r},!1),e.pressState&&(e.pressState.stop=Jt.shared.add((function(e){return c({x:t.x,y:t.y},e)}),!0,1))}else u()},l=function(t){u(),t.touches.length>1||t.changedTouches.length<=0||c({x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY},Bt())},h=function(t){u(),c({x:t.clientX,y:t.clientY},Bt())},u=function(){var t;if(e.pressState){var i=Bt()-e.pressState.time;e.onPressGesture({x:e.pressState.x,y:e.pressState.y,delta:i},!0),null===(t=e.pressState)||void 0===t||t.stop(),delete e.pressState}},d=function(e){if(e&&"function"==typeof e.preventDefault&&e.currentTarget===t&&e.preventDefault(),"function"==typeof getSelection){var i=getSelection();i&&i.focusNode&&(i.removeAllRanges&&i.removeAllRanges(),i.empty&&i.empty())}};t.addEventListener("wheel",o,!1),t.addEventListener("mousemove",a,!1),t.addEventListener("mouseout",s,!1),t.addEventListener("touchstart",l,!1),t.addEventListener("touchend",u,!1),t.addEventListener("touchcancel",u,!1),t.addEventListener("mousedown",h,!1),t.addEventListener("mouseup",u,!1),t.addEventListener("touchstart",d,!1),t.addEventListener("contextmenu",d,!1);return Object.assign((function(){n.destroy(),t.removeEventListener("wheel",o,!1),t.removeEventListener("mousemove",a,!1),t.removeEventListener("mouseout",s,!1),t.removeEventListener("touchstart",l,!1),t.removeEventListener("touchend",u,!1),t.removeEventListener("touchcancel",u,!1),t.removeEventListener("mousedown",h,!1),t.removeEventListener("mouseup",u,!1),t.removeEventListener("touchstart",d,!1),t.removeEventListener("contextmenu",d,!1)}),{element:t})},i}(It),cv=function(t){function i(e){var n,r,o,a,s=this,c=i.parseArgs(e);return(s=t.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 Zm({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 e.__extends(i,t),i.distanceFromModel=function(t,e,i){var n=t.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*e/360);return i<1&&(o/=i),isNaN(o)?r:o},i.parseArgs=function(i){var n,r,o,a,s,c,l,h=t.parseArgs.call(this,i);return e.__assign(e.__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(t){var e,n,o,a=this.parseArgs(t),s=t.initial[1];return{longitude:null!==(e=s.longitude)&&void 0!==e?e:a.defaultLongitude,latitude:Rm(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:t.model.bounding.getCenter(new r.Vector3),distance:i.distanceFromModel(a.model,a.camera.fov,a.camera.aspect)}},i.prototype.destroy=function(){t.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&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(t,e,i,n,r){return this.work=t,this.updateCamera(i,null!=n?n:0,r),!0},i.prototype.updateModel=function(e){t.prototype.updateModel.call(this,e);var n=e.bounding.getCenter(new r.Vector3),o=i.distanceFromModel(e,this.camera.fov,this.camera.aspect);this.locationMotion.set({x:n.x,y:n.y,z:n.z,distance:o},0).catch(Pt)},i.prototype.updateTime=function(t,e){if(!this.destroyed){var i={},n={};this.locationMotion.ended||(this.locationMotion.update(t),i.modelAlpha=this.locationMotion.value.modelAlpha,i.perspToOrtho=Rm(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(t),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),Xg(i)||this.model.setMaterial(i),Xg(n)||this.setCamera(n)}},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(Bt())[1],e=this.locationMotion.getKeyFrameSegment(Bt())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new r.Vector3(e.value.x,e.value.y,e.value.z),distance:e.value.distance}},i.prototype.initAnimation=function(t,e,n,o){var a,s,c,l=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var h={longitude:null!==(a=e.longitude)&&void 0!==a?a:this.defaultLongitude,latitude:Rm(null!==(s=e.latitude)&&void 0!==s?s:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Rm(null!==(c=e.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.camera.fov,this.camera.aspect)},u=Xe(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",t,h,this.userAction),this.cameraMotion.set(u,n).catch(Pt),this.locationMotion.set(d,n).then((function(){l.emit("initAnimationEnded",t,h,l.userAction)}),(function(e){var i=Yg(l.camera.pose);l.emit("initAnimationEnded",t,i,l.userAction)}))}},i.prototype.updateRenderSize=function(){this.locationMotion.set({distance:i.distanceFromModel(this.model,this.camera.fov,this.camera.aspect)},0)},i.prototype.getForwardPanoIndexOrNot=function(t){var e=this.work.observers.filter((function(t){return t.active})),i=this.model.intersectRaycaster(t)[0];if(!i)return null;var n=Kg(e,(function(t){return t.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},i.prototype.coordinatesForOffset=function(t){var e=this.renderer.getSize(new r.Vector2);return{longitude:2*t.x/(e.x*this.scissor.width),latitude:2*t.y/(e.y*this.scissor.height)}},i.prototype.requestInteriaMovement=function(t,i){var n=this;if(!1!==this.interiaMovement){for(var r=e.__assign({},t),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=zg(this.cameraMotion.value.longitude+o.longitude),c=Rm(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(Pt);var h=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!h),h?Jt.shared.add((function(t,e){n.requestInteriaMovement(r,0|e)}),!0,1):this.interiaMovement=!1}},i.prototype.onPanGesture=function(t){var e=this.panState,i=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:i,x:t.center.x,y:t.center.y},void 0!==e&&e.pointerLength===i){var n=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal)){var r={x:t.center.x-e.x,y:t.center.y-e.y},o=this.relativeClientPosition(t.center),a=this.camera.pose.latitude<Math.PI/6||o.y<0?-1:1;r.x*=a;var s=this.coordinatesForOffset(r),c=zg(this.cameraMotion.value.longitude+s.longitude),l=Rm(this.cameraMotion.value.latitude+s.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(t.overallVelocityX)>.2&&Math.atan2(Math.abs(t.overallVelocityY),Math.abs(t.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,t.isFinal))if(this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",h,t.isFinal),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({longitude:h.longitude,latitude:h.latitude},0).catch(Pt),t.isFinal)if(!this.emit("wantsInteriaPan",h)){this.interiaMovement=!0;var u=t.velocityX*a,d=t.velocityY;this.requestInteriaMovement(this.coordinatesForOffset({x:u,y:d}),0)}}}},i.prototype.onPinchGesture=function(t){var e,i=null===(e=this.pinchState)||void 0===e?void 0:e.fov,n=!1;if("pinchstart"!==t.type){if("pinchend"===t.type&&(n=!0,delete this.panState,delete this.pinchState),void 0!==i){var r=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Rm(i/t.scale,this.minFov,this.maxFov);this.emit("wantsPinchGesture",t.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",t.scale,o,n),this.userAction=!0,this.interiaMovement=!1,this.cameraMotion.set({fov:o},0).catch(Pt),this.onPanGesture(t))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(t){var e=this,i=(Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX)/-60,n=[{x:t.clientX,y:t.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=this.minFov,o=this.maxFov,a=Rm(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(Pt),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete e.mouseWheelState;e.emit("wantsGesture","mouseWheel",n,!0)||e.emit("wantsMouseWheel",i,a,!0)||(e.emit("gesture","mouseWheel",n,!0),e.emit("mouseWheel",0,a,!0))}),200)})}},i.prototype.onTapGesture=function(t){var e=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","tap",e,!0)){var i=this.relativeClientPosition(t.center),n=new r.Raycaster;if(n.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",n,i,!0)){this.emit("gesture","tap",e,!0),this.emit("tapGesture",n,i,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(n);if(!_m(o)){this.emit("panoSelected",o);var a={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,a,!0)}}}},i.prototype.onPressGesture=function(t,e){var i,n,o=[t];if(this.emit("wantsGesture","press",o,e))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var a=this.relativeClientPosition(t),s=new r.Raycaster;if(s.setFromCamera(a,this.camera),this.emit("wantsPressGesture",s,a,t.delta,e))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,e),this.emit("pressGesture",s,a,t.delta,e)},i}(sv);var lv=function(t){function i(e){var n=i.parseArgs(e);return t.call(this,n)||this}return e.__extends(i,t),i.parseArgs=function(i){var n=[i.initial[0],e.__assign(e.__assign({},i.initial[1]),{longitude:0,latitude:Math.PI/2}),i.initial[2],i.initial[3]],r=e.__assign(e.__assign({},i),{initial:n,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return t.parseArgs.call(this,r)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.updateModel=function(t){this.model=t,this.needsRender=!0;var e=t.bounding.getCenter(new r.Vector3);this.locationMotion.set({x:e.x,y:e.y,z:e.z,distance:cv.distanceFromModel(this.model,this.camera.fov,this.camera.aspect)},0).catch(Pt)},i.prototype.initAnimation=function(t,e,i,n){var o,a=this;if(!this.destroyed){this.pending=!1,this.userAction=n;var s={longitude:0,latitude:Math.PI/2,fov:Rm(null!==(o=e.fov)&&void 0!==o?o:this.defaultFov,this.minFov,this.maxFov),offset:this.model.bounding.getCenter(new r.Vector3),distance:cv.distanceFromModel(this.model,this.camera.fov,this.camera.aspect)},c=Xe(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(Pt),this.locationMotion.set(l,i).then((function(){a.emit("initAnimationEnded",t,s,a.userAction)}),(function(e){var i=Yg(a.camera.pose);a.emit("initAnimationEnded",t,i,a.userAction)}))}},i.prototype.getZoomOffsetFromFov=function(t,e,i){var n=new r.Vector3(0,-1,0),o=Math.tan(i/2*Math.PI/180),a=Math.tan(e.fov/2*Math.PI/180),s=(a-o)/a,c=new r.Raycaster;c.setFromCamera(t,e);var l=c.ray.direction,h=l.angleTo(n),u=cv.distanceFromModel(this.model,this.camera.fov,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(t,e){},i.prototype.onPanGesture=function(t){var e=this.panState,i=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:i,x:t.center.x,y:t.center.y},void 0!==e&&e.pointerLength===i){var n=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal)){var o=t.center.x-e.x,a=t.center.y-e.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(t,e){var i=new r.Vector3;return i.setFromMatrixColumn(e,0),i.multiplyScalar(-t),i}(2*o*d/p.y,this.camera.matrix)),s.add(function(t,e,i){var n=new r.Vector3;return n.setFromMatrixColumn(i,0),n.crossVectors(e,n),n.multiplyScalar(t),n}(2*a*d/p.y,this.camera.up,this.camera.matrix)),s.x=Rm(s.x,l.x-h,l.x+h),s.z=Rm(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,t.isFinal)||(this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",f,t.isFinal),this.userAction=!0,this.locationMotion.set({x:s.x,y:s.y,z:s.z},0).catch(Pt))}}},i.prototype.onPinchGesture=function(t){var e,i=null===(e=this.pinchState)||void 0===e?void 0:e.fov,n=!1;if("pinchstart"!==t.type){if("pinchend"===t.type&&(n=!0,delete this.pinchState),void 0!==i){var r=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pinch",r,n)){var o=Rm(i/t.scale,this.minFov,this.maxFov),a=this.relativeClientPosition({x:t.center.x,y:t.center.y}),s=this.getZoomOffsetFromFov(a,this.camera,o),c=this.camera.pose.offset.clone().add(s);this.emit("wantsPinchGesture",t.scale,o,n)||this.emit("wantsChangeCameraFov",o)||(this.emit("gesture","pinch",r,n),this.emit("pinchGesture",t.scale,o,n),this.userAction=!0,this.locationMotion.set({x:c.x,y:c.y,z:c.z},0).catch(Pt),this.cameraMotion.set({longitude:0,latitude:Math.PI/2,fov:o},0).catch(Pt),this.onPanGesture(t))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(t){var e=this,i=(Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX)/-60,n=[{x:t.clientX,y:t.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Rm(this.cameraMotion.value.fov-i,this.minFov,this.maxFov),o=this.relativeClientPosition({x:t.clientX,y:t.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(Pt),this.cameraMotion.set({longitude:0,latitude:Math.PI/2,fov:r},0).catch(Pt),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete e.mouseWheelState;e.emit("wantsGesture","mouseWheel",n,!0)||e.emit("wantsMouseWheel",i,r,!0)||e.emit("wantsChangeCameraFov",r)||(e.emit("gesture","mouseWheel",n,!0),e.emit("mouseWheel",0,r,!0))}),200)})}},i}(cv);function hv(t,e){void 0===e&&(e=!1);var i=typeof t;if("string"===i)return JSON.stringify(t);if(!0===t)return"true";if(!1===t)return"false";if(null===t)return"null";if(t instanceof Array){for(var n="[",r=t.length-1,o=0;o<r;o++)n+=hv(t[o],!1)+",";return r>-1&&(n+=hv(t[o],!1)),n+"]"}if(t instanceof Object){if("function"==typeof t.toJSON)return hv(t.toJSON(),e);var a=Object.keys(t).sort(),s=a.length;for(n="",o=0;o<s;){var c=a[o],l=hv(t[c],!0);void 0!==l&&(o&&""!==n&&(n+=","),n+=JSON.stringify(c)+":"+l),o++}return"{"+n+"}"}switch(i){case"function":case"undefined":return e?void 0:null;case"number":return t;default:return isFinite(t)?t:null}}function uv(t){return bt(String(hv(t,!1)))}var dv,pv=function(t){function i(e){var n=this,r=i.parseArgs(e);return(n=t.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 e.__extends(i,t),i.parseArgs=function(i){var n,r,o,a,s,c,l,h,u,d=t.parseArgs.call(this,i);return e.__assign(e.__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 Rg}})},i.initAnimationEndPose=function(t){var e,i,n,r=this.parseArgs(t),o=t.initial,a=o[0],s=o[1];return{longitude:null!==(e=s.longitude)&&void 0!==e?e:r.defaultLongitude,latitude:Rm(null!==(i=s.latitude)&&void 0!==i?i:r.defaultLatitude,r.minLatitude,r.maxLatitude),fov:Rm(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(){t.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&&t.prototype.isReady.call(this))))},i.prototype.calculateMovingDuration=function(t,e){switch(typeof t){case"function":return t(e,this.moveSpeed);case"number":return t;case"string":return Number(t);default:return Math.floor(Math.max(Math.min(e/this.moveSpeed*1e3,1500),500))}},i.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.emit("intersectionHidden"),this.needsRender=!0},i.prototype.coordinatesForOffset=function(t){var e=this.cameraMotion.value.fov,i=this.camera.aspect,n=this.renderer.getSize(new r.Vector2);return{longitude:2*t.x/(n.x*this.scissor.width)*e/95*i,latitude:-2*t.y/(n.y*this.scissor.height)*e/95}},i.prototype.cameraBounce=function(){var t=this.cameraMotion.value,e=t.longitude,i=t.latitude,n=t.fov,r=[{progress:0,value:{longitude:e,latitude:i,fov:n}},{progress:.5,value:{longitude:e,latitude:i,fov:.98*n}},{progress:1,value:{longitude:e,latitude:i,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(Pt)},i.prototype.requestInteriaMovement=function(t,i){var n=this;if(!1!==this.interiaMovement){for(var r=e.__assign({},t),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=zg(this.cameraMotion.value.longitude+o.longitude),c=Rm(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(Pt);var h=r.longitude>1e-4||r.longitude<-1e-4||r.latitude>1e-4||r.latitude<-1e-4;this.emit("interiaPan",l,!h),h?Jt.shared.add((function(t,e){n.requestInteriaMovement(r,0|e)}),!0,1):this.interiaMovement=!1}},i.prototype.onPanGesture=function(t){var e=this.panState,i=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:i,x:t.center.x,y:t.center.y},void 0!==e&&e.pointerLength===i){var n=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal)){var r={x:t.center.x-e.x,y:t.center.y-e.y},o=this.coordinatesForOffset(r),a=zg(this.cameraMotion.value.longitude+o.longitude),s=Rm(this.cameraMotion.value.latitude+o.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(t.overallVelocityX)>.2&&Math.atan2(Math.abs(t.overallVelocityY),Math.abs(t.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,t.isFinal)){this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",c,t.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(Pt),t.isFinal)if(!this.emit("wantsInteriaPan",c)){this.interiaMovement=!0;var h=t.velocityX,u=.6*t.velocityY;Math.abs(u)>.5&&Math.abs(h)<.5&&(h=0),this.requestInteriaMovement(this.coordinatesForOffset({x:h,y:u}),0)}}}}},i.prototype.onPinchGesture=function(t){var e,i=null===(e=this.pinchState)||void 0===e?void 0:e.fov,n=t.scale,r=!1;if("pinchstart"!==t.type){if("pinchend"===t.type&&(r=!0,delete this.pinchState),void 0!==i){var o=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pinch",o,r)){var a=Rm(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(Pt),this.onPanGesture(t))}}}else this.pinchState={fov:this.cameraMotion.value.fov}},i.prototype.onMouseWheel=function(t){var e=this,i=(Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX)/-60,n=[{x:t.clientX,y:t.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Rm(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(Pt),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete e.mouseWheelState;e.emit("wantsGesture","mouseWheel",n,!0)||e.emit("wantsMouseWheel",i,r,!0)||e.emit("wantsChangeCameraFov",r)||(e.emit("gesture","mouseWheel",n,!0),e.emit("mouseWheel",0,r,!0))}),200)})}},i.prototype.onMouseMove=function(t){if(this.intersectMesh.parent&&!this.model.empty&&this.model.bvhs&&!0===this.model.bvhs.loaded&&!this.panState){var e=this.relativeClientPosition({x:t.clientX,y:t.clientY}),i=new r.Raycaster;if(i.setFromCamera(e,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:t.clientX,clientY:t.clientY}}}},i.prototype.onMouseOut=function(){this.intersectMesh.parent&&!0===this.intersectMesh.visible&&this.hideIntersectMesh()},i.prototype.onPressGesture=function(t,e){var i,n,o=[t];if(this.emit("wantsGesture","press",o,e))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var a=this.relativeClientPosition(t),s=new r.Raycaster;if(s.setFromCamera(a,this.camera),this.emit("wantsPressGesture",s,a,t.delta,e))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,e),this.emit("pressGesture",s,a,t.delta,e)},i}(sv);var fv,mv=function(t){function i(e,i){return void 0===i&&(i=.5),t.call(this,e,{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 e.__extends(i,t),i}(nv),gv=function(t){function i(e,i){void 0===i&&(i=.002);var n=t.call(this,e,{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 e.__extends(i,t),Object.defineProperty(i.prototype,"targetBuffer",{get:function(){return this.material.uniforms.targetBuffer.value},set:function(t){this.material.uniforms.targetBuffer.value=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(t){this.material.uniforms.step.value=t},enumerable:!1,configurable:!0}),i}(nv),vv=function(t){function i(e){var i=t.call(this,e,{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 e.__extends(i,t),Object.defineProperty(i.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(t){this.material.uniforms.luminanceAdaptiveBuffer.value=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(t){this.material.uniforms.progress.value=t},enumerable:!1,configurable:!0}),i}(nv),yv=function(t){function i(e){var i=t.call(this,e)||this;return i.enableTime=Bt(),i.renderer=e,i.valuePass=new rv(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 e.__extends(i,t),i.prototype.render=function(t,e){if(!this.enable)return this.enableTime=null,void this.copyPass.render(t);null===this.enableTime&&(this.enableTime=Bt()),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(t,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((Bt()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(t,e)},i.prototype.dispose=function(){var t,e,i;null===(t=this.luminanceTargetBuffer)||void 0===t||t.dispose(),null===(e=this.luminancePrevBuffer)||void 0===e||e.dispose(),null===(i=this.luminanceNextBuffer)||void 0===i||i.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},i}(av),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 Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Ev=new Float32Array([0,0,1,0,0,1,1,1]),Sv=new Uint8Array([0,1,2,1,3,2]),_v=new r.BufferGeometry;_v.setAttribute("position",new r.BufferAttribute(Mv,3)),_v.setAttribute("uv",new r.BufferAttribute(Ev,2)),_v.setIndex(new r.BufferAttribute(Sv,1));var Tv=function(t){function i(){var e=t.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 e.depthTest=!1,e.depthWrite=!1,e.blending=r.NoBlending,e.map=e.uniforms.map.value,e.luminanceMap=e.uniforms.luminanceMap.value,Object.defineProperties(e,{map:{get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(t){this.uniforms.luminanceMap.value=t,this.defines.USE_LUMINANCE=null!==t,this.needsUpdate=!0}}}),e}return e.__extends(i,t),i}(r.ShaderMaterial),Cv=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.level=0,e.sideCount=0,e.col=0,e.row=0,e.index=0,e.type="up",e}return e.__extends(i,t),i}(r.Box3),Iv=function(t){function i(e,i){var n=this,o=new Tv;return o.visible=!1,(n=t.call(this,_v,o)||this).position.copy(e.getCenter(new r.Vector3)),n.quaternion.copy(bv[e.type]),n.scale.setScalar(1/Math.pow(2,e.level)),n.level=e.level,n.activeTime=-1,n.disposed=!1,n.needsRender=!1,n.frustumCulled=!1,i.then((function(t){var e=t[0],i=t[1];n.disposed?(e.dispose(),null==i||i.dispose()):(n.material.map=e,n.material.luminanceMap=i,n.material.needsUpdate=!0,n.material.visible=!0)})).catch(Pt),n}return e.__extends(i,t),i.getBox=function(t,e,i){var n=new Cv,r=Math.pow(2,t),o=1/r,a=i%r,s=Math.floor(i/r);switch(n.level=t,n.index=i,n.sideCount=r,n.row=s,n.col=a,n.type=e,e){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(t){},i.prototype.dispose=function(){var t;this.disposed=!0,this.material.map&&(this.material.map.dispose(),null===(t=this.material.luminanceMap)||void 0===t||t.dispose()),this.material.dispose()},i}(r.Mesh),Pv=function(t){function i(){var e=t.call(this)||this;return e.needsRender=!1,e.name="tiling",e}return e.__extends(i,t),i}(r.Group),Rv=function(){function t(t,e){this.disposed=!1,this.textureLoader=new yi(t),this.level=0,this.panoIndex=0,this.tiles=[],this.resource=[],this.luminance=null,this.imageOptions=e,this.object=new Pv}return t.prototype.setAllowHosts=function(t){this.textureLoader.setAllowHosts(t)},t.prototype.setNetworkSubscribe=function(t){this.textureLoader.setNetworkSubscribe(t)},t.prototype.cleanup=function(){for(var t=0;t<this.tiles.length;t++)if(this.tiles[t]){var e=this.tiles[t],i="level-group:"+t,n=this.object.getObjectByName(i);for(var r in e){var o=e[r];o.dispose(),n.remove(o),delete e[r],this.object.needsRender=!0}}},t.prototype.setRotation=function(t){if(!this.disposed){var e=(new r.Quaternion).multiplyQuaternions(t,wv);this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)}},t.prototype.setPosition=function(t){this.disposed||this.object.position.equals(t)||(this.object.position.copy(t),this.object.needsRender=!0)},t.prototype.setResource=function(t){if(!this.disposed&&this.resource!==t){this.cleanup(),this.resource=t;for(var e=0;e<t.length;e++){var i=t[e].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}},t.prototype.setLuminance=function(t){this.luminance=t},t.prototype.getTileResources=function(t){for(var e,i=null!==(e=this.imageOptions.size)&&void 0!==e?e:2048,n=[],r=this.resource.length-1;r>=0;r--)this.resource[r].level<=t&&512*Math.pow(2,this.resource[r].level)>i&&n.unshift(this.resource[r]);return n},t.prototype.update=function(t,i,n){var o=this;if(!this.disposed){this.level=i;var a=(new r.PerspectiveCamera).copy(t);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=(new r.Frustum).setFromProjectionMatrix((new r.Matrix4).multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse)),l=this.getTileResources(i),h=function(t){if(t){for(var i=[],a=t.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=Iv.getBox(a,m,g);c.intersectsBox(v)&&i.push(v)}i.sort((function(t,e){return t.getCenter(new r.Vector3).angleTo(s)-e.getCenter(new r.Vector3).angleTo(s)}));for(var y=[],A=0,x=i;A<x.length;A++){var b=(v=x[A]).sideCount,w=v.row,M=v.col,E=(m=v.type,"tile-level:".concat(a,"-face:").concat(m,"-row:").concat(w,"-col:").concat(M));if(!u.tiles[a][E]){var S=t[m],_=t.size,T=_/b,C=[T*M,T*w,T,T],I=e.__assign({key:"pano_tile.".concat(u.panoIndex,".").concat(m,".").concat(a,".").concat(w,".").concat(M),basisLoaderInitialized:gi.isInitialized(),cut:C},Xe(u.imageOptions,["format","mappings"]));a<=1&&("jpg"===I.format||/\.jpg$/.test(S))?(1024!==T&&(I.size=1024),I.quality=70):512!==T&&(I.size=512);var P=u.imageOptions.transform?u.imageOptions.transform(S,I):ie(S,I),R=u.textureLoader.load(P,{preInit:!0}).then((function(t){return t.body})),B=null;if(u.luminance){var L=u.luminance[m],D=L.match(/\/cube_(\d+)\//),O=!!D&&Number(D[1]);if(!1!==O){var N=_/O,k=e.__assign(e.__assign({},I),{size:256,cut:[C[0]/N,C[1]/N,C[2]/N,C[3]/N],key:"pano_tile_luminance.".concat(u.panoIndex,".").concat(m,".").concat(a,".").concat(w,".").concat(M)}),F=u.imageOptions.transform?u.imageOptions.transform(L,k):ie(L,k);B=u.textureLoader.load(F,{format:r.LuminanceFormat,preInit:!0}).then((function(t){return t.body})).catch((function(){return null}))}}(H=u.tiles[a][E]=new Iv(v,Promise.all([R,B]))).name=E,H.renderOrder=a,d.add(H)}u.tiles[a][E].activeTime=n,y.push(E)}for(var V=0,z=Object.keys(u.tiles[a]).sort((function(t,e){return o.tiles[a][e].activeTime-o.tiles[a][t].activeTime})).slice(Math.max(24,y.length));V<z.length;V++){E=z[V];var H=u.tiles[a][E];d.remove(H),H.dispose(),delete u.tiles[a][E],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)}}},t.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},t}(),Bv=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]),Lv=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]),Dv=new r.BufferGeometry;Dv.setAttribute("position",new r.BufferAttribute(Bv,3)),Dv.setIndex(new r.BufferAttribute(Lv,1));var Ov=function(){function t(){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(Dv,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.alphaMotion=new Zm({alpha:0})}return t.prototype.setMaterial=function(t){t?(this.material.uniforms.size.value=t.size,this.material.uniforms.matrix.value=t.matrix,this.material.uniforms.map.value=t.map,this.alphaMotion.set({alpha:t.alpha},500).catch(Pt),this.material.uniforms.alpha.value=t.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(Pt));var e=null!==t;e!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=e,this.material.needsUpdate=!0,this.object.visible=null!==t)},t.prototype.updateTime=function(t){this.alphaMotion.ended||(this.alphaMotion.update(t),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},t.prototype.dispose=function(){this.material.dispose()},t}(),Nv=(new r.Matrix4).makeRotationAxis(new r.Vector3(0,1,0),Math.PI),kv=new r.Vector3(-1,1,1),Fv=function(t){function i(e){var n,r,o,a,s,c,l,h=this,u=i.parseArgs(e);(h=t.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 Zm({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=Dr()]={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,networkSubscribe:h.networkSubscribe};return h.textureLoader=new yi(m),h.tiling=new Rv(m,h.imageOptions),h.scene.add(h.tiling.object),h.panoVideo=new Ov,h.scene.add(h.panoVideo.object),h}return e.__extends(i,t),i.parseArgs=function(i){var n,r,o,a,s=t.parseArgs.call(this,i);return e.__assign(e.__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 Tg},tileLevelForFov:null!==(a=i.tileLevelForFov)&&void 0!==a?a:function(t,e){var i=2*Math.atan(Math.tan(t/180*Math.PI/2)*(e.width/e.height))/Math.PI*180,n=Math.max(e.width/i,e.height/t),r=s.imageOptions.size;if(void 0===r&&s.work.observers[0]){var o=s.work.observers[0].images.up.match(/\/cube_(\d+)\//);o&&(r=Number(o[1]))}return void 0===r&&(r=2048),r<8192&&n>40?4:r<4096&&n>24?3:r<2048&&n>10?2:r<1024&&n>6?1:0}})},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var e,i,n=this;t.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(t){n.helper.remove(t),t.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!==(e=this.model.getMaterial())&&void 0!==e?e:{},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&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(t,e,i,n,r){var o=this;this.userAction=r,this.work=t,this.currentPanoIndex=e,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(e,{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(t){this.model=t;var e={},i=!0;this.boundingMesh&&(e=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(e),this.scene.add(this.boundingMesh),this.updatePanoMeshes()},i.prototype.updateTime=function(t,e){var i,n,o,a,s,c,l;if(!this.destroyed){var h={},u={},d=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),p=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),f=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(t);var m=this.locationMotion.getKeyFrameSegment(t),g=m[0],v=m[1],y=this.panoResourceFromLocationMotionKeyframe(g),A=this.panoResourceFromLocationMotionKeyframe(v),x=(new r.Vector3).copy(y.position),b=(new r.Vector3).copy(A.position),w=this.locationMotion.value.count-v.value.count+1;h.progress=w,h.modelAlpha=this.locationMotion.value.modelAlpha,h.perspToOrtho=Rm(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),A.panoPicture&&(w<1?y.panoPicture&&(h.pano0=y.panoPicture):h.pano0=A.panoPicture,h.pano1=A.panoPicture),f=h.useBlackTransition="instant"===A.effect||"montage"===A.effect,"fade"!==A.effect&&"montage"!==A.effect||(h.pano0&&y.panoPicture&&(h.pano0={map:h.pano0.map,luminanceMap:h.pano0.luminanceMap,matrix:y.panoPicture.matrix.clone().setPosition(A.position)}),x.copy(b)),u.distance=this.locationMotion.value.distance,u.offset=new r.Vector3(x.x+(b.x-x.x)*w,x.y+(b.y-x.y)*w,x.z+(b.z-x.z)*w);for(var M=[],E=[],S=0,_=this.locationMotion.keyframes;S<_.length;S++){var T=_[S],C=T.key,I=T.progress;void 0!==C&&(M.push(C),I>=this.locationMotion.progress&&E.push(C))}for(var P=0,R=Object.keys(this.panoResources);P<R.length;P++){var B=R[P];if(!(E.indexOf(B)>=0)){var L=this.panoResources[B];if(L.panoPicture){var D=L.panoPicture.map;if(D){if(D===(null===(i=h.pano0)||void 0===i?void 0:i.map))continue;if(D===(null===(n=h.pano1)||void 0===n?void 0:n.map))continue;D.dispose(),null===(o=L.panoPicture.luminanceMap)||void 0===o||o.dispose(),L.panoPicture=null}}M.indexOf(B)>=0||delete this.panoResources[B]}}y.workCode===A.workCode?this.currentPanoIndex=w<.5?y.panoIndex:A.panoIndex:this.currentPanoIndex=A.panoIndex,this.emit("movingToPano",p.panoIndex,d.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),u.longitude=this.cameraMotion.value.longitude,u.latitude=this.cameraMotion.value.latitude,u.fov=this.cameraMotion.value.fov),!1===Xg(h)&&(this.model.setMaterial(h),this.boundingMesh.setMaterial(h)),!1===Xg(u)&&this.setCamera(u),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(f)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:Rm(1.4/H,.5,.7)),V.updateTime&&V.updateTime(t,e)}else V.visible=!1,V.setOpacity(0);else V.visible=!1,V.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 U=this.tiling.object.visible;if(!1!==this.tileLevelForFov&&this.initAnimationed){var G=p.panoIndex,j=this.work.observers[G];if(j)if(Dg(this.camera.position,j.position)&&this.locationMotion.ended){this.tiling.object.visible=!0,this.enableIOSEDR&&this.tiling.setLuminance(null!==(s=j.images.luminance)&&void 0!==s?s:null),this.tiling.panoIndex!==G&&this.tiling.cleanup(),this.tiling.panoIndex=G,this.tiling.setResource(null!==(l=null===(c=j.images)||void 0===c?void 0:c.tiles)&&void 0!==l?l:[]),this.tiling.setRotation(j.quaternion),this.tiling.setPosition(j.position);var Q=this.renderer.getSize(new r.Vector2);Q.width*=this.scissor.width,Q.height*=this.scissor.height,this.tiling.update(this.camera,this.tileLevelForFov(this.camera.fov,Q),t)}else this.tiling.object.visible=!1;else this.tiling.object.visible=!1}else this.tiling.object.visible=!1;U!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(t)}},i.prototype.render=function(){var e=this.work.observers[this.currentPanoIndex];e&&e.video&&(this.needsRender=!0),t.prototype.render.call(this)},i.prototype.postProcessing=function(t,e){if(!this.destroyed)return this.effect||(this.effect=new yv(this.renderer)),this.effect.render(t,e)},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(Bt())[1],e=this.locationMotion.getKeyFrameSegment(Bt())[1],i=this.panoResourceFromLocationMotionKeyframe(e),n=this.work.observers[i.panoIndex];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},i.prototype.moveToPano=function(t,i,n){var o,a,s,c=this,l=this.work.observers[t],h=e.__assign({key:"pano.".concat(t),basisLoaderInitialized:gi.isInitialized()},Xe(this.imageOptions,["format","size","quality","sharpen","mappings"])),u=null!==(o=this.imageOptions.transform)&&void 0!==o?o:ie,d={right:u(l.images.right,e.__assign(e.__assign({},h),{key:"".concat(h.key,".right")})),left:u(l.images.left,e.__assign(e.__assign({},h),{key:"".concat(h.key,".left")})),up:u(l.images.up,e.__assign(e.__assign({},h),{key:"".concat(h.key,".up")})),down:u(l.images.down,e.__assign(e.__assign({},h),{key:"".concat(h.key,".down")})),front:u(l.images.front,e.__assign(e.__assign({},h),{key:"".concat(h.key,".front")})),back:u(l.images.back,e.__assign(e.__assign({},h),{key:"".concat(h.key,".back")}))},p={key:"pano_luminance.".concat(t),basisLoaderInitialized:gi.isInitialized(),size:h.size?h.size/2:1024},f=this.enableIOSEDR&&l.images.luminance?{right:u(l.images.luminance.right,e.__assign(e.__assign({},p),{key:"".concat(p.key,".right")})),left:u(l.images.luminance.left,e.__assign(e.__assign({},p),{key:"".concat(p.key,".left")})),up:u(l.images.luminance.up,e.__assign(e.__assign({},p),{key:"".concat(p.key,".up")})),down:u(l.images.luminance.down,e.__assign(e.__assign({},p),{key:"".concat(p.key,".down")})),front:u(l.images.luminance.front,e.__assign(e.__assign({},p),{key:"".concat(p.key,".front")})),back:u(l.images.luminance.back,e.__assign(e.__assign({},p),{key:"".concat(p.key,".back")}))}:null,m="pano:"+uv(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:t,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,kv)},position:l.position.clone()};Jt.shared.add((function(){c.pending=!1,c.emit("panoLoaded",t),c.doMoveToPano(t,b,i,n)}),!0,1)}else{this.pendingTextureTask={panoIndex:t,hash:m,onLoad:function(e,o){var a,s;if(c.pending=!1,c.destroyed)e.body.dispose();else{e.body.name=m,c.emit("panoLoaded",t);var h={panoIndex:t,workCode:c.work.workCode,effect:null!==(a=i.effect)&&void 0!==a?a:"fly",panoPicture:{map:e.body,luminanceMap:null!==(s=null==o?void 0:o.body)&&void 0!==s?s:null,matrix:(new r.Matrix4).compose(l.position,l.quaternion,kv)},position:l.position.clone()};c.doMoveToPano(t,h,i,n)}},onError:function(e){c.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),c.emit("panoLoadError",e,t),c.emit("moveToPanoCanceled",t)}};var w=this.panoMeshes[t];w&&w.tap&&w.tap(),Promise.all([this.textureLoader.loadCube(d,{format:r.RGBFormat,viaAjax:!0},void 0,void 0,(function(e){var i,n;c.emit("textureLoading",e,t,l),(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(null===(n=c.panoMeshes[t])||void 0===n||n.setProgress(e))}),this.renderer),f?this.textureLoader.loadCube(f,{format:r.LuminanceFormat}).catch((function(){return null})):Promise.resolve(null)]).then((function(e){var i,n,r=e[0],o=e[1];(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m?(c.pendingTextureTask.onLoad(r,o),null===(n=c.panoMeshes[t])||void 0===n||n.setProgress(0),delete c.pendingTextureTask,c.emit("textureLoaded",t,l,r.meta)):(r.body.dispose(),null==o||o.body.dispose())})).catch((function(e){var i,n;(null===(i=c.pendingTextureTask)||void 0===i?void 0:i.hash)===m&&(c.pendingTextureTask.onError(e),null===(n=c.panoMeshes[t])||void 0===n||n.setProgress(0),delete c.pendingTextureTask,c.emit("textureError",e,t,l),c.emit("error",e))})),this.emit("textureStartLoad",t,l)}},i.prototype.initAnimation=function(t,e,i,n){var r,o,a,s=this;if(!this.destroyed){var c=!1;this.pending=!1,this.userAction=n,this.moveToPano(t,{longitude:null!==(r=e.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Rm(null!==(o=e.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Rm(null!==(a=e.fov)&&void 0!==a?a:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(t,e){c=!0,s.emit("initAnimationWillStart",t,e,s.userAction)},moveEndCallback:function(t,e){s.emit("initAnimationEnded",t,e,s.userAction),s.initAnimationed=!0},moveCancelCallback:function(){var 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};!1===c&&s.emit("initAnimationWillStart",s.currentPanoIndex,t,s.userAction),s.emit("initAnimationEnded",s.currentPanoIndex,t,s.userAction),s.initAnimationed=!0}},n)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(t){return this.panoResources[t.key]},i.prototype.locationMotionKeyframesLength=function(t){for(var e=0,i=1;i<t.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(t[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(t[i]).position;e+=n.distanceTo(r)*(t[i].value.count-t[i-1].value.count)}return e},i.prototype.updatePanoMeshes=function(t){void 0===t&&(t=!0);for(var e={},i=0,n=this.panoMeshes;i<n.length;i++){e[(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(e[a]?(c=e[a],delete e[a]):((c=this.panoCircleMeshCreator()).name=a,this.helper.add(c)),c.position.copy(s.standingPosition),t&&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(e);p<f.length;p++){var m=f[p];this.helper.remove(e[m]),e[m].dispose(),delete e[m]}},i.prototype.generateBoundingMesh=function(t){void 0===t&&(t=!1);for(var e=this.model.bounding.clone(),i=0,n=this.work.observers;i<n.length;i++){var o=n[i];e.expandByPoint(o.standingPosition),e.expandByPoint((new r.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}t&&e.expandByPoint(this.camera.position);var a=Fg(e,new r.Vector3(1,0,1));return a.name="panorama_bounding",a},i.prototype.doMoveToPano=function(t,i,n,o){var a,s,c,l=this;void 0===n&&(n={}),this.userAction=o;var h=Bt(),u=Dr();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:e.__assign(e.__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:e.__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(t,I),this.emit("panoWillArrive",t,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=Pt,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(C,T).catch(Pt),this.locationMotion.setKeyframes(p,T,f).then((function(){var e,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(t,s),l.emit("panoArrived",t,s,o);var c=l.work.observers[l.currentPanoIndex];if(c&&c.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var h=Nv.clone().multiply(null!==(a=null===(i=null===(e=l.model.getMaterial())||void 0===e?void 0:e.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=Dr(),p=l.videoTexture.image;p.setAttribute("uuid",d),(dv||(dv=new Promise((function(t){var e,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(e);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?t(!0):t(!1)):t(!1)}),!1),i.addEventListener("canplay",(function t(){i.removeEventListener("canplay",t,!1),i.play()}),!1),e=window.setTimeout((function(){return t(!1)}),1e3)})))).then((function(t){t&&c.video&&p.getAttribute("uuid")===d&&(p.oncanplay=function(){p.oncanplay=Pt,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=Pt,l.panoVideo.setMaterial(u))},p.src=c.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){n.moveCancelCallback&&n.moveCancelCallback(),l.emit("moveToPanoCanceled",t)}))},i.prototype.getForwardPanoIndexOrNot=function(t){var e=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(t){if(t===e.currentPanoIndex)return!1;var i=e.work.observers[t],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=(t?t.ray.direction.clone():i.clone()).setY(0);if(0===s.length())return null;for(var c=a.slice().sort((function(t,i){var r=e.work.observers[t].position.clone().setY(n.y),o=e.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(t){var i=this,n=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","tap",n,!0)){var o=this.relativeClientPosition(t.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(t){if(t===i.currentPanoIndex)return!1;var e=i.work.observers[t];return!(e.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(e.loadable||e.active)})),u=this.model.intersectRaycaster(a)[0];if(u){var d=Kg(h,(function(t){var e=i.work.observers[t].standingPosition.clone();return e.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:e.distanceTo(u.point)}),!0),p=d[0];d[1]<this.panoTapTriggerRadius&&(c=p)}_m(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),_m(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 B=(C.length>0?C:e.__spreadArray(e.__spreadArray([],_,!0),T,!0)).slice().sort((function(t,e){return t.angleTo(M)-e.angleTo(M)}))[0];B&&B.angleTo(s)>b&&(A.longitude=Math.atan2(-B.x,-B.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Rm(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}(pv),Vv=Math.PI/180,zv=180/Math.PI,Hv=function(){var t="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return t}}(),Uv=function(){var t="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return t}}(),Gv=function(){var t="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return t}}(),jv=function(){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,e=t?parseInt(t[1],10):null;return function(){return e}}(),Qv=function(){var t=!1;if(65===jv()){var e="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(e){var i=e[1].split(".");i[0],i[1];var n=i[2],r=i[3];t=3325===parseInt(n,10)&&parseInt(r,10)<148}}return function(){return t}}(),Wv=function(){var t=Hv()&&Uv()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return t}}(),qv=function(){var t="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return t}}();function Kv(){var t="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return qv()?!t:t}var Xv,Yv=(Xv={},function(t,e){void 0===Xv[t]&&(console.warn("cardboard: "+e),Xv[t]=!0)});function Zv(t){var e,i=t.indexOf("://");e=-1!==i?i+3:0;var n=t.indexOf("/",e);return-1===n&&(n=t.length),t.substring(0,n)}var Jv,$v=function(t,e,i){!function(t,e,i){var n=e?e[0]:0,r=e?e[1]:0,o=e?e[2]:0,a=e?e[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;t[0]=1-(p+m),t[1]=u+y,t[2]=d-v,t[3]=0,t[4]=u-y,t[5]=1-(h+m),t[6]=f+g,t[7]=0,t[8]=d+v,t[9]=f-g,t[10]=1-(h+p),t[11]=0,t[12]=i?i[0]:0,t[13]=i?i[1]:0,t[14]=i?i[2]:0,t[15]=1}(t,e),i&&function(t,e,i){var n,r,o,a,s,c,l,h,u,d,p,f,m=i[0],g=i[1],v=i[2];e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],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]=n*m+s*g+u*v+e[12],t[13]=r*m+c*g+d*v+e[13],t[14]=o*m+l*g+p*v+e[14],t[15]=a*m+h*g+f*v+e[15])}(t,t,i),function(t,e){var i=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],m=e[13],g=e[14],v=e[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,t[0]=(s*I-c*C+l*T)*P,t[1]=(r*C-n*I-o*T)*P,t[2]=(m*M-g*w+v*b)*P,t[3]=(d*w-u*M-p*b)*P,t[4]=(c*_-a*I-l*S)*P,t[5]=(i*I-r*_+o*S)*P,t[6]=(g*x-f*M-v*A)*P,t[7]=(h*M-d*x+p*A)*P,t[8]=(a*C-s*_+l*E)*P,t[9]=(n*_-i*C-o*E)*P,t[10]=(f*w-m*x+v*y)*P,t[11]=(u*x-h*w-p*y)*P,t[12]=(s*S-a*T-c*E)*P,t[13]=(i*T-n*S+r*E)*P,t[14]=(m*A-f*b-g*y)*P,t[15]=(h*b-u*A+d*y)*P)}(t,t)},ty=function(){function t(t,e){void 0===t&&(t=new r.Vector3),void 0===e&&(e=0),this.sample=t,this.timestampS=e}return t.prototype.set=function(t,e){this.sample=t,this.timestampS=e},t.prototype.copy=function(t){this.set(t.sample,t.timestampS)},t}(),ey=function(){function t(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new ty,this.currentGyroMeasurement=new ty,this.previousGyroMeasurement=new ty,Hv()?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 t.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},t.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var i,n=e-this.previousGyroMeasurement.timestampS;i=n,isNaN(i)||i<=.001||i>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},t.prototype.getOrientation=function(){return this.filterQ},t.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);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)",zv*((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)},t.prototype.accelToQuaternion_=function(t){var e=new r.Vector3;e.copy(t),e.normalize();var i=new r.Quaternion;return i.setFromUnitVectors(new r.Vector3(0,0,-1),e),i.inverse(),i},t.prototype.gyroToQuaternionDelta_=function(t,e){var i=new r.Quaternion,n=new r.Vector3;return n.copy(t),n.normalize(),i.setFromAxisAngle(n,t.length()*e),i},t}(),iy=function(){function t(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new r.Quaternion,this.previousTimestampS=null,this.deltaQ=new r.Quaternion,this.outQ=new r.Quaternion}return t.prototype.getPrediction=function(t,e,i){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=i,t;var n=new r.Vector3;n.copy(e),n.normalize();var o=e.length();if(o<20*Vv)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(zv*o).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),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(t),this.previousTimestampS=i,this.outQ},t}(),ny=function(){function t(t){this.coefficients=t}return t.prototype.distortInverse=function(t){for(var e=0,i=1,n=t-this.distort(e);Math.abs(i-e)>1e-4;){var r=t-this.distort(i),o=i-r*((i-e)/(r-n));e=i,i=o,n=r}return i},t.prototype.distort=function(t){for(var e=t*t,i=0,n=0;n<this.coefficients.length;n++)i=e*(i+this.coefficients[n]);return(i+1)*t},t}(),ry=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},oy=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},ay=function(){function t(t,e,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 ey(t,n),this.posePredictor=new iy(e,n),this.isFirefoxAndroid=Gv(),this.isIOS=Hv();var o=jv();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=Qv()||Wv(),this.filterToWorldQ=new r.Quaternion,Hv()?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_(),Kv()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new r.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return t.prototype.getPosition=function(){return null},t.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var t=(new r.Quaternion).setFromAxisAngle(new r.Vector3(0,0,-1),0),e=new r.Quaternion;return"undefined"!=typeof window&&-90===window.orientation?e.setFromAxisAngle(new r.Vector3(0,1,0),Math.PI/-2):e.setFromAxisAngle(new r.Vector3(0,1,0),Math.PI/2),t.multiply(e)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((i=new r.Quaternion).setFromAxisAngle(new r.Vector3(1,0,0),-Math.PI/2),i),t=this._deviceOrientationQ;var e=new r.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}var i,n=this.filter.getOrientation();t=this.posePredictor.getPrediction(n,this.gyroscope,this.previousTimestampS);var o=new r.Quaternion;return o.copy(this.filterToWorldQ),o.multiply(this.resetQ),o.multiply(t),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_},t.prototype.getPose=function(){var t=new ry;return t.orientation=this.getOrientation(),t},t.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),Kv()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},t.prototype.getFrameData=function(t){var e=this.getOrientation(),i=this.getEyeOffset(),n=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(n.left),t.rightProjectionMatrix.set(n.right),$v(t.leftViewMatrix,e,i.left),$v(t.rightViewMatrix,e,i.right),t},t.prototype.start=function(){if("undefined"==typeof window)return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),i=this.onMessage_.bind(this),n=this.onDeviceOrientation_.bind(this);return Hv()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var t=window.self!==window.top,e=Zv(document.referrer),i=Zv(window.location.href);return t&&e!==i}()&&window.addEventListener("message",i),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",n):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",i)}},t.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},t.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,i=this.depthFar,n={left:[],right:[]},r=t.left.upDegrees*Vv,o=t.left.downDegrees*Vv,a=2/((c=t.left.leftDegrees*Vv)+(l=t.left.rightDegrees*Vv)),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/(e-i),n.left[11]=-1,n.left[12]=0,n.left[13]=0,n.left[14]=i*e/(e-i),n.left[15]=0;var c,l;r=t.right.upDegrees*Vv,o=t.right.downDegrees*Vv,a=2/((c=t.right.leftDegrees*Vv)+(l=t.right.rightDegrees*Vv)),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/(e-i),n.right[11]=-1,n.right[12]=0,n.right[13]=0,n.right[14]=i*e/(e-i),n.right[15]=0,n},t.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,i=new ny(t.distortionCoefficients),n=t.screenLensDistance,r=(e.widthMeters-t.interLensDistance)/2,o=t.interLensDistance/2,a=t.baselineLensDistance-e.bevelMeters,s=e.heightMeters-a,c=zv*Math.atan(i.distort(r/n)),l=zv*Math.atan(i.distort(o/n)),h=zv*Math.atan(i.distort(a/n)),u=zv*Math.atan(i.distort(s/n)),d=new oy,p=new oy;return d.leftDegrees=Math.min(c,t.fov),d.rightDegrees=Math.min(l,t.fov),d.downDegrees=Math.min(h,t.fov),d.upDegrees=Math.min(u,t.fov),p.leftDegrees=d.rightDegrees,p.rightDegrees=d.leftDegrees,p.upDegrees=d.upDegrees,p.downDegrees=d.downDegrees,{left:d,right:p}},t.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new r.Quaternion;var e=t.alpha,i=t.beta,n=t.gamma;e=(e||0)*Math.PI/180,i=(i||0)*Math.PI/180,n=(n||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new r.Euler(e,i,-n,"YXZ"))},t.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},t.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,i=t.rotationRate,n=t.timeStamp/1e3,r=n-this.previousTimestampS;return r<0?(Yv("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=n)):r<=.001||r>1?(Yv("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=n)):(e&&(this.accelerometer.set(-e.x,-e.y,-e.z),i&&(qv()?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))},t.prototype.onOrientationChange_=function(){this.setScreenTransform_()},t.prototype.onMessage_=function(t){var e=t.data;e&&e.type&&("devicemotion"===e.type.toLowerCase()&&this.updateDeviceMotion_(e.deviceMotionEvent))},t.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()},t}(),sy=[0,0,.5,1],cy=[.5,0,.5,1],ly=function(){function t(t){var e=this;this.renderer=t,this.sensor=new ay(.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 t=e.renderer.getSize(new r.Vector2);e.renderer.setScissor(0,0,t.width,t.height),e.renderer.setViewport(0,0,t.width,t.height),e.renderer.setScissorTest(!1),i()}}return t.prototype.render=function(t,e){var i=this.renderer.getSize(new r.Vector2);if(i.width>i.height){var n=t.autoUpdate;n&&(t.updateMatrixWorld(),t.autoUpdate=!1);var o={x:Math.round(i.width*sy[0]),y:Math.round(i.height*sy[1]),width:Math.round(i.width*sy[2]),height:Math.round(i.height*sy[3])},a={x:Math.round(i.width*cy[0]),y:Math.round(i.height*cy[1]),width:Math.round(i.width*cy[2]),height:Math.round(i.height*cy[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.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(t,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(t,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&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},t.prototype.dispose=function(){},t}(),hy={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},uy="undefined"!=typeof navigator&&null!==(Jv=hy[navigator.language.split("-")[0]])&&void 0!==Jv?Jv:hy.zh,dy="\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(uy.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(uy.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 py(t){for(var e=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&&(e=Number(o[1])),isNaN(e)&&(e=1)}}return dy.replace(/\n/g," ").replace(/\ +/g," ").replace(/\$id/g,t).replace(/(\d+)px/g,(function(t,i){return function(t){return Math.floor(t*e)+"px"}(Number(i))}))}var fy=new r.CircleBufferGeometry(.12,16),my=function(){var t=he(),e=new r.Texture;return t.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(t,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(),e.image=n,e.needsUpdate=!0}}},t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAR9JREFUOBF10kFOAzEMBdCZFhCbrrgAN+NqHIULsWKDKO3gF+VHoZpa+rXjfH87nq7btr0ty3KZ8FsxnHeQPL748lA/x0Jsq+AwYe0X8nDtGA33BEJUHIEKW/EorHOLI7BHNlkEbju38YkQAIRZxFkHz2HOirKDxNcIzG+fu/6oLiNmqc5ZrlwTeKyAgJF14tMZmSn87pBrxeX/CRABgk/dl1s+C18dio2Pp9nmCQru2UtdvN+7lI9AFsgb3zNMcSp8FF4LYs3UhLfOAvkDJffci8q1J/ByRLKnQ8gUJUFOd2SeZYliCxwiyJCxCbhUGFKF4zPm61hiq7sVyJnPmATyR5IzLSNyDNEFRCDnkAmA8U2RfCsIefYhDeKOQLv7A+l1ZTyjymNxAAAAAElFTkSuQmCC",e}(),gy=function(){if("undefined"!=typeof document){var t=document.createElement("canvas");t.setAttribute("width",String(512)),t.setAttribute("height",String(512));var e=t.getContext("2d");if(e){var i=256;return e.beginPath(),e.arc(i,i,192,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.1)",e.closePath(),e.fill(),e.save(),e.beginPath(),e.arc(i,i,192,0,2*Math.PI),e.strokeStyle="rgba(255, 255, 255, 0.5)",e.lineWidth=10.24,e.closePath(),e.stroke(),new r.CanvasTexture(t)}}return null}(),vy=function(){if("undefined"!=typeof document){var t=512,e=document.createElement("canvas");e.setAttribute("width",String(t)),e.setAttribute("height",String(t));var i=e.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,t);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(e)}}return null}(),yy=function(){if("undefined"!=typeof document){var t=512,e=document.createElement("canvas");e.setAttribute("width",String(t)),e.setAttribute("height",String(t));var i=e.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,t);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(e)}}return null}(),Ay=function(){if("undefined"!=typeof document){var t=512,e=document.createElement("canvas");e.setAttribute("width",String(t)),e.setAttribute("height",String(t));var i=e.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,t,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(e)}}return null}(),xy=function(t){function i(){var i=t.call(this)||this;i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.opacityMotion=new Zm({opacity:0}),i.loadingMotion=new Zm({opacity:0}),i.currentMotion=new Zm({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(fy,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{color:0,opacity:0}))),i.hitTestMesh.scale.set(1.5,1.5,1.5),i.centerMesh=new r.Mesh(fy,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:vy,opacity:0}))),i.centerMesh2=new r.Mesh(fy,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:yy,opacity:0}))),i.ringMesh=new r.Mesh(fy,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:Ay,opacity:0}))),i.loadingMesh=new r.Mesh(fy,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:my,opacity:.8}))),i.disableMesh=new r.Mesh(fy,new r.MeshBasicMaterial(e.__assign(e.__assign({},n),{map:gy}))),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 e.__extends(i,t),i.prototype.setProgress=function(t){this.progress=t,this.setLoading(t>0)},i.prototype.setOpacity=function(t){this.opacity!==t&&(this.opacity=t=Rm(t,0,1),this.opacityMotion.set({opacity:t},30).catch(Pt))},i.prototype.setCurrent=function(t){if(this.current!==t){if(t){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(Pt)}else{i=[{progress:0,value:e.__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.5,circleScale:1}}];this.currentMotion.setKeyframes(i,200).catch(Pt)}this.current=t}},i.prototype.setLoading=function(t){this.loading!==t&&(t?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=t,!0===this.disabled&&this.setDisabled(!1),this.needsRender=!0)},i.prototype.setDisabled=function(t){this.disabled!==t&&(this.disabled=t,!0===this.loading&&this.setLoading(!1),this.disableMesh.visible=t,this.centerMesh.visible=!t,this.needsRender=!0)},i.prototype.tap=function(){return Promise.resolve()},i.prototype.updateTime=function(t,e){this.opacityMotion.update(t),this.currentMotion.update(t),this.loadingMotion.update(t);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(-e/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),by=function(t){function i(e){var n=this,r=i.parseArgs(e);(n=t.call(this,r)||this).cardboard=new ly(n.renderer);var o,a,s,c=(o="five_vr_helper_"+Dr(),a=py(o),(s=document.createElement("div")).className=o,s.innerHTML=a,s);n.helperElement=c;var l=new Zg(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 e.__extends(i,t),i.parseArgs=function(i){var n=e.__assign(e.__assign({},i),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,n)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=0,i=this.panoMeshes;e<i.length;e++){var n=i[e];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 t=this;this.panoMeshes.forEach((function(e){t.helper.remove(e),e.dispose()})),this.panoMeshes.length=0;for(var e=0;e<this.work.observers.length;e++){var i=this.work.observers[e],n=new xy;n.name="panoSphere_".concat(this.work.workCode,"_").concat(e),n.position.copy(i.position),n.needsRender=!0,this.helper.add(n),this.panoMeshes[e]=n}},i.prototype.updateTime=function(t,e){var i,n;if(!this.destroyed){this.needsRender=!0;var o={},a={};if(!1===this.locationMotion.ended){this.locationMotion.update(t);var s=this.locationMotion.getKeyFrameSegment(t),c=s[0],l=s[1],h=this.panoResourceFromLocationMotionKeyframe(c),u=this.panoResourceFromLocationMotionKeyframe(l),d=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),p=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),f=h.position,m=u.position,g=this.locationMotion.value.count-l.value.count+1;o.modelAlpha=this.locationMotion.value.modelAlpha,o.perspToOrtho=Rm(1-10*(1-this.locationMotion.value.perspToOrtho),0,1),o.useBlackTransition="instant"===u.effect,u.panoPicture&&(g<1?h.panoPicture&&(o.pano0=h.panoPicture):o.pano0=u.panoPicture,o.pano1=u.panoPicture),"fade"===u.effect&&(o.pano0&&h.panoPicture&&(o.pano0={map:o.pano0.map,luminanceMap:o.pano0.luminanceMap,matrix:h.panoPicture.matrix.clone().setPosition(u.position)}),f.copy(m)),o.progress=g,a.distance=this.locationMotion.value.distance,a.offset=new r.Vector3(f.x+(m.x-f.x)*g,f.y+(m.y-f.y)*g,f.z+(m.z-f.z)*g);for(var v=[],y=[],A=0,x=this.locationMotion.keyframes;A<x.length;A++){var b=x[A],w=b.key,M=b.progress;void 0!==w&&(v.push(w),M>=this.locationMotion.progress&&y.push(w))}for(var E=0,S=Object.keys(this.panoResources);E<S.length;E++){var _=S[E];if(!(y.indexOf(_)>=0)){var T=this.panoResources[_];if(T.panoPicture){var C=T.panoPicture.map;if(C){if(C===(null===(i=o.pano0)||void 0===i?void 0:i.map))continue;if(C===(null===(n=o.pano1)||void 0===n?void 0:n.map))continue;C.dispose(),T.panoPicture=null}}v.indexOf(_)>=0||delete this.panoResources[_]}}this.currentPanoIndex=g<.5?h.panoIndex:u.panoIndex,this.emit("movingToPano",p.panoIndex,d.panoIndex,this.locationMotion.progress)}!1===Xg(o)&&(this.model.setMaterial(o),this.boundingMesh.setMaterial(o)),a.offset&&this.camera.position.copy(a.offset);var I=this.camera.pose.longitude,P=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();for(var R=this.work.observers[this.currentPanoIndex].visibleNodes.concat(this.currentPanoIndex),B=0;B<this.work.observers.length;B++){var L=this.work.observers[B];if((N=this.panoMeshes[B]).visible=!0,L.loadable||L.active){if(-1===R.indexOf(B))N.visible=!1;else{N.visible=!0;var D=N.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);D<.05?N.setOpacity(0):N.setOpacity(Rm(1.5/D,0,1)),this.currentPanoIndex===B&&N.setOpacity(0)}N.lookAt(this.camera.position)}else N.visible=!0}var O=this.intersect(t);for(B=0;B<this.work.observers.length;B++){null==(N=this.panoMeshes[B])||N.setCurrent(N===O)}for(B=0;B<this.work.observers.length;B++){var N;(N=this.panoMeshes[B])&&N.updateTime&&N.updateTime(t,e)}I===this.camera.pose.longitude&&P===this.camera.pose.latitude||(this.cameraMotion.set(Xe(this.camera.pose,["longitude","latitude"]),0).catch(Pt),this.emit("cameraDirectionUpdate",Xe(this.camera.pose,["longitude","latitude"]),!0),this.emit("cameraUpdate",Yg(Xe(this.camera.pose,["longitude","latitude","fov","offset","distance"])),!0))}},i.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},i.prototype.setCamera=function(t){},i.prototype.destroyHelper=function(){},i.prototype.setHelperElementSize=function(){if(this.helperElement){var t=new r.Vector2(this.element.offsetWidth,this.element.offsetHeight),e=t.x*this.scissor.left,i=t.y*(1-this.scissor.bottom-this.scissor.height),n=t.x*this.scissor.width,o=t.y*this.scissor.height;this.helperElement.style.marginLeft=e+"px",this.helperElement.style.marginTop=i+"px",this.helperElement.style.width=n+"px",this.helperElement.style.height=o+"px"}},i.prototype.intersect=function(t){var e;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&t-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!==(e=h.hitTestMesh)&&void 0!==e?e:h,!0)[0];u&&s.push({panoMesh:h,intersection:u})}}var d=s.sort((function(t,e){return t.intersection.distance-e.intersection.distance}))[0];if(d?(a=d.intersection,this.activePanoMesh!==d.panoMesh&&(this.activePanoMesh=d.panoMesh,this.activeTime=t),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}(Fv),wy=function(t){function i(e){var n,r,o,a,s=this,c=i.parseArgs(e);return(s=t.call(this,c)||this).currentPanoIndex=c.initial[0],s.locationMotion=new Zm({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 e.__extends(i,t),i.parseArgs=function(e){return t.parseArgs.call(this,e)},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.locationMotion.dispose()},i.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(t,e,i,n,r){this.work=t,this.currentPanoIndex=e,this.hideIntersectMesh();var o={duration:0,longitude:i.longitude,latitude:i.latitude,fov:i.fov};return this.moveToPano(e,o,r),!0},i.prototype.updateTime=function(t,e){if(!this.destroyed){var i={},n={};if(!this.locationMotion.ended){this.locationMotion.update(t),i.modelAlpha=this.locationMotion.value.modelAlpha,i.perspToOrtho=Rm(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);var o=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=Kg(this.work.observers,(function(t){return t.position.distanceTo(o)}));this.currentPanoIndex=this.work.observers.indexOf(a)}this.cameraMotion.ended||(this.cameraMotion.update(t),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),Xg(i)||this.model.setMaterial(i),Xg(n)||this.setCamera(n)}},i.prototype.initAnimation=function(t,e,i,n){var r,o,a,s=this;this.destroyed||(this.pending=!1,this.userAction=n,this.moveToPano(t,{longitude:null!==(r=e.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Rm(null!==(o=e.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Rm(null!==(a=e.fov)&&void 0!==a?a:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(t,e){s.emit("initAnimationWillStart",t,e,s.userAction)},moveEndCallback:function(t,e){s.emit("initAnimationEnded",t,e,s.userAction)},moveCancelCallback:function(){var t=s.currentPanoIndex,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};s.emit("initAnimationEnded",t,e,s.userAction)}},n))},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(Bt())[1],e=this.locationMotion.getKeyFrameSegment(Bt())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new r.Vector3(e.value.x,e.value.y,e.value.z),distance:e.value.distance}},i.prototype.moveToPano=function(t,e,i){void 0===e&&(e={});var n=this.work.observers[t];n&&this.moveToPosition(n.position,e,i)},i.prototype.moveToPosition=function(t,e,i){var n,o,a,s=this;void 0===e&&(e={}),this.userAction=i;for(var c=Bt(),l=new r.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z).distanceTo(t),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(e.duration,l),M={x:t.x,y:t.y,z:t.z,distance:0,modelAlpha:1,perspToOrtho:0},E={longitude:e.longitude,latitude:e.latitude,fov:e.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:t.clone(),distance:0},_=Kg(this.work.observers,(function(e){return e.position.distanceTo(t)})),T=this.work.observers.indexOf(_);this.emit("moveToPano",T,this.userAction),e.moveStartCallback&&e.moveStartCallback(T,S),this.emit("panoWillArrive",T,S,this.userAction),this.cameraMotion.set(E,w).catch(Pt),this.locationMotion.set(M,w,b).then((function(){var t=Yg(s.camera.pose);e.moveEndCallback&&e.moveEndCallback(T,t),s.emit("panoArrived",T,t,s.userAction)}),(function(){e.moveCancelCallback&&e.moveCancelCallback(),s.emit("moveToPanoCanceled",T)}))},i.prototype.onTapGesture=function(t){var e=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","tap",e,!0)){var i=this.relativeClientPosition(t.center),n=new r.Raycaster;if(n.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",n,i,!0)){this.emit("gesture","tap",e,!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=Kg(this.work.observers.filter((function(t){return Math.abs(t.standingPosition.y-u.y)<1})),(function(t){return t.standingPosition.distanceTo(u)}));if(d)return u.y=d.position.y,void this.moveToPosition(u,{},!0)}this.cameraBounce()}}},i}(pv),My=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.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"),Ey=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=113,n=126,r=0,o="";return arguments[r].split(o).map((function(t){return t.charCodeAt(r)>n?t:String.fromCharCode((t.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"),Sy=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),_y=new r.SphereBufferGeometry(.01,128,128);var Ty=function(){function t(t){void 0===t&&(t={}),this.textureLoader=new yi({allowHosts:this.allowHosts,networkSubscribe:this.networkSubscribe}),this.allowHosts=t.allowHosts,this.networkSubscribe=t.networkSubscribe}return t.prototype.setAllowHosts=function(t){this.allowHosts=t,this.textureLoader.setAllowHosts(t)},t.prototype.setNetworkSubscribe=function(t){this.networkSubscribe=t,this.textureLoader.setNetworkSubscribe(t)},t.prototype.load=function(t,i,n,o,a,s,c,l){var h=[0,0],u=function(t,e){h[e]=t,c(.8*h[0]+.2*h[1])},d=[this.textureLoader.load(t,{viaAjax:!0},void 0,void 0,(function(t){return u(t,1)}),l),this.textureLoader.loadCube(i,{viaAjax:!0},void 0,void 0,(function(t){return u(t,0)}),l)];return Promise.all(d).then((function(t){var i=t[0],s=t[1],c={body:function(t,e,i,n){var o=new r.ShaderMaterial({side:r.BackSide,vertexShader:My,fragmentShader:Ey,transparent:!0,uniforms:r.UniformsUtils.clone(Sy)}),a=e;return a.needsUpdate=!0,a.minFilter=r.LinearFilter,a.magFilter=r.LinearFilter,t.needsUpdate=!0,t.minFilter=r.LinearFilter,t.magFilter=r.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=a,o.uniforms.panoDisplacementMap.value=t,o.uniforms.panoPosition.value=i,o.uniforms.panoMatrix.value=n,Object.assign(new r.Mesh(_y,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:e.__spreadArray([i.meta],s.meta,!0)};return a(c),c})).catch((function(t){for(var e=0,i=d;e<i.length;e++){i[e].then((function(t){return t.body.dispose()})).catch(Pt)}return s(t),Promise.reject(t)}))},t}(),Cy=new r.Vector3(-1,1,1),Iy=function(t){function i(e){var n,o,a,s,c,l,h,u=this,d=i.parseArgs(e);return(u=t.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 Zm({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=Dr()]={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 Ty({allowHosts:u.work.allowHosts,networkSubscribe:u.networkSubscribe}),u}return e.__extends(i,t),i.parseArgs=function(i){var n,r,o,a=t.parseArgs.call(this,i);return e.__assign(e.__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 Tg}})},i.initAnimationEndPose=function(e){var i=this.parseArgs(e);return t.initAnimationEndPose.call(this,i)},i.prototype.destroy=function(){var e,i=this;if(t.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(t){i.helper.remove(t),t.dispose()})),this.panoMeshes.length=0);for(var a=null!==(e=this.model.getMaterial())&&void 0!==e?e:{},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&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(t,e,i,n,r){this.userAction=r,this.work=t,this.currentPanoIndex=e,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(e,{effect:"fade",duration:n,longitude:i.longitude,latitude:i.latitude,fov:i.fov},r),!0},i.prototype.updateTime=function(t,e){var i,n,o;if(!this.destroyed){var a={},s={},c=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),l=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),h=!1;if(!1===this.locationMotion.ended){this.locationMotion.update(t);var u=this.locationMotion.getKeyFrameSegment(t),d=u[0],p=u[1],f=this.panoResourceFromLocationMotionKeyframe(d),m=this.panoResourceFromLocationMotionKeyframe(p),g=(new r.Vector3).copy(f.position),v=(new r.Vector3).copy(m.position),y=this.locationMotion.value.count-p.value.count+1;a.progress=y,a.modelAlpha=this.locationMotion.value.modelAlpha,a.perspToOrtho=Rm(1-10*(1-this.locationMotion.value.perspToOrtho),0,1);for(var A=0,x=this.panoModelGroup.children;A<x.length;A++){var b=x[A];b.visible=b===f.panoModel||b===m.panoModel}f.panoModel&&(f.panoModel.material.uniforms.opacity.value=1-y,f.panoModel.material.depthTest=0!==y),m.panoModel&&(m.panoModel.material.uniforms.opacity.value=y,m.panoModel.material.depthTest=1!==y),m.panoModel&&(y<1?f.panoModel&&(a.pano0={map:f.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:f.matrix}):a.pano0={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix},a.pano1={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix}),h=a.useBlackTransition="instant"===m.effect||"montage"===m.effect,"fade"!==m.effect&&"montage"!==m.effect||(a.pano0&&(a.pano0={map:a.pano0.map,luminanceMap:null,matrix:f.matrix.clone().setPosition(m.position)}),g.copy(v)),s.distance=this.locationMotion.value.distance,s.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 w=[],M=[],E=0,S=this.locationMotion.keyframes;E<S.length;E++){var _=S[E],T=_.key,C=_.progress;void 0!==T&&(w.push(T),C>=this.locationMotion.progress&&M.push(T))}for(var I=0,P=Object.keys(this.panoResources);I<P.length;I++){var R=P[I];if(!(M.indexOf(R)>=0)){var B=this.panoResources[R];if(B.panoModel){if(B.panoModel.material.uniforms.panoMap.value===(null===(i=a.pano0)||void 0===i?void 0:i.map))continue;if(B.panoModel.material.uniforms.panoMap.value===(null===(n=a.pano1)||void 0===n?void 0:n.map))continue;this.panoModelGroup.remove(B.panoModel),B.panoModel.material.uniforms.panoMap.value.dispose(),B.panoModel.dispose(),delete B.panoModel}w.indexOf(R)>=0||delete this.panoResources[R]}}f.workCode===m.workCode?this.currentPanoIndex=y<.5?f.panoIndex:m.panoIndex:this.currentPanoIndex=m.panoIndex,this.emit("movingToPano",l.panoIndex,c.panoIndex,this.locationMotion.progress)}if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),s.longitude=this.cameraMotion.value.longitude,s.latitude=this.cameraMotion.value.latitude,s.fov=this.cameraMotion.value.fov),!1===Xg(a)&&(this.model.setMaterial(a),this.boundingMesh.setMaterial(a)),!1===Xg(s)&&this.setCamera(s),this.camera.pose.distance>.1)for(var L=0;L<this.work.observers.length;L++){(k=this.panoMeshes[L])&&(k.visible=!1)}else{var D=this.work.observers[this.currentPanoIndex];if(D){var O=D.visibleNodes.concat(this.currentPanoIndex),N=this.getForwardPanoIndexOrNot();for(L=0;L<this.work.observers.length;L++){var k,F=this.work.observers[L];if(k=this.panoMeshes[L])if(F.loadable||F.active)if(-1!==O.indexOf(L))if(h)k.visible=!1,k.setOpacity(0);else{k.visible=!0;var V=k.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);k.setCurrent(N===L),k.setOpacity(V<.01?0:Rm(1.4/V,.5,.7)),k.updateTime&&k.updateTime(t,e)}else k.visible=!1,k.setOpacity(0);else k.visible=!1,k.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 t=this.cameraMotion.getKeyFrameSegment(Bt())[1],e=this.locationMotion.getKeyFrameSegment(Bt())[1],i=this.panoResourceFromLocationMotionKeyframe(e),n=this.work.observers[i.panoIndex];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:0}},i.prototype.moveToPano=function(t,i,n){var o,a,s=this;void 0===i&&(i={});var c=this.work.observers[t].images.depth,l=e.__assign({key:"pano.".concat(t),basisLoaderInitialized:gi.isInitialized()},Xe(this.imageOptions,["format","size","quality","sharpen","mappings"])),h=null!==(o=this.imageOptions.transform)&&void 0!==o?o:ie,u={right:h(this.work.observers[t].images.right,e.__assign(e.__assign({},l),{key:"pano.".concat(t,".right")})),left:h(this.work.observers[t].images.left,e.__assign(e.__assign({},l),{key:"pano.".concat(t,".left")})),up:h(this.work.observers[t].images.up,e.__assign(e.__assign({},l),{key:"pano.".concat(t,".up")})),down:h(this.work.observers[t].images.down,e.__assign(e.__assign({},l),{key:"pano.".concat(t,".down")})),front:h(this.work.observers[t].images.front,e.__assign(e.__assign({},l),{key:"pano.".concat(t,".front")})),back:h(this.work.observers[t].images.back,e.__assign(e.__assign({},l),{key:"pano.".concat(t,".back")}))},d=this.work.observers[t],p=d.position,f=d.quaternion,m=(new r.Matrix4).compose(p,f,new r.Vector3(-1,1,1)),g="pano:"+uv(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:t,hash:g,onLoad:function(e){s.pending=!1,s.destroyed?e.body.dispose():(e.body.name=g,s.emit("panoLoaded",t),s.doMoveToPano(t,e.body,i,n))},onError:function(e){s.pending=!1,i.moveCancelCallback&&i.moveCancelCallback(),s.emit("panoLoadError",e,t),s.emit("moveToPanoCanceled",t)}};var y=this.panoMeshes[t];y&&y.tap&&y.tap(),this.depthTextureLoader.load(c,u,p,m,(function(e){var i,n;(null===(i=s.pendingTextureTask)||void 0===i?void 0:i.hash)===g?(s.pendingTextureTask.onLoad(e),null===(n=s.panoMeshes[t])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("textureLoaded",t,s.work.observers[t],e.meta)):e.body.dispose()}),(function(e){var i,n;(null===(i=s.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(s.pendingTextureTask.onError(e),null===(n=s.panoMeshes[t])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("textureError",e,t,s.work.observers[t]),s.emit("error",e))}),(function(e){var i,n;s.emit("textureLoading",e,t,s.work.observers[t]),(null===(i=s.pendingTextureTask)||void 0===i?void 0:i.hash)===g&&(null===(n=s.panoMeshes[t])||void 0===n||n.setProgress(e))}),this.renderer),this.emit("textureStartLoad",t,this.work.observers[t])},i.prototype.initAnimation=function(t,e,i,n){var r,o,a,s=this;if(!this.destroyed){var c=!1;this.pending=!1,this.userAction=n,this.moveToPano(t,{longitude:null!==(r=e.longitude)&&void 0!==r?r:this.defaultLongitude,latitude:Rm(null!==(o=e.latitude)&&void 0!==o?o:this.defaultLatitude,this.minLatitude,this.maxLatitude),fov:Rm(null!==(a=e.fov)&&void 0!==a?a:this.defaultFov,this.minFov,this.maxFov),duration:i,moveStartCallback:function(t,e){c=!0,s.emit("initAnimationWillStart",t,e,s.userAction)},moveEndCallback:function(t,e){s.emit("initAnimationEnded",t,e,s.userAction)},moveCancelCallback:function(){var t=Yg(s.camera.pose);!1===c&&s.emit("initAnimationWillStart",s.currentPanoIndex,t,s.userAction),s.emit("initAnimationEnded",s.currentPanoIndex,t,s.userAction)}},n)}},i.prototype.panoResourceFromLocationMotionKeyframe=function(t){return this.panoResources[t.key]},i.prototype.locationMotionKeyframesLength=function(t){for(var e=0,i=1;i<t.length;i++){var n=this.panoResourceFromLocationMotionKeyframe(t[i-1]).position,r=this.panoResourceFromLocationMotionKeyframe(t[i]).position;e+=n.distanceTo(r)*(t[i].value.count-t[i-1].value.count)}return e},i.prototype.updatePanoMeshes=function(){for(var t={},e=0,i=this.panoMeshes;e<i.length;e++){t[(a=i[e]).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;t[r]?(a=t[r],delete t[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(t);s<c.length;s++){var l=c[s];this.helper.remove(t[l]),t[l].dispose(),delete t[l]}},i.prototype.generateBoundingMesh=function(t){void 0===t&&(t=!1);for(var e=this.model.bounding.clone(),i=0,n=this.work.observers;i<n.length;i++){var o=n[i];e.expandByPoint(o.standingPosition),e.expandByPoint((new r.Vector3).fromArray([o.position.x,2*o.position.y-o.standingPosition.y,o.position.z]))}t&&e.expandByPoint(this.camera.position);var a=Fg(e,new r.Vector3(1,0,1));return a.name="panorama_bounding",a.frustumCulled=!1,a},i.prototype.doMoveToPano=function(t,i,n,o){var a,s,c,l,h=this;void 0===n&&(n={}),this.userAction=o;var u=Bt(),d=Dr(),p=this.work.observers[t],f=this.panoResources[d]={panoIndex:t,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,Cy),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:e.__assign(e.__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:e.__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},B={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(t,B),this.emit("panoWillArrive",t,B,this.userAction),this.cameraMotion.set(R,P).catch(Pt),this.locationMotion.setKeyframes(g,P,v).then((function(){var e={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(t,e),h.emit("panoArrived",t,e,o)}),(function(){n.moveCancelCallback&&n.moveCancelCallback(),h.emit("moveToPanoCanceled",t)}))},i.prototype.getForwardPanoIndexOrNot=function(t){var e=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(t){if(t===e.currentPanoIndex)return!1;var i=e.work.observers[t],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=(t?t.ray.direction.clone():i.clone()).setY(0);if(0===s.length())return null;for(var c=a.slice().sort((function(t,i){var r=e.work.observers[t].position.clone().setY(n.y),o=e.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(t){var i=this,n=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","tap",n,!0)){var o=this.relativeClientPosition(t.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(t){if(t===i.currentPanoIndex)return!1;var e=i.work.observers[t];return!(e.position.distanceTo(i.camera.position)>i.maxAccessibleDistance)&&(e.loadable||e.active)})),u=a.intersectObject(this.boundingMesh,!0)[0];if(u){var d=Kg(h,(function(t){var e=i.work.observers[t].standingPosition.clone();return e.clone().sub(i.camera.position).setY(0).angleTo(s)>Math.PI/2?1/0:e.distanceTo(u.point)}),!0),p=d[0];d[1]<this.panoTapTriggerRadius&&(c=p)}_m(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),_m(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 B=(C.length>0?C:e.__spreadArray(e.__spreadArray([],_,!0),T,!0)).slice().sort((function(t,e){return t.angleTo(M)-e.angleTo(M)}))[0];B&&B.angleTo(s)>b&&(A.longitude=Math.atan2(-B.x,-B.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Rm(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}(pv);function Py(t,e){var i=new r.Vector3;return i.setFromMatrixColumn(e,0),i.multiplyScalar(-t),i}function Ry(t,e,i){var n=new r.Vector3;return n.setFromMatrixColumn(i,0),n.crossVectors(e,n),n.multiplyScalar(t),n}var By=function(t){function i(e){var n,r,o,a,s=this,c=i.parseArgs(e);return(s=t.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 Zm({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 e.__extends(i,t),i.parseArgs=function(i){var n,r,o,a,s,c,l,h=t.parseArgs.call(this,i);return e.__assign(e.__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(t,e,i){var n=t.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*e/360);return i<1&&(o/=i),isNaN(o)?r:o},i.initAnimationEndPose=function(t){var e,n,r=this.parseArgs(t),o=t.initial[0],a=t.initial[1];return{longitude:null!==(e=a.longitude)&&void 0!==e?e:r.defaultLongitude,latitude:Rm(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,r.camera.fov,r.camera.aspect)}},i.prototype.destroy=function(){t.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&&t.prototype.isReady.call(this)},i.prototype.updateWork=function(t,e,i,n,r){return this.work=t,this.updateCamera(i,n,r),!0},i.prototype.updateModel=function(e){t.prototype.updateModel.call(this,e);var i=e.bounding.getCenter(new r.Vector3);this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(Pt),this.model.enableTiles=!0},i.prototype.updateTime=function(t,e){if(!this.destroyed){var i={},n={};this.locationMotion.ended||(this.locationMotion.update(t),i.modelAlpha=this.locationMotion.value.modelAlpha,i.perspToOrtho=Rm(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(t),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),Xg(i)||this.model.setMaterial(i),Xg(n)||this.setCamera(n)}},i.prototype.setCamera=function(e){t.prototype.setCamera.call(this,e);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=Kg(this.work.observers,(function(t){return t.position.distanceTo(i)})),s=this.work.observers.indexOf(a);s!==this.currentPanoIndex&&(this.emit("moveToPano",s,this.userAction),this.emit("panoWillArrive",s,Yg(this.camera.pose),this.userAction),this.currentPanoIndex=s,this.emit("panoArrived",s,Yg(this.camera.pose),this.userAction))},i.prototype.getTargetPose=function(){var t=this.cameraMotion.getKeyFrameSegment(Bt())[1],e=this.locationMotion.getKeyFrameSegment(Bt())[1];return{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,distance:e.value.distance,offset:new r.Vector3(e.value.x,e.value.y,e.value.z)}},i.prototype.initAnimation=function(t,e,n,o){var a,s,c=this;if(!this.destroyed){this.pending=!1,this.userAction=o;var l={longitude:null!==(a=e.longitude)&&void 0!==a?a:this.defaultLongitude,latitude:Rm(null!==(s=e.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,this.camera.fov,this.camera.aspect)},h=Xe(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",t,l,this.userAction),this.cameraMotion.set(h,n).catch(Pt),this.locationMotion.set(u,n).then((function(){c.emit("initAnimationEnded",t,l,c.userAction)}),(function(e){var i=Yg(c.camera.pose);c.emit("initAnimationEnded",t,i,c.userAction)})).then((function(){c.model.enableTiles=!0}))}},i.prototype.getForwardPanoIndexOrNot=function(t){var e=this.work.observers.filter((function(t){return t.active})),i=this.model.intersectRaycaster(t)[0];if(!i)return null;var n=Kg(e,(function(t){return t.standingPosition.distanceTo(i.point)}),!0),r=n[0];return n[1]<5?this.work.observers.indexOf(r):null},i.prototype.coordinatesForOffset=function(t){var e=this.cameraMotion.value.fov,i=this.camera.aspect,n=this.renderer.getSize(new r.Vector2);return{longitude:2*t.x/(n.x*this.scissor.width)*e/95*i,latitude:-2*t.y/(n.y*this.scissor.height)*e/95}},i.prototype.onPanGesture=function(t){var e=this.panState,i=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:i,x:t.center.x,y:t.center.y},void 0!==e&&e.pointerLength===i){var n=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pan",n,t.isFinal))if("mouse"===t.pointerType&&2===t.srcEvent.buttons){var o={x:t.center.x-e.x,y:t.center.y-e.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(Py(2*o.x*h/u.y,this.camera.matrix)),a.add(Ry(2*o.y*h/u.y,this.camera.up,this.camera.matrix)),a.x=Rm(a.x,c.x-l.x,c.x+l.x),a.z=Rm(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,t.isFinal))return;this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",d,t.isFinal),this.userAction=!0,this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(Pt)}else{a={x:t.center.x-e.x,y:t.center.y-e.y};var p=this.coordinatesForOffset(a),f=zg(this.cameraMotion.value.longitude+-1*p.longitude),m=Rm(this.cameraMotion.value.latitude+-1*p.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(t.overallVelocityX)>.2&&Math.atan2(Math.abs(t.overallVelocityY),Math.abs(t.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,t.isFinal))return;this.emit("gesture","pan",n,t.isFinal),this.emit("panGesture",d,t.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(Pt),t.isFinal)this.emit("wantsInteriaPan",d)||(this.interiaMovement=!0,t.velocityX,t.velocityY)}}},i.prototype.onPinchGesture=function(t){var e=this.pinchState||{},i=e.distance;e.offsetY;var n=!1;if("pinchstart"!==t.type){if("pinchend"===t.type&&(n=!0,delete this.pinchState),void 0!==i){this.pinchState={distance:i};var o=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(this.emit("wantsGesture","pinch",o,n))return;var a=Rm(i/t.scale,this.minDistance,this.maxDistance);if(this.emit("wantsPinchGesture",t.scale,this.camera.pose.fov,n))return;this.emit("gesture","pinch",o,n),this.emit("pinchGesture",t.scale,this.camera.pose.fov,n),this.userAction=!0,this.locationMotion.set({distance:a},0).catch(Pt)}var s=this.panState,c=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:c,x:t.center.x,y:t.center.y},void 0!==s&&s.pointerLength===c){var l=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pinch",l,n)){console.log(t.srcEvent);var h=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","pinch",h,n)){var u={x:t.center.x-s.x,y:t.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(Py(2*u.x*g/v.y,this.camera.matrix)),d.add(Ry(2*u.y*g/v.y,this.camera.up,this.camera.matrix)),d.x=Rm(d.x,f.x-m.x,f.x+m.x),d.z=Rm(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,t.isFinal)||(this.emit("gesture","pan",h,t.isFinal),this.emit("panGesture",y,t.isFinal),this.userAction=!0,this.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(Pt))}}}}else this.pinchState={distance:this.locationMotion.value.distance}},i.prototype.onMouseWheel=function(t){var e=this,i=(Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX)/-60,n=[{x:t.clientX,y:t.clientY,delta:i}];if(!this.emit("wantsGesture","mouseWheel",n,!1)){var r=Rm(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(Pt),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:window.setTimeout((function(){delete e.mouseWheelState;e.emit("wantsGesture","mouseWheel",n,!0)||e.emit("wantsMouseWheel",i,e.camera.pose.fov,!0)||(e.emit("gesture","mouseWheel",n,!0),e.emit("mouseWheel",0,e.camera.pose.fov,!0))}),200)})}},i.prototype.onTapGesture=function(t){var e=t.pointers.map((function(t){return Xe(t,["x","y"])}));if(!this.emit("wantsGesture","tap",e,!0)){var i=this.relativeClientPosition(t.center),n=new r.Raycaster;if(n.setFromCamera(i,this.camera),!this.emit("wantsTapGesture",n,i,!0)){this.emit("gesture","tap",e,!0),this.emit("tapGesture",n,i,!0),this.interiaMovement=!1;var o=this.getForwardPanoIndexOrNot(n);if(!_m(o)){this.emit("panoSelected",o);var a={longitude:this.camera.pose.longitude,latitude:0};this.emit("wantsMoveToPano",o,a,!0)}}}},i.prototype.onPressGesture=function(t,e){var i,n,o=[t];if(this.emit("wantsGesture","press",o,e))return null===(i=this.pressState)||void 0===i||i.stop(),void delete this.pressState;var a=this.relativeClientPosition(t),s=new r.Raycaster;if(s.setFromCamera(a,this.camera),this.emit("wantsPressGesture",s,a,t.delta,e))return null===(n=this.pressState)||void 0===n||n.stop(),void delete this.pressState;this.emit("gesture","press",o,e),this.emit("pressGesture",s,a,t.delta,e)},i}(sv),Ly=["Panorama","DepthPanorama","Model"],Dy={Floorplan:cv,Topview:lv,Panorama:Fv,VRPanorama:by,Model:wy,DepthPanorama:Iy,Mapview:By};function Oy(t){for(var e=0,i=Ly;e<i.length;e++){var n=i[e];if("string"==typeof t){if(n===t)return!0}else if(t instanceof sv&&t instanceof Dy[n])return!0}return!1}var Ny=["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"];function ky(t){for(var e,i,n={},r=0,o=t.split(/(\;|\,)/);r<o.length;r++){var a=o[r].split("="),s=null===(e=a[0])||void 0===e?void 0:e.trim(),c=null===(i=a[1])||void 0===i?void 0:i.trim();s&&c&&(n[s]=c)}return n}function Fy(){for(var t,e=document.getElementsByTagName("meta"),i=0;i<e.length;i++){var n=e[i];if("viewport"===n.getAttribute("name")){var r=ky(null!==(t=n.getAttribute("content"))&&void 0!==t?t:""),o=Number(r["initial-scale"]);if(!isNaN(o))return o}}return 1}var Vy=[351,63],zy=[20,20],Hy=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Uy=new Float32Array([0,0,1,0,0,1,1,1]),Gy=new Uint8Array([0,1,2,1,3,2]),jy=new r.BufferGeometry;jy.setAttribute("position",new r.BufferAttribute(Hy,3)),jy.setAttribute("uv",new r.BufferAttribute(Uy,2)),jy.setIndex(new r.BufferAttribute(Gy,1));var Qy=new r.MeshBasicMaterial({transparent:!0,depthTest:!1}),Wy=new r.Mesh(jy,Qy),qy=new r.Scene;qy.add(Wy);var Ky=new r.OrthographicCamera(-.5,.5,.5,-.5,.1,1);Ky.position.set(0,0,.5),Ky.lookAt(0,0,0);var Xy=new r.Vector4,Yy=new r.Vector4;function Zy(t){if(Qy.map){var e=t.getViewport(Xy),i=t.getScissor(Yy),n=t.getScissorTest(),o=t.autoClear;t.setViewport(i.x+zy[0]/3,i.y+zy[1]/3,Vy[0]/3,Vy[1]/3),t.setScissor(i.x+zy[0]/3,i.y+zy[1]/3,Vy[0]/3,Vy[1]/3),t.setScissorTest(!0),t.autoClear=!1,t.render(qy,Ky),t.setViewport(e),t.setScissor(i),t.setScissorTest(n),t.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,Qy.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==",Qy.map=a}}var Jy={instances:{}};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:Jy});var $y=new r.Box3(new r.Vector3(-50,-50,-50),new r.Vector3(50,50,50)),tA=new r.Vector2,eA=new r.Frustum,iA=new r.Matrix4,nA=new WeakMap,rA=new WeakMap,oA=function(t){function i(i){void 0===i&&(i={});var n,o,a,s,c,l,h,u,d,p,f=this;if((f=t.call(this)||this).ident=Dr(),Jy.instances[f.ident]=f,f.renderSwitch01=0,f.panoIndex=0,f.needsRender=!1,f.onlyRenderIfNeeds=null===(n=i.onlyRenderIfNeeds)||void 0===n||n,f.imageOptions=e.__assign({},null!==(o=i.imageOptions)&&void 0!==o?o:{}),f.textureOptions=e.__assign({},null!==(a=i.textureOptions)&&void 0!==a?a:{}),f.poweredByRealsee=null===(s=i.poweredByRealsee)||void 0===s||s,f.extraElements=[],f.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)},f.fps={testCount:0,testTime:Bt()},f.modeChangeDuration=null!==(c=i.modeChangeDuration)&&void 0!==c?c:1e3,f.panoramaLikeSavedPose={},"undefined"!=typeof window)if(i.renderer)i.renderer instanceof ge&&f.throwError(new Error("cannot render a internal renderer")),f.renderer=i.renderer;else try{f.renderer=new ge({preserveDrawingBuffer:i.preserveDrawingBuffer,backgroundColor:i.backgroundColor,backgroundAlpha:i.backgroundAlpha,antialias:i.antialias,webgl2:null==i?void 0:i.webgl2});var m=Fy();f.renderer.setPixelRatio(1===m?window.devicePixelRatio:1),f.renderer.setSize(512,512)}catch(t){t instanceof Error&&f.throwError(t)}f.getPixelsRenderTarget=new r.WebGLRenderTarget(1,1,{encoding:null!==(h=null===(l=f.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==h?h:r.sRGBEncoding}),f.scissor=Object.assign({left:0,bottom:0,width:1,height:1},i.scissor),f.camera=new Se(80),f.scene=new ve,f.lastLoadWorkTask=Promise.resolve(),f.networkSubscribe=new Wt,f.networkSubscribe.on("network",(function(t,e,i,n){var r;f.emit("network",t,e,i,n),null===(r=f.analysis)||void 0===r||r.network(f.work,t,e,i,n)})),f.model=new Pm({allowHosts:[],networkSubscribe:f.networkSubscribe});var g=Fg($y);g.name="model_empty",f.model.add(g),f.model.visible=!1,f.readyCallbacks=[],f.modelPending=!1,f.syncingState=!1,f.scene.add(f.model),f.helperGroup=new r.Group,f.helperGroup.name="helper",f.scene.add(f.helperGroup),f.videoTexture=new r.VideoTexture(i.videoInstance||function(){var t=document.createElement("video");t.loop=!0,t.autoplay=!0,t.playsInline=!0,t.muted=!0,t.crossOrigin="";var e=function(){document.removeEventListener("touchstart",e,!1),document.removeEventListener("mousedown",e,!1),t.muted=!1};return document.addEventListener("touchstart",e,!1),document.addEventListener("mousedown",e,!1),t}()),function(t){(e=new r.DirectionalLight(16777215,.5)).position.copy(new r.Vector3(1,1,1)),t.add(e);var e=new r.DirectionalLight(16777215,.3);t.add(e),e=new r.AmbientLight(16777215,.3),t.add(e)}(f.scene),f.state={mode:null!==(u=f.currentMode)&&void 0!==u?u:"Panorama",panoIndex:null!==(d=f.panoIndex)&&void 0!==d?d:0,longitude:f.camera.pose.longitude,latitude:f.camera.pose.latitude,fov:f.camera.pose.fov,offset:f.camera.pose.offset.clone(),distance:f.camera.pose.distance},f.stateSynced=!1,f._enableIOSEDR=!1,f.destroyed=!1,f.paused=!0,"undefined"!=typeof window&&(!1!==i.play&&f.play(),!1!==(null!==(p=i.initialBasisLoader)&&void 0!==p&&p)&&("string"==typeof i.initialBasisLoader?f.initBasisLoader(i.initialBasisLoader):f.initBasisLoader()),f.stopAnimationLoop=Jt.shared.add((function(t,e){f.updateTime(t,e)}),!1,0,10));var v=function(){"undefined"!=typeof document&&null===document.fullscreenElement&&"VRPanorama"===f.currentMode&&f.controller.emit("vrWantsToExit")};if("undefined"!=typeof document&&document.addEventListener("fullscreenchange",v,!1),f.removeEventListeners=function(){"undefined"!=typeof document&&document.removeEventListener("fullscreenchange",v,!1)},f.plugins={},i.plugins&&i.plugins.length)for(var y=0,A=i.plugins;y<A.length;y++){var x=A[y];if("function"==typeof x)x(f);else if(Array.isArray(x)){var b=x[0],w=x[1],M=x[2];if("function"==typeof b){var E=b(f,M);"string"==typeof w&&(f.plugins[w]?f.throwError(new Error("plugin name ".concat(w," is exists."))):f.plugins[w]=E)}}}return f}return e.__extends(i,t),i.prototype.dispose=function(){var t;if(!0!==this.destroyed){delete Jy.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var e=this.getElement();e&&e.parentNode&&e.parentNode.removeChild(e),this.scene.remove(this.model);var i=this.model.getMaterial();i&&(i.pano0&&i.pano0.map.dispose(),i.pano1&&i.pano1.map!==(null===(t=i.pano0)||void 0===t?void 0:t.map)&&i.pano1.map.dispose()),this.model.dispose(),this.renderer instanceof ge&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},i.prototype.setScissor=function(t){Object.assign(this.scissor,t),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(i.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(t){this.helperGroup.visible!==t&&(this.helperGroup.visible=t,this.emit("helpersVisibleChange",t),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(t){this._enableIOSEDR!==t&&(this._enableIOSEDR=t,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(t){var e,i;if(t){if(!this.screenBuffer){var n=this.getDrawingBufferSize(tA);this.screenBuffer=new r.WebGLRenderTarget(n.x,n.y,{encoding:null!==(i=null===(e=this.renderer)||void 0===e?void 0:e.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(t){var e=!1;t.panorama&&(Object.assign(this.controllerInits.Panorama,t.panorama),"Panorama"===this.currentMode&&(e=!0)),t.model&&(Object.assign(this.controllerInits.Model,t.model),"Model"===this.currentMode&&(e=!0)),t.floorplan&&(Object.assign(this.controllerInits.Floorplan,t.floorplan),"Floorplan"===this.currentMode&&(e=!0)),t.topview&&(Object.assign(this.controllerInits.Topview,t.topview),"Topview"===this.currentMode&&(e=!0)),t.mapview&&(Object.assign(this.controllerInits.Mapview,t.topview),"Mapview"===this.currentMode&&(e=!0)),t.depthPanorama&&(Object.assign(this.controllerInits.DepthPanorama,t.depthPanorama),"DepthPanorama"===this.currentMode&&(e=!0)),t.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,t.vrPanorama),"VRPanorama"===this.currentMode&&(e=!0)),t.imageOptions&&(Object.assign(this.imageOptions,t.imageOptions),"Panorama"!==this.currentMode&&"DepthPanorama"!==this.currentMode&&"VRPanorama"!==this.currentMode||(e=!0)),e&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},i.prototype.appendTo=function(t,e){if(void 0===e&&(e={}),this.renderer)if(this.renderer instanceof ge){var i=this.getElement();if(i){t.appendChild(i),this.refresh(e);var n=window.getComputedStyle(t).position;"relative"!==n&&"absolute"!==n&&"fixed"!==n&&"sticky"!==n&&(t.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},i.prototype.refresh=function(t,e){if(void 0===t&&(t={}),this.renderer){var i=this.getElement();if(i){var n=i.parentNode;if(n&&n.nodeName){var o=t.width,a=void 0===o?n.offsetWidth:o,s=t.height,c=void 0===s?n.offsetHeight:s;this.renderer instanceof ge&&(e&&this.renderer.setPixelRatio(e),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(t){var e=this;return-1===this.extraElements.indexOf(t)&&(this.extraElements.push(t),this.controller&&this.controller.bindExtraElement(t)),function(){return e.removeExtraElement(t)}},i.prototype.removeExtraElement=function(t){var e=this.extraElements.indexOf(t);-1!==e&&(this.extraElements.splice(e,1),this.controller&&this.controller.unbindExtraElement(t))},i.prototype.getPose=function(){var t=this.camera.copyPose(),e=t.longitude,i=t.latitude,n=t.fov,r=t.offset,o=t.distance;return{longitude:e,latitude:i,fov:n,offset:r.clone(),distance:o}},i.prototype.getSize=function(t){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(t),t.x*=this.scissor.width,t.y*=this.scissor.height,t},i.prototype.getDrawingBufferSize=function(t){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(t),t.x*=this.scissor.width,t.y*=this.scissor.height,t},i.prototype.updateCamera=function(t,e,i){return void 0===i&&(i=!0),this.controller?this.controller.updateCamera(t,e,i):Promise.reject(new Error("controller is not initialized."))},i.prototype.getLongitudeAndLatitude=function(){var t=this.getPose();return{longitude:t.longitude,latitude:t.latitude}},i.prototype.getOffset=function(){return this.getPose().offset},i.prototype.getCameraLocal=function(){if("number"==typeof this.panoIndex&&this.controller&&this.work){var t=this.work.observers[this.panoIndex],e=new r.Object3D;return e.position.copy(t.position),e.quaternion.copy(t.quaternion),e.scale.set(1,1,1),e.updateMatrixWorld(!0),function(t,e){var i=new r.Vector3(0,0,-1);i.applyQuaternion(t.quaternion);var n=e.quaternion.clone().inverse();return i.applyQuaternion(n),{theta:Math.atan2(i.x,-i.z),phi:-Math.asin(i.y),lookAtVector:i}}(this.camera,e)}},i.prototype.initBasisLoader=function(t){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 t&&gi.setTranscoderPath(t),gi.workerConfig.format||gi.detectSupport(this.renderer),gi._allocateWorker(0)}catch(t){t instanceof Error&&this.throwError(t)}},Object.defineProperty(i.prototype,"work",{get:function(){var t=rA.get(this);if(t&&Um.get(t))return t},enumerable:!1,configurable:!0}),i.prototype.load=function(t,e,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=t)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then?r.load_(t,e,i,n):t.then((function(t){return r.load_(t,e,i,n)}));var o}));return this.lastLoadWorkTask=o.catch((function(t){r.throwError(t)})),o},i.prototype.load_=function(t,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(t),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?{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",t,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=e.__assign(e.__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",t,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(t){var e;void 0===t&&(t=Pt),A.model&&(m.model.name!==(null===(e=A.model)||void 0===e?void 0:e.file)?(m.emit("modelWillLoad",A.model),m.loadModel(A.model,A.allowHosts,t,!0)):t&&t())};return rA.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",t,m.work)}))},i.prototype.changeMode=function(t,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(t)){var h=new Error('mode "'.concat(t,'" is not existed'));return s.throwError(h),void l(h)}if((t===i.Mode.Floorplan||t===i.Mode.Topview||t===i.Mode.Mapview||t===i.Mode.Model)&&(_m(s.model)||!0!==s.model.loaded)){h=new Error("model is not ready.");return s.throwError(h),void l(h)}if(_m(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",t,d))l(new Error("change mode canceled."));else{if(s.controller&&!1===a&&d===t)t===i.Mode.Panorama||t===i.Mode.DepthPanorama||t===i.Mode.Model||t===i.Mode.VRPanorama?"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,e.__assign({duration:r},n),o):s.controller.updateCamera(n,r,o).catch(Pt):("number"==typeof n.panoIndex&&n.panoIndex!==s.panoIndex&&(s.panoIndex=n.panoIndex),s.controller.updateCamera(n,r,o).catch(Pt));else{u.destroy();var g=null!==(m=null!==(f=n.panoIndex)&&void 0!==f?f:s.panoIndex)&&void 0!==m?m:0,v=Oy(t)?s.panoramaLikeSavedPose:{};t===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=e.__assign(e.__assign({initial:[g,v,r,o]},s.commonParams()),s.controllerInits[t]);s.saveControllerPose(u),s.controller=s.applyController(t,y);var A=Dy[t].initAnimationEndPose(y);s.emit("modeChange",t,d,g,A)}c()}};t===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(t){if("granted"==t)return Promise.resolve();var e=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(e)})):Promise.resolve()).then((function(){return p()})).catch((function(t){t instanceof Error&&(s.exitFullscreen(),s.throwError(t),l(t))}))):p()}))},i.prototype.getPixels=function(t,e,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);t=Rm(t,Math.floor(i/2),Math.floor(s.x-i)),e=Rm(e,Math.floor(n/2),Math.floor(s.y-n)),t*=o,e*=o,i*=o,n*=o,a.setSize(s.x*o,s.y*o),a.scissor.set(t,e,i,n),a.scissorTest=!0,this.renderer.setRenderTarget(a);var c=new Uint8Array(i*n*4);return this.controller?this.controller.render():this.renderer.render(this.scene,this.camera),this.renderer.readRenderTargetPixels(a,t,e,i,n,c),this.renderer.setRenderTarget(null),a.setSize(1,1),a.scissor.set(0,0,0,0),a.scissorTest=!1,c},i.prototype.getElement=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.domElement},i.prototype.render=function(t,e){var i=this;if(void 0===e&&(e=!1),!this.renderer)return null;if(e){var n=this.renderer.getSize(tA);this.scene.traverseVisible((function(t){t.setResolution&&t.setResolution(n.x,n.y)}))}if(this.controller&&this.screenBuffer&&null===this.renderer.getRenderTarget()){var r=this.getDrawingBufferSize(tA);return this.screenBuffer.setSize(r.x,r.y),this.renderer.setRenderTarget(this.screenBuffer),this.controller.render(),this.renderer.setRenderTarget(null),"VRPanorama"!==this.currentMode&&this.poweredByRealsee&&Zy(this.renderer),this.renderer.setRenderTarget(null),t&&Jt.shared.add(t,!0),this.screenBuffer}return this.aroundScissor((function(){i.renderer&&(i.controller?i.controller.render():i.renderer.render(i.scene,i.camera),"VRPanorama"!==i.currentMode&&i.poweredByRealsee&&Zy(i.renderer)),t&&Jt.shared.add(t,!0)})),null},i.prototype.updateTime=function(t,e){var i=this;if(!this.destroyed){this.syncingState=this.syncState(t,e),this.controller&&this.controller.updateTime(t,e),this.syncingState=!1;var n=new r.Vector2(512,512),o=new r.Vector2(512,512);this.renderer&&(this.renderer.getSize(n),n.x*=this.scissor.width,n.y*=this.scissor.height,this.renderer.getDrawingBufferSize(o),o.x*=this.scissor.width,o.y*=this.scissor.height);var a=[];if(iA.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.renderer&&this.model.update(this.renderer,this.camera),eA.setFromProjectionMatrix(iA),this.scene.traverse((function(t){if(t.setResolution&&t.setResolution(n.x,n.y),t.mixer instanceof r.AnimationMixer){var e=nA.get(t.mixer);e||(e=new r.Clock,nA.set(t.mixer,e)),t.mixer.update(e.getDelta())}(t instanceof r.Mesh||t instanceof r.Line||t instanceof r.Points)&&(t instanceof r.ImmediateRenderObject||!t.frustumCulled||eA.intersectsObject(t))&&a.push(t)})),o.width*o.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var s=void 0;if(!0!==this.onlyRenderIfNeeds)s=this.render();else{for(var c=0,l=a;c<l.length;c++){var h=l[c],u=function(t){!0===t.needsRender?(t.needsRender=!1,i.needsRender=!0):t.mixer&&t.mixer.stats.actions.inUse>0&&(i.needsRender=!0)};u(h),h.traverseAncestors(u)}this.controller&&!0===this.controller.needsRender&&(this.controller.needsRender=!1,this.needsRender=!0),!1!==this.needsRender&&(s=this.render())}this.needsRender=!1,this.controller&&this.screenBuffer&&this.aroundScissor((function(){return i.controller.postProcessing(i.screenBuffer,void 0)})),this.hasListener("renderFrame")&&this.emit("renderFrame",void 0!==s)}if(this.fps.testTime&&t-this.fps.testTime<1e3)this.fps.testCount++;else if(this.emit("fps",this.fps.testCount),this.fps.testTime=t,this.fps.testCount=0,this.renderer){var d=function(t){var e=t.getError();if(e===t.NO_ERROR)return null;switch(e){case t.INVALID_ENUM:return new Error("webgl error: INVALID_ENUM");case t.INVALID_VALUE:return new Error("webgl error: INVALID_VALUE");case t.INVALID_OPERATION:return new Error("webgl error: INVALID_OPERATION");case t.INVALID_FRAMEBUFFER_OPERATION:return new Error("webgl error: INVALID_FRAMEBUFFER_OPERATION");case t.OUT_OF_MEMORY:return new Error("webgl error: OUT_OF_MEMORY");case t.CONTEXT_LOST_WEBGL:return new Error("webgl error: CONTEXT_LOST_WEBGL");default:return null}}(this.renderer.getContext());d&&this.throwError(d)}}},i.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof ge&&this.renderer.clear(!0,!0,!0)},i.prototype.play=function(){this.needsRender=!0,this.paused=!1},i.prototype.moveToPano=function(t,e,n){void 0===e&&(e={}),void 0===n&&(n=!0);var r=this,o=r.controller,a=r.currentMode,s=r.renderer;o?s?a===i.Mode.Floorplan||a===i.Mode.Topview||a===i.Mode.Mapview?_m(t)||(this.panoIndex=t,this.changeMode(i.Mode.Panorama,e,void 0,n)):o.moveToPano(t,e,n):this.throwError(new Error("renderer is not initialized.")):this.throwError(new Error("controller is not initialized."))},i.prototype.preloadPano=function(t,i){var n=this;if(void 0===i&&(i=Pt),!this.work)return Promise.reject(new Error("work never loaded"));var r=this.work.observers[t],o=Bt();return Promise.all(["right","left","up","down","front","back"].map((function(i){var o=e.__assign({key:"pano.".concat(t,".").concat(i),basisLoaderInitialized:gi.isInitialized()},Xe(n.imageOptions,["size","format","quality","mappings"])),a=r.images[i];return function(t,e){return void 0===e&&(e={}),t in Kt?Kt[t]:Kt[t]=new Promise((function(i,n){var r=document.createElement("link");r.href=t,r.rel=r.relList&&r.relList.supports("prefetch")?"prefetch":"preload",r.as="fetch",r.crossOrigin="";var o=Bt(),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=Bt(),a={source:t,requestTime:o,responseTime:r,costs:r-o,headers:{}};null===(n=e.networkSubscribe)||void 0===n||n.emit("network",t,"Link","preload",JSON.stringify(a))}},r.onerror=function(i){var r;if(!0!==s){s=!0;var o=new zt(t,"Link",0);n(o),null===(r=e.networkSubscribe)||void 0===r||r.emit("network",t,"Link","error",o.message)}}}))}(n.imageOptions.transform?n.imageOptions.transform(a,o):ie(a,o),{networkSubscribe:n.networkSubscribe})}))).then((function(){var t=Bt()-o;return i(t),t}))},i.prototype.project2d=function(t,e){if(void 0===e&&(e=!1),!this.renderer)return null;if(!1===this.model.empty&&e){var i=this.camera.position,n=t.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=t.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(t){iA.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),eA.setFromProjectionMatrix(iA),t||(t=this.scene);var e=[];return t.traverseVisible((function(t){(t instanceof r.Mesh||t instanceof r.Line||t instanceof r.Points)&&(t instanceof r.ImmediateRenderObject||!t.frustumCulled||eA.intersectsObject(t))&&e.push(t)})),e},i.prototype.getCurrentState=function(){return e.__assign(e.__assign({},this.getPose()),{mode:this.currentMode||i.Mode.Panorama,panoIndex:this.panoIndex||0})},i.prototype.setState=function(t,n,o){var a,s,c,l,h,u,d,p,f;void 0===n&&(n=!1),void 0===o&&(o=!0),!(t=Object.assign({},t)).offset||t instanceof r.Vector3||(t.offset=new r.Vector3(t.offset.x,t.offset.y,t.offset.z));var m,g,v,y,A,x=null!==(a=t.panoIndex)&&void 0!==a?a:this.state.panoIndex,b=null!==(s=t.mode)&&void 0!==s?s:this.state.mode;if(this.work)if(this.work.observers[x])if(t.mode!==i.Mode.Floorplan&&t.mode!==i.Mode.Topview&&t.mode!==i.Mode.Mapview&&t.mode!==i.Mode.Model||!_m(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=Oy(this.state.mode)&&Oy(b)?e.__assign({},this.state):Oy(b)?e.__assign({},this.panoramaLikeSavedPose):b===i.Mode.Mapview?{longitude:this.panoramaLikeSavedPose.latitude}:e.__assign({},t),"number"==typeof t.longitude&&(w.longitude=t.longitude),"number"==typeof t.latitude&&(w.latitude=t.latitude),"number"==typeof t.fov&&(w.fov=t.fov);var M=e.__assign(e.__assign({initial:[x,w,this.modeChangeDuration,!1]},this.commonParams()),this.controllerInits[b]),E=Dy[b].initAnimationEndPose(M);m=E.longitude,g=E.latitude,v=E.fov,y=E.offset,A=E.distance}else m=null!==(c=t.longitude)&&void 0!==c?c:this.state.longitude,g=null!==(l=t.latitude)&&void 0!==l?l:this.state.latitude,v=null!==(h=t.fov)&&void 0!==h?h:this.state.fov,y=null!==(u=t.offset)&&void 0!==u?u:this.state.offset,A=null!==(d=t.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),Wg(this.state,S)||(Qg(this.state,S),this.controller&&(this.controller.userAction=o),n&&this.state.mode===S.mode&&(this.syncingState=this.syncState(Bt(),0,n),this.syncingState&&(null===(p=this.controller)||void 0===p||p.updateTime(Bt(),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(t){if(this.renderer){var e=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(e);var n=Math.floor(e.x*this.scissor.left),o=Math.floor(e.y*this.scissor.bottom),a=Math.floor(e.x*this.scissor.width),s=Math.floor(e.y*this.scissor.height);this.renderer.setViewport(n,o,a,s),this.renderer.setScissor(n,o,a,s),this.renderer.setScissorTest(!0)}t(),i&&(this.renderer.setViewport(0,0,e.x,e.y),this.renderer.setScissor(0,0,e.x,e.y),this.renderer.setScissorTest(!1))}},i.prototype.syncState=function(t,e,n){void 0===n&&(n=!1);var o=this.stateSynced;if(this.stateSynced=!1,!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)for(var c=void 0;c=this.readyCallbacks.shift();)c()}if(this.controller instanceof Dy.Model){if(!this.camera.pose.offset.equals(this.state.offset)){var l={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,l,!1),!0}}else if(this.state.panoIndex!==this.panoIndex){l={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,l,!1),!0}if(this.controller instanceof Dy.Topview||this.controller instanceof Dy.Mapview){var h=1,u=n?this.state.fov:Gg(this.camera.pose.fov,this.state.fov,h),d=n?new r.Vector3(this.state.offset.x,this.state.offset.y,this.state.offset.z):new r.Vector3(Gg(this.camera.pose.offset.x,this.state.offset.x,.2),Gg(this.camera.pose.offset.y,this.state.offset.y,.2),Gg(this.camera.pose.offset.z,this.state.offset.z,.2));if(Lg(u,this.camera.pose.fov)||Og(d,this.camera.pose.offset))return this.controller.cameraMotion.set({fov:u},0).catch(Pt),this.controller.locationMotion.set({x:d.x,y:d.y,z:d.z},0).catch(Pt),!0}else{h=1;var p=Math.PI/45,f=(u=n?this.state.fov:Gg(this.camera.pose.fov,this.state.fov,h),n?{longitude:this.state.longitude,latitude:this.state.latitude}:function(t,e,i){if(t.longitude===e.longitude&&t.latitude===e.latitude)return{longitude:e.longitude,latitude:e.latitude};var n=zg(t.longitude),r=t.latitude,o=zg(e.longitude),a=e.latitude;o-n>Hg?n+=Ug:n-o>Hg&&(n-=Ug);var s=i/Math.sqrt(Math.pow(o-n,2)+Math.pow(a-r,2));return s>=1?{longitude:e.longitude,latitude:e.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},p)),m=f.longitude,g=f.latitude;if(Lg(m,this.camera.pose.longitude,2*Math.PI)||Lg(g,this.camera.pose.latitude)||Lg(u,this.camera.pose.fov))return this.controller.cameraMotion.set({longitude:m,latitude:g,fov:u},0).catch(Pt),!0}return this.stateSynced=!0,!1===o&&this.emit("stateSynced",this.state),!1},i.prototype.ready=function(){var t=this;return new Promise((function(e){return t.readyCallbacks.push(e)}))},i.prototype.requestFullscreen=function(){var t;if(jg()){var e=null===(t=this.getElement())||void 0===t?void 0:t.parentNode;e&&"requestFullscreen"in e&&"undefined"!=typeof document&&null===document.fullscreenElement&&e.requestFullscreen()}},i.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},i.prototype.throwError=function(t){this.hasListener("error")?this.emit("error",t):console.error(t)},i.prototype.loadModel=function(t,e,i,n){var o=this,a=t.file;this.emit("modelWillLoad",t);var s=new Pm({allowHosts:e,networkSubscribe:this.networkSubscribe});s.once("bvhLoaded",(function(){var t,e;o.destroyed||a===(null===(e=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===e?void 0:e.file)&&o.emit("modelBvhLoaded",s)})),s.once("materialLoaded",(function(){var t,e;o.destroyed||a===(null===(e=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===e?void 0:e.file)&&o.emit("modelMaterialLoaded",s)})),s.once("geometryLoaded",(function(){var t,e,i,n;if(!o.destroyed&&a===(null===(e=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===e?void 0:e.file)){s.bounding.max.y-s.bounding.min.y<1.5&&(s.bounding.max.y=s.bounding.min.y+10);var r,c=o.model;c&&(c.show(),r=c.getMaterial()||{},o.scene.remove(c),c.dispose(),s.setTransparent(c.getTransparent())),r&&s.setMaterial(r),o.model=s,o.scene.add(s),null===(i=o.controller)||void 0===i||i.updateModel(s),null===(n=o.renderer)||void 0===n||n.compile(o.scene,o.camera),o.needsRender=!0,o.modelPending=!1,o.emit("modelGeometryLoaded",s)}})),s.once("loaded",(function(){var t,e;o.destroyed||a===(null===(e=null===(t=o.work)||void 0===t?void 0:t.model)||void 0===e?void 0:e.file)&&(i(),o.emit("modelLoaded",s))})),s.on("shownFloorChange",(function(t,e){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",t,e)})),s.on("error",(function(t){var e,n,c,l;if(!o.destroyed&&a===(null===(n=null===(e=o.work)||void 0===e?void 0:e.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=Fg(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",t,s),o.throwError(t),o.modelPending=!1,i()}})),this.modelPending=!0,s.load(t,this.textureOptions).catch(Pt)},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}},i.prototype.saveControllerPose=function(t){void 0===t&&(t=this.controller),t&&Oy(t)&&(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(t,n){var r=this;if(!this.renderer)throw new Error("renderer is not initialized.");var o=Dy[t];t===this.currentMode||this.model.empty||this.model.show(),this.model.setTransparent(t===i.Mode.Floorplan||t===i.Mode.Topview||t===i.Mode.Model||t===i.Mode.Mapview),this.currentMode=t;for(var a=new o(n),s=function(t){a.on(t,(function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var o=r.emit.apply(r,e.__spreadArray([t],i,!1));if(o)return!1}))},c=0,l=Ny;c<l.length;c++){s(l[c])}var h=Dy[t].initAnimationEndPose(n),u=n.initial[3],d={panoIndex:n.initial[0],mode:t,longitude:h.longitude,latitude:h.latitude,fov:h.fov,offset:h.offset,distance:h.distance};return Wg(this.state,d)||(Qg(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=e.__assign(e.__assign({},r.controller.getTargetPose()),{panoIndex:r.panoIndex,mode:t});n&&!1===r.syncingState&&r.state.mode===a.mode&&!Wg(r.state,a)&&(Qg(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=e.__assign(e.__assign({},n),{panoIndex:i,mode:t});o&&r.state.mode===s.mode&&!Wg(r.state,s)&&(Qg(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=e.__assign(e.__assign({},n),{panoIndex:i,mode:t});o&&r.state.mode===s.mode&&!Wg(r.state,s)&&(Qg(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=e.__assign(e.__assign({},n),{panoIndex:i,mode:t});o&&r.state.mode===s.mode&&!Wg(r.state,s)&&(Qg(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=e.__assign(e.__assign({},n),{panoIndex:i,mode:t});o&&r.state.mode===s.mode&&!Wg(r.state,s)&&(Qg(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(t,e){r.emit("currentStateChange",r.getCurrentState(),e)})),a.on("wantsMoveToPano",(function(t,e,i){var n=r.emit("wantsMoveToPano",t,e,i);n||(n=r.emit("wantsToMoveToPano",t,e,i)),n||r.moveToPano(t,e,i)})),a.on("vrWantsToExit",(function(){r.currentMode===i.Mode.VRPanorama&&(r.exitFullscreen(),r.changeMode(i.Mode.Panorama))})),a.on("error",(function(t){return r.throwError(t)})),a},i.prototype.removeEventListeners=function(){},i.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama"},i.Line=null,i}(It);exports.AnimationFrameLoop=Jt,exports.BVH=Le,exports.BVHIntersect=Ce,exports.BVHNode=Te,exports.BVHVector3=_e,exports.Camera=Se,exports.Five=oA,exports.InternalWebGLRenderer=ge,exports.IntersectMesh=Rg,exports.LegacyPanoCircleMesh=dg,exports.Model=Pm,exports.NetworkSubscribe=Wt,exports.PBMContainer=ae,exports.PBMGroup=se,exports.PBMMaterial=me,exports.PBMMesh=oe,exports.PROXY_CONTROLLER_EVENT_NAMES=Ny,exports.PanoCircleMesh=Tg,exports.Scene=ve,exports.Subscribe=It,exports.Tile3DModel=Sm,exports.Work=Gm,exports.defaultImageURLTransform=ie,exports.getViewportScale=Fy,exports.imageSupport=function(){return re||(re=Promise.all([ne("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),ne("data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA")]).then((function(t){var e=t[0];return{webp:t[1],avif:e}})).catch((function(){return{webp:!1,avif:!1}})))},exports.parseWork=qm;