@cesium/engine 3.0.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-2U6EBIRX.js +757 -0
  5. package/Build/Workers/chunk-2ZI7FZ3Q.js +58 -0
  6. package/Build/Workers/chunk-3TSHZWOZ.js +1860 -0
  7. package/Build/Workers/chunk-44B6FQSJ.js +684 -0
  8. package/Build/Workers/chunk-4AJR66C5.js +368 -0
  9. package/Build/Workers/chunk-4HN3N5SE.js +501 -0
  10. package/Build/Workers/chunk-4QGPYV3W.js +102 -0
  11. package/Build/Workers/chunk-4RKE4B3G.js +476 -0
  12. package/Build/Workers/chunk-5E3V7Y4R.js +196 -0
  13. package/Build/Workers/chunk-6EHT6GS3.js +163 -0
  14. package/Build/Workers/chunk-6I22NWKQ.js +171 -0
  15. package/Build/Workers/chunk-7N67FBLW.js +1054 -0
  16. package/Build/Workers/chunk-AQQGAFKX.js +124 -0
  17. package/Build/Workers/chunk-CROU4RHL.js +138 -0
  18. package/Build/Workers/chunk-CTJCECTX.js +258 -0
  19. package/Build/Workers/chunk-DWJZFZ67.js +781 -0
  20. package/Build/Workers/chunk-EHJQEARC.js +59 -0
  21. package/Build/Workers/chunk-EVLKHUAE.js +1477 -0
  22. package/Build/Workers/chunk-FOOYJER7.js +834 -0
  23. package/Build/Workers/chunk-GLCRFDOB.js +73 -0
  24. package/Build/Workers/chunk-GPO47TW4.js +39 -0
  25. package/Build/Workers/chunk-H5Q2JKIA.js +1075 -0
  26. package/Build/Workers/chunk-HIDSEUWS.js +2041 -0
  27. package/Build/Workers/chunk-HV67ARO7.js +302 -0
  28. package/Build/Workers/chunk-IC7G4BX2.js +421 -0
  29. package/Build/Workers/chunk-IQN2LMGD.js +55 -0
  30. package/Build/Workers/chunk-J2FHYK2Z.js +55 -0
  31. package/Build/Workers/chunk-K3VEWONC.js +289 -0
  32. package/Build/Workers/chunk-KZFXE35V.js +117 -0
  33. package/Build/Workers/chunk-MG2TXIO5.js +400 -0
  34. package/Build/Workers/chunk-MRCFDEKH.js +138 -0
  35. package/Build/Workers/chunk-MYDS6HBL.js +3273 -0
  36. package/Build/Workers/chunk-OCIX2CQ7.js +305 -0
  37. package/Build/Workers/chunk-P32XMW4I.js +2716 -0
  38. package/Build/Workers/chunk-PEVZYZBQ.js +157 -0
  39. package/Build/Workers/chunk-PMDLIBEQ.js +218 -0
  40. package/Build/Workers/chunk-QDUOGCCO.js +1009 -0
  41. package/Build/Workers/chunk-QUCJGBCK.js +430 -0
  42. package/Build/Workers/chunk-RCI7BSOM.js +452 -0
  43. package/Build/Workers/chunk-SVTSC7FX.js +390 -0
  44. package/Build/Workers/chunk-TXOGSFHZ.js +77 -0
  45. package/Build/Workers/chunk-TXYJOVQK.js +629 -0
  46. package/Build/Workers/chunk-UFIT5XDI.js +1258 -0
  47. package/Build/Workers/chunk-ULLMQNFQ.js +73 -0
  48. package/Build/Workers/chunk-UM7FIUQW.js +101 -0
  49. package/Build/Workers/{package.js → chunk-UMLTOPAE.js} +13 -2
  50. package/Build/Workers/chunk-V5S5N2IS.js +8644 -0
  51. package/Build/Workers/chunk-VN2IHJKM.js +513 -0
  52. package/Build/Workers/chunk-VWSD2XV5.js +669 -0
  53. package/Build/Workers/chunk-X2KIWBTW.js +100 -0
  54. package/Build/Workers/chunk-Y24CDOJC.js +353 -0
  55. package/Build/Workers/chunk-YLMDWSXO.js +44 -0
  56. package/Build/Workers/chunk-YNZ4DMR7.js +634 -0
  57. package/Build/Workers/chunk-Z2MP3UBE.js +236 -0
  58. package/Build/Workers/combineGeometry.js +65 -15
  59. package/Build/Workers/createBoxGeometry.js +55 -10
  60. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  61. package/Build/Workers/createCircleGeometry.js +185 -202
  62. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  65. package/Build/Workers/createCorridorGeometry.js +1163 -1307
  66. package/Build/Workers/createCorridorOutlineGeometry.js +534 -569
  67. package/Build/Workers/createCylinderGeometry.js +57 -10
  68. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  69. package/Build/Workers/createEllipseGeometry.js +68 -12
  70. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  71. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  73. package/Build/Workers/createFrustumGeometry.js +55 -10
  74. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  75. package/Build/Workers/createGeometry.js +143 -48
  76. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2012
  77. package/Build/Workers/createPlaneGeometry.js +216 -243
  78. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  79. package/Build/Workers/createPolygonGeometry.js +1437 -1314
  80. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  81. package/Build/Workers/createPolylineGeometry.js +471 -547
  82. package/Build/Workers/createPolylineVolumeGeometry.js +354 -384
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +272 -295
  84. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  85. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  86. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  87. package/Build/Workers/createSphereGeometry.js +112 -118
  88. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  89. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  90. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  91. package/Build/Workers/createVectorTileGeometries.js +377 -436
  92. package/Build/Workers/createVectorTilePoints.js +110 -77
  93. package/Build/Workers/createVectorTilePolygons.js +369 -391
  94. package/Build/Workers/createVectorTilePolylines.js +252 -244
  95. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  96. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  97. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  98. package/Build/Workers/createWallGeometry.js +459 -593
  99. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  100. package/Build/Workers/decodeDraco.js +327 -347
  101. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  102. package/Build/Workers/decodeI3S.js +765 -970
  103. package/Build/Workers/transcodeKTX2.js +3351 -1473
  104. package/Build/Workers/transferTypedArrayTest.js +3 -4
  105. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  106. package/LICENSE.md +0 -12
  107. package/Source/Core/CesiumTerrainProvider.js +1 -2
  108. package/Source/Core/Credit.js +7 -1
  109. package/Source/Core/FeatureDetection.js +9 -0
  110. package/Source/Core/GoogleMaps.js +1 -2
  111. package/Source/Core/Ion.js +1 -2
  112. package/Source/Core/KTX2Transcoder.js +7 -3
  113. package/Source/Core/PolygonGeometry.js +340 -27
  114. package/Source/Core/PolygonGeometryLibrary.js +302 -1
  115. package/Source/Core/Stereographic.js +247 -0
  116. package/Source/Core/TaskProcessor.js +185 -168
  117. package/Source/Core/Transforms.js +2 -2
  118. package/Source/Core/buildModuleUrl.js +6 -5
  119. package/Source/Core/sampleTerrain.js +43 -10
  120. package/Source/Core/sampleTerrainMostDetailed.js +27 -3
  121. package/Source/Scene/ArcGisMapService.js +1 -2
  122. package/Source/Scene/Billboard.js +7 -0
  123. package/Source/Scene/Cesium3DTilePass.js +1 -1
  124. package/Source/Scene/Cesium3DTileset.js +38 -81
  125. package/Source/Scene/CreditDisplay.js +2 -2
  126. package/Source/Scene/DracoLoader.js +26 -3
  127. package/Source/Scene/I3SDataProvider.js +0 -27
  128. package/Source/Scene/I3SDecoder.js +127 -0
  129. package/Source/Scene/I3SNode.js +32 -110
  130. package/Source/Scene/Implicit3DTileContent.js +13 -0
  131. package/Source/Scene/ImplicitTileset.js +5 -0
  132. package/Source/Scene/LabelCollection.js +3 -1
  133. package/Source/Scene/Model/I3dmLoader.js +5 -1
  134. package/Source/Scene/Model/Model.js +20 -23
  135. package/Source/Scene/OpenStreetMapImageryProvider.js +4 -1
  136. package/Source/Scene/PostProcessStageLibrary.js +3 -3
  137. package/Source/Scene/PrimitiveCollection.js +39 -0
  138. package/Source/Scene/Scene.js +3 -0
  139. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  140. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  141. package/Source/Widget/CesiumWidget.js +2 -1
  142. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  143. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  144. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  145. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  146. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  147. package/Source/Workers/transferTypedArrayTest.js +0 -6
  148. package/index.d.ts +69 -35
  149. package/index.js +189 -187
  150. package/package.json +2 -1
  151. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  152. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  153. package/Build/Workers/AxisAlignedBoundingBox-a03420b1.js +0 -258
  154. package/Build/Workers/BoundingRectangle-32fa8a4a.js +0 -369
  155. package/Build/Workers/BoxGeometry-cd550612.js +0 -884
  156. package/Build/Workers/Check-6ede7e26.js +0 -290
  157. package/Build/Workers/Color-571a6085.js +0 -2262
  158. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  159. package/Build/Workers/CoplanarPolygonGeometryLibrary-488b1a9f.js +0 -132
  160. package/Build/Workers/CorridorGeometryLibrary-fc4ff147.js +0 -498
  161. package/Build/Workers/CylinderGeometry-bc26926d.js +0 -467
  162. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  163. package/Build/Workers/EllipseGeometry-89533a10.js +0 -1304
  164. package/Build/Workers/EllipseGeometryLibrary-b0d7df17.js +0 -366
  165. package/Build/Workers/EllipseOutlineGeometry-63ff7a87.js +0 -443
  166. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  167. package/Build/Workers/EllipsoidGeometry-07e99d2d.js +0 -637
  168. package/Build/Workers/EllipsoidOutlineGeometry-ba5c7ee2.js +0 -454
  169. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  170. package/Build/Workers/EllipsoidTangentPlane-65d41b3e.js +0 -373
  171. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  172. package/Build/Workers/FrustumGeometry-4a7589ed.js +0 -2540
  173. package/Build/Workers/GeometryAttribute-a5b6275b.js +0 -619
  174. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  175. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  176. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  177. package/Build/Workers/GeometryPipeline-fa9e6ffc.js +0 -3690
  178. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  179. package/Build/Workers/IntersectionTests-feace3da.js +0 -1836
  180. package/Build/Workers/Math-0a2ac845.js +0 -1340
  181. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  182. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  183. package/Build/Workers/OrientedBoundingBox-6b94d955.js +0 -1259
  184. package/Build/Workers/Plane-4c3d403b.js +0 -309
  185. package/Build/Workers/PolygonGeometryLibrary-4ffc457d.js +0 -1074
  186. package/Build/Workers/PolygonPipeline-d5e66350.js +0 -1344
  187. package/Build/Workers/PolylinePipeline-83410f0c.js +0 -573
  188. package/Build/Workers/PolylineVolumeGeometryLibrary-290e7aec.js +0 -781
  189. package/Build/Workers/PrimitivePipeline-6081d138.js +0 -966
  190. package/Build/Workers/RectangleGeometryLibrary-986710d8.js +0 -280
  191. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  192. package/Build/Workers/TerrainEncoding-528e1d68.js +0 -1227
  193. package/Build/Workers/Transforms-b527bb09.js +0 -14714
  194. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  195. package/Build/Workers/WallGeometryLibrary-faf583f8.js +0 -211
  196. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  197. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  198. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  199. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  200. package/Build/Workers/combine-d9581036.js +0 -82
  201. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  202. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  203. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  204. package/Source/Workers/package.json +0 -1
  205. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  231. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  232. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  233. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  234. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  235. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  236. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  237. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  238. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  239. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  240. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  241. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  242. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  243. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  244. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  245. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  246. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,1363 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.108
