@vertexvis/viewer 0.18.2-testing.0 → 0.18.2-testing.1

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 (228) hide show
  1. package/dist/cjs/index-b99cd335.js +126 -1
  2. package/dist/esm/index-fd7d7b68.js +126 -1
  3. package/package.json +7 -7
  4. package/dist/components/_commonjsHelpers.js +0 -41
  5. package/dist/components/_commonjsHelpers.js.map +0 -1
  6. package/dist/components/browser.esm.js +0 -3173
  7. package/dist/components/browser.esm.js.map +0 -1
  8. package/dist/components/bundle.esm.js +0 -2250
  9. package/dist/components/bundle.esm.js.map +0 -1
  10. package/dist/components/bundle.esm2.js +0 -39740
  11. package/dist/components/bundle.esm2.js.map +0 -1
  12. package/dist/components/config.js +0 -81
  13. package/dist/components/config.js.map +0 -1
  14. package/dist/components/controller.js +0 -7627
  15. package/dist/components/controller.js.map +0 -1
  16. package/dist/components/controller2.js +0 -124
  17. package/dist/components/controller2.js.map +0 -1
  18. package/dist/components/controller3.js +0 -111
  19. package/dist/components/controller3.js.map +0 -1
  20. package/dist/components/cursors.js +0 -110
  21. package/dist/components/cursors.js.map +0 -1
  22. package/dist/components/dom.js +0 -43
  23. package/dist/components/dom.js.map +0 -1
  24. package/dist/components/dom2.js +0 -10
  25. package/dist/components/dom2.js.map +0 -1
  26. package/dist/components/elementRectObserver.js +0 -25
  27. package/dist/components/elementRectObserver.js.map +0 -1
  28. package/dist/components/entities.js +0 -179
  29. package/dist/components/entities.js.map +0 -1
  30. package/dist/components/errors.js +0 -80
  31. package/dist/components/errors.js.map +0 -1
  32. package/dist/components/events.js +0 -11
  33. package/dist/components/events.js.map +0 -1
  34. package/dist/components/index.d.ts +0 -26
  35. package/dist/components/index.js +0 -365
  36. package/dist/components/index.js.map +0 -1
  37. package/dist/components/index2.js +0 -63
  38. package/dist/components/index2.js.map +0 -1
  39. package/dist/components/interactions.js +0 -236
  40. package/dist/components/interactions.js.map +0 -1
  41. package/dist/components/mapper.js +0 -9811
  42. package/dist/components/mapper.js.map +0 -1
  43. package/dist/components/markup.js +0 -33
  44. package/dist/components/markup.js.map +0 -1
  45. package/dist/components/model.js +0 -134
  46. package/dist/components/model.js.map +0 -1
  47. package/dist/components/model2.js +0 -157
  48. package/dist/components/model2.js.map +0 -1
  49. package/dist/components/overlays.js +0 -76
  50. package/dist/components/overlays.js.map +0 -1
  51. package/dist/components/png-decoder.js +0 -2405
  52. package/dist/components/png-decoder.js.map +0 -1
  53. package/dist/components/regl-component.js +0 -12582
  54. package/dist/components/regl-component.js.map +0 -1
  55. package/dist/components/results.js +0 -24
  56. package/dist/components/results.js.map +0 -1
  57. package/dist/components/row.js +0 -32
  58. package/dist/components/row.js.map +0 -1
  59. package/dist/components/scene-tree-search.js +0 -146
  60. package/dist/components/scene-tree-search.js.map +0 -1
  61. package/dist/components/scene-tree-table-layout.js +0 -928
  62. package/dist/components/scene-tree-table-layout.js.map +0 -1
  63. package/dist/components/scene-tree-toolbar.js +0 -35
  64. package/dist/components/scene-tree-toolbar.js.map +0 -1
  65. package/dist/components/scene.js +0 -1508
  66. package/dist/components/scene.js.map +0 -1
  67. package/dist/components/stencil.js +0 -25
  68. package/dist/components/stencil.js.map +0 -1
  69. package/dist/components/streamAttributes.js +0 -40833
  70. package/dist/components/streamAttributes.js.map +0 -1
  71. package/dist/components/templates.js +0 -36
  72. package/dist/components/templates.js.map +0 -1
  73. package/dist/components/tslib.es6.js +0 -125
  74. package/dist/components/tslib.es6.js.map +0 -1
  75. package/dist/components/vertex-scene-tree-search.d.ts +0 -11
  76. package/dist/components/vertex-scene-tree-search.js +0 -11
  77. package/dist/components/vertex-scene-tree-search.js.map +0 -1
  78. package/dist/components/vertex-scene-tree-table-cell.d.ts +0 -11
  79. package/dist/components/vertex-scene-tree-table-cell.js +0 -209
  80. package/dist/components/vertex-scene-tree-table-cell.js.map +0 -1
  81. package/dist/components/vertex-scene-tree-table-column.d.ts +0 -11
  82. package/dist/components/vertex-scene-tree-table-column.js +0 -42
  83. package/dist/components/vertex-scene-tree-table-column.js.map +0 -1
  84. package/dist/components/vertex-scene-tree-table-header.d.ts +0 -11
  85. package/dist/components/vertex-scene-tree-table-header.js +0 -38
  86. package/dist/components/vertex-scene-tree-table-header.js.map +0 -1
  87. package/dist/components/vertex-scene-tree-table-layout.d.ts +0 -11
  88. package/dist/components/vertex-scene-tree-table-layout.js +0 -11
  89. package/dist/components/vertex-scene-tree-table-layout.js.map +0 -1
  90. package/dist/components/vertex-scene-tree-table-resize-divider.d.ts +0 -11
  91. package/dist/components/vertex-scene-tree-table-resize-divider.js +0 -57
  92. package/dist/components/vertex-scene-tree-table-resize-divider.js.map +0 -1
  93. package/dist/components/vertex-scene-tree-toolbar-group.d.ts +0 -11
  94. package/dist/components/vertex-scene-tree-toolbar-group.js +0 -38
  95. package/dist/components/vertex-scene-tree-toolbar-group.js.map +0 -1
  96. package/dist/components/vertex-scene-tree-toolbar.d.ts +0 -11
  97. package/dist/components/vertex-scene-tree-toolbar.js +0 -11
  98. package/dist/components/vertex-scene-tree-toolbar.js.map +0 -1
  99. package/dist/components/vertex-scene-tree.d.ts +0 -11
  100. package/dist/components/vertex-scene-tree.js +0 -803
  101. package/dist/components/vertex-scene-tree.js.map +0 -1
  102. package/dist/components/vertex-viewer-box-query-tool.d.ts +0 -11
  103. package/dist/components/vertex-viewer-box-query-tool.js +0 -352
  104. package/dist/components/vertex-viewer-box-query-tool.js.map +0 -1
  105. package/dist/components/vertex-viewer-button.d.ts +0 -11
  106. package/dist/components/vertex-viewer-button.js +0 -11
  107. package/dist/components/vertex-viewer-button.js.map +0 -1
  108. package/dist/components/vertex-viewer-default-toolbar.d.ts +0 -11
  109. package/dist/components/vertex-viewer-default-toolbar.js +0 -99
  110. package/dist/components/vertex-viewer-default-toolbar.js.map +0 -1
  111. package/dist/components/vertex-viewer-dom-element.d.ts +0 -11
  112. package/dist/components/vertex-viewer-dom-element.js +0 -11
  113. package/dist/components/vertex-viewer-dom-element.js.map +0 -1
  114. package/dist/components/vertex-viewer-dom-group.d.ts +0 -11
  115. package/dist/components/vertex-viewer-dom-group.js +0 -11
  116. package/dist/components/vertex-viewer-dom-group.js.map +0 -1
  117. package/dist/components/vertex-viewer-dom-renderer.d.ts +0 -11
  118. package/dist/components/vertex-viewer-dom-renderer.js +0 -11
  119. package/dist/components/vertex-viewer-dom-renderer.js.map +0 -1
  120. package/dist/components/vertex-viewer-hit-result-indicator.d.ts +0 -11
  121. package/dist/components/vertex-viewer-hit-result-indicator.js +0 -335
  122. package/dist/components/vertex-viewer-hit-result-indicator.js.map +0 -1
  123. package/dist/components/vertex-viewer-icon.d.ts +0 -11
  124. package/dist/components/vertex-viewer-icon.js +0 -11
  125. package/dist/components/vertex-viewer-icon.js.map +0 -1
  126. package/dist/components/vertex-viewer-layer.d.ts +0 -11
  127. package/dist/components/vertex-viewer-layer.js +0 -11
  128. package/dist/components/vertex-viewer-layer.js.map +0 -1
  129. package/dist/components/vertex-viewer-markup-arrow.d.ts +0 -11
  130. package/dist/components/vertex-viewer-markup-arrow.js +0 -11
  131. package/dist/components/vertex-viewer-markup-arrow.js.map +0 -1
  132. package/dist/components/vertex-viewer-markup-circle.d.ts +0 -11
  133. package/dist/components/vertex-viewer-markup-circle.js +0 -11
  134. package/dist/components/vertex-viewer-markup-circle.js.map +0 -1
  135. package/dist/components/vertex-viewer-markup-freeform.d.ts +0 -11
  136. package/dist/components/vertex-viewer-markup-freeform.js +0 -11
  137. package/dist/components/vertex-viewer-markup-freeform.js.map +0 -1
  138. package/dist/components/vertex-viewer-markup-tool.d.ts +0 -11
  139. package/dist/components/vertex-viewer-markup-tool.js +0 -257
  140. package/dist/components/vertex-viewer-markup-tool.js.map +0 -1
  141. package/dist/components/vertex-viewer-markup.d.ts +0 -11
  142. package/dist/components/vertex-viewer-markup.js +0 -362
  143. package/dist/components/vertex-viewer-markup.js.map +0 -1
  144. package/dist/components/vertex-viewer-measurement-details.d.ts +0 -11
  145. package/dist/components/vertex-viewer-measurement-details.js +0 -307
  146. package/dist/components/vertex-viewer-measurement-details.js.map +0 -1
  147. package/dist/components/vertex-viewer-measurement-distance.d.ts +0 -11
  148. package/dist/components/vertex-viewer-measurement-distance.js +0 -1067
  149. package/dist/components/vertex-viewer-measurement-distance.js.map +0 -1
  150. package/dist/components/vertex-viewer-measurement-line.d.ts +0 -11
  151. package/dist/components/vertex-viewer-measurement-line.js +0 -11
  152. package/dist/components/vertex-viewer-measurement-line.js.map +0 -1
  153. package/dist/components/vertex-viewer-measurement-overlays.d.ts +0 -11
  154. package/dist/components/vertex-viewer-measurement-overlays.js +0 -11
  155. package/dist/components/vertex-viewer-measurement-overlays.js.map +0 -1
  156. package/dist/components/vertex-viewer-measurement-precise.d.ts +0 -11
  157. package/dist/components/vertex-viewer-measurement-precise.js +0 -362
  158. package/dist/components/vertex-viewer-measurement-precise.js.map +0 -1
  159. package/dist/components/vertex-viewer-pin-group.d.ts +0 -11
  160. package/dist/components/vertex-viewer-pin-group.js +0 -11
  161. package/dist/components/vertex-viewer-pin-group.js.map +0 -1
  162. package/dist/components/vertex-viewer-pin-label-line.d.ts +0 -11
  163. package/dist/components/vertex-viewer-pin-label-line.js +0 -11
  164. package/dist/components/vertex-viewer-pin-label-line.js.map +0 -1
  165. package/dist/components/vertex-viewer-pin-label.d.ts +0 -11
  166. package/dist/components/vertex-viewer-pin-label.js +0 -11
  167. package/dist/components/vertex-viewer-pin-label.js.map +0 -1
  168. package/dist/components/vertex-viewer-pin-tool.d.ts +0 -11
  169. package/dist/components/vertex-viewer-pin-tool.js +0 -430
  170. package/dist/components/vertex-viewer-pin-tool.js.map +0 -1
  171. package/dist/components/vertex-viewer-spinner.d.ts +0 -11
  172. package/dist/components/vertex-viewer-spinner.js +0 -11
  173. package/dist/components/vertex-viewer-spinner.js.map +0 -1
  174. package/dist/components/vertex-viewer-toolbar-group.d.ts +0 -11
  175. package/dist/components/vertex-viewer-toolbar-group.js +0 -11
  176. package/dist/components/vertex-viewer-toolbar-group.js.map +0 -1
  177. package/dist/components/vertex-viewer-toolbar.d.ts +0 -11
  178. package/dist/components/vertex-viewer-toolbar.js +0 -11
  179. package/dist/components/vertex-viewer-toolbar.js.map +0 -1
  180. package/dist/components/vertex-viewer-transform-widget.d.ts +0 -11
  181. package/dist/components/vertex-viewer-transform-widget.js +0 -838
  182. package/dist/components/vertex-viewer-transform-widget.js.map +0 -1
  183. package/dist/components/vertex-viewer-view-cube.d.ts +0 -11
  184. package/dist/components/vertex-viewer-view-cube.js +0 -270
  185. package/dist/components/vertex-viewer-view-cube.js.map +0 -1
  186. package/dist/components/vertex-viewer.d.ts +0 -11
  187. package/dist/components/vertex-viewer.js +0 -3543
  188. package/dist/components/vertex-viewer.js.map +0 -1
  189. package/dist/components/viewer-button.js +0 -35
  190. package/dist/components/viewer-button.js.map +0 -1
  191. package/dist/components/viewer-dom-element.js +0 -250
  192. package/dist/components/viewer-dom-element.js.map +0 -1
  193. package/dist/components/viewer-dom-group.js +0 -214
  194. package/dist/components/viewer-dom-group.js.map +0 -1
  195. package/dist/components/viewer-dom-renderer.js +0 -295
  196. package/dist/components/viewer-dom-renderer.js.map +0 -1
  197. package/dist/components/viewer-icon.js +0 -87
  198. package/dist/components/viewer-icon.js.map +0 -1
  199. package/dist/components/viewer-layer.js +0 -46
  200. package/dist/components/viewer-layer.js.map +0 -1
  201. package/dist/components/viewer-markup-arrow.js +0 -235
  202. package/dist/components/viewer-markup-arrow.js.map +0 -1
  203. package/dist/components/viewer-markup-circle-components.js +0 -42
  204. package/dist/components/viewer-markup-circle-components.js.map +0 -1
  205. package/dist/components/viewer-markup-circle.js +0 -201
  206. package/dist/components/viewer-markup-circle.js.map +0 -1
  207. package/dist/components/viewer-markup-freeform.js +0 -251
  208. package/dist/components/viewer-markup-freeform.js.map +0 -1
  209. package/dist/components/viewer-measurement-line.js +0 -77
  210. package/dist/components/viewer-measurement-line.js.map +0 -1
  211. package/dist/components/viewer-measurement-overlays.js +0 -184
  212. package/dist/components/viewer-measurement-overlays.js.map +0 -1
  213. package/dist/components/viewer-pin-group.js +0 -207
  214. package/dist/components/viewer-pin-group.js.map +0 -1
  215. package/dist/components/viewer-pin-label-line.js +0 -43
  216. package/dist/components/viewer-pin-label-line.js.map +0 -1
  217. package/dist/components/viewer-pin-label.js +0 -427
  218. package/dist/components/viewer-pin-label.js.map +0 -1
  219. package/dist/components/viewer-spinner.js +0 -53
  220. package/dist/components/viewer-spinner.js.map +0 -1
  221. package/dist/components/viewer-toolbar-group.js +0 -42
  222. package/dist/components/viewer-toolbar-group.js.map +0 -1
  223. package/dist/components/viewer-toolbar.js +0 -61
  224. package/dist/components/viewer-toolbar.js.map +0 -1
  225. package/dist/components/viewport.js +0 -188
  226. package/dist/components/viewport.js.map +0 -1
  227. package/dist/components/wrappers_pb.js +0 -1926
  228. package/dist/components/wrappers_pb.js.map +0 -1
@@ -1,3173 +0,0 @@
1
- /*!
2
- * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
- */
4
- import { _ as __extends, a as __read, b as __spreadArray, c as __assign, d as __awaiter, e as __generator } from './tslib.es6.js';
5
-
6
- /**
7
- * Adds a listener to the given `target`, and returns a promise that
8
- * resolves with the first event emitted of the given `type`.
9
- *
10
- * @param target The target to add an event listener to.
11
- * @param type The event type to listen for.
12
- * @param opts Options to pass to `addEventListener`.
13
- * @returns A promise that resolves with the first event emitted of `type`.
14
- */
15
- function once(target, type, opts) {
16
- return __awaiter(this, void 0, void 0, function () {
17
- return __generator(this, function (_a) {
18
- return [2 /*return*/, new Promise(function (resolve) {
19
- function handler(event) {
20
- target.removeEventListener(type, handler);
21
- resolve(event);
22
- }
23
- target.addEventListener(type, handler, opts);
24
- })];
25
- });
26
- });
27
- }
28
-
29
- function delay() {
30
- var args = [];
31
- for (var _i = 0; _i < arguments.length; _i++) {
32
- args[_i] = arguments[_i];
33
- }
34
- return __awaiter(this, void 0, void 0, function () {
35
- var ms, promise, delay_1;
36
- return __generator(this, function (_a) {
37
- switch (_a.label) {
38
- case 0:
39
- ms = args[0];
40
- if (!(typeof ms === 'number')) return [3 /*break*/, 4];
41
- promise = args[1];
42
- delay_1 = new Promise(function (resolve) { return setTimeout(resolve, ms); });
43
- if (!(promise != null)) return [3 /*break*/, 2];
44
- return [4 /*yield*/, delay_1];
45
- case 1:
46
- _a.sent();
47
- return [2 /*return*/, promise];
48
- case 2: return [2 /*return*/, delay_1];
49
- case 3: return [3 /*break*/, 5];
50
- case 4: return [2 /*return*/, Promise.reject(new TypeError('First argument to `delay` must be a number'))];
51
- case 5: return [2 /*return*/];
52
- }
53
- });
54
- });
55
- }
56
- function timeout() {
57
- var args = [];
58
- for (var _i = 0; _i < arguments.length; _i++) {
59
- args[_i] = arguments[_i];
60
- }
61
- return __awaiter(this, void 0, void 0, function () {
62
- var ms, promise, timer_1, timeout_1, res;
63
- return __generator(this, function (_a) {
64
- switch (_a.label) {
65
- case 0:
66
- ms = args[0];
67
- if (!(typeof ms === 'number')) return [3 /*break*/, 4];
68
- promise = args[1];
69
- timeout_1 = new Promise(function (_, reject) {
70
- timer_1 = setTimeout(function () { return reject(new Error("Promise timed out after ".concat(ms, "ms"))); }, ms);
71
- });
72
- if (!(promise != null)) return [3 /*break*/, 2];
73
- return [4 /*yield*/, Promise.race([promise, timeout_1])];
74
- case 1:
75
- res = _a.sent();
76
- clearTimeout(timer_1);
77
- return [2 /*return*/, res];
78
- case 2: return [2 /*return*/, timeout_1];
79
- case 3: return [3 /*break*/, 5];
80
- case 4: return [2 /*return*/, Promise.reject('First argument to `timeout` must be a number')];
81
- case 5: return [2 /*return*/];
82
- }
83
- });
84
- });
85
- }
86
- /**
87
- * Executes and reattempts execution of an asynchronous function if it throws an
88
- * error. By default, this function will only retry once and reexecute
89
- * immediately after the previous execution throws. You can configure the number
90
- * of retry attempts and delays with the `maxRetries` and `delaysInMs` options.
91
- *
92
- * The `delaysInMs` is an array of delays in milliseconds for each retry
93
- * attempt. If there are more retry attempts than delays, the last delay will be
94
- * used.
95
- *
96
- * @param process The process to execute.
97
- * @param opts Options to configure retry behavior.
98
- * @returns A promise that resolves with a successful value, or the original
99
- * rejected value if the process fails.
100
- */
101
- function retry(process, opts) {
102
- if (opts === void 0) { opts = {}; }
103
- return __awaiter(this, void 0, void 0, function () {
104
- function execute(attempt, process, opts) {
105
- return __awaiter(this, void 0, void 0, function () {
106
- var _a, delaysInMs, _b, maxRetries, delayInMs, e_1;
107
- return __generator(this, function (_c) {
108
- switch (_c.label) {
109
- case 0:
110
- _a = opts.delaysInMs, delaysInMs = _a === void 0 ? [] : _a, _b = opts.maxRetries, maxRetries = _b === void 0 ? 1 : _b;
111
- _c.label = 1;
112
- case 1:
113
- _c.trys.push([1, 4, , 8]);
114
- delayInMs = attempt === 0 || delaysInMs.length === 0
115
- ? 0
116
- : delaysInMs[Math.min(attempt - 1, delaysInMs.length - 1)];
117
- return [4 /*yield*/, delay(delayInMs)];
118
- case 2:
119
- _c.sent();
120
- return [4 /*yield*/, process()];
121
- case 3: return [2 /*return*/, _c.sent()];
122
- case 4:
123
- e_1 = _c.sent();
124
- if (!(attempt < maxRetries)) return [3 /*break*/, 6];
125
- return [4 /*yield*/, execute(attempt + 1, process, opts)];
126
- case 5: return [2 /*return*/, _c.sent()];
127
- case 6: throw e_1;
128
- case 7: return [3 /*break*/, 8];
129
- case 8: return [2 /*return*/];
130
- }
131
- });
132
- });
133
- }
134
- return __generator(this, function (_a) {
135
- return [2 /*return*/, execute(0, process, opts)];
136
- });
137
- });
138
- }
139
- /**
140
- * Returns a promise that either resolves with the result of `promise`, or a
141
- * value that indicates the execution was aborted.
142
- *
143
- * **Note:** Because Promises in JS cannot be canceled, an abort signal will not
144
- * cancel the execution of the promise.
145
- *
146
- * @param signal A signal that communicates the process should be aborted.
147
- * @param promise A promise who's value will be returned if not aborted.
148
- * @returns A value indicating if the process was aborted, or the value of
149
- * `promise`.
150
- */
151
- function abort(signal, promise) {
152
- return __awaiter(this, void 0, void 0, function () {
153
- var controller, pendingAbort, result;
154
- return __generator(this, function (_a) {
155
- switch (_a.label) {
156
- case 0:
157
- controller = new AbortController();
158
- pendingAbort = once(signal, 'abort', { signal: controller.signal });
159
- return [4 /*yield*/, Promise.race([promise, pendingAbort])];
160
- case 1:
161
- result = _a.sent();
162
- if (isAbortEvent(result)) {
163
- return [2 /*return*/, { aborted: true }];
164
- }
165
- else {
166
- controller.abort();
167
- return [2 /*return*/, { aborted: false, result: result }];
168
- }
169
- }
170
- });
171
- });
172
- }
173
- function isAbortEvent(obj) {
174
- if (obj instanceof Event) {
175
- return obj.type === 'abort';
176
- }
177
- else
178
- return false;
179
- }
180
-
181
- var async = /*#__PURE__*/Object.freeze({
182
- __proto__: null,
183
- delay: delay,
184
- timeout: timeout,
185
- retry: retry,
186
- abort: abort
187
- });
188
-
189
- var rgbRegex = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
190
- var rgbaRegex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/;
191
- var hexRegex = /^(#|0x)?([A-Fa-f0-9]{6})$/;
192
- /**
193
- * Constructs a new color with the given red, green, blue and alpha values. If
194
- * alpha is undefined, defaults to 1.
195
- */
196
- var create$2 = function (r, g, b, a) {
197
- if (a === void 0) { a = 255; }
198
- return { r: r, g: g, b: b, a: a };
199
- };
200
- /**
201
- * Converts a numeric color value containing red, green and blue values to a
202
- * `Color`. The alpha channel will default to fully opaque.
203
- */
204
- var fromNumber = function (num) {
205
- // tslint:disable:no-bitwise
206
- var normalized = num & 0xffffff;
207
- return create$2((normalized >> 16) & 0xff, (normalized >> 8) & 0xff, normalized & 0xff);
208
- // tslint:enable:no-bitwise
209
- };
210
- /**
211
- * Returns a `Color` from a hex string, or undefined if the color string cannot
212
- * be parsed. Supports hex strings in the format of `"#00FF00"`, `"0x00FF00"` or
213
- * `"00FF00"`.
214
- */
215
- var fromHexString = function (str) {
216
- var match = hexRegex.exec(str);
217
- if (match != null) {
218
- return fromNumber(parseInt(match[2], 16));
219
- }
220
- };
221
- /**
222
- * Creates a `Color` from a CSS color value. This function currently only
223
- * supports `rgb(255, 255, 255)`, `rgba(255, 255, 255, 0.5)` or `"#FFFFFF"`.
224
- * Returns `undefined` if the color cannot be parsed.
225
- */
226
- var fromCss = function (css) {
227
- var rgbMatch = rgbRegex.exec(css);
228
- if (rgbMatch != null) {
229
- return create$2(parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3]));
230
- }
231
- var rgbaMatch = rgbaRegex.exec(css);
232
- if (rgbaMatch != null) {
233
- return create$2(parseInt(rgbaMatch[1]), parseInt(rgbaMatch[2]), parseInt(rgbaMatch[3]), Math.floor(parseFloat(rgbaMatch[4]) * 255));
234
- }
235
- if (hexRegex.test(css)) {
236
- return fromHexString(css);
237
- }
238
- };
239
- /**
240
- * Converts an array of four values to a `Color`. The sequence of the array is
241
- * expected to be `[r, g, b]` or `[r, g, b, a]`.
242
- */
243
- var fromArray = function (rgba) {
244
- return create$2(rgba[0], rgba[1], rgba[2], rgba[3]);
245
- };
246
- /**
247
- * Returns `true` if the color's alpha channel is 0.
248
- */
249
- var isInvisible = function (color) {
250
- return color.a === 0;
251
- };
252
- /**
253
- * Returns `true` if the alpha channel of this color is fully opaque (255).
254
- */
255
- var isOpaque = function (color) {
256
- return color.a === 255;
257
- };
258
- /**
259
- * Converts a `Color` to a hex string. The returned string will be prefixed with
260
- * `#`.
261
- */
262
- var toHexString = function (color) {
263
- return "#".concat(componentToHex(color.r)).concat(componentToHex(color.g)).concat(componentToHex(color.b));
264
- };
265
- var componentToHex = function (num) {
266
- var hex = num.toString(16);
267
- return hex.length === 1 ? '0' + hex : hex;
268
- };
269
-
270
- var color = /*#__PURE__*/Object.freeze({
271
- __proto__: null,
272
- create: create$2,
273
- fromNumber: fromNumber,
274
- fromHexString: fromHexString,
275
- fromCss: fromCss,
276
- fromArray: fromArray,
277
- isInvisible: isInvisible,
278
- isOpaque: isOpaque,
279
- toHexString: toHexString
280
- });
281
-
282
- /**
283
- * A module for defining functional schemas to map between different types. This
284
- * module is useful for parsing to or from JSON/protobufs to domain types.
285
- *
286
- * Mappers support greedy validation, so all validation errors are aggregated
287
- * and reported vs failing on the first invalid input.
288
- *
289
- * @example
290
- *
291
- * ```ts
292
- * import { Mapper as M } from '@vertexvis/utils';
293
- *
294
- * interface Address {
295
- * address: string;
296
- * city: string;
297
- * state: string;
298
- * zip: string;
299
- * }
300
- *
301
- * interface Person {
302
- * name: string;
303
- * addresses: Address[];
304
- * }
305
- *
306
- * type AddressJson = Partial<Address>;
307
- * type PersonJson = {
308
- * name?: string;
309
- * addresses?: AddressJson[];
310
- * }
311
- *
312
- * const mapAddress: M.Func<AddressJson, Address> = M.defineMapper(
313
- * M.read(
314
- * M.requireProp('address'),
315
- * M.requireProp('city'),
316
- * M.requireProp('state'),
317
- * M.requireProp('zip')
318
- * ),
319
- * ([address, city, state, zip]) => ({
320
- * address, city, state, zip
321
- * })
322
- * );
323
- *
324
- * const mapPerson: M.Func<PersonJson, Person> = M.defineMapper(
325
- * M.read(
326
- * M.requireProp('name'),
327
- * M.mapProp(
328
- * 'addresses',
329
- * M.compose(M.required('addresses'), M.mapArray(mapAddress))
330
- * )
331
- * ),
332
- * ([name, addresses]) => ({ name, addresses })
333
- * );
334
- *
335
- * const person = mapPerson({
336
- * name: 'John',
337
- * addresses: [{ address: '123', city: 'Ames', state: 'IA', zip: '50010' }]
338
- * });
339
- *
340
- * const invalidPerson = mapPerson({
341
- * addresses: [{ city: 'Ames', state: 'IA', zip: '50010' }]
342
- * });
343
- * ```
344
- * // {
345
- * // errors: ["Name is required.", "Address is required."]
346
- * // }
347
- *
348
- * @module
349
- */
350
- /**
351
- * An error that is thrown when validation of a schema fails.
352
- *
353
- * @see {@link ifInvalidThrow} - for throwing errors on invalid input.
354
- */
355
- var MapperValidationError = /** @class */ (function (_super) {
356
- __extends(MapperValidationError, _super);
357
- function MapperValidationError(errors) {
358
- var _this = _super.call(this, 'Validation error mapping object.') || this;
359
- _this.errors = errors;
360
- Object.setPrototypeOf(_this, MapperValidationError.prototype);
361
- return _this;
362
- }
363
- return MapperValidationError;
364
- }(Error));
365
- /**
366
- * Returns a mapper that asserts the input is not null or not undefined.
367
- *
368
- * @param name A name to report when invalid.
369
- */
370
- function required(name) {
371
- return function (input) {
372
- if (input != null) {
373
- return input;
374
- }
375
- else {
376
- return { errors: ["".concat(name, " is required.")] };
377
- }
378
- };
379
- }
380
- /**
381
- * Returns a mapper that asserts a property on the input is not null or not
382
- * defined.
383
- *
384
- * @param prop The prop to assert.
385
- * @returns A mapper that returns the property's value.
386
- */
387
- function requiredProp(prop) {
388
- return function (obj) {
389
- var value = obj[prop];
390
- if (value != null) {
391
- return value;
392
- }
393
- else {
394
- return { errors: ["".concat(prop, " is required")] };
395
- }
396
- };
397
- }
398
- /**
399
- * Returns a mapper that invokes a function if the input is not null or not
400
- * undefined.
401
- *
402
- * @param mapper A mapping function.
403
- */
404
- function ifDefined(mapper) {
405
- return function (input) {
406
- if (input != null) {
407
- return mapper(input);
408
- }
409
- else {
410
- return input;
411
- }
412
- };
413
- }
414
- /**
415
- * Returns a mapper that extracts a property's value.
416
- *
417
- * @param prop The property to extract.
418
- */
419
- function getProp(prop) {
420
- return function (input) {
421
- return input[prop];
422
- };
423
- }
424
- /**
425
- * Returns a mapper that will invoke a mapping function on an input's property.
426
- *
427
- * @param prop The name of the property to map over.
428
- * @param mapper A function that will be invoked with the property's value.
429
- */
430
- function mapProp(prop, mapper) {
431
- return function (input) {
432
- var value = input[prop];
433
- return mapper(value);
434
- };
435
- }
436
- /**
437
- * Returns a mapper that will check if the given property is defined, and if so
438
- * invoke the given mapping function.
439
- *
440
- * @param prop The name of the property to map over.
441
- * @param mapper A function that will be invoked with the property's value if
442
- * the property is defined.
443
- */
444
- function mapRequiredProp(prop, mapper) {
445
- return mapProp(prop, compose(required(prop.toString()), mapper));
446
- }
447
- /**
448
- * Returns a mapper that will invoke a mapper over each value in the input
449
- * array. Returns `Invalid` containing errors for all invalid values in the
450
- * array.
451
- *
452
- * @param mapper A function that will be invoked with each array value.
453
- * @returns
454
- */
455
- function mapArray(mapper) {
456
- return function (inputs) {
457
- if (inputs.length > 0) {
458
- var _a = __read(inputs), head = _a[0], tail = _a.slice(1);
459
- var first = mapper(head);
460
- return tail.reduce(function (res, input) {
461
- var value = mapper(input);
462
- if (isInvalid(value)) {
463
- return isInvalid(res)
464
- ? { errors: __spreadArray(__spreadArray([], __read(res.errors), false), __read(value.errors), false) }
465
- : value;
466
- }
467
- else if (isInvalid(res)) {
468
- return res;
469
- }
470
- else {
471
- return __spreadArray(__spreadArray([], __read(res), false), [value], false);
472
- }
473
- }, isInvalid(first) ? first : [first]);
474
- }
475
- else {
476
- return [];
477
- }
478
- };
479
- }
480
- /**
481
- * A type guard that checks if the object is an `Invalid` type.
482
- */
483
- function isInvalid(obj) {
484
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
485
- return obj != null && obj.hasOwnProperty('errors');
486
- }
487
- /**
488
- * Returns a function that throws an error if the input is invalid. Otherwise
489
- * returns the result.
490
- *
491
- * @param mapper A mapper that will be invoked with the input.
492
- * @throws {@link MapperValidationError} If the input is invalid.
493
- */
494
- function ifInvalidThrow(mapper) {
495
- return function (input) {
496
- var value = mapper(input);
497
- if (isInvalid(value)) {
498
- throw new MapperValidationError(value.errors);
499
- }
500
- else
501
- return value;
502
- };
503
- }
504
- function ifValidThen(obj, f) {
505
- if (isInvalid(obj)) {
506
- return obj;
507
- }
508
- else {
509
- return f(obj);
510
- }
511
- }
512
- function read() {
513
- var mappers = [];
514
- for (var _i = 0; _i < arguments.length; _i++) {
515
- mappers[_i] = arguments[_i];
516
- }
517
- return function (input) {
518
- return mappers.reduce(function (res, decoder) {
519
- var value = decoder(input);
520
- if (isInvalid(value)) {
521
- return isInvalid(res)
522
- ? { errors: __spreadArray(__spreadArray([], __read(res.errors), false), __read(value.errors), false) }
523
- : value;
524
- }
525
- else if (isInvalid(res)) {
526
- return res;
527
- }
528
- else {
529
- return __spreadArray(__spreadArray([], __read(res), false), [value], false);
530
- }
531
- }, []);
532
- };
533
- }
534
- /* eslint-enable padding-line-between-statements */
535
- /**
536
- * Defines a mapper that reads the values from an input and invokes a builder to
537
- * transform data from one schema to another.
538
- *
539
- * @example
540
- *
541
- * ```ts
542
- * import { Mapper as M } from '@vertexvis/utils';
543
- *
544
- * interface Address {
545
- * address: string;
546
- * city: string;
547
- * state: string;
548
- * zip: string;
549
- * }
550
- *
551
- * interface Person {
552
- * name: string;
553
- * addresses: Address[];
554
- * }
555
- *
556
- * type AddressJson = Partial<Address>;
557
- * type PersonJson = {
558
- * name?: string;
559
- * addresses?: AddressJson[];
560
- * }
561
- *
562
- * const mapAddress: M.Func<AddressJson, Address> = M.defineMapper(
563
- * M.read(
564
- * M.requireProp('address'),
565
- * M.requireProp('city'),
566
- * M.requireProp('state'),
567
- * M.requireProp('zip')
568
- * ),
569
- * ([address, city, state, zip]) => ({
570
- * address, city, state, zip
571
- * })
572
- * );
573
- *
574
- * const mapPerson: M.Func<PersonJson, Person> = M.defineMapper(
575
- * M.read(
576
- * M.requireProp('name'),
577
- * M.mapProp(
578
- * 'addresses',
579
- * M.compose(M.required('addresses'), M.mapArray(mapAddress))
580
- * )
581
- * ),
582
- * ([name, addresses]) => ({ name, addresses })
583
- * )
584
- *
585
- * const person = mapPerson({
586
- * name: 'John',
587
- * addresses: [{ address: '123', city: 'Ames', state: 'IA', zip: '50010' }]
588
- * })
589
- * ```
590
- *
591
- * @param reader The mapper that reads values from the input an creates an
592
- * intermediate format that will be passed to the `builder`.
593
- * @param builder A mapper that takes the output of `reader` and constructs the
594
- * output format.
595
- * @see {@link read} - a helper function to read and validate input values.
596
- */
597
- function defineMapper(reader, builder) {
598
- return function (input) {
599
- var values = reader(input);
600
- return ifValidThen(values, builder);
601
- };
602
- }
603
- function compose() {
604
- var decoders = [];
605
- for (var _i = 0; _i < arguments.length; _i++) {
606
- decoders[_i] = arguments[_i];
607
- }
608
- return function (input) {
609
- return decoders.reduce(function (last, decoder) {
610
- if (isInvalid(last)) {
611
- return last;
612
- }
613
- else {
614
- return decoder(last);
615
- }
616
- }, input);
617
- };
618
- }
619
- function pickFirst() {
620
- var decoders = [];
621
- for (var _i = 0; _i < arguments.length; _i++) {
622
- decoders[_i] = arguments[_i];
623
- }
624
- return function (input) {
625
- return decoders.reduce(function (value, decoder) {
626
- if (value === undefined) {
627
- return decoder(input);
628
- }
629
- else {
630
- return value;
631
- }
632
- }, undefined);
633
- };
634
- }
635
- /* eslint-enable padding-line-between-statements */
636
-
637
- var mapper = /*#__PURE__*/Object.freeze({
638
- __proto__: null,
639
- MapperValidationError: MapperValidationError,
640
- required: required,
641
- requiredProp: requiredProp,
642
- ifDefined: ifDefined,
643
- getProp: getProp,
644
- mapProp: mapProp,
645
- mapRequiredProp: mapRequiredProp,
646
- mapArray: mapArray,
647
- isInvalid: isInvalid,
648
- ifInvalidThrow: ifInvalidThrow,
649
- read: read,
650
- defineMapper: defineMapper,
651
- compose: compose,
652
- pickFirst: pickFirst
653
- });
654
-
655
- /*!
656
- * isobject <https://github.com/jonschlinkert/isobject>
657
- *
658
- * Copyright (c) 2014-2017, Jon Schlinkert.
659
- * Released under the MIT License.
660
- */
661
-
662
- function isObject(val) {
663
- return val != null && typeof val === 'object' && Array.isArray(val) === false;
664
- }
665
-
666
- /*!
667
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
668
- *
669
- * Copyright (c) 2014-2017, Jon Schlinkert.
670
- * Released under the MIT License.
671
- */
672
-
673
- function isObjectObject(o) {
674
- return isObject(o) === true
675
- && Object.prototype.toString.call(o) === '[object Object]';
676
- }
677
-
678
- function isPlainObject$1(o) {
679
- var ctor,prot;
680
-
681
- if (isObjectObject(o) === false) return false;
682
-
683
- // If has modified constructor
684
- ctor = o.constructor;
685
- if (typeof ctor !== 'function') return false;
686
-
687
- // If has modified prototype
688
- prot = ctor.prototype;
689
- if (isObjectObject(prot) === false) return false;
690
-
691
- // If constructor does not have an Object-specific method
692
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
693
- return false;
694
- }
695
-
696
- // Most likely a plain Object
697
- return true;
698
- }
699
-
700
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
701
-
702
- var lodash_isequal = {exports: {}};
703
-
704
- /**
705
- * Lodash (Custom Build) <https://lodash.com/>
706
- * Build: `lodash modularize exports="npm" -o ./`
707
- * Copyright JS Foundation and other contributors <https://js.foundation/>
708
- * Released under MIT license <https://lodash.com/license>
709
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
710
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
711
- */
712
-
713
- (function (module, exports) {
714
- /** Used as the size to enable large array optimizations. */
715
- var LARGE_ARRAY_SIZE = 200;
716
-
717
- /** Used to stand-in for `undefined` hash values. */
718
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
719
-
720
- /** Used to compose bitmasks for value comparisons. */
721
- var COMPARE_PARTIAL_FLAG = 1,
722
- COMPARE_UNORDERED_FLAG = 2;
723
-
724
- /** Used as references for various `Number` constants. */
725
- var MAX_SAFE_INTEGER = 9007199254740991;
726
-
727
- /** `Object#toString` result references. */
728
- var argsTag = '[object Arguments]',
729
- arrayTag = '[object Array]',
730
- asyncTag = '[object AsyncFunction]',
731
- boolTag = '[object Boolean]',
732
- dateTag = '[object Date]',
733
- errorTag = '[object Error]',
734
- funcTag = '[object Function]',
735
- genTag = '[object GeneratorFunction]',
736
- mapTag = '[object Map]',
737
- numberTag = '[object Number]',
738
- nullTag = '[object Null]',
739
- objectTag = '[object Object]',
740
- promiseTag = '[object Promise]',
741
- proxyTag = '[object Proxy]',
742
- regexpTag = '[object RegExp]',
743
- setTag = '[object Set]',
744
- stringTag = '[object String]',
745
- symbolTag = '[object Symbol]',
746
- undefinedTag = '[object Undefined]',
747
- weakMapTag = '[object WeakMap]';
748
-
749
- var arrayBufferTag = '[object ArrayBuffer]',
750
- dataViewTag = '[object DataView]',
751
- float32Tag = '[object Float32Array]',
752
- float64Tag = '[object Float64Array]',
753
- int8Tag = '[object Int8Array]',
754
- int16Tag = '[object Int16Array]',
755
- int32Tag = '[object Int32Array]',
756
- uint8Tag = '[object Uint8Array]',
757
- uint8ClampedTag = '[object Uint8ClampedArray]',
758
- uint16Tag = '[object Uint16Array]',
759
- uint32Tag = '[object Uint32Array]';
760
-
761
- /**
762
- * Used to match `RegExp`
763
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
764
- */
765
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
766
-
767
- /** Used to detect host constructors (Safari). */
768
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
769
-
770
- /** Used to detect unsigned integer values. */
771
- var reIsUint = /^(?:0|[1-9]\d*)$/;
772
-
773
- /** Used to identify `toStringTag` values of typed arrays. */
774
- var typedArrayTags = {};
775
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
776
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
777
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
778
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
779
- typedArrayTags[uint32Tag] = true;
780
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
781
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
782
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
783
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
784
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
785
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
786
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
787
- typedArrayTags[weakMapTag] = false;
788
-
789
- /** Detect free variable `global` from Node.js. */
790
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
791
-
792
- /** Detect free variable `self`. */
793
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
794
-
795
- /** Used as a reference to the global object. */
796
- var root = freeGlobal || freeSelf || Function('return this')();
797
-
798
- /** Detect free variable `exports`. */
799
- var freeExports = exports && !exports.nodeType && exports;
800
-
801
- /** Detect free variable `module`. */
802
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
803
-
804
- /** Detect the popular CommonJS extension `module.exports`. */
805
- var moduleExports = freeModule && freeModule.exports === freeExports;
806
-
807
- /** Detect free variable `process` from Node.js. */
808
- var freeProcess = moduleExports && freeGlobal.process;
809
-
810
- /** Used to access faster Node.js helpers. */
811
- var nodeUtil = (function() {
812
- try {
813
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
814
- } catch (e) {}
815
- }());
816
-
817
- /* Node.js helper references. */
818
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
819
-
820
- /**
821
- * A specialized version of `_.filter` for arrays without support for
822
- * iteratee shorthands.
823
- *
824
- * @private
825
- * @param {Array} [array] The array to iterate over.
826
- * @param {Function} predicate The function invoked per iteration.
827
- * @returns {Array} Returns the new filtered array.
828
- */
829
- function arrayFilter(array, predicate) {
830
- var index = -1,
831
- length = array == null ? 0 : array.length,
832
- resIndex = 0,
833
- result = [];
834
-
835
- while (++index < length) {
836
- var value = array[index];
837
- if (predicate(value, index, array)) {
838
- result[resIndex++] = value;
839
- }
840
- }
841
- return result;
842
- }
843
-
844
- /**
845
- * Appends the elements of `values` to `array`.
846
- *
847
- * @private
848
- * @param {Array} array The array to modify.
849
- * @param {Array} values The values to append.
850
- * @returns {Array} Returns `array`.
851
- */
852
- function arrayPush(array, values) {
853
- var index = -1,
854
- length = values.length,
855
- offset = array.length;
856
-
857
- while (++index < length) {
858
- array[offset + index] = values[index];
859
- }
860
- return array;
861
- }
862
-
863
- /**
864
- * A specialized version of `_.some` for arrays without support for iteratee
865
- * shorthands.
866
- *
867
- * @private
868
- * @param {Array} [array] The array to iterate over.
869
- * @param {Function} predicate The function invoked per iteration.
870
- * @returns {boolean} Returns `true` if any element passes the predicate check,
871
- * else `false`.
872
- */
873
- function arraySome(array, predicate) {
874
- var index = -1,
875
- length = array == null ? 0 : array.length;
876
-
877
- while (++index < length) {
878
- if (predicate(array[index], index, array)) {
879
- return true;
880
- }
881
- }
882
- return false;
883
- }
884
-
885
- /**
886
- * The base implementation of `_.times` without support for iteratee shorthands
887
- * or max array length checks.
888
- *
889
- * @private
890
- * @param {number} n The number of times to invoke `iteratee`.
891
- * @param {Function} iteratee The function invoked per iteration.
892
- * @returns {Array} Returns the array of results.
893
- */
894
- function baseTimes(n, iteratee) {
895
- var index = -1,
896
- result = Array(n);
897
-
898
- while (++index < n) {
899
- result[index] = iteratee(index);
900
- }
901
- return result;
902
- }
903
-
904
- /**
905
- * The base implementation of `_.unary` without support for storing metadata.
906
- *
907
- * @private
908
- * @param {Function} func The function to cap arguments for.
909
- * @returns {Function} Returns the new capped function.
910
- */
911
- function baseUnary(func) {
912
- return function(value) {
913
- return func(value);
914
- };
915
- }
916
-
917
- /**
918
- * Checks if a `cache` value for `key` exists.
919
- *
920
- * @private
921
- * @param {Object} cache The cache to query.
922
- * @param {string} key The key of the entry to check.
923
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
924
- */
925
- function cacheHas(cache, key) {
926
- return cache.has(key);
927
- }
928
-
929
- /**
930
- * Gets the value at `key` of `object`.
931
- *
932
- * @private
933
- * @param {Object} [object] The object to query.
934
- * @param {string} key The key of the property to get.
935
- * @returns {*} Returns the property value.
936
- */
937
- function getValue(object, key) {
938
- return object == null ? undefined : object[key];
939
- }
940
-
941
- /**
942
- * Converts `map` to its key-value pairs.
943
- *
944
- * @private
945
- * @param {Object} map The map to convert.
946
- * @returns {Array} Returns the key-value pairs.
947
- */
948
- function mapToArray(map) {
949
- var index = -1,
950
- result = Array(map.size);
951
-
952
- map.forEach(function(value, key) {
953
- result[++index] = [key, value];
954
- });
955
- return result;
956
- }
957
-
958
- /**
959
- * Creates a unary function that invokes `func` with its argument transformed.
960
- *
961
- * @private
962
- * @param {Function} func The function to wrap.
963
- * @param {Function} transform The argument transform.
964
- * @returns {Function} Returns the new function.
965
- */
966
- function overArg(func, transform) {
967
- return function(arg) {
968
- return func(transform(arg));
969
- };
970
- }
971
-
972
- /**
973
- * Converts `set` to an array of its values.
974
- *
975
- * @private
976
- * @param {Object} set The set to convert.
977
- * @returns {Array} Returns the values.
978
- */
979
- function setToArray(set) {
980
- var index = -1,
981
- result = Array(set.size);
982
-
983
- set.forEach(function(value) {
984
- result[++index] = value;
985
- });
986
- return result;
987
- }
988
-
989
- /** Used for built-in method references. */
990
- var arrayProto = Array.prototype,
991
- funcProto = Function.prototype,
992
- objectProto = Object.prototype;
993
-
994
- /** Used to detect overreaching core-js shims. */
995
- var coreJsData = root['__core-js_shared__'];
996
-
997
- /** Used to resolve the decompiled source of functions. */
998
- var funcToString = funcProto.toString;
999
-
1000
- /** Used to check objects for own properties. */
1001
- var hasOwnProperty = objectProto.hasOwnProperty;
1002
-
1003
- /** Used to detect methods masquerading as native. */
1004
- var maskSrcKey = (function() {
1005
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1006
- return uid ? ('Symbol(src)_1.' + uid) : '';
1007
- }());
1008
-
1009
- /**
1010
- * Used to resolve the
1011
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1012
- * of values.
1013
- */
1014
- var nativeObjectToString = objectProto.toString;
1015
-
1016
- /** Used to detect if a method is native. */
1017
- var reIsNative = RegExp('^' +
1018
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
1019
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1020
- );
1021
-
1022
- /** Built-in value references. */
1023
- var Buffer = moduleExports ? root.Buffer : undefined,
1024
- Symbol = root.Symbol,
1025
- Uint8Array = root.Uint8Array,
1026
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
1027
- splice = arrayProto.splice,
1028
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1029
-
1030
- /* Built-in method references for those with the same name as other `lodash` methods. */
1031
- var nativeGetSymbols = Object.getOwnPropertySymbols,
1032
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
1033
- nativeKeys = overArg(Object.keys, Object);
1034
-
1035
- /* Built-in method references that are verified to be native. */
1036
- var DataView = getNative(root, 'DataView'),
1037
- Map = getNative(root, 'Map'),
1038
- Promise = getNative(root, 'Promise'),
1039
- Set = getNative(root, 'Set'),
1040
- WeakMap = getNative(root, 'WeakMap'),
1041
- nativeCreate = getNative(Object, 'create');
1042
-
1043
- /** Used to detect maps, sets, and weakmaps. */
1044
- var dataViewCtorString = toSource(DataView),
1045
- mapCtorString = toSource(Map),
1046
- promiseCtorString = toSource(Promise),
1047
- setCtorString = toSource(Set),
1048
- weakMapCtorString = toSource(WeakMap);
1049
-
1050
- /** Used to convert symbols to primitives and strings. */
1051
- var symbolProto = Symbol ? Symbol.prototype : undefined,
1052
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
1053
-
1054
- /**
1055
- * Creates a hash object.
1056
- *
1057
- * @private
1058
- * @constructor
1059
- * @param {Array} [entries] The key-value pairs to cache.
1060
- */
1061
- function Hash(entries) {
1062
- var index = -1,
1063
- length = entries == null ? 0 : entries.length;
1064
-
1065
- this.clear();
1066
- while (++index < length) {
1067
- var entry = entries[index];
1068
- this.set(entry[0], entry[1]);
1069
- }
1070
- }
1071
-
1072
- /**
1073
- * Removes all key-value entries from the hash.
1074
- *
1075
- * @private
1076
- * @name clear
1077
- * @memberOf Hash
1078
- */
1079
- function hashClear() {
1080
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
1081
- this.size = 0;
1082
- }
1083
-
1084
- /**
1085
- * Removes `key` and its value from the hash.
1086
- *
1087
- * @private
1088
- * @name delete
1089
- * @memberOf Hash
1090
- * @param {Object} hash The hash to modify.
1091
- * @param {string} key The key of the value to remove.
1092
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1093
- */
1094
- function hashDelete(key) {
1095
- var result = this.has(key) && delete this.__data__[key];
1096
- this.size -= result ? 1 : 0;
1097
- return result;
1098
- }
1099
-
1100
- /**
1101
- * Gets the hash value for `key`.
1102
- *
1103
- * @private
1104
- * @name get
1105
- * @memberOf Hash
1106
- * @param {string} key The key of the value to get.
1107
- * @returns {*} Returns the entry value.
1108
- */
1109
- function hashGet(key) {
1110
- var data = this.__data__;
1111
- if (nativeCreate) {
1112
- var result = data[key];
1113
- return result === HASH_UNDEFINED ? undefined : result;
1114
- }
1115
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
1116
- }
1117
-
1118
- /**
1119
- * Checks if a hash value for `key` exists.
1120
- *
1121
- * @private
1122
- * @name has
1123
- * @memberOf Hash
1124
- * @param {string} key The key of the entry to check.
1125
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1126
- */
1127
- function hashHas(key) {
1128
- var data = this.__data__;
1129
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
1130
- }
1131
-
1132
- /**
1133
- * Sets the hash `key` to `value`.
1134
- *
1135
- * @private
1136
- * @name set
1137
- * @memberOf Hash
1138
- * @param {string} key The key of the value to set.
1139
- * @param {*} value The value to set.
1140
- * @returns {Object} Returns the hash instance.
1141
- */
1142
- function hashSet(key, value) {
1143
- var data = this.__data__;
1144
- this.size += this.has(key) ? 0 : 1;
1145
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
1146
- return this;
1147
- }
1148
-
1149
- // Add methods to `Hash`.
1150
- Hash.prototype.clear = hashClear;
1151
- Hash.prototype['delete'] = hashDelete;
1152
- Hash.prototype.get = hashGet;
1153
- Hash.prototype.has = hashHas;
1154
- Hash.prototype.set = hashSet;
1155
-
1156
- /**
1157
- * Creates an list cache object.
1158
- *
1159
- * @private
1160
- * @constructor
1161
- * @param {Array} [entries] The key-value pairs to cache.
1162
- */
1163
- function ListCache(entries) {
1164
- var index = -1,
1165
- length = entries == null ? 0 : entries.length;
1166
-
1167
- this.clear();
1168
- while (++index < length) {
1169
- var entry = entries[index];
1170
- this.set(entry[0], entry[1]);
1171
- }
1172
- }
1173
-
1174
- /**
1175
- * Removes all key-value entries from the list cache.
1176
- *
1177
- * @private
1178
- * @name clear
1179
- * @memberOf ListCache
1180
- */
1181
- function listCacheClear() {
1182
- this.__data__ = [];
1183
- this.size = 0;
1184
- }
1185
-
1186
- /**
1187
- * Removes `key` and its value from the list cache.
1188
- *
1189
- * @private
1190
- * @name delete
1191
- * @memberOf ListCache
1192
- * @param {string} key The key of the value to remove.
1193
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1194
- */
1195
- function listCacheDelete(key) {
1196
- var data = this.__data__,
1197
- index = assocIndexOf(data, key);
1198
-
1199
- if (index < 0) {
1200
- return false;
1201
- }
1202
- var lastIndex = data.length - 1;
1203
- if (index == lastIndex) {
1204
- data.pop();
1205
- } else {
1206
- splice.call(data, index, 1);
1207
- }
1208
- --this.size;
1209
- return true;
1210
- }
1211
-
1212
- /**
1213
- * Gets the list cache value for `key`.
1214
- *
1215
- * @private
1216
- * @name get
1217
- * @memberOf ListCache
1218
- * @param {string} key The key of the value to get.
1219
- * @returns {*} Returns the entry value.
1220
- */
1221
- function listCacheGet(key) {
1222
- var data = this.__data__,
1223
- index = assocIndexOf(data, key);
1224
-
1225
- return index < 0 ? undefined : data[index][1];
1226
- }
1227
-
1228
- /**
1229
- * Checks if a list cache value for `key` exists.
1230
- *
1231
- * @private
1232
- * @name has
1233
- * @memberOf ListCache
1234
- * @param {string} key The key of the entry to check.
1235
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1236
- */
1237
- function listCacheHas(key) {
1238
- return assocIndexOf(this.__data__, key) > -1;
1239
- }
1240
-
1241
- /**
1242
- * Sets the list cache `key` to `value`.
1243
- *
1244
- * @private
1245
- * @name set
1246
- * @memberOf ListCache
1247
- * @param {string} key The key of the value to set.
1248
- * @param {*} value The value to set.
1249
- * @returns {Object} Returns the list cache instance.
1250
- */
1251
- function listCacheSet(key, value) {
1252
- var data = this.__data__,
1253
- index = assocIndexOf(data, key);
1254
-
1255
- if (index < 0) {
1256
- ++this.size;
1257
- data.push([key, value]);
1258
- } else {
1259
- data[index][1] = value;
1260
- }
1261
- return this;
1262
- }
1263
-
1264
- // Add methods to `ListCache`.
1265
- ListCache.prototype.clear = listCacheClear;
1266
- ListCache.prototype['delete'] = listCacheDelete;
1267
- ListCache.prototype.get = listCacheGet;
1268
- ListCache.prototype.has = listCacheHas;
1269
- ListCache.prototype.set = listCacheSet;
1270
-
1271
- /**
1272
- * Creates a map cache object to store key-value pairs.
1273
- *
1274
- * @private
1275
- * @constructor
1276
- * @param {Array} [entries] The key-value pairs to cache.
1277
- */
1278
- function MapCache(entries) {
1279
- var index = -1,
1280
- length = entries == null ? 0 : entries.length;
1281
-
1282
- this.clear();
1283
- while (++index < length) {
1284
- var entry = entries[index];
1285
- this.set(entry[0], entry[1]);
1286
- }
1287
- }
1288
-
1289
- /**
1290
- * Removes all key-value entries from the map.
1291
- *
1292
- * @private
1293
- * @name clear
1294
- * @memberOf MapCache
1295
- */
1296
- function mapCacheClear() {
1297
- this.size = 0;
1298
- this.__data__ = {
1299
- 'hash': new Hash,
1300
- 'map': new (Map || ListCache),
1301
- 'string': new Hash
1302
- };
1303
- }
1304
-
1305
- /**
1306
- * Removes `key` and its value from the map.
1307
- *
1308
- * @private
1309
- * @name delete
1310
- * @memberOf MapCache
1311
- * @param {string} key The key of the value to remove.
1312
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1313
- */
1314
- function mapCacheDelete(key) {
1315
- var result = getMapData(this, key)['delete'](key);
1316
- this.size -= result ? 1 : 0;
1317
- return result;
1318
- }
1319
-
1320
- /**
1321
- * Gets the map value for `key`.
1322
- *
1323
- * @private
1324
- * @name get
1325
- * @memberOf MapCache
1326
- * @param {string} key The key of the value to get.
1327
- * @returns {*} Returns the entry value.
1328
- */
1329
- function mapCacheGet(key) {
1330
- return getMapData(this, key).get(key);
1331
- }
1332
-
1333
- /**
1334
- * Checks if a map value for `key` exists.
1335
- *
1336
- * @private
1337
- * @name has
1338
- * @memberOf MapCache
1339
- * @param {string} key The key of the entry to check.
1340
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1341
- */
1342
- function mapCacheHas(key) {
1343
- return getMapData(this, key).has(key);
1344
- }
1345
-
1346
- /**
1347
- * Sets the map `key` to `value`.
1348
- *
1349
- * @private
1350
- * @name set
1351
- * @memberOf MapCache
1352
- * @param {string} key The key of the value to set.
1353
- * @param {*} value The value to set.
1354
- * @returns {Object} Returns the map cache instance.
1355
- */
1356
- function mapCacheSet(key, value) {
1357
- var data = getMapData(this, key),
1358
- size = data.size;
1359
-
1360
- data.set(key, value);
1361
- this.size += data.size == size ? 0 : 1;
1362
- return this;
1363
- }
1364
-
1365
- // Add methods to `MapCache`.
1366
- MapCache.prototype.clear = mapCacheClear;
1367
- MapCache.prototype['delete'] = mapCacheDelete;
1368
- MapCache.prototype.get = mapCacheGet;
1369
- MapCache.prototype.has = mapCacheHas;
1370
- MapCache.prototype.set = mapCacheSet;
1371
-
1372
- /**
1373
- *
1374
- * Creates an array cache object to store unique values.
1375
- *
1376
- * @private
1377
- * @constructor
1378
- * @param {Array} [values] The values to cache.
1379
- */
1380
- function SetCache(values) {
1381
- var index = -1,
1382
- length = values == null ? 0 : values.length;
1383
-
1384
- this.__data__ = new MapCache;
1385
- while (++index < length) {
1386
- this.add(values[index]);
1387
- }
1388
- }
1389
-
1390
- /**
1391
- * Adds `value` to the array cache.
1392
- *
1393
- * @private
1394
- * @name add
1395
- * @memberOf SetCache
1396
- * @alias push
1397
- * @param {*} value The value to cache.
1398
- * @returns {Object} Returns the cache instance.
1399
- */
1400
- function setCacheAdd(value) {
1401
- this.__data__.set(value, HASH_UNDEFINED);
1402
- return this;
1403
- }
1404
-
1405
- /**
1406
- * Checks if `value` is in the array cache.
1407
- *
1408
- * @private
1409
- * @name has
1410
- * @memberOf SetCache
1411
- * @param {*} value The value to search for.
1412
- * @returns {number} Returns `true` if `value` is found, else `false`.
1413
- */
1414
- function setCacheHas(value) {
1415
- return this.__data__.has(value);
1416
- }
1417
-
1418
- // Add methods to `SetCache`.
1419
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1420
- SetCache.prototype.has = setCacheHas;
1421
-
1422
- /**
1423
- * Creates a stack cache object to store key-value pairs.
1424
- *
1425
- * @private
1426
- * @constructor
1427
- * @param {Array} [entries] The key-value pairs to cache.
1428
- */
1429
- function Stack(entries) {
1430
- var data = this.__data__ = new ListCache(entries);
1431
- this.size = data.size;
1432
- }
1433
-
1434
- /**
1435
- * Removes all key-value entries from the stack.
1436
- *
1437
- * @private
1438
- * @name clear
1439
- * @memberOf Stack
1440
- */
1441
- function stackClear() {
1442
- this.__data__ = new ListCache;
1443
- this.size = 0;
1444
- }
1445
-
1446
- /**
1447
- * Removes `key` and its value from the stack.
1448
- *
1449
- * @private
1450
- * @name delete
1451
- * @memberOf Stack
1452
- * @param {string} key The key of the value to remove.
1453
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1454
- */
1455
- function stackDelete(key) {
1456
- var data = this.__data__,
1457
- result = data['delete'](key);
1458
-
1459
- this.size = data.size;
1460
- return result;
1461
- }
1462
-
1463
- /**
1464
- * Gets the stack value for `key`.
1465
- *
1466
- * @private
1467
- * @name get
1468
- * @memberOf Stack
1469
- * @param {string} key The key of the value to get.
1470
- * @returns {*} Returns the entry value.
1471
- */
1472
- function stackGet(key) {
1473
- return this.__data__.get(key);
1474
- }
1475
-
1476
- /**
1477
- * Checks if a stack value for `key` exists.
1478
- *
1479
- * @private
1480
- * @name has
1481
- * @memberOf Stack
1482
- * @param {string} key The key of the entry to check.
1483
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1484
- */
1485
- function stackHas(key) {
1486
- return this.__data__.has(key);
1487
- }
1488
-
1489
- /**
1490
- * Sets the stack `key` to `value`.
1491
- *
1492
- * @private
1493
- * @name set
1494
- * @memberOf Stack
1495
- * @param {string} key The key of the value to set.
1496
- * @param {*} value The value to set.
1497
- * @returns {Object} Returns the stack cache instance.
1498
- */
1499
- function stackSet(key, value) {
1500
- var data = this.__data__;
1501
- if (data instanceof ListCache) {
1502
- var pairs = data.__data__;
1503
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1504
- pairs.push([key, value]);
1505
- this.size = ++data.size;
1506
- return this;
1507
- }
1508
- data = this.__data__ = new MapCache(pairs);
1509
- }
1510
- data.set(key, value);
1511
- this.size = data.size;
1512
- return this;
1513
- }
1514
-
1515
- // Add methods to `Stack`.
1516
- Stack.prototype.clear = stackClear;
1517
- Stack.prototype['delete'] = stackDelete;
1518
- Stack.prototype.get = stackGet;
1519
- Stack.prototype.has = stackHas;
1520
- Stack.prototype.set = stackSet;
1521
-
1522
- /**
1523
- * Creates an array of the enumerable property names of the array-like `value`.
1524
- *
1525
- * @private
1526
- * @param {*} value The value to query.
1527
- * @param {boolean} inherited Specify returning inherited property names.
1528
- * @returns {Array} Returns the array of property names.
1529
- */
1530
- function arrayLikeKeys(value, inherited) {
1531
- var isArr = isArray(value),
1532
- isArg = !isArr && isArguments(value),
1533
- isBuff = !isArr && !isArg && isBuffer(value),
1534
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1535
- skipIndexes = isArr || isArg || isBuff || isType,
1536
- result = skipIndexes ? baseTimes(value.length, String) : [],
1537
- length = result.length;
1538
-
1539
- for (var key in value) {
1540
- if ((inherited || hasOwnProperty.call(value, key)) &&
1541
- !(skipIndexes && (
1542
- // Safari 9 has enumerable `arguments.length` in strict mode.
1543
- key == 'length' ||
1544
- // Node.js 0.10 has enumerable non-index properties on buffers.
1545
- (isBuff && (key == 'offset' || key == 'parent')) ||
1546
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1547
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1548
- // Skip index properties.
1549
- isIndex(key, length)
1550
- ))) {
1551
- result.push(key);
1552
- }
1553
- }
1554
- return result;
1555
- }
1556
-
1557
- /**
1558
- * Gets the index at which the `key` is found in `array` of key-value pairs.
1559
- *
1560
- * @private
1561
- * @param {Array} array The array to inspect.
1562
- * @param {*} key The key to search for.
1563
- * @returns {number} Returns the index of the matched value, else `-1`.
1564
- */
1565
- function assocIndexOf(array, key) {
1566
- var length = array.length;
1567
- while (length--) {
1568
- if (eq(array[length][0], key)) {
1569
- return length;
1570
- }
1571
- }
1572
- return -1;
1573
- }
1574
-
1575
- /**
1576
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1577
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1578
- * symbols of `object`.
1579
- *
1580
- * @private
1581
- * @param {Object} object The object to query.
1582
- * @param {Function} keysFunc The function to get the keys of `object`.
1583
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
1584
- * @returns {Array} Returns the array of property names and symbols.
1585
- */
1586
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1587
- var result = keysFunc(object);
1588
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1589
- }
1590
-
1591
- /**
1592
- * The base implementation of `getTag` without fallbacks for buggy environments.
1593
- *
1594
- * @private
1595
- * @param {*} value The value to query.
1596
- * @returns {string} Returns the `toStringTag`.
1597
- */
1598
- function baseGetTag(value) {
1599
- if (value == null) {
1600
- return value === undefined ? undefinedTag : nullTag;
1601
- }
1602
- return (symToStringTag && symToStringTag in Object(value))
1603
- ? getRawTag(value)
1604
- : objectToString(value);
1605
- }
1606
-
1607
- /**
1608
- * The base implementation of `_.isArguments`.
1609
- *
1610
- * @private
1611
- * @param {*} value The value to check.
1612
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1613
- */
1614
- function baseIsArguments(value) {
1615
- return isObjectLike(value) && baseGetTag(value) == argsTag;
1616
- }
1617
-
1618
- /**
1619
- * The base implementation of `_.isEqual` which supports partial comparisons
1620
- * and tracks traversed objects.
1621
- *
1622
- * @private
1623
- * @param {*} value The value to compare.
1624
- * @param {*} other The other value to compare.
1625
- * @param {boolean} bitmask The bitmask flags.
1626
- * 1 - Unordered comparison
1627
- * 2 - Partial comparison
1628
- * @param {Function} [customizer] The function to customize comparisons.
1629
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1630
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1631
- */
1632
- function baseIsEqual(value, other, bitmask, customizer, stack) {
1633
- if (value === other) {
1634
- return true;
1635
- }
1636
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1637
- return value !== value && other !== other;
1638
- }
1639
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1640
- }
1641
-
1642
- /**
1643
- * A specialized version of `baseIsEqual` for arrays and objects which performs
1644
- * deep comparisons and tracks traversed objects enabling objects with circular
1645
- * references to be compared.
1646
- *
1647
- * @private
1648
- * @param {Object} object The object to compare.
1649
- * @param {Object} other The other object to compare.
1650
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1651
- * @param {Function} customizer The function to customize comparisons.
1652
- * @param {Function} equalFunc The function to determine equivalents of values.
1653
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1654
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1655
- */
1656
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1657
- var objIsArr = isArray(object),
1658
- othIsArr = isArray(other),
1659
- objTag = objIsArr ? arrayTag : getTag(object),
1660
- othTag = othIsArr ? arrayTag : getTag(other);
1661
-
1662
- objTag = objTag == argsTag ? objectTag : objTag;
1663
- othTag = othTag == argsTag ? objectTag : othTag;
1664
-
1665
- var objIsObj = objTag == objectTag,
1666
- othIsObj = othTag == objectTag,
1667
- isSameTag = objTag == othTag;
1668
-
1669
- if (isSameTag && isBuffer(object)) {
1670
- if (!isBuffer(other)) {
1671
- return false;
1672
- }
1673
- objIsArr = true;
1674
- objIsObj = false;
1675
- }
1676
- if (isSameTag && !objIsObj) {
1677
- stack || (stack = new Stack);
1678
- return (objIsArr || isTypedArray(object))
1679
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1680
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1681
- }
1682
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1683
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1684
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1685
-
1686
- if (objIsWrapped || othIsWrapped) {
1687
- var objUnwrapped = objIsWrapped ? object.value() : object,
1688
- othUnwrapped = othIsWrapped ? other.value() : other;
1689
-
1690
- stack || (stack = new Stack);
1691
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1692
- }
1693
- }
1694
- if (!isSameTag) {
1695
- return false;
1696
- }
1697
- stack || (stack = new Stack);
1698
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1699
- }
1700
-
1701
- /**
1702
- * The base implementation of `_.isNative` without bad shim checks.
1703
- *
1704
- * @private
1705
- * @param {*} value The value to check.
1706
- * @returns {boolean} Returns `true` if `value` is a native function,
1707
- * else `false`.
1708
- */
1709
- function baseIsNative(value) {
1710
- if (!isObject(value) || isMasked(value)) {
1711
- return false;
1712
- }
1713
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1714
- return pattern.test(toSource(value));
1715
- }
1716
-
1717
- /**
1718
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1719
- *
1720
- * @private
1721
- * @param {*} value The value to check.
1722
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1723
- */
1724
- function baseIsTypedArray(value) {
1725
- return isObjectLike(value) &&
1726
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1727
- }
1728
-
1729
- /**
1730
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1731
- *
1732
- * @private
1733
- * @param {Object} object The object to query.
1734
- * @returns {Array} Returns the array of property names.
1735
- */
1736
- function baseKeys(object) {
1737
- if (!isPrototype(object)) {
1738
- return nativeKeys(object);
1739
- }
1740
- var result = [];
1741
- for (var key in Object(object)) {
1742
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
1743
- result.push(key);
1744
- }
1745
- }
1746
- return result;
1747
- }
1748
-
1749
- /**
1750
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1751
- * partial deep comparisons.
1752
- *
1753
- * @private
1754
- * @param {Array} array The array to compare.
1755
- * @param {Array} other The other array to compare.
1756
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1757
- * @param {Function} customizer The function to customize comparisons.
1758
- * @param {Function} equalFunc The function to determine equivalents of values.
1759
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1760
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1761
- */
1762
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1763
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1764
- arrLength = array.length,
1765
- othLength = other.length;
1766
-
1767
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1768
- return false;
1769
- }
1770
- // Assume cyclic values are equal.
1771
- var stacked = stack.get(array);
1772
- if (stacked && stack.get(other)) {
1773
- return stacked == other;
1774
- }
1775
- var index = -1,
1776
- result = true,
1777
- seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1778
-
1779
- stack.set(array, other);
1780
- stack.set(other, array);
1781
-
1782
- // Ignore non-index properties.
1783
- while (++index < arrLength) {
1784
- var arrValue = array[index],
1785
- othValue = other[index];
1786
-
1787
- if (customizer) {
1788
- var compared = isPartial
1789
- ? customizer(othValue, arrValue, index, other, array, stack)
1790
- : customizer(arrValue, othValue, index, array, other, stack);
1791
- }
1792
- if (compared !== undefined) {
1793
- if (compared) {
1794
- continue;
1795
- }
1796
- result = false;
1797
- break;
1798
- }
1799
- // Recursively compare arrays (susceptible to call stack limits).
1800
- if (seen) {
1801
- if (!arraySome(other, function(othValue, othIndex) {
1802
- if (!cacheHas(seen, othIndex) &&
1803
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1804
- return seen.push(othIndex);
1805
- }
1806
- })) {
1807
- result = false;
1808
- break;
1809
- }
1810
- } else if (!(
1811
- arrValue === othValue ||
1812
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1813
- )) {
1814
- result = false;
1815
- break;
1816
- }
1817
- }
1818
- stack['delete'](array);
1819
- stack['delete'](other);
1820
- return result;
1821
- }
1822
-
1823
- /**
1824
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1825
- * the same `toStringTag`.
1826
- *
1827
- * **Note:** This function only supports comparing values with tags of
1828
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1829
- *
1830
- * @private
1831
- * @param {Object} object The object to compare.
1832
- * @param {Object} other The other object to compare.
1833
- * @param {string} tag The `toStringTag` of the objects to compare.
1834
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1835
- * @param {Function} customizer The function to customize comparisons.
1836
- * @param {Function} equalFunc The function to determine equivalents of values.
1837
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1838
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1839
- */
1840
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1841
- switch (tag) {
1842
- case dataViewTag:
1843
- if ((object.byteLength != other.byteLength) ||
1844
- (object.byteOffset != other.byteOffset)) {
1845
- return false;
1846
- }
1847
- object = object.buffer;
1848
- other = other.buffer;
1849
-
1850
- case arrayBufferTag:
1851
- if ((object.byteLength != other.byteLength) ||
1852
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1853
- return false;
1854
- }
1855
- return true;
1856
-
1857
- case boolTag:
1858
- case dateTag:
1859
- case numberTag:
1860
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1861
- // Invalid dates are coerced to `NaN`.
1862
- return eq(+object, +other);
1863
-
1864
- case errorTag:
1865
- return object.name == other.name && object.message == other.message;
1866
-
1867
- case regexpTag:
1868
- case stringTag:
1869
- // Coerce regexes to strings and treat strings, primitives and objects,
1870
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1871
- // for more details.
1872
- return object == (other + '');
1873
-
1874
- case mapTag:
1875
- var convert = mapToArray;
1876
-
1877
- case setTag:
1878
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1879
- convert || (convert = setToArray);
1880
-
1881
- if (object.size != other.size && !isPartial) {
1882
- return false;
1883
- }
1884
- // Assume cyclic values are equal.
1885
- var stacked = stack.get(object);
1886
- if (stacked) {
1887
- return stacked == other;
1888
- }
1889
- bitmask |= COMPARE_UNORDERED_FLAG;
1890
-
1891
- // Recursively compare objects (susceptible to call stack limits).
1892
- stack.set(object, other);
1893
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1894
- stack['delete'](object);
1895
- return result;
1896
-
1897
- case symbolTag:
1898
- if (symbolValueOf) {
1899
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1900
- }
1901
- }
1902
- return false;
1903
- }
1904
-
1905
- /**
1906
- * A specialized version of `baseIsEqualDeep` for objects with support for
1907
- * partial deep comparisons.
1908
- *
1909
- * @private
1910
- * @param {Object} object The object to compare.
1911
- * @param {Object} other The other object to compare.
1912
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1913
- * @param {Function} customizer The function to customize comparisons.
1914
- * @param {Function} equalFunc The function to determine equivalents of values.
1915
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1916
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1917
- */
1918
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1919
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1920
- objProps = getAllKeys(object),
1921
- objLength = objProps.length,
1922
- othProps = getAllKeys(other),
1923
- othLength = othProps.length;
1924
-
1925
- if (objLength != othLength && !isPartial) {
1926
- return false;
1927
- }
1928
- var index = objLength;
1929
- while (index--) {
1930
- var key = objProps[index];
1931
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1932
- return false;
1933
- }
1934
- }
1935
- // Assume cyclic values are equal.
1936
- var stacked = stack.get(object);
1937
- if (stacked && stack.get(other)) {
1938
- return stacked == other;
1939
- }
1940
- var result = true;
1941
- stack.set(object, other);
1942
- stack.set(other, object);
1943
-
1944
- var skipCtor = isPartial;
1945
- while (++index < objLength) {
1946
- key = objProps[index];
1947
- var objValue = object[key],
1948
- othValue = other[key];
1949
-
1950
- if (customizer) {
1951
- var compared = isPartial
1952
- ? customizer(othValue, objValue, key, other, object, stack)
1953
- : customizer(objValue, othValue, key, object, other, stack);
1954
- }
1955
- // Recursively compare objects (susceptible to call stack limits).
1956
- if (!(compared === undefined
1957
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1958
- : compared
1959
- )) {
1960
- result = false;
1961
- break;
1962
- }
1963
- skipCtor || (skipCtor = key == 'constructor');
1964
- }
1965
- if (result && !skipCtor) {
1966
- var objCtor = object.constructor,
1967
- othCtor = other.constructor;
1968
-
1969
- // Non `Object` object instances with different constructors are not equal.
1970
- if (objCtor != othCtor &&
1971
- ('constructor' in object && 'constructor' in other) &&
1972
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1973
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1974
- result = false;
1975
- }
1976
- }
1977
- stack['delete'](object);
1978
- stack['delete'](other);
1979
- return result;
1980
- }
1981
-
1982
- /**
1983
- * Creates an array of own enumerable property names and symbols of `object`.
1984
- *
1985
- * @private
1986
- * @param {Object} object The object to query.
1987
- * @returns {Array} Returns the array of property names and symbols.
1988
- */
1989
- function getAllKeys(object) {
1990
- return baseGetAllKeys(object, keys, getSymbols);
1991
- }
1992
-
1993
- /**
1994
- * Gets the data for `map`.
1995
- *
1996
- * @private
1997
- * @param {Object} map The map to query.
1998
- * @param {string} key The reference key.
1999
- * @returns {*} Returns the map data.
2000
- */
2001
- function getMapData(map, key) {
2002
- var data = map.__data__;
2003
- return isKeyable(key)
2004
- ? data[typeof key == 'string' ? 'string' : 'hash']
2005
- : data.map;
2006
- }
2007
-
2008
- /**
2009
- * Gets the native function at `key` of `object`.
2010
- *
2011
- * @private
2012
- * @param {Object} object The object to query.
2013
- * @param {string} key The key of the method to get.
2014
- * @returns {*} Returns the function if it's native, else `undefined`.
2015
- */
2016
- function getNative(object, key) {
2017
- var value = getValue(object, key);
2018
- return baseIsNative(value) ? value : undefined;
2019
- }
2020
-
2021
- /**
2022
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
2023
- *
2024
- * @private
2025
- * @param {*} value The value to query.
2026
- * @returns {string} Returns the raw `toStringTag`.
2027
- */
2028
- function getRawTag(value) {
2029
- var isOwn = hasOwnProperty.call(value, symToStringTag),
2030
- tag = value[symToStringTag];
2031
-
2032
- try {
2033
- value[symToStringTag] = undefined;
2034
- var unmasked = true;
2035
- } catch (e) {}
2036
-
2037
- var result = nativeObjectToString.call(value);
2038
- if (unmasked) {
2039
- if (isOwn) {
2040
- value[symToStringTag] = tag;
2041
- } else {
2042
- delete value[symToStringTag];
2043
- }
2044
- }
2045
- return result;
2046
- }
2047
-
2048
- /**
2049
- * Creates an array of the own enumerable symbols of `object`.
2050
- *
2051
- * @private
2052
- * @param {Object} object The object to query.
2053
- * @returns {Array} Returns the array of symbols.
2054
- */
2055
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
2056
- if (object == null) {
2057
- return [];
2058
- }
2059
- object = Object(object);
2060
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
2061
- return propertyIsEnumerable.call(object, symbol);
2062
- });
2063
- };
2064
-
2065
- /**
2066
- * Gets the `toStringTag` of `value`.
2067
- *
2068
- * @private
2069
- * @param {*} value The value to query.
2070
- * @returns {string} Returns the `toStringTag`.
2071
- */
2072
- var getTag = baseGetTag;
2073
-
2074
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2075
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
2076
- (Map && getTag(new Map) != mapTag) ||
2077
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
2078
- (Set && getTag(new Set) != setTag) ||
2079
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
2080
- getTag = function(value) {
2081
- var result = baseGetTag(value),
2082
- Ctor = result == objectTag ? value.constructor : undefined,
2083
- ctorString = Ctor ? toSource(Ctor) : '';
2084
-
2085
- if (ctorString) {
2086
- switch (ctorString) {
2087
- case dataViewCtorString: return dataViewTag;
2088
- case mapCtorString: return mapTag;
2089
- case promiseCtorString: return promiseTag;
2090
- case setCtorString: return setTag;
2091
- case weakMapCtorString: return weakMapTag;
2092
- }
2093
- }
2094
- return result;
2095
- };
2096
- }
2097
-
2098
- /**
2099
- * Checks if `value` is a valid array-like index.
2100
- *
2101
- * @private
2102
- * @param {*} value The value to check.
2103
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
2104
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
2105
- */
2106
- function isIndex(value, length) {
2107
- length = length == null ? MAX_SAFE_INTEGER : length;
2108
- return !!length &&
2109
- (typeof value == 'number' || reIsUint.test(value)) &&
2110
- (value > -1 && value % 1 == 0 && value < length);
2111
- }
2112
-
2113
- /**
2114
- * Checks if `value` is suitable for use as unique object key.
2115
- *
2116
- * @private
2117
- * @param {*} value The value to check.
2118
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
2119
- */
2120
- function isKeyable(value) {
2121
- var type = typeof value;
2122
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
2123
- ? (value !== '__proto__')
2124
- : (value === null);
2125
- }
2126
-
2127
- /**
2128
- * Checks if `func` has its source masked.
2129
- *
2130
- * @private
2131
- * @param {Function} func The function to check.
2132
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
2133
- */
2134
- function isMasked(func) {
2135
- return !!maskSrcKey && (maskSrcKey in func);
2136
- }
2137
-
2138
- /**
2139
- * Checks if `value` is likely a prototype object.
2140
- *
2141
- * @private
2142
- * @param {*} value The value to check.
2143
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
2144
- */
2145
- function isPrototype(value) {
2146
- var Ctor = value && value.constructor,
2147
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
2148
-
2149
- return value === proto;
2150
- }
2151
-
2152
- /**
2153
- * Converts `value` to a string using `Object.prototype.toString`.
2154
- *
2155
- * @private
2156
- * @param {*} value The value to convert.
2157
- * @returns {string} Returns the converted string.
2158
- */
2159
- function objectToString(value) {
2160
- return nativeObjectToString.call(value);
2161
- }
2162
-
2163
- /**
2164
- * Converts `func` to its source code.
2165
- *
2166
- * @private
2167
- * @param {Function} func The function to convert.
2168
- * @returns {string} Returns the source code.
2169
- */
2170
- function toSource(func) {
2171
- if (func != null) {
2172
- try {
2173
- return funcToString.call(func);
2174
- } catch (e) {}
2175
- try {
2176
- return (func + '');
2177
- } catch (e) {}
2178
- }
2179
- return '';
2180
- }
2181
-
2182
- /**
2183
- * Performs a
2184
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2185
- * comparison between two values to determine if they are equivalent.
2186
- *
2187
- * @static
2188
- * @memberOf _
2189
- * @since 4.0.0
2190
- * @category Lang
2191
- * @param {*} value The value to compare.
2192
- * @param {*} other The other value to compare.
2193
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2194
- * @example
2195
- *
2196
- * var object = { 'a': 1 };
2197
- * var other = { 'a': 1 };
2198
- *
2199
- * _.eq(object, object);
2200
- * // => true
2201
- *
2202
- * _.eq(object, other);
2203
- * // => false
2204
- *
2205
- * _.eq('a', 'a');
2206
- * // => true
2207
- *
2208
- * _.eq('a', Object('a'));
2209
- * // => false
2210
- *
2211
- * _.eq(NaN, NaN);
2212
- * // => true
2213
- */
2214
- function eq(value, other) {
2215
- return value === other || (value !== value && other !== other);
2216
- }
2217
-
2218
- /**
2219
- * Checks if `value` is likely an `arguments` object.
2220
- *
2221
- * @static
2222
- * @memberOf _
2223
- * @since 0.1.0
2224
- * @category Lang
2225
- * @param {*} value The value to check.
2226
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2227
- * else `false`.
2228
- * @example
2229
- *
2230
- * _.isArguments(function() { return arguments; }());
2231
- * // => true
2232
- *
2233
- * _.isArguments([1, 2, 3]);
2234
- * // => false
2235
- */
2236
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
2237
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
2238
- !propertyIsEnumerable.call(value, 'callee');
2239
- };
2240
-
2241
- /**
2242
- * Checks if `value` is classified as an `Array` object.
2243
- *
2244
- * @static
2245
- * @memberOf _
2246
- * @since 0.1.0
2247
- * @category Lang
2248
- * @param {*} value The value to check.
2249
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
2250
- * @example
2251
- *
2252
- * _.isArray([1, 2, 3]);
2253
- * // => true
2254
- *
2255
- * _.isArray(document.body.children);
2256
- * // => false
2257
- *
2258
- * _.isArray('abc');
2259
- * // => false
2260
- *
2261
- * _.isArray(_.noop);
2262
- * // => false
2263
- */
2264
- var isArray = Array.isArray;
2265
-
2266
- /**
2267
- * Checks if `value` is array-like. A value is considered array-like if it's
2268
- * not a function and has a `value.length` that's an integer greater than or
2269
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2270
- *
2271
- * @static
2272
- * @memberOf _
2273
- * @since 4.0.0
2274
- * @category Lang
2275
- * @param {*} value The value to check.
2276
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2277
- * @example
2278
- *
2279
- * _.isArrayLike([1, 2, 3]);
2280
- * // => true
2281
- *
2282
- * _.isArrayLike(document.body.children);
2283
- * // => true
2284
- *
2285
- * _.isArrayLike('abc');
2286
- * // => true
2287
- *
2288
- * _.isArrayLike(_.noop);
2289
- * // => false
2290
- */
2291
- function isArrayLike(value) {
2292
- return value != null && isLength(value.length) && !isFunction(value);
2293
- }
2294
-
2295
- /**
2296
- * Checks if `value` is a buffer.
2297
- *
2298
- * @static
2299
- * @memberOf _
2300
- * @since 4.3.0
2301
- * @category Lang
2302
- * @param {*} value The value to check.
2303
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
2304
- * @example
2305
- *
2306
- * _.isBuffer(new Buffer(2));
2307
- * // => true
2308
- *
2309
- * _.isBuffer(new Uint8Array(2));
2310
- * // => false
2311
- */
2312
- var isBuffer = nativeIsBuffer || stubFalse;
2313
-
2314
- /**
2315
- * Performs a deep comparison between two values to determine if they are
2316
- * equivalent.
2317
- *
2318
- * **Note:** This method supports comparing arrays, array buffers, booleans,
2319
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
2320
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
2321
- * by their own, not inherited, enumerable properties. Functions and DOM
2322
- * nodes are compared by strict equality, i.e. `===`.
2323
- *
2324
- * @static
2325
- * @memberOf _
2326
- * @since 0.1.0
2327
- * @category Lang
2328
- * @param {*} value The value to compare.
2329
- * @param {*} other The other value to compare.
2330
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2331
- * @example
2332
- *
2333
- * var object = { 'a': 1 };
2334
- * var other = { 'a': 1 };
2335
- *
2336
- * _.isEqual(object, other);
2337
- * // => true
2338
- *
2339
- * object === other;
2340
- * // => false
2341
- */
2342
- function isEqual(value, other) {
2343
- return baseIsEqual(value, other);
2344
- }
2345
-
2346
- /**
2347
- * Checks if `value` is classified as a `Function` object.
2348
- *
2349
- * @static
2350
- * @memberOf _
2351
- * @since 0.1.0
2352
- * @category Lang
2353
- * @param {*} value The value to check.
2354
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
2355
- * @example
2356
- *
2357
- * _.isFunction(_);
2358
- * // => true
2359
- *
2360
- * _.isFunction(/abc/);
2361
- * // => false
2362
- */
2363
- function isFunction(value) {
2364
- if (!isObject(value)) {
2365
- return false;
2366
- }
2367
- // The use of `Object#toString` avoids issues with the `typeof` operator
2368
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
2369
- var tag = baseGetTag(value);
2370
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
2371
- }
2372
-
2373
- /**
2374
- * Checks if `value` is a valid array-like length.
2375
- *
2376
- * **Note:** This method is loosely based on
2377
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2378
- *
2379
- * @static
2380
- * @memberOf _
2381
- * @since 4.0.0
2382
- * @category Lang
2383
- * @param {*} value The value to check.
2384
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2385
- * @example
2386
- *
2387
- * _.isLength(3);
2388
- * // => true
2389
- *
2390
- * _.isLength(Number.MIN_VALUE);
2391
- * // => false
2392
- *
2393
- * _.isLength(Infinity);
2394
- * // => false
2395
- *
2396
- * _.isLength('3');
2397
- * // => false
2398
- */
2399
- function isLength(value) {
2400
- return typeof value == 'number' &&
2401
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2402
- }
2403
-
2404
- /**
2405
- * Checks if `value` is the
2406
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
2407
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
2408
- *
2409
- * @static
2410
- * @memberOf _
2411
- * @since 0.1.0
2412
- * @category Lang
2413
- * @param {*} value The value to check.
2414
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
2415
- * @example
2416
- *
2417
- * _.isObject({});
2418
- * // => true
2419
- *
2420
- * _.isObject([1, 2, 3]);
2421
- * // => true
2422
- *
2423
- * _.isObject(_.noop);
2424
- * // => true
2425
- *
2426
- * _.isObject(null);
2427
- * // => false
2428
- */
2429
- function isObject(value) {
2430
- var type = typeof value;
2431
- return value != null && (type == 'object' || type == 'function');
2432
- }
2433
-
2434
- /**
2435
- * Checks if `value` is object-like. A value is object-like if it's not `null`
2436
- * and has a `typeof` result of "object".
2437
- *
2438
- * @static
2439
- * @memberOf _
2440
- * @since 4.0.0
2441
- * @category Lang
2442
- * @param {*} value The value to check.
2443
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
2444
- * @example
2445
- *
2446
- * _.isObjectLike({});
2447
- * // => true
2448
- *
2449
- * _.isObjectLike([1, 2, 3]);
2450
- * // => true
2451
- *
2452
- * _.isObjectLike(_.noop);
2453
- * // => false
2454
- *
2455
- * _.isObjectLike(null);
2456
- * // => false
2457
- */
2458
- function isObjectLike(value) {
2459
- return value != null && typeof value == 'object';
2460
- }
2461
-
2462
- /**
2463
- * Checks if `value` is classified as a typed array.
2464
- *
2465
- * @static
2466
- * @memberOf _
2467
- * @since 3.0.0
2468
- * @category Lang
2469
- * @param {*} value The value to check.
2470
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2471
- * @example
2472
- *
2473
- * _.isTypedArray(new Uint8Array);
2474
- * // => true
2475
- *
2476
- * _.isTypedArray([]);
2477
- * // => false
2478
- */
2479
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
2480
-
2481
- /**
2482
- * Creates an array of the own enumerable property names of `object`.
2483
- *
2484
- * **Note:** Non-object values are coerced to objects. See the
2485
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2486
- * for more details.
2487
- *
2488
- * @static
2489
- * @since 0.1.0
2490
- * @memberOf _
2491
- * @category Object
2492
- * @param {Object} object The object to query.
2493
- * @returns {Array} Returns the array of property names.
2494
- * @example
2495
- *
2496
- * function Foo() {
2497
- * this.a = 1;
2498
- * this.b = 2;
2499
- * }
2500
- *
2501
- * Foo.prototype.c = 3;
2502
- *
2503
- * _.keys(new Foo);
2504
- * // => ['a', 'b'] (iteration order is not guaranteed)
2505
- *
2506
- * _.keys('hi');
2507
- * // => ['0', '1']
2508
- */
2509
- function keys(object) {
2510
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2511
- }
2512
-
2513
- /**
2514
- * This method returns a new empty array.
2515
- *
2516
- * @static
2517
- * @memberOf _
2518
- * @since 4.13.0
2519
- * @category Util
2520
- * @returns {Array} Returns the new empty array.
2521
- * @example
2522
- *
2523
- * var arrays = _.times(2, _.stubArray);
2524
- *
2525
- * console.log(arrays);
2526
- * // => [[], []]
2527
- *
2528
- * console.log(arrays[0] === arrays[1]);
2529
- * // => false
2530
- */
2531
- function stubArray() {
2532
- return [];
2533
- }
2534
-
2535
- /**
2536
- * This method returns `false`.
2537
- *
2538
- * @static
2539
- * @memberOf _
2540
- * @since 4.13.0
2541
- * @category Util
2542
- * @returns {boolean} Returns `false`.
2543
- * @example
2544
- *
2545
- * _.times(2, _.stubFalse);
2546
- * // => [false, false]
2547
- */
2548
- function stubFalse() {
2549
- return false;
2550
- }
2551
-
2552
- module.exports = isEqual;
2553
- }(lodash_isequal, lodash_isequal.exports));
2554
-
2555
- var areEqual = lodash_isequal.exports;
2556
-
2557
- function defaults() {
2558
- var objects = [];
2559
- for (var _i = 0; _i < arguments.length; _i++) {
2560
- objects[_i] = arguments[_i];
2561
- }
2562
- var _a = __read(objects), a = _a[0], other = _a.slice(1);
2563
- var result = __assign({}, a);
2564
- if (other.length === 0) {
2565
- return result;
2566
- }
2567
- else if (other.length === 1) {
2568
- var b = other[0];
2569
- for (var key in b) {
2570
- if (result[key] == null) {
2571
- result[key] = b[key];
2572
- }
2573
- else if (isPlainObject(result[key])) {
2574
- result[key] = defaults(result[key], b[key]);
2575
- }
2576
- }
2577
- return result;
2578
- }
2579
- else {
2580
- return other.reduce(function (result, next) { return defaults(result, next); }, a);
2581
- }
2582
- }
2583
- /* eslint-enable padding-line-between-statements */
2584
- /**
2585
- * Returns `true` if this is a plain object, which is defined by a type created
2586
- * by the `Object` constructor. Returns `false` otherwise.
2587
- *
2588
- * @example
2589
- * ```
2590
- * isPlainObject(Object.create({})); //=> true
2591
- * isPlainObject(Object.create(Object.prototype)); //=> true
2592
- * isPlainObject({foo: 'bar'}); //=> true
2593
- * isPlainObject({}); //=> true
2594
- *
2595
- * isPlainObject(1); //=> false
2596
- * isPlainObject(['foo', 'bar']); //=> false
2597
- * isPlainObject([]); //=> false
2598
- * isPlainObject(new Foo); //=> false
2599
- * isPlainObject(null); //=> false
2600
- * isPlainObject(Object.create(null)); //=> false
2601
- * ```
2602
- */
2603
- function isPlainObject(obj) {
2604
- return isPlainObject$1(obj);
2605
- }
2606
- /**
2607
- * Performs a deep comparison of two objects and returns `true` if they're
2608
- * equal.
2609
- *
2610
- * This method supports comparing arrays, array buffers, booleans, date objects,
2611
- * error objects, maps, numbers, Object objects, regexes, sets, strings,
2612
- * symbols, and typed arrays. Object objects are compared by their own, not
2613
- * inherited, enumerable properties. Functions and DOM nodes are compared by
2614
- * strict equality, i.e. ===.
2615
- *
2616
- * @param a The object to compare with `b`.
2617
- * @param b The object to compare with `a`.
2618
- * @returns `true` if the two objects are equal. Otherwise `false`.
2619
- */
2620
- function isEqual$1(a, b) {
2621
- return areEqual(a, b);
2622
- }
2623
- function toPairs(obj) {
2624
- if (obj != null) {
2625
- return Object.keys(obj).map(function (key) { return [key, obj[key]]; });
2626
- }
2627
- else {
2628
- return [];
2629
- }
2630
- }
2631
- function fromPairs(pairs) {
2632
- if (Array.isArray(pairs)) {
2633
- return pairs.reduce(function (result, pair) {
2634
- var _a;
2635
- if (pair != null) {
2636
- return __assign(__assign({}, result), (_a = {}, _a[pair[0]] = pair[1], _a));
2637
- }
2638
- else {
2639
- return result;
2640
- }
2641
- }, {});
2642
- }
2643
- else {
2644
- return {};
2645
- }
2646
- }
2647
- /* eslint-enable padding-line-between-statements */
2648
-
2649
- var objects = /*#__PURE__*/Object.freeze({
2650
- __proto__: null,
2651
- defaults: defaults,
2652
- isPlainObject: isPlainObject,
2653
- isEqual: isEqual$1,
2654
- toPairs: toPairs,
2655
- fromPairs: fromPairs
2656
- });
2657
-
2658
- /**
2659
- * Returns a new `Range` with the given start and end points.
2660
- */
2661
- var create$1 = function (start, end) { return ({ start: start, end: end }); };
2662
- /**
2663
- * Returns a new `Range` with the start and end points at the given position.
2664
- */
2665
- var at = function (position) { return ({
2666
- start: position,
2667
- end: position,
2668
- }); };
2669
- /**
2670
- * Returns a new `Range` with the given start point and length.
2671
- */
2672
- var withLength = function (start, len) { return ({
2673
- start: start,
2674
- end: start + len - 1,
2675
- }); };
2676
- /**
2677
- * Returns a range with the start and end points shifted by the given distance.
2678
- */
2679
- var add = function (distance, range) {
2680
- return create$1(range.start + distance, range.end + distance);
2681
- };
2682
- /**
2683
- * Returns a range such that `range` is constrained to the start and end points
2684
- * of `to`. The function will try to maintain the length of the range, but will
2685
- * shrink the range if its length is greater than `to`.
2686
- */
2687
- var constrain = function (range, to) {
2688
- if (contains(range, to)) {
2689
- return range;
2690
- }
2691
- else if (length(range) > length(to)) {
2692
- return to;
2693
- }
2694
- else if (range.start < to.start) {
2695
- return create$1(to.start, to.start + length(range) - 1);
2696
- }
2697
- else {
2698
- return create$1(to.end - length(range) + 1, to.end);
2699
- }
2700
- };
2701
- /**
2702
- * Checks if the given number or range is contained within another range.
2703
- */
2704
- var contains = function (numOrRange, range) {
2705
- if (typeof numOrRange === 'number') {
2706
- return range.start <= numOrRange && numOrRange <= range.end;
2707
- }
2708
- else {
2709
- return contains(numOrRange.start, range) && contains(numOrRange.end, range);
2710
- }
2711
- };
2712
- /**
2713
- * Returns a range that represents the overlap between `other` and `range`. If
2714
- * the two ranges do not intersect, then `undefined` is returned.
2715
- * @param other
2716
- * @param range
2717
- */
2718
- var intersection = function (other, range) {
2719
- if (intersects(other, range)) {
2720
- return create$1(Math.max(other.start, range.start), Math.min(other.end, range.end));
2721
- }
2722
- };
2723
- /**
2724
- * Returns `true` if `other` intersects with `range`.
2725
- */
2726
- var intersects = function (other, range) {
2727
- return ((other.start <= range.end && other.end >= range.start) ||
2728
- (range.start <= other.end && range.end >= other.start));
2729
- };
2730
- /**
2731
- * Checks if a range has the same starting point as another range.
2732
- */
2733
- var isAt = function (other, range) {
2734
- return other.start === range.start;
2735
- };
2736
- /**
2737
- * Returns `true` if a range's start point is after the starting point of
2738
- * another range.
2739
- */
2740
- var isAfter = function (other, range) {
2741
- return other.start > range.start;
2742
- };
2743
- /**
2744
- * Returns `true` if a range start at or is after another range.
2745
- */
2746
- var isAtOrAfter = function (other, range) {
2747
- return isAt(other, range) || isAfter(other, range);
2748
- };
2749
- /**
2750
- * Returns `true` if a range's starting point is before another range's starting
2751
- * point.
2752
- */
2753
- var isBefore = function (other, range) {
2754
- return other.start < range.start;
2755
- };
2756
- /**
2757
- * Returns `true` if a range's starting point is at or before another range's
2758
- * starting point.
2759
- */
2760
- var isAtOrBefore = function (other, range) {
2761
- return isAt(other, range) || isBefore(other, range);
2762
- };
2763
- /**
2764
- * Returns the length of a range.
2765
- */
2766
- var length = function (range) {
2767
- return range.end - range.start + 1;
2768
- };
2769
- /**
2770
- * Returns a `Range` with its start and end points subtracted by the given
2771
- * distance.
2772
- */
2773
- var subtract = function (distance, range) {
2774
- return add(distance * -1, range);
2775
- };
2776
- /**
2777
- * Adjusts either the start or end position of a range so that its contained
2778
- * within another range. Unlike `constrain`, this will not attempt to retain
2779
- * the range's length.
2780
- *
2781
- * If `other` does not intersect with `to`, then the range cannot be truncated
2782
- * and `undefined` is returned.
2783
- */
2784
- var truncate = function (other, to) {
2785
- if (intersects(to, other)) {
2786
- return create$1(Math.max(other.start, to.start), Math.min(other.end, to.end));
2787
- }
2788
- };
2789
-
2790
- var range = /*#__PURE__*/Object.freeze({
2791
- __proto__: null,
2792
- create: create$1,
2793
- at: at,
2794
- withLength: withLength,
2795
- add: add,
2796
- constrain: constrain,
2797
- contains: contains,
2798
- intersection: intersection,
2799
- intersects: intersects,
2800
- isAt: isAt,
2801
- isAfter: isAfter,
2802
- isAtOrAfter: isAtOrAfter,
2803
- isBefore: isBefore,
2804
- isAtOrBefore: isAtOrBefore,
2805
- length: length,
2806
- subtract: subtract,
2807
- truncate: truncate
2808
- });
2809
-
2810
- /**
2811
- * A comparator that sorts a number or string in ascending order.
2812
- */
2813
- var asc = function (a, b) {
2814
- if (a < b) {
2815
- return -1;
2816
- }
2817
- else if (a > b) {
2818
- return 1;
2819
- }
2820
- else {
2821
- return 0;
2822
- }
2823
- };
2824
- /**
2825
- * A comparator that plucks the first element of an array and passes that value
2826
- * to the given comparator for sorting.
2827
- */
2828
- var head = function (comparator) {
2829
- return function (_a, _b) {
2830
- var _c = __read(_a, 1), a = _c[0];
2831
- var _d = __read(_b, 1), b = _d[0];
2832
- return comparator(a, b);
2833
- };
2834
- };
2835
-
2836
- /**
2837
- * Parses a URI string according to RFC 3986. If the URI is an empty string,
2838
- * then an empty object is returned.
2839
- *
2840
- * See https://tools.ietf.org/html/rfc3986#appendix-B for parsing rules.
2841
- *
2842
- * @param uri The URI to parse.
2843
- */
2844
- var parse = function (uri) {
2845
- var regex = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
2846
- var match = regex.exec(uri);
2847
- if (match != null) {
2848
- return {
2849
- scheme: match[2],
2850
- authority: match[4],
2851
- path: match[5],
2852
- query: match[7],
2853
- fragment: match[9],
2854
- };
2855
- }
2856
- else {
2857
- return {};
2858
- }
2859
- };
2860
- /**
2861
- * Convenience method to create a URI from a base string and add params if present
2862
- * @param base
2863
- * @param params
2864
- */
2865
- var parseAndAddParams = function (baseStr, params) {
2866
- var base = parse(baseStr);
2867
- return params ? addQueryParams(params, base) : base;
2868
- };
2869
- var isEqual = function (a, b) {
2870
- var queryA = JSON.stringify(sortByQueryName(queryAsArray(a)));
2871
- var queryB = JSON.stringify(sortByQueryName(queryAsArray(b)));
2872
- return (a.scheme === b.scheme &&
2873
- a.authority === b.authority &&
2874
- a.path === b.path &&
2875
- a.fragment === b.fragment &&
2876
- queryA === queryB);
2877
- };
2878
- var replacePath = function (path, uri) {
2879
- var pathWithForwardSlash = path[0] === '/' ? path : "/".concat(path);
2880
- return __assign(__assign({}, uri), { path: pathWithForwardSlash });
2881
- };
2882
- var pathAsArray = function (uri) {
2883
- return uri.path != null ? sanitizePath(uri.path.split('/')) : [];
2884
- };
2885
- var appendPath = function (path, uri) {
2886
- var beforeParts = pathAsArray(uri);
2887
- var afterParts = sanitizePath(path.split('/'));
2888
- return replacePath(beforeParts.concat(afterParts).join('/'), uri);
2889
- };
2890
- var addQueryString = function (query, uri) {
2891
- var queryArray = stringAsQueryArray(query);
2892
- return addQueryEntries(queryArray, uri);
2893
- };
2894
- var addQueryEntry = function (query, uri) {
2895
- if (query[1] != null) {
2896
- var newQuery = __spreadArray(__spreadArray([], __read(queryAsArray(uri)), false), [query], false);
2897
- return __assign(__assign({}, uri), { query: newQuery
2898
- .map(function (entry) { return entry.map(encodeURIComponent).join('='); })
2899
- .join('&') });
2900
- }
2901
- else {
2902
- return uri;
2903
- }
2904
- };
2905
- var addQueryEntries = function (entries, uri) {
2906
- return entries.reduce(function (result, entry) { return addQueryEntry(entry, result); }, uri);
2907
- };
2908
- var addQueryParams = function (params, uri) {
2909
- return mapAsEntries(params).reduce(function (result, entry) { return addQueryEntry(entry, result); }, uri);
2910
- };
2911
- var replaceFragment = function (fragment, uri) {
2912
- return __assign(__assign({}, uri), { fragment: fragment });
2913
- };
2914
- /**
2915
- * Return an array of name/value pairs representing the query string of a URI.
2916
- * The returned names and values will be URI decoded. If the query string is
2917
- * empty, then an empty array is returned.
2918
- *
2919
- * @param uri A URI to return the query string for.
2920
- */
2921
- var queryAsArray = function (uri) {
2922
- if (uri.query != null) {
2923
- return stringAsQueryArray(uri.query);
2924
- }
2925
- else {
2926
- return [];
2927
- }
2928
- };
2929
- var stringAsQueryArray = function (queryString) {
2930
- return queryString
2931
- .split('&')
2932
- .map(function (param) {
2933
- return param.split('=').map(function (value) { return decodeURIComponent(value); });
2934
- });
2935
- };
2936
- /**
2937
- * Return a map containing a URI's query string names and their values. The
2938
- * returned names and values will be URI decoded. If the query string contains
2939
- * multiple instances of the same name, then the last occurrence will be used.
2940
- *
2941
- * If the query string is empty, an empty map is returned.
2942
- *
2943
- * @param uri A URI to return the query string for.
2944
- */
2945
- var queryAsMap = function (uri) {
2946
- return queryAsArray(uri).reduce(function (map, _a) {
2947
- var _b;
2948
- var _c = __read(_a, 2), name = _c[0], value = _c[1];
2949
- return __assign(__assign({}, map), (_b = {}, _b[name] = value, _b));
2950
- }, {});
2951
- };
2952
- var toString = function (uri) {
2953
- var result = '';
2954
- if (uri.scheme != null && uri.scheme.length > 0) {
2955
- result = "".concat(uri.scheme, ":");
2956
- }
2957
- if (uri.authority != null && uri.authority.length > 0) {
2958
- result += "//".concat(uri.authority);
2959
- }
2960
- result += uri.path;
2961
- if (uri.query != null && uri.query.length > 0) {
2962
- result += "?".concat(uri.query);
2963
- }
2964
- if (uri.fragment != null && uri.fragment.length > 0) {
2965
- result += "#".concat(uri.fragment);
2966
- }
2967
- return result;
2968
- };
2969
- var sanitizePath = function (path) {
2970
- return path.filter(function (segment) { return segment.length > 0; });
2971
- };
2972
- var mapAsEntries = function (map) {
2973
- var entries = [];
2974
- for (var key in map) {
2975
- entries.push([key, map[key]]);
2976
- }
2977
- return entries;
2978
- };
2979
- var sortByQueryName = function (entries) {
2980
- return entries.concat().sort(head(asc));
2981
- };
2982
- /* eslint-enable @typescript-eslint/no-explicit-any */
2983
-
2984
- var uri = /*#__PURE__*/Object.freeze({
2985
- __proto__: null,
2986
- parse: parse,
2987
- parseAndAddParams: parseAndAddParams,
2988
- isEqual: isEqual,
2989
- replacePath: replacePath,
2990
- pathAsArray: pathAsArray,
2991
- appendPath: appendPath,
2992
- addQueryString: addQueryString,
2993
- addQueryEntry: addQueryEntry,
2994
- addQueryEntries: addQueryEntries,
2995
- addQueryParams: addQueryParams,
2996
- replaceFragment: replaceFragment,
2997
- queryAsArray: queryAsArray,
2998
- queryAsMap: queryAsMap,
2999
- toString: toString
3000
- });
3001
-
3002
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
3003
- // require the crypto API and do not support built-in fallback to lower quality random number
3004
- // generators (like Math.random()).
3005
- var getRandomValues;
3006
- var rnds8 = new Uint8Array(16);
3007
- function rng() {
3008
- // lazy load so that environments that need to polyfill have a chance to do so
3009
- if (!getRandomValues) {
3010
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
3011
- // find the complete implementation of crypto (msCrypto) on IE11.
3012
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
3013
-
3014
- if (!getRandomValues) {
3015
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
3016
- }
3017
- }
3018
-
3019
- return getRandomValues(rnds8);
3020
- }
3021
-
3022
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
3023
-
3024
- function validate(uuid) {
3025
- return typeof uuid === 'string' && REGEX.test(uuid);
3026
- }
3027
-
3028
- /**
3029
- * Convert array of 16 byte values to UUID string format of the form:
3030
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
3031
- */
3032
-
3033
- var byteToHex = [];
3034
-
3035
- for (var i = 0; i < 256; ++i) {
3036
- byteToHex.push((i + 0x100).toString(16).substr(1));
3037
- }
3038
-
3039
- function stringify(arr) {
3040
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3041
- // Note: Be careful editing this code! It's been tuned for performance
3042
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
3043
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
3044
- // of the following:
3045
- // - One or more input array values don't map to a hex octet (leading to
3046
- // "undefined" in the uuid)
3047
- // - Invalid input values for the RFC `version` or `variant` fields
3048
-
3049
- if (!validate(uuid)) {
3050
- throw TypeError('Stringified UUID is invalid');
3051
- }
3052
-
3053
- return uuid;
3054
- }
3055
-
3056
- function v4(options, buf, offset) {
3057
- options = options || {};
3058
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
3059
-
3060
- rnds[6] = rnds[6] & 0x0f | 0x40;
3061
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
3062
-
3063
- if (buf) {
3064
- offset = offset || 0;
3065
-
3066
- for (var i = 0; i < 16; ++i) {
3067
- buf[offset + i] = rnds[i];
3068
- }
3069
-
3070
- return buf;
3071
- }
3072
-
3073
- return stringify(rnds);
3074
- }
3075
-
3076
- function create() {
3077
- return v4();
3078
- }
3079
- function fromMsbLsb(msb, lsb) {
3080
- function digits(val, ds) {
3081
- var hi = BigInt(1) << (ds * BigInt(4));
3082
- return (hi | (val & (hi - BigInt(1)))).toString(16).substring(1);
3083
- }
3084
- var msbB = typeof msb === 'string' ? BigInt(msb) : msb;
3085
- var lsbB = typeof lsb === 'string' ? BigInt(lsb) : lsb;
3086
- var sec1 = digits(msbB >> BigInt(32), BigInt(8));
3087
- var sec2 = digits(msbB >> BigInt(16), BigInt(4));
3088
- var sec3 = digits(msbB, BigInt(4));
3089
- var sec4 = digits(lsbB >> BigInt(48), BigInt(4));
3090
- var sec5 = digits(lsbB, BigInt(12));
3091
- return "".concat(sec1, "-").concat(sec2, "-").concat(sec3, "-").concat(sec4, "-").concat(sec5);
3092
- }
3093
- function toMsbLsb(id) {
3094
- var _a = __read(id.split('-'), 5), c1 = _a[0], c2 = _a[1], c3 = _a[2], c4 = _a[3], c5 = _a[4];
3095
- if (c1 == null || c2 == null || c3 == null || c4 == null || c5 == null) {
3096
- throw new Error("Invalid UUID string ".concat(id));
3097
- }
3098
- var msb = BigInt.asIntN(64, BigInt("0x".concat(c1 + c2 + c3)));
3099
- var lsb = BigInt.asIntN(64, BigInt("0x".concat(c4 + c5)));
3100
- return { msb: msb.toString(), lsb: lsb.toString() };
3101
- }
3102
-
3103
- var uuid = /*#__PURE__*/Object.freeze({
3104
- __proto__: null,
3105
- create: create,
3106
- fromMsbLsb: fromMsbLsb,
3107
- toMsbLsb: toMsbLsb
3108
- });
3109
-
3110
- var EventDispatcher = /** @class */ (function () {
3111
- function EventDispatcher() {
3112
- this.listeners = [];
3113
- }
3114
- EventDispatcher.prototype.on = function (listener, opts) {
3115
- var _this = this;
3116
- var _a;
3117
- if (opts === void 0) { opts = {}; }
3118
- this.listeners.push(listener);
3119
- var controller = new AbortController();
3120
- controller.signal.addEventListener('abort', function () { return _this.off(listener); });
3121
- (_a = opts.abort) === null || _a === void 0 ? void 0 : _a.addEventListener('abort', function () { return controller.abort(); });
3122
- return { dispose: function () { return controller.abort(); } };
3123
- };
3124
- EventDispatcher.prototype.once = function (opts) {
3125
- var _this = this;
3126
- if (opts === void 0) { opts = {}; }
3127
- return new Promise(function (resolve) {
3128
- _this.on(function (event) { return resolve(event); }, opts);
3129
- });
3130
- };
3131
- EventDispatcher.prototype.onceWhen = function (predicate, opts) {
3132
- var _a;
3133
- if (opts === void 0) { opts = {}; }
3134
- return __awaiter(this, void 0, void 0, function () {
3135
- var controller;
3136
- var _this = this;
3137
- return __generator(this, function (_b) {
3138
- controller = new AbortController();
3139
- (_a = opts.abort) === null || _a === void 0 ? void 0 : _a.addEventListener('abort', function () { return controller.abort(); });
3140
- return [2 /*return*/, new Promise(function (resolve) {
3141
- _this.when(predicate, function (event) {
3142
- if (predicate(event)) {
3143
- controller.abort();
3144
- resolve(event);
3145
- }
3146
- }, __assign(__assign({}, opts), { abort: controller.signal }));
3147
- })];
3148
- });
3149
- });
3150
- };
3151
- EventDispatcher.prototype.when = function (predicate, listener, opts) {
3152
- if (opts === void 0) { opts = {}; }
3153
- return this.on(function (event) {
3154
- if (predicate(event)) {
3155
- listener(event);
3156
- }
3157
- }, opts);
3158
- };
3159
- EventDispatcher.prototype.off = function (listener) {
3160
- var index = this.listeners.indexOf(listener);
3161
- if (index !== -1) {
3162
- this.listeners.splice(index, 1);
3163
- }
3164
- };
3165
- EventDispatcher.prototype.emit = function (event) {
3166
- this.listeners.forEach(function (listener) { return listener(event); });
3167
- };
3168
- return EventDispatcher;
3169
- }());
3170
-
3171
- export { EventDispatcher as E, async as a, uuid as b, color as c, mapper as m, objects as o, range as r, uri as u };
3172
-
3173
- //# sourceMappingURL=browser.esm.js.map