5
- *
6
- * Copyright 2011-2022 Cesium Contributors
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- *
20
- * Columbus View (Pat. Pend.)
21
- *
22
- * Portions licensed separately.
23
- * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
- */
25
-
26
- if (typeof self === "undefined") {
27
- self = {};
28
- }
29
- self.onmessage = function(event) {
30
- var data = event.data;
31
- require(data.loaderConfig, [data.workerModule], function(workerModule) {
32
- self.onmessage = workerModule;
33
- self.CESIUM_BASE_URL = data.loaderConfig.baseUrl;
34
- });
35
- };
36
- function setTimeout(fn) {
37
- fn();
38
- }
39
- /** vim: et:ts=4:sw=4:sts=4
40
- * @license RequireJS 2.1.20 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
41
- * Available via the MIT or new BSD license.
42
- * see: http://github.com/jrburke/requirejs for details
43
- */
44
- var requirejs, require, define;
45
- (function(global) {
46
- var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, version = "2.1.20", commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, currDirRegExp = /^\.\//, op = Object.prototype, ostring = op.toString, hasOwn = op.hasOwnProperty, ap = Array.prototype, isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document), isWebWorker = !isBrowser && typeof importScripts !== "undefined", readyRegExp = isBrowser && navigator.platform === "PLAYSTATION 3" ? /^complete$/ : /^(complete|loaded)$/, defContextName = "_", isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]", contexts = {}, cfg = {}, globalDefQueue = [], useInteractive = false;
47
- function isFunction(it) {
48
- return ostring.call(it) === "[object Function]";
49
- }
50
- function isArray(it) {
51
- return ostring.call(it) === "[object Array]";
52
- }
53
- function each(ary, func) {
54
- if (ary) {
55
- var i;
56
- for (i = 0; i < ary.length; i += 1) {
57
- if (ary[i] && func(ary[i], i, ary)) {
58
- break;
59
- }
60
- }
61
- }
62
- }
63
- function eachReverse(ary, func) {
64
- if (ary) {
65
- var i;
66
- for (i = ary.length - 1; i > -1; i -= 1) {
67
- if (ary[i] && func(ary[i], i, ary)) {
68
- break;
69
- }
70
- }
71
- }
72
- }
73
- function hasProp(obj, prop) {
74
- return hasOwn.call(obj, prop);
75
- }
76
- function getOwn(obj, prop) {
77
- return hasProp(obj, prop) && obj[prop];
78
- }
79
- function eachProp(obj, func) {
80
- var prop;
81
- for (prop in obj) {
82
- if (hasProp(obj, prop)) {
83
- if (func(obj[prop], prop)) {
84
- break;
85
- }
86
- }
87
- }
88
- }
89
- function mixin(target, source, force, deepStringMixin) {
90
- if (source) {
91
- eachProp(source, function(value, prop) {
92
- if (force || !hasProp(target, prop)) {
93
- if (deepStringMixin && typeof value === "object" && value && !isArray(value) && !isFunction(value) && !(value instanceof RegExp)) {
94
- if (!target[prop]) {
95
- target[prop] = {};
96
- }
97
- mixin(target[prop], value, force, deepStringMixin);
98
- } else {
99
- target[prop] = value;
100
- }
101
- }
102
- });
103
- }
104
- return target;
105
- }
106
- function bind(obj, fn) {
107
- return function() {
108
- return fn.apply(obj, arguments);
109
- };
110
- }
111
- function scripts() {
112
- return document.getElementsByTagName("script");
113
- }
114
- function defaultOnError(err) {
115
- throw err;
116
- }
117
- function getGlobal(value) {
118
- if (!value) {
119
- return value;
120
- }
121
- var g = global;
122
- each(value.split("."), function(part) {
123
- g = g[part];
124
- });
125
- return g;
126
- }
127
- function makeError(id, msg, err, requireModules) {
128
- var e = new Error(msg + "\nhttp://requirejs.org/docs/errors.html#" + id);
129
- e.requireType = id;
130
- e.requireModules = requireModules;
131
- if (err) {
132
- e.originalError = err;
133
- }
134
- return e;
135
- }
136
- if (typeof define !== "undefined") {
137
- return;
138
- }
139
- if (typeof requirejs !== "undefined") {
140
- if (isFunction(requirejs)) {
141
- return;
142
- }
143
- cfg = requirejs;
144
- requirejs = void 0;
145
- }
146
- if (typeof require !== "undefined" && !isFunction(require)) {
147
- cfg = require;
148
- require = void 0;
149
- }
150
- function newContext(contextName) {
151
- var inCheckLoaded, Module, context, handlers, checkLoadedTimeoutId, config = {
152
- //Defaults. Do not set a default for map
153
- //config to speed up normalize(), which
154
- //will run faster if there is no default.
155
- waitSeconds: 7,
156
- baseUrl: "./",
157
- paths: {},
158
- bundles: {},
159
- pkgs: {},
160
- shim: {},
161
- config: {}
162
- }, registry = {}, enabledRegistry = {}, undefEvents = {}, defQueue = [], defined = {}, urlFetched = {}, bundlesMap = {}, requireCounter = 1, unnormalizedCounter = 1;
163
- function trimDots(ary) {
164
- var i, part;
165
- for (i = 0; i < ary.length; i++) {
166
- part = ary[i];
167
- if (part === ".") {
168
- ary.splice(i, 1);
169
- i -= 1;
170
- } else if (part === "..") {
171
- if (i === 0 || i === 1 && ary[2] === ".." || ary[i - 1] === "..") {
172
- continue;
173
- } else if (i > 0) {
174
- ary.splice(i - 1, 2);
175
- i -= 2;
176
- }
177
- }
178
- }
179
- }
180
- function normalize(name, baseName, applyMap) {
181
- var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, foundMap, foundI, foundStarMap, starI, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = map && map["*"];
182
- if (name) {
183
- name = name.split("/");
184
- lastIndex = name.length - 1;
185
- if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
186
- name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, "");
187
- }
188
- if (name[0].charAt(0) === "." && baseParts) {
189
- normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
190
- name = normalizedBaseParts.concat(name);
191
- }
192
- trimDots(name);
193
- name = name.join("/");
194
- }
195
- if (applyMap && map && (baseParts || starMap)) {
196
- nameParts = name.split("/");
197
- outerLoop:
198
- for (i = nameParts.length; i > 0; i -= 1) {
199
- nameSegment = nameParts.slice(0, i).join("/");
200
- if (baseParts) {
201
- for (j = baseParts.length; j > 0; j -= 1) {
202
- mapValue = getOwn(map, baseParts.slice(0, j).join("/"));
203
- if (mapValue) {
204
- mapValue = getOwn(mapValue, nameSegment);
205
- if (mapValue) {
206
- foundMap = mapValue;
207
- foundI = i;
208
- break outerLoop;
209
- }
210
- }
211
- }
212
- }
213
- if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
214
- foundStarMap = getOwn(starMap, nameSegment);
215
- starI = i;
216
- }
217
- }
218
- if (!foundMap && foundStarMap) {
219
- foundMap = foundStarMap;
220
- foundI = starI;
221
- }
222
- if (foundMap) {
223
- nameParts.splice(0, foundI, foundMap);
224
- name = nameParts.join("/");
225
- }
226
- }
227
- pkgMain = getOwn(config.pkgs, name);
228
- return pkgMain ? pkgMain : name;
229
- }
230
- function removeScript(name) {
231
- if (isBrowser) {
232
- each(scripts(), function(scriptNode) {
233
- if (scriptNode.getAttribute("data-requiremodule") === name && scriptNode.getAttribute("data-requirecontext") === context.contextName) {
234
- scriptNode.parentNode.removeChild(scriptNode);
235
- return true;
236
- }
237
- });
238
- }
239
- }
240
- function hasPathFallback(id) {
241
- var pathConfig = getOwn(config.paths, id);
242
- if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
243
- pathConfig.shift();
244
- context.require.undef(id);
245
- context.makeRequire(null, {
246
- skipMap: true
247
- })([id]);
248
- return true;
249
- }
250
- }
251
- function splitPrefix(name) {
252
- var prefix, index = name ? name.indexOf("!") : -1;
253
- if (index > -1) {
254
- prefix = name.substring(0, index);
255
- name = name.substring(index + 1, name.length);
256
- }
257
- return [prefix, name];
258
- }
259
- function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
260
- var url, pluginModule, suffix, nameParts, prefix = null, parentName = parentModuleMap ? parentModuleMap.name : null, originalName = name, isDefine = true, normalizedName = "";
261
- if (!name) {
262
- isDefine = false;
263
- name = "_@r" + (requireCounter += 1);
264
- }
265
- nameParts = splitPrefix(name);
266
- prefix = nameParts[0];
267
- name = nameParts[1];
268
- if (prefix) {
269
- prefix = normalize(prefix, parentName, applyMap);
270
- pluginModule = getOwn(defined, prefix);
271
- }
272
- if (name) {
273
- if (prefix) {
274
- if (pluginModule && pluginModule.normalize) {
275
- normalizedName = pluginModule.normalize(name, function(name2) {
276
- return normalize(name2, parentName, applyMap);
277
- });
278
- } else {
279
- normalizedName = name.indexOf("!") === -1 ? normalize(name, parentName, applyMap) : name;
280
- }
281
- } else {
282
- normalizedName = normalize(name, parentName, applyMap);
283
- nameParts = splitPrefix(normalizedName);
284
- prefix = nameParts[0];
285
- normalizedName = nameParts[1];
286
- isNormalized = true;
287
- url = context.nameToUrl(normalizedName);
288
- }
289
- }
290
- suffix = prefix && !pluginModule && !isNormalized ? "_unnormalized" + (unnormalizedCounter += 1) : "";
291
- return {
292
- prefix,
293
- name: normalizedName,
294
- parentMap: parentModuleMap,
295
- unnormalized: !!suffix,
296
- url,
297
- originalName,
298
- isDefine,
299
- id: (prefix ? prefix + "!" + normalizedName : normalizedName) + suffix
300
- };
301
- }
302
- function getModule(depMap) {
303
- var id = depMap.id, mod = getOwn(registry, id);
304
- if (!mod) {
305
- mod = registry[id] = new context.Module(depMap);
306
- }
307
- return mod;
308
- }
309
- function on(depMap, name, fn) {
310
- var id = depMap.id, mod = getOwn(registry, id);
311
- if (hasProp(defined, id) && (!mod || mod.defineEmitComplete)) {
312
- if (name === "defined") {
313
- fn(defined[id]);
314
- }
315
- } else {
316
- mod = getModule(depMap);
317
- if (mod.error && name === "error") {
318
- fn(mod.error);
319
- } else {
320
- mod.on(name, fn);
321
- }
322
- }
323
- }
324
- function onError(err, errback) {
325
- var ids = err.requireModules, notified = false;
326
- if (errback) {
327
- errback(err);
328
- } else {
329
- each(ids, function(id) {
330
- var mod = getOwn(registry, id);
331
- if (mod) {
332
- mod.error = err;
333
- if (mod.events.error) {
334
- notified = true;
335
- mod.emit("error", err);
336
- }
337
- }
338
- });
339
- if (!notified) {
340
- req.onError(err);
341
- }
342
- }
343
- }
344
- function takeGlobalQueue() {
345
- if (globalDefQueue.length) {
346
- each(globalDefQueue, function(queueItem) {
347
- var id = queueItem[0];
348
- if (typeof id === "string") {
349
- context.defQueueMap[id] = true;
350
- }
351
- defQueue.push(queueItem);
352
- });
353
- globalDefQueue = [];
354
- }
355
- }
356
- handlers = {
357
- require: function(mod) {
358
- if (mod.require) {
359
- return mod.require;
360
- } else {
361
- return mod.require = context.makeRequire(mod.map);
362
- }
363
- },
364
- exports: function(mod) {
365
- mod.usingExports = true;
366
- if (mod.map.isDefine) {
367
- if (mod.exports) {
368
- return defined[mod.map.id] = mod.exports;
369
- } else {
370
- return mod.exports = defined[mod.map.id] = {};
371
- }
372
- }
373
- },
374
- module: function(mod) {
375
- if (mod.module) {
376
- return mod.module;
377
- } else {
378
- return mod.module = {
379
- id: mod.map.id,
380
- uri: mod.map.url,
381
- config: function() {
382
- return getOwn(config.config, mod.map.id) || {};
383
- },
384
- exports: mod.exports || (mod.exports = {})
385
- };
386
- }
387
- }
388
- };
389
- function cleanRegistry(id) {
390
- delete registry[id];
391
- delete enabledRegistry[id];
392
- }
393
- function breakCycle(mod, traced, processed) {
394
- var id = mod.map.id;
395
- if (mod.error) {
396
- mod.emit("error", mod.error);
397
- } else {
398
- traced[id] = true;
399
- each(mod.depMaps, function(depMap, i) {
400
- var depId = depMap.id, dep = getOwn(registry, depId);
401
- if (dep && !mod.depMatched[i] && !processed[depId]) {
402
- if (getOwn(traced, depId)) {
403
- mod.defineDep(i, defined[depId]);
404
- mod.check();
405
- } else {
406
- breakCycle(dep, traced, processed);
407
- }
408
- }
409
- });
410
- processed[id] = true;
411
- }
412
- }
413
- function checkLoaded() {
414
- var err, usingPathFallback, waitInterval = config.waitSeconds * 1e3, expired = waitInterval && context.startTime + waitInterval < (/* @__PURE__ */ new Date()).getTime(), noLoads = [], reqCalls = [], stillLoading = false, needCycleCheck = true;
415
- if (inCheckLoaded) {
416
- return;
417
- }
418
- inCheckLoaded = true;
419
- eachProp(enabledRegistry, function(mod) {
420
- var map = mod.map, modId = map.id;
421
- if (!mod.enabled) {
422
- return;
423
- }
424
- if (!map.isDefine) {
425
- reqCalls.push(mod);
426
- }
427
- if (!mod.error) {
428
- if (!mod.inited && expired) {
429
- if (hasPathFallback(modId)) {
430
- usingPathFallback = true;
431
- stillLoading = true;
432
- } else {
433
- noLoads.push(modId);
434
- removeScript(modId);
435
- }
436
- } else if (!mod.inited && mod.fetched && map.isDefine) {
437
- stillLoading = true;
438
- if (!map.prefix) {
439
- return needCycleCheck = false;
440
- }
441
- }
442
- }
443
- });
444
- if (expired && noLoads.length) {
445
- err = makeError(
446
- "timeout",
447
- "Load timeout for modules: " + noLoads,
448
- null,
449
- noLoads
450
- );
451
- err.contextName = context.contextName;
452
- return onError(err);
453
- }
454
- if (needCycleCheck) {
455
- each(reqCalls, function(mod) {
456
- breakCycle(mod, {}, {});
457
- });
458
- }
459
- if ((!expired || usingPathFallback) && stillLoading) {
460
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
461
- checkLoadedTimeoutId = setTimeout(function() {
462
- checkLoadedTimeoutId = 0;
463
- checkLoaded();
464
- }, 50);
465
- }
466
- }
467
- inCheckLoaded = false;
468
- }
469
- Module = function(map) {
470
- this.events = getOwn(undefEvents, map.id) || {};
471
- this.map = map;
472
- this.shim = getOwn(config.shim, map.id);
473
- this.depExports = [];
474
- this.depMaps = [];
475
- this.depMatched = [];
476
- this.pluginMaps = {};
477
- this.depCount = 0;
478
- };
479
- Module.prototype = {
480
- init: function(depMaps, factory, errback, options) {
481
- options = options || {};
482
- if (this.inited) {
483
- return;
484
- }
485
- this.factory = factory;
486
- if (errback) {
487
- this.on("error", errback);
488
- } else if (this.events.error) {
489
- errback = bind(this, function(err) {
490
- this.emit("error", err);
491
- });
492
- }
493
- this.depMaps = depMaps && depMaps.slice(0);
494
- this.errback = errback;
495
- this.inited = true;
496
- this.ignore = options.ignore;
497
- if (options.enabled || this.enabled) {
498
- this.enable();
499
- } else {
500
- this.check();
501
- }
502
- },
503
- defineDep: function(i, depExports) {
504
- if (!this.depMatched[i]) {
505
- this.depMatched[i] = true;
506
- this.depCount -= 1;
507
- this.depExports[i] = depExports;
508
- }
509
- },
510
- fetch: function() {
511
- if (this.fetched) {
512
- return;
513
- }
514
- this.fetched = true;
515
- context.startTime = (/* @__PURE__ */ new Date()).getTime();
516
- var map = this.map;
517
- if (this.shim) {
518
- context.makeRequire(this.map, {
519
- enableBuildCallback: true
520
- })(
521
- this.shim.deps || [],
522
- bind(this, function() {
523
- return map.prefix ? this.callPlugin() : this.load();
524
- })
525
- );
526
- } else {
527
- return map.prefix ? this.callPlugin() : this.load();
528
- }
529
- },
530
- load: function() {
531
- var url = this.map.url;
532
- if (!urlFetched[url]) {
533
- urlFetched[url] = true;
534
- context.load(this.map.id, url);
535
- }
536
- },
537
- /**
538
- * Checks if the module is ready to define itself, and if so,
539
- * define it.
540
- * @private
541
- */
542
- check: function() {
543
- if (!this.enabled || this.enabling) {
544
- return;
545
- }
546
- var err, cjsModule, id = this.map.id, depExports = this.depExports, exports = this.exports, factory = this.factory;
547
- if (!this.inited) {
548
- if (!hasProp(context.defQueueMap, id)) {
549
- this.fetch();
550
- }
551
- } else if (this.error) {
552
- this.emit("error", this.error);
553
- } else if (!this.defining) {
554
- this.defining = true;
555
- if (this.depCount < 1 && !this.defined) {
556
- if (isFunction(factory)) {
557
- if (this.events.error && this.map.isDefine || req.onError !== defaultOnError) {
558
- try {
559
- exports = context.execCb(id, factory, depExports, exports);
560
- } catch (e) {
561
- err = e;
562
- }
563
- } else {
564
- exports = context.execCb(id, factory, depExports, exports);
565
- }
566
- if (this.map.isDefine && exports === void 0) {
567
- cjsModule = this.module;
568
- if (cjsModule) {
569
- exports = cjsModule.exports;
570
- } else if (this.usingExports) {
571
- exports = this.exports;
572
- }
573
- }
574
- if (err) {
575
- err.requireMap = this.map;
576
- err.requireModules = this.map.isDefine ? [this.map.id] : null;
577
- err.requireType = this.map.isDefine ? "define" : "require";
578
- return onError(this.error = err);
579
- }
580
- } else {
581
- exports = factory;
582
- }
583
- this.exports = exports;
584
- if (this.map.isDefine && !this.ignore) {
585
- defined[id] = exports;
586
- if (req.onResourceLoad) {
587
- req.onResourceLoad(context, this.map, this.depMaps);
588
- }
589
- }
590
- cleanRegistry(id);
591
- this.defined = true;
592
- }
593
- this.defining = false;
594
- if (this.defined && !this.defineEmitted) {
595
- this.defineEmitted = true;
596
- this.emit("defined", this.exports);
597
- this.defineEmitComplete = true;
598
- }
599
- }
600
- },
601
- callPlugin: function() {
602
- var map = this.map, id = map.id, pluginMap = makeModuleMap(map.prefix);
603
- this.depMaps.push(pluginMap);
604
- on(
605
- pluginMap,
606
- "defined",
607
- bind(this, function(plugin) {
608
- var load, normalizedMap, normalizedMod, bundleId = getOwn(bundlesMap, this.map.id), name = this.map.name, parentName = this.map.parentMap ? this.map.parentMap.name : null, localRequire = context.makeRequire(map.parentMap, {
609
- enableBuildCallback: true
610
- });
611
- if (this.map.unnormalized) {
612
- if (plugin.normalize) {
613
- name = plugin.normalize(name, function(name2) {
614
- return normalize(name2, parentName, true);
615
- }) || "";
616
- }
617
- normalizedMap = makeModuleMap(
618
- map.prefix + "!" + name,
619
- this.map.parentMap
620
- );
621
- on(
622
- normalizedMap,
623
- "defined",
624
- bind(this, function(value) {
625
- this.init(
626
- [],
627
- function() {
628
- return value;
629
- },
630
- null,
631
- {
632
- enabled: true,
633
- ignore: true
634
- }
635
- );
636
- })
637
- );
638
- normalizedMod = getOwn(registry, normalizedMap.id);
639
- if (normalizedMod) {
640
- this.depMaps.push(normalizedMap);
641
- if (this.events.error) {
642
- normalizedMod.on(
643
- "error",
644
- bind(this, function(err) {
645
- this.emit("error", err);
646
- })
647
- );
648
- }
649
- normalizedMod.enable();
650
- }
651
- return;
652
- }
653
- if (bundleId) {
654
- this.map.url = context.nameToUrl(bundleId);
655
- this.load();
656
- return;
657
- }
658
- load = bind(this, function(value) {
659
- this.init(
660
- [],
661
- function() {
662
- return value;
663
- },
664
- null,
665
- {
666
- enabled: true
667
- }
668
- );
669
- });
670
- load.error = bind(this, function(err) {
671
- this.inited = true;
672
- this.error = err;
673
- err.requireModules = [id];
674
- eachProp(registry, function(mod) {
675
- if (mod.map.id.indexOf(id + "_unnormalized") === 0) {
676
- cleanRegistry(mod.map.id);
677
- }
678
- });
679
- onError(err);
680
- });
681
- load.fromText = bind(this, function(text2, textAlt) {
682
- var moduleName = map.name, moduleMap = makeModuleMap(moduleName), hasInteractive = useInteractive;
683
- if (textAlt) {
684
- text2 = textAlt;
685
- }
686
- if (hasInteractive) {
687
- useInteractive = false;
688
- }
689
- getModule(moduleMap);
690
- if (hasProp(config.config, id)) {
691
- config.config[moduleName] = config.config[id];
692
- }
693
- try {
694
- req.exec(text2);
695
- } catch (e) {
696
- return onError(
697
- makeError(
698
- "fromtexteval",
699
- "fromText eval for " + id + " failed: " + e,
700
- e,
701
- [id]
702
- )
703
- );
704
- }
705
- if (hasInteractive) {
706
- useInteractive = true;
707
- }
708
- this.depMaps.push(moduleMap);
709
- context.completeLoad(moduleName);
710
- localRequire([moduleName], load);
711
- });
712
- plugin.load(map.name, localRequire, load, config);
713
- })
714
- );
715
- context.enable(pluginMap, this);
716
- this.pluginMaps[pluginMap.id] = pluginMap;
717
- },
718
- enable: function() {
719
- enabledRegistry[this.map.id] = this;
720
- this.enabled = true;
721
- this.enabling = true;
722
- each(
723
- this.depMaps,
724
- bind(this, function(depMap, i) {
725
- var id, mod, handler;
726
- if (typeof depMap === "string") {
727
- depMap = makeModuleMap(
728
- depMap,
729
- this.map.isDefine ? this.map : this.map.parentMap,
730
- false,
731
- !this.skipMap
732
- );
733
- this.depMaps[i] = depMap;
734
- handler = getOwn(handlers, depMap.id);
735
- if (handler) {
736
- this.depExports[i] = handler(this);
737
- return;
738
- }
739
- this.depCount += 1;
740
- on(
741
- depMap,
742
- "defined",
743
- bind(this, function(depExports) {
744
- if (this.undefed) {
745
- return;
746
- }
747
- this.defineDep(i, depExports);
748
- this.check();
749
- })
750
- );
751
- if (this.errback) {
752
- on(depMap, "error", bind(this, this.errback));
753
- } else if (this.events.error) {
754
- on(
755
- depMap,
756
- "error",
757
- bind(this, function(err) {
758
- this.emit("error", err);
759
- })
760
- );
761
- }
762
- }
763
- id = depMap.id;
764
- mod = registry[id];
765
- if (!hasProp(handlers, id) && mod && !mod.enabled) {
766
- context.enable(depMap, this);
767
- }
768
- })
769
- );
770
- eachProp(
771
- this.pluginMaps,
772
- bind(this, function(pluginMap) {
773
- var mod = getOwn(registry, pluginMap.id);
774
- if (mod && !mod.enabled) {
775
- context.enable(pluginMap, this);
776
- }
777
- })
778
- );
779
- this.enabling = false;
780
- this.check();
781
- },
782
- on: function(name, cb) {
783
- var cbs = this.events[name];
784
- if (!cbs) {
785
- cbs = this.events[name] = [];
786
- }
787
- cbs.push(cb);
788
- },
789
- emit: function(name, evt) {
790
- each(this.events[name], function(cb) {
791
- cb(evt);
792
- });
793
- if (name === "error") {
794
- delete this.events[name];
795
- }
796
- }
797
- };
798
- function callGetModule(args) {
799
- if (!hasProp(defined, args[0])) {
800
- getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
801
- }
802
- }
803
- function removeListener(node, func, name, ieName) {
804
- if (node.detachEvent && !isOpera) {
805
- if (ieName) {
806
- node.detachEvent(ieName, func);
807
- }
808
- } else {
809
- node.removeEventListener(name, func, false);
810
- }
811
- }
812
- function getScriptData(evt) {
813
- var node = evt.currentTarget || evt.srcElement;
814
- removeListener(node, context.onScriptLoad, "load", "onreadystatechange");
815
- removeListener(node, context.onScriptError, "error");
816
- return {
817
- node,
818
- id: node && node.getAttribute("data-requiremodule")
819
- };
820
- }
821
- function intakeDefines() {
822
- var args;
823
- takeGlobalQueue();
824
- while (defQueue.length) {
825
- args = defQueue.shift();
826
- if (args[0] === null) {
827
- return onError(
828
- makeError(
829
- "mismatch",
830
- "Mismatched anonymous define() module: " + args[args.length - 1]
831
- )
832
- );
833
- } else {
834
- callGetModule(args);
835
- }
836
- }
837
- context.defQueueMap = {};
838
- }
839
- context = {
840
- config,
841
- contextName,
842
- registry,
843
- defined,
844
- urlFetched,
845
- defQueue,
846
- defQueueMap: {},
847
- Module,
848
- makeModuleMap,
849
- nextTick: req.nextTick,
850
- onError,
851
- /**
852
- * @private
853
- * Set a configuration for the context.
854
- * @param {object} cfg config object to integrate.
855
- */
856
- configure: function(cfg2) {
857
- if (cfg2.baseUrl) {
858
- if (cfg2.baseUrl.charAt(cfg2.baseUrl.length - 1) !== "/") {
859
- cfg2.baseUrl += "/";
860
- }
861
- }
862
- var shim = config.shim, objs = {
863
- paths: true,
864
- bundles: true,
865
- config: true,
866
- map: true
867
- };
868
- eachProp(cfg2, function(value, prop) {
869
- if (objs[prop]) {
870
- if (!config[prop]) {
871
- config[prop] = {};
872
- }
873
- mixin(config[prop], value, true, true);
874
- } else {
875
- config[prop] = value;
876
- }
877
- });
878
- if (cfg2.bundles) {
879
- eachProp(cfg2.bundles, function(value, prop) {
880
- each(value, function(v) {
881
- if (v !== prop) {
882
- bundlesMap[v] = prop;
883
- }
884
- });
885
- });
886
- }
887
- if (cfg2.shim) {
888
- eachProp(cfg2.shim, function(value, id) {
889
- if (isArray(value)) {
890
- value = {
891
- deps: value
892
- };
893
- }
894
- if ((value.exports || value.init) && !value.exportsFn) {
895
- value.exportsFn = context.makeShimExports(value);
896
- }
897
- shim[id] = value;
898
- });
899
- config.shim = shim;
900
- }
901
- if (cfg2.packages) {
902
- each(cfg2.packages, function(pkgObj) {
903
- var location, name;
904
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
905
- name = pkgObj.name;
906
- location = pkgObj.location;
907
- if (location) {
908
- config.paths[name] = pkgObj.location;
909
- }
910
- config.pkgs[name] = pkgObj.name + "/" + (pkgObj.main || "main").replace(currDirRegExp, "").replace(jsSuffixRegExp, "");
911
- });
912
- }
913
- eachProp(registry, function(mod, id) {
914
- if (!mod.inited && !mod.map.unnormalized) {
915
- mod.map = makeModuleMap(id, null, true);
916
- }
917
- });
918
- if (cfg2.deps || cfg2.callback) {
919
- context.require(cfg2.deps || [], cfg2.callback);
920
- }
921
- },
922
- makeShimExports: function(value) {
923
- function fn() {
924
- var ret;
925
- if (value.init) {
926
- ret = value.init.apply(global, arguments);
927
- }
928
- return ret || value.exports && getGlobal(value.exports);
929
- }
930
- return fn;
931
- },
932
- makeRequire: function(relMap, options) {
933
- options = options || {};
934
- function localRequire(deps, callback, errback) {
935
- var id, map, requireMod;
936
- if (options.enableBuildCallback && callback && isFunction(callback)) {
937
- callback.__requireJsBuild = true;
938
- }
939
- if (typeof deps === "string") {
940
- if (isFunction(callback)) {
941
- return onError(
942
- makeError("requireargs", "Invalid require call"),
943
- errback
944
- );
945
- }
946
- if (relMap && hasProp(handlers, deps)) {
947
- return handlers[deps](registry[relMap.id]);
948
- }
949
- if (req.get) {
950
- return req.get(context, deps, relMap, localRequire);
951
- }
952
- map = makeModuleMap(deps, relMap, false, true);
953
- id = map.id;
954
- if (!hasProp(defined, id)) {
955
- return onError(
956
- makeError(
957
- "notloaded",
958
- 'Module name "' + id + '" has not been loaded yet for context: ' + contextName + (relMap ? "" : ". Use require([])")
959
- )
960
- );
961
- }
962
- return defined[id];
963
- }
964
- intakeDefines();
965
- context.nextTick(function() {
966
- intakeDefines();
967
- requireMod = getModule(makeModuleMap(null, relMap));
968
- requireMod.skipMap = options.skipMap;
969
- requireMod.init(deps, callback, errback, {
970
- enabled: true
971
- });
972
- checkLoaded();
973
- });
974
- return localRequire;
975
- }
976
- mixin(localRequire, {
977
- isBrowser,
978
- /**
979
- * Converts a module name + .extension into an URL path.
980
- * *Requires* the use of a module name. It does not support using
981
- * plain URLs like nameToUrl.
982
- */
983
- toUrl: function(moduleNamePlusExt) {
984
- var ext, index = moduleNamePlusExt.lastIndexOf("."), segment = moduleNamePlusExt.split("/")[0], isRelative = segment === "." || segment === "..";
985
- if (index !== -1 && (!isRelative || index > 1)) {
986
- ext = moduleNamePlusExt.substring(
987
- index,
988
- moduleNamePlusExt.length
989
- );
990
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
991
- }
992
- return context.nameToUrl(
993
- normalize(moduleNamePlusExt, relMap && relMap.id, true),
994
- ext,
995
- true
996
- );
997
- },
998
- defined: function(id) {
999
- return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
1000
- },
1001
- specified: function(id) {
1002
- id = makeModuleMap(id, relMap, false, true).id;
1003
- return hasProp(defined, id) || hasProp(registry, id);
1004
- }
1005
- });
1006
- if (!relMap) {
1007
- localRequire.undef = function(id) {
1008
- takeGlobalQueue();
1009
- var map = makeModuleMap(id, relMap, true), mod = getOwn(registry, id);
1010
- mod.undefed = true;
1011
- removeScript(id);
1012
- delete defined[id];
1013
- delete urlFetched[map.url];
1014
- delete undefEvents[id];
1015
- eachReverse(defQueue, function(args, i) {
1016
- if (args[0] === id) {
1017
- defQueue.splice(i, 1);
1018
- }
1019
- });
1020
- delete context.defQueueMap[id];
1021
- if (mod) {
1022
- if (mod.events.defined) {
1023
- undefEvents[id] = mod.events;
1024
- }
1025
- cleanRegistry(id);
1026
- }
1027
- };
1028
- }
1029
- return localRequire;
1030
- },
1031
- /**
1032
- * @private
1033
- * Called to enable a module if it is still in the registry
1034
- * awaiting enablement. A second arg, parent, the parent module,
1035
- * is passed in for context, when this method is overridden by
1036
- * the optimizer. Not shown here to keep code compact.
1037
- */
1038
- enable: function(depMap) {
1039
- var mod = getOwn(registry, depMap.id);
1040
- if (mod) {
1041
- getModule(depMap).enable();
1042
- }
1043
- },
1044
- /**
1045
- * Internal method used by environment adapters to complete a load event.
1046
- * A load event could be a script load or just a load pass from a synchronous
1047
- * load call.
1048
- * @param {string} moduleName the name of the module to potentially complete.
1049
- * @private
1050
- */
1051
- completeLoad: function(moduleName) {
1052
- var found, args, mod, shim = getOwn(config.shim, moduleName) || {}, shExports = shim.exports;
1053
- takeGlobalQueue();
1054
- while (defQueue.length) {
1055
- args = defQueue.shift();
1056
- if (args[0] === null) {
1057
- args[0] = moduleName;
1058
- if (found) {
1059
- break;
1060
- }
1061
- found = true;
1062
- } else if (args[0] === moduleName) {
1063
- found = true;
1064
- }
1065
- callGetModule(args);
1066
- }
1067
- context.defQueueMap = {};
1068
- mod = getOwn(registry, moduleName);
1069
- if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
1070
- if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
1071
- if (hasPathFallback(moduleName)) {
1072
- return;
1073
- } else {
1074
- return onError(
1075
- makeError(
1076
- "nodefine",
1077
- "No define call for " + moduleName,
1078
- null,
1079
- [moduleName]
1080
- )
1081
- );
1082
- }
1083
- } else {
1084
- callGetModule([moduleName, shim.deps || [], shim.exportsFn]);
1085
- }
1086
- }
1087
- checkLoaded();
1088
- },
1089
- /**
1090
- * @private
1091
- * Converts a module name to a file path. Supports cases where
1092
- * moduleName may actually be just an URL.
1093
- * Note that it **does not** call normalize on the moduleName,
1094
- * it is assumed to have already been normalized. This is an
1095
- * internal API, not a public one. Use toUrl for the public API.
1096
- */
1097
- nameToUrl: function(moduleName, ext, skipExt) {
1098
- var paths, syms, i, parentModule, url, parentPath, bundleId, pkgMain = getOwn(config.pkgs, moduleName);
1099
- if (pkgMain) {
1100
- moduleName = pkgMain;
1101
- }
1102
- bundleId = getOwn(bundlesMap, moduleName);
1103
- if (bundleId) {
1104
- return context.nameToUrl(bundleId, ext, skipExt);
1105
- }
1106
- if (req.jsExtRegExp.test(moduleName)) {
1107
- url = moduleName + (ext || "");
1108
- } else {
1109
- paths = config.paths;
1110
- syms = moduleName.split("/");
1111
- for (i = syms.length; i > 0; i -= 1) {
1112
- parentModule = syms.slice(0, i).join("/");
1113
- parentPath = getOwn(paths, parentModule);
1114
- if (parentPath) {
1115
- if (isArray(parentPath)) {
1116
- parentPath = parentPath[0];
1117
- }
1118
- syms.splice(0, i, parentPath);
1119
- break;
1120
- }
1121
- }
1122
- url = syms.join("/");
1123
- url += ext || (/^data\:|\?/.test(url) || skipExt ? "" : ".js");
1124
- url = (url.charAt(0) === "/" || url.match(/^[\w\+\.\-]+:/) ? "" : config.baseUrl) + url;
1125
- }
1126
- return config.urlArgs ? url + ((url.indexOf("?") === -1 ? "?" : "&") + config.urlArgs) : url;
1127
- },
1128
- //Delegates to req.load. Broken out as a separate function to
1129
- //allow overriding in the optimizer.
1130
- load: function(id, url) {
1131
- req.load(context, id, url);
1132
- },
1133
- /**
1134
- * Executes a module callback function. Broken out as a separate function
1135
- * solely to allow the build system to sequence the files in the built
1136
- * layer in the right sequence.
1137
- *
1138
- * @private
1139
- */
1140
- execCb: function(name, callback, args, exports) {
1141
- return callback.apply(exports, args);
1142
- },
1143
- /**
1144
- * callback for script loads, used to check status of loading.
1145
- * @private
1146
- * @param {Event} evt the event from the browser for the script
1147
- * that was loaded.
1148
- */
1149
- onScriptLoad: function(evt) {
1150
- if (evt.type === "load" || readyRegExp.test((evt.currentTarget || evt.srcElement).readyState)) {
1151
- interactiveScript = null;
1152
- var data = getScriptData(evt);
1153
- context.completeLoad(data.id);
1154
- }
1155
- },
1156
- /**
1157
- * @private
1158
- * Callback for script errors.
1159
- */
1160
- onScriptError: function(evt) {
1161
- var data = getScriptData(evt);
1162
- if (!hasPathFallback(data.id)) {
1163
- return onError(
1164
- makeError("scripterror", "Script error for: " + data.id, evt, [
1165
- data.id
1166
- ])
1167
- );
1168
- }
1169
- }
1170
- };
1171
- context.require = context.makeRequire();
1172
- return context;
1173
- }
1174
- req = requirejs = function(deps, callback, errback, optional) {
1175
- var context, config, contextName = defContextName;
1176
- if (!isArray(deps) && typeof deps !== "string") {
1177
- config = deps;
1178
- if (isArray(callback)) {
1179
- deps = callback;
1180
- callback = errback;
1181
- errback = optional;
1182
- } else {
1183
- deps = [];
1184
- }
1185
- }
1186
- if (config && config.context) {
1187
- contextName = config.context;
1188
- }
1189
- context = getOwn(contexts, contextName);
1190
- if (!context) {
1191
- context = contexts[contextName] = req.s.newContext(contextName);
1192
- }
1193
- if (config) {
1194
- context.configure(config);
1195
- }
1196
- return context.require(deps, callback, errback);
1197
- };
1198
- req.config = function(config) {
1199
- return req(config);
1200
- };
1201
- req.nextTick = typeof setTimeout !== "undefined" ? function(fn) {
1202
- setTimeout(fn, 4);
1203
- } : function(fn) {
1204
- fn();
1205
- };
1206
- if (!require) {
1207
- require = req;
1208
- }
1209
- req.version = version;
1210
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
1211
- req.isBrowser = isBrowser;
1212
- s = req.s = {
1213
- contexts,
1214
- newContext
1215
- };
1216
- req({});
1217
- each(["toUrl", "undef", "defined", "specified"], function(prop) {
1218
- req[prop] = function() {
1219
- var ctx = contexts[defContextName];
1220
- return ctx.require[prop].apply(ctx, arguments);
1221
- };
1222
- });
1223
- if (isBrowser) {
1224
- head = s.head = document.getElementsByTagName("head")[0];
1225
- baseElement = document.getElementsByTagName("base")[0];
1226
- if (baseElement) {
1227
- head = s.head = baseElement.parentNode;
1228
- }
1229
- }
1230
- req.onError = defaultOnError;
1231
- req.createNode = function(config, moduleName, url) {
1232
- var node = config.xhtml ? document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") : document.createElement("script");
1233
- node.type = config.scriptType || "text/javascript";
1234
- node.charset = "utf-8";
1235
- node.async = true;
1236
- return node;
1237
- };
1238
- req.load = function(context, moduleName, url) {
1239
- var config = context && context.config || {}, node;
1240
- if (isBrowser) {
1241
- node = req.createNode(config, moduleName, url);
1242
- if (config.onNodeCreated) {
1243
- config.onNodeCreated(node, config, moduleName, url);
1244
- }
1245
- node.setAttribute("data-requirecontext", context.contextName);
1246
- node.setAttribute("data-requiremodule", moduleName);
1247
- if (node.attachEvent && //Check if node.attachEvent is artificially added by custom script or
1248
- //natively supported by browser
1249
- //read https://github.com/jrburke/requirejs/issues/187
1250
- //if we can NOT find [native code] then it must NOT natively supported.
1251
- //in IE8, node.attachEvent does not have toString()
1252
- //Note the test for "[native code" with no closing brace, see:
1253
- //https://github.com/jrburke/requirejs/issues/273
1254
- !(node.attachEvent.toString && node.attachEvent.toString().indexOf("[native code") < 0) && !isOpera) {
1255
- useInteractive = true;
1256
- node.attachEvent("onreadystatechange", context.onScriptLoad);
1257
- } else {
1258
- node.addEventListener("load", context.onScriptLoad, false);
1259
- node.addEventListener("error", context.onScriptError, false);
1260
- }
1261
- node.src = url;
1262
- currentlyAddingScript = node;
1263
- if (baseElement) {
1264
- head.insertBefore(node, baseElement);
1265
- } else {
1266
- head.appendChild(node);
1267
- }
1268
- currentlyAddingScript = null;
1269
- return node;
1270
- } else if (isWebWorker) {
1271
- try {
1272
- importScripts(url);
1273
- context.completeLoad(moduleName);
1274
- } catch (e) {
1275
- context.onError(
1276
- makeError(
1277
- "importscripts",
1278
- "importScripts failed for " + moduleName + " at " + url,
1279
- e,
1280
- [moduleName]
1281
- )
1282
- );
1283
- }
1284
- }
1285
- };
1286
- function getInteractiveScript() {
1287
- if (interactiveScript && interactiveScript.readyState === "interactive") {
1288
- return interactiveScript;
1289
- }
1290
- eachReverse(scripts(), function(script) {
1291
- if (script.readyState === "interactive") {
1292
- return interactiveScript = script;
1293
- }
1294
- });
1295
- return interactiveScript;
1296
- }
1297
- if (isBrowser && !cfg.skipDataMain) {
1298
- eachReverse(scripts(), function(script) {
1299
- if (!head) {
1300
- head = script.parentNode;
1301
- }
1302
- dataMain = script.getAttribute("data-main");
1303
- if (dataMain) {
1304
- mainScript = dataMain;
1305
- if (!cfg.baseUrl) {
1306
- src = mainScript.split("/");
1307
- mainScript = src.pop();
1308
- subPath = src.length ? src.join("/") + "/" : "./";
1309
- cfg.baseUrl = subPath;
1310
- }
1311
- mainScript = mainScript.replace(jsSuffixRegExp, "");
1312
- if (req.jsExtRegExp.test(mainScript)) {
1313
- mainScript = dataMain;
1314
- }
1315
- cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
1316
- return true;
1317
- }
1318
- });
1319
- }
1320
- define = function(name, deps, callback) {
1321
- var node, context;
1322
- if (typeof name !== "string") {
1323
- callback = deps;
1324
- deps = name;
1325
- name = null;
1326
- }
1327
- if (!isArray(deps)) {
1328
- callback = deps;
1329
- deps = null;
1330
- }
1331
- if (!deps && isFunction(callback)) {
1332
- deps = [];
1333
- if (callback.length) {
1334
- callback.toString().replace(commentRegExp, "").replace(cjsRequireRegExp, function(match, dep) {
1335
- deps.push(dep);
1336
- });
1337
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
1338
- }
1339
- }
1340
- if (useInteractive) {
1341
- node = currentlyAddingScript || getInteractiveScript();
1342
- if (node) {
1343
- if (!name) {
1344
- name = node.getAttribute("data-requiremodule");
1345
- }
1346
- context = contexts[node.getAttribute("data-requirecontext")];
1347
- }
1348
- }
1349
- if (context) {
1350
- context.defQueue.push([name, deps, callback]);
1351
- context.defQueueMap[name] = true;
1352
- } else {
1353
- globalDefQueue.push([name, deps, callback]);
1354
- }
1355
- };
1356
- define.amd = {
1357
- jQuery: true
1358
- };
1359
- req.exec = function(text) {
1360
- return eval(text);
1361
- };
1362
- req(cfg);
1363
- })(this);