@plasmicapp/loader-core 1.0.89 → 1.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/loader-core.cjs.development.js +94 -271
- package/dist/loader-core.cjs.development.js.map +1 -1
- package/dist/loader-core.cjs.production.min.js +1 -1
- package/dist/loader-core.cjs.production.min.js.map +1 -1
- package/dist/loader-core.esm.js +94 -271
- package/dist/loader-core.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -12,52 +12,42 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
12
12
|
reject(error);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
if (info.done) {
|
|
17
16
|
resolve(value);
|
|
18
17
|
} else {
|
|
19
18
|
Promise.resolve(value).then(_next, _throw);
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
function _asyncToGenerator(fn) {
|
|
24
22
|
return function () {
|
|
25
23
|
var self = this,
|
|
26
|
-
|
|
24
|
+
args = arguments;
|
|
27
25
|
return new Promise(function (resolve, reject) {
|
|
28
26
|
var gen = fn.apply(self, args);
|
|
29
|
-
|
|
30
27
|
function _next(value) {
|
|
31
28
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
function _throw(err) {
|
|
35
31
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
_next(undefined);
|
|
39
34
|
});
|
|
40
35
|
};
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
function _extends() {
|
|
44
|
-
_extends = Object.assign
|
|
38
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
45
39
|
for (var i = 1; i < arguments.length; i++) {
|
|
46
40
|
var source = arguments[i];
|
|
47
|
-
|
|
48
41
|
for (var key in source) {
|
|
49
42
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
50
43
|
target[key] = source[key];
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
return target;
|
|
56
48
|
};
|
|
57
|
-
|
|
58
49
|
return _extends.apply(this, arguments);
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
function _unsupportedIterableToArray(o, minLen) {
|
|
62
52
|
if (!o) return;
|
|
63
53
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -66,19 +56,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
66
56
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
67
57
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
68
58
|
}
|
|
69
|
-
|
|
70
59
|
function _arrayLikeToArray(arr, len) {
|
|
71
60
|
if (len == null || len > arr.length) len = arr.length;
|
|
72
|
-
|
|
73
61
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
74
|
-
|
|
75
62
|
return arr2;
|
|
76
63
|
}
|
|
77
|
-
|
|
78
64
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
79
65
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
80
66
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
81
|
-
|
|
82
67
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
83
68
|
if (it) o = it;
|
|
84
69
|
var i = 0;
|
|
@@ -92,7 +77,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
92
77
|
};
|
|
93
78
|
};
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
97
81
|
}
|
|
98
82
|
|
|
@@ -104,64 +88,48 @@ var DepsGraph = /*#__PURE__*/function () {
|
|
|
104
88
|
this.dependedBy = {};
|
|
105
89
|
this.rebuildGraph();
|
|
106
90
|
}
|
|
107
|
-
|
|
108
91
|
var _proto = DepsGraph.prototype;
|
|
109
|
-
|
|
110
92
|
_proto.getTransitiveDependers = function getTransitiveDependers(name) {
|
|
111
93
|
return this.transitiveCrawl(name, this.dependedBy);
|
|
112
94
|
};
|
|
113
|
-
|
|
114
95
|
_proto.getTransitiveDeps = function getTransitiveDeps(name) {
|
|
115
96
|
if (!(name in this.dependsOn)) {
|
|
116
97
|
return [];
|
|
117
98
|
}
|
|
118
|
-
|
|
119
99
|
return this.transitiveCrawl(name, this.dependsOn);
|
|
120
100
|
};
|
|
121
|
-
|
|
122
101
|
_proto.transitiveCrawl = function transitiveCrawl(name, edges) {
|
|
123
102
|
var deps = new Set();
|
|
124
|
-
|
|
125
103
|
var crawl = function crawl(dep) {
|
|
126
104
|
if (deps.has(dep)) {
|
|
127
105
|
return;
|
|
128
106
|
}
|
|
129
|
-
|
|
130
107
|
deps.add(dep);
|
|
131
|
-
|
|
132
108
|
for (var _iterator = _createForOfIteratorHelperLoose((_edges$dep = edges[dep]) != null ? _edges$dep : []), _step; !(_step = _iterator()).done;) {
|
|
133
109
|
var _edges$dep;
|
|
134
|
-
|
|
135
110
|
var subdep = _step.value;
|
|
136
111
|
crawl(subdep);
|
|
137
112
|
}
|
|
138
113
|
};
|
|
139
|
-
|
|
140
114
|
for (var _iterator2 = _createForOfIteratorHelperLoose(edges[name]), _step2; !(_step2 = _iterator2()).done;) {
|
|
141
115
|
var dep = _step2.value;
|
|
142
116
|
crawl(dep);
|
|
143
117
|
}
|
|
144
|
-
|
|
145
118
|
return Array.from(deps);
|
|
146
119
|
};
|
|
147
|
-
|
|
148
120
|
_proto.rebuildGraph = function rebuildGraph() {
|
|
149
121
|
this.dependedBy = {};
|
|
150
122
|
this.dependsOn = {};
|
|
151
|
-
|
|
152
123
|
for (var _iterator3 = _createForOfIteratorHelperLoose(this.browserBuild ? this.bundle.modules.browser : this.bundle.modules.server), _step3; !(_step3 = _iterator3()).done;) {
|
|
153
124
|
var mod = _step3.value;
|
|
154
|
-
|
|
155
125
|
if (mod.type === 'code') {
|
|
156
126
|
for (var _iterator4 = _createForOfIteratorHelperLoose(mod.imports), _step4; !(_step4 = _iterator4()).done;) {
|
|
157
127
|
var imported = _step4.value;
|
|
158
|
-
|
|
159
128
|
if (!(mod.fileName in this.dependsOn)) {
|
|
160
129
|
this.dependsOn[mod.fileName] = [imported];
|
|
161
130
|
} else {
|
|
162
131
|
this.dependsOn[mod.fileName].push(imported);
|
|
163
132
|
}
|
|
164
|
-
|
|
165
133
|
if (!(imported in this.dependedBy)) {
|
|
166
134
|
this.dependedBy[imported] = [mod.fileName];
|
|
167
135
|
} else {
|
|
@@ -171,7 +139,6 @@ var DepsGraph = /*#__PURE__*/function () {
|
|
|
171
139
|
}
|
|
172
140
|
}
|
|
173
141
|
};
|
|
174
|
-
|
|
175
142
|
return DepsGraph;
|
|
176
143
|
}();
|
|
177
144
|
|
|
@@ -180,10 +147,8 @@ var DepsGraph = /*#__PURE__*/function () {
|
|
|
180
147
|
* @param opts.target by default, will target the browser modules. Can request
|
|
181
148
|
* the server modules instead.
|
|
182
149
|
*/
|
|
183
|
-
|
|
184
150
|
function getBundleSubset(bundle, names, opts) {
|
|
185
151
|
var _opts$target;
|
|
186
|
-
|
|
187
152
|
var namesSet = new Set(names);
|
|
188
153
|
var target = (_opts$target = opts == null ? void 0 : opts.target) != null ? _opts$target : 'browser';
|
|
189
154
|
var forBrowser = target === 'browser';
|
|
@@ -191,11 +156,9 @@ function getBundleSubset(bundle, names, opts) {
|
|
|
191
156
|
var deps = new Set(names.flatMap(function (name) {
|
|
192
157
|
return graph.getTransitiveDeps(name);
|
|
193
158
|
}));
|
|
194
|
-
|
|
195
159
|
var isSubModule = function isSubModule(fileName) {
|
|
196
160
|
return deps.has(fileName) || namesSet.has(fileName);
|
|
197
161
|
};
|
|
198
|
-
|
|
199
162
|
var modules = bundle.modules[target];
|
|
200
163
|
var filteredModules = modules.filter(function (mod) {
|
|
201
164
|
return isSubModule(mod.fileName);
|
|
@@ -224,64 +187,48 @@ var Registry = /*#__PURE__*/function () {
|
|
|
224
187
|
this.registeredModules = {};
|
|
225
188
|
this.modules = {};
|
|
226
189
|
}
|
|
227
|
-
|
|
228
190
|
Registry.getInstance = function getInstance() {
|
|
229
191
|
if (!Registry.instance) {
|
|
230
192
|
Registry.instance = new Registry();
|
|
231
193
|
}
|
|
232
|
-
|
|
233
194
|
return Registry.instance;
|
|
234
195
|
};
|
|
235
|
-
|
|
236
196
|
var _proto = Registry.prototype;
|
|
237
|
-
|
|
238
197
|
_proto.register = function register(name, module) {
|
|
239
198
|
this.registeredModules[name] = module;
|
|
240
199
|
};
|
|
241
|
-
|
|
242
200
|
_proto.isEmpty = function isEmpty() {
|
|
243
201
|
return Object.keys(this.loadedModules).length === 0;
|
|
244
202
|
};
|
|
245
|
-
|
|
246
203
|
_proto.clear = function clear() {
|
|
247
204
|
this.loadedModules = {};
|
|
248
205
|
};
|
|
249
|
-
|
|
250
206
|
_proto.getRegisteredModule = function getRegisteredModule(name) {
|
|
251
207
|
return this.registeredModules[name];
|
|
252
208
|
};
|
|
253
|
-
|
|
254
209
|
_proto.hasModule = function hasModule(name, opts) {
|
|
255
210
|
if (opts === void 0) {
|
|
256
211
|
opts = {};
|
|
257
212
|
}
|
|
258
|
-
|
|
259
213
|
if (name in this.registeredModules && !opts.forceOriginal) {
|
|
260
214
|
return true;
|
|
261
215
|
}
|
|
262
|
-
|
|
263
216
|
return name in this.modules;
|
|
264
217
|
};
|
|
265
|
-
|
|
266
218
|
_proto.load = function load(name, opts) {
|
|
267
219
|
var _this = this;
|
|
268
|
-
|
|
269
220
|
if (opts === void 0) {
|
|
270
221
|
opts = {};
|
|
271
222
|
}
|
|
272
|
-
|
|
273
223
|
if (name in this.registeredModules && !opts.forceOriginal) {
|
|
274
224
|
return this.registeredModules[name];
|
|
275
225
|
}
|
|
276
|
-
|
|
277
226
|
if (name in this.loadedModules) {
|
|
278
227
|
return this.loadedModules[name];
|
|
279
228
|
}
|
|
280
|
-
|
|
281
229
|
if (!(name in this.modules)) {
|
|
282
230
|
throw new Error("Unknown module " + name);
|
|
283
231
|
}
|
|
284
|
-
|
|
285
232
|
var code = this.modules[name];
|
|
286
233
|
var requireFn = isBrowser ? function (dep) {
|
|
287
234
|
var normalizedDep = resolvePath(dep, name);
|
|
@@ -300,16 +247,13 @@ var Registry = /*#__PURE__*/function () {
|
|
|
300
247
|
}
|
|
301
248
|
};
|
|
302
249
|
var func;
|
|
303
|
-
|
|
304
250
|
try {
|
|
305
251
|
func = new Function('require', 'exports', code);
|
|
306
252
|
} catch (err) {
|
|
307
253
|
throw new Error("PLASMIC: Failed to create function for " + name + ": " + err);
|
|
308
254
|
}
|
|
309
|
-
|
|
310
255
|
var exports = {};
|
|
311
256
|
this.loadedModules[name] = exports;
|
|
312
|
-
|
|
313
257
|
try {
|
|
314
258
|
func(requireFn, exports);
|
|
315
259
|
} catch (err) {
|
|
@@ -318,56 +262,44 @@ var Registry = /*#__PURE__*/function () {
|
|
|
318
262
|
delete this.loadedModules[name];
|
|
319
263
|
throw new Error("PLASMIC: Failed to load " + name + ": " + err);
|
|
320
264
|
}
|
|
321
|
-
|
|
322
265
|
return exports;
|
|
323
266
|
};
|
|
324
|
-
|
|
325
267
|
_proto.updateModules = function updateModules(bundle) {
|
|
326
268
|
var updated = false;
|
|
327
|
-
|
|
328
269
|
for (var _iterator = _createForOfIteratorHelperLoose(isBrowser ? bundle.modules.browser : bundle.modules.server), _step; !(_step = _iterator()).done;) {
|
|
329
270
|
var mod = _step.value;
|
|
330
|
-
|
|
331
271
|
if (mod.type === 'code' && mod.code !== this.modules[mod.fileName]) {
|
|
332
272
|
this.modules[mod.fileName] = mod.code;
|
|
333
273
|
updated = true;
|
|
334
274
|
}
|
|
335
275
|
}
|
|
336
|
-
|
|
337
276
|
if (updated) {
|
|
338
277
|
// TODO: do something more efficient than tearing everything down?
|
|
339
278
|
this.clear();
|
|
340
279
|
}
|
|
341
280
|
};
|
|
342
|
-
|
|
343
281
|
return Registry;
|
|
344
|
-
}();
|
|
345
|
-
|
|
282
|
+
}();
|
|
283
|
+
// Singleton
|
|
346
284
|
Registry.instance = undefined;
|
|
347
|
-
|
|
348
285
|
function resolvePath(path, from) {
|
|
349
286
|
var fromParts = from.split('/');
|
|
350
287
|
var pathParts = path.split('/');
|
|
351
|
-
|
|
352
288
|
if (pathParts.length === 0) {
|
|
353
289
|
return path;
|
|
354
290
|
}
|
|
355
|
-
|
|
356
291
|
if (pathParts[0] === '.') {
|
|
357
292
|
return [].concat(fromParts.slice(0, fromParts.length - 1), pathParts.slice(1)).join('/');
|
|
358
293
|
} else if (pathParts[0] === '..') {
|
|
359
294
|
var count = 0;
|
|
360
|
-
|
|
361
295
|
for (var _iterator2 = _createForOfIteratorHelperLoose(pathParts), _step2; !(_step2 = _iterator2()).done;) {
|
|
362
296
|
var part = _step2.value;
|
|
363
|
-
|
|
364
297
|
if (part === '..') {
|
|
365
298
|
count += 1;
|
|
366
299
|
} else {
|
|
367
300
|
break;
|
|
368
301
|
}
|
|
369
302
|
}
|
|
370
|
-
|
|
371
303
|
return [].concat(fromParts.slice(0, fromParts.length - count - 1), pathParts.slice(count)).join('/');
|
|
372
304
|
} else {
|
|
373
305
|
return path;
|
|
@@ -385,17 +317,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
385
317
|
* This source code is licensed under the MIT license found in the
|
|
386
318
|
* LICENSE file in the root directory of this source tree.
|
|
387
319
|
*/
|
|
320
|
+
|
|
388
321
|
var runtime = function (exports) {
|
|
389
322
|
|
|
390
323
|
var Op = Object.prototype;
|
|
391
324
|
var hasOwn = Op.hasOwnProperty;
|
|
392
325
|
var undefined$1; // More compressible than void 0.
|
|
393
|
-
|
|
394
326
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
395
327
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
396
328
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
397
329
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
398
|
-
|
|
399
330
|
function define(obj, key, value) {
|
|
400
331
|
Object.defineProperty(obj, key, {
|
|
401
332
|
value: value,
|
|
@@ -405,7 +336,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
405
336
|
});
|
|
406
337
|
return obj[key];
|
|
407
338
|
}
|
|
408
|
-
|
|
409
339
|
try {
|
|
410
340
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
411
341
|
define({}, "");
|
|
@@ -414,19 +344,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
414
344
|
return obj[key] = value;
|
|
415
345
|
};
|
|
416
346
|
}
|
|
417
|
-
|
|
418
347
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
419
348
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
420
349
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
421
350
|
var generator = Object.create(protoGenerator.prototype);
|
|
422
|
-
var context = new Context(tryLocsList || []);
|
|
423
|
-
// .throw, and .return methods.
|
|
351
|
+
var context = new Context(tryLocsList || []);
|
|
424
352
|
|
|
353
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
354
|
+
// .throw, and .return methods.
|
|
425
355
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
426
356
|
return generator;
|
|
427
357
|
}
|
|
358
|
+
exports.wrap = wrap;
|
|
428
359
|
|
|
429
|
-
|
|
360
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
430
361
|
// record like context.tryEntries[i].completion. This interface could
|
|
431
362
|
// have been (and was previously) designed to take a closure to be
|
|
432
363
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -436,7 +367,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
436
367
|
// in every case, so we don't have to touch the arguments object. The
|
|
437
368
|
// only additional allocation required is the completion record, which
|
|
438
369
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
439
|
-
|
|
440
370
|
function tryCatch(fn, obj, arg) {
|
|
441
371
|
try {
|
|
442
372
|
return {
|
|
@@ -450,46 +380,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
450
380
|
};
|
|
451
381
|
}
|
|
452
382
|
}
|
|
453
|
-
|
|
454
383
|
var GenStateSuspendedStart = "suspendedStart";
|
|
455
384
|
var GenStateSuspendedYield = "suspendedYield";
|
|
456
385
|
var GenStateExecuting = "executing";
|
|
457
|
-
var GenStateCompleted = "completed";
|
|
386
|
+
var GenStateCompleted = "completed";
|
|
387
|
+
|
|
388
|
+
// Returning this object from the innerFn has the same effect as
|
|
458
389
|
// breaking out of the dispatch switch statement.
|
|
390
|
+
var ContinueSentinel = {};
|
|
459
391
|
|
|
460
|
-
|
|
392
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
461
393
|
// .constructor.prototype properties for functions that return Generator
|
|
462
394
|
// objects. For full spec compliance, you may wish to configure your
|
|
463
395
|
// minifier not to mangle the names of these two functions.
|
|
464
|
-
|
|
465
396
|
function Generator() {}
|
|
466
|
-
|
|
467
397
|
function GeneratorFunction() {}
|
|
398
|
+
function GeneratorFunctionPrototype() {}
|
|
468
399
|
|
|
469
|
-
|
|
400
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
470
401
|
// don't natively support it.
|
|
471
|
-
|
|
472
|
-
|
|
473
402
|
var IteratorPrototype = {};
|
|
474
403
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
475
404
|
return this;
|
|
476
405
|
});
|
|
477
406
|
var getProto = Object.getPrototypeOf;
|
|
478
407
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
479
|
-
|
|
480
408
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
481
409
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
482
410
|
// of the polyfill.
|
|
483
411
|
IteratorPrototype = NativeIteratorPrototype;
|
|
484
412
|
}
|
|
485
|
-
|
|
486
413
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
487
414
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
488
415
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
489
416
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
490
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
491
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
417
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
492
418
|
|
|
419
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
420
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
493
421
|
function defineIteratorMethods(prototype) {
|
|
494
422
|
["next", "throw", "return"].forEach(function (method) {
|
|
495
423
|
define(prototype, method, function (arg) {
|
|
@@ -497,14 +425,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
497
425
|
});
|
|
498
426
|
});
|
|
499
427
|
}
|
|
500
|
-
|
|
501
428
|
exports.isGeneratorFunction = function (genFun) {
|
|
502
429
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
503
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
430
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
431
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
504
432
|
// do is to check its .name property.
|
|
505
433
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
506
434
|
};
|
|
507
|
-
|
|
508
435
|
exports.mark = function (genFun) {
|
|
509
436
|
if (Object.setPrototypeOf) {
|
|
510
437
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -512,31 +439,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
512
439
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
513
440
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
514
441
|
}
|
|
515
|
-
|
|
516
442
|
genFun.prototype = Object.create(Gp);
|
|
517
443
|
return genFun;
|
|
518
|
-
};
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
// Within the body of any async function, `await x` is transformed to
|
|
519
447
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
520
448
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
521
449
|
// meant to be awaited.
|
|
522
|
-
|
|
523
|
-
|
|
524
450
|
exports.awrap = function (arg) {
|
|
525
451
|
return {
|
|
526
452
|
__await: arg
|
|
527
453
|
};
|
|
528
454
|
};
|
|
529
|
-
|
|
530
455
|
function AsyncIterator(generator, PromiseImpl) {
|
|
531
456
|
function invoke(method, arg, resolve, reject) {
|
|
532
457
|
var record = tryCatch(generator[method], generator, arg);
|
|
533
|
-
|
|
534
458
|
if (record.type === "throw") {
|
|
535
459
|
reject(record.arg);
|
|
536
460
|
} else {
|
|
537
461
|
var result = record.arg;
|
|
538
462
|
var value = result.value;
|
|
539
|
-
|
|
540
463
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
541
464
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
542
465
|
invoke("next", value, resolve, reject);
|
|
@@ -544,7 +467,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
544
467
|
invoke("throw", err, resolve, reject);
|
|
545
468
|
});
|
|
546
469
|
}
|
|
547
|
-
|
|
548
470
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
549
471
|
// When a yielded Promise is resolved, its final value becomes
|
|
550
472
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -558,17 +480,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
558
480
|
});
|
|
559
481
|
}
|
|
560
482
|
}
|
|
561
|
-
|
|
562
483
|
var previousPromise;
|
|
563
|
-
|
|
564
484
|
function enqueue(method, arg) {
|
|
565
485
|
function callInvokeWithMethodAndArg() {
|
|
566
486
|
return new PromiseImpl(function (resolve, reject) {
|
|
567
487
|
invoke(method, arg, resolve, reject);
|
|
568
488
|
});
|
|
569
489
|
}
|
|
570
|
-
|
|
571
|
-
|
|
490
|
+
return previousPromise =
|
|
491
|
+
// If enqueue has been called before, then we want to wait until
|
|
572
492
|
// all previous Promises have been resolved before calling invoke,
|
|
573
493
|
// so that results are always delivered in the correct order. If
|
|
574
494
|
// enqueue has not been called before, then it is important to
|
|
@@ -580,24 +500,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
580
500
|
// execute code before the first await. Since we implement simple
|
|
581
501
|
// async functions in terms of async generators, it is especially
|
|
582
502
|
// important to get this right, even though it requires care.
|
|
583
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
503
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
504
|
+
// Avoid propagating failures to Promises returned by later
|
|
584
505
|
// invocations of the iterator.
|
|
585
506
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
586
|
-
}
|
|
587
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
588
|
-
|
|
507
|
+
}
|
|
589
508
|
|
|
509
|
+
// Define the unified helper method that is used to implement .next,
|
|
510
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
590
511
|
this._invoke = enqueue;
|
|
591
512
|
}
|
|
592
|
-
|
|
593
513
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
594
514
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
595
515
|
return this;
|
|
596
516
|
});
|
|
597
|
-
exports.AsyncIterator = AsyncIterator;
|
|
517
|
+
exports.AsyncIterator = AsyncIterator;
|
|
518
|
+
|
|
519
|
+
// Note that simple async functions are implemented on top of
|
|
598
520
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
599
521
|
// the final result produced by the iterator.
|
|
600
|
-
|
|
601
522
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
602
523
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
603
524
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -606,39 +527,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
606
527
|
return result.done ? result.value : iter.next();
|
|
607
528
|
});
|
|
608
529
|
};
|
|
609
|
-
|
|
610
530
|
function makeInvokeMethod(innerFn, self, context) {
|
|
611
531
|
var state = GenStateSuspendedStart;
|
|
612
532
|
return function invoke(method, arg) {
|
|
613
533
|
if (state === GenStateExecuting) {
|
|
614
534
|
throw new Error("Generator is already running");
|
|
615
535
|
}
|
|
616
|
-
|
|
617
536
|
if (state === GenStateCompleted) {
|
|
618
537
|
if (method === "throw") {
|
|
619
538
|
throw arg;
|
|
620
|
-
}
|
|
621
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
622
|
-
|
|
539
|
+
}
|
|
623
540
|
|
|
541
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
542
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
624
543
|
return doneResult();
|
|
625
544
|
}
|
|
626
|
-
|
|
627
545
|
context.method = method;
|
|
628
546
|
context.arg = arg;
|
|
629
|
-
|
|
630
547
|
while (true) {
|
|
631
548
|
var delegate = context.delegate;
|
|
632
|
-
|
|
633
549
|
if (delegate) {
|
|
634
550
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
635
|
-
|
|
636
551
|
if (delegateResult) {
|
|
637
552
|
if (delegateResult === ContinueSentinel) continue;
|
|
638
553
|
return delegateResult;
|
|
639
554
|
}
|
|
640
555
|
}
|
|
641
|
-
|
|
642
556
|
if (context.method === "next") {
|
|
643
557
|
// Setting context._sent for legacy support of Babel's
|
|
644
558
|
// function.sent implementation.
|
|
@@ -648,51 +562,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
648
562
|
state = GenStateCompleted;
|
|
649
563
|
throw context.arg;
|
|
650
564
|
}
|
|
651
|
-
|
|
652
565
|
context.dispatchException(context.arg);
|
|
653
566
|
} else if (context.method === "return") {
|
|
654
567
|
context.abrupt("return", context.arg);
|
|
655
568
|
}
|
|
656
|
-
|
|
657
569
|
state = GenStateExecuting;
|
|
658
570
|
var record = tryCatch(innerFn, self, context);
|
|
659
|
-
|
|
660
571
|
if (record.type === "normal") {
|
|
661
572
|
// If an exception is thrown from innerFn, we leave state ===
|
|
662
573
|
// GenStateExecuting and loop back for another invocation.
|
|
663
574
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
664
|
-
|
|
665
575
|
if (record.arg === ContinueSentinel) {
|
|
666
576
|
continue;
|
|
667
577
|
}
|
|
668
|
-
|
|
669
578
|
return {
|
|
670
579
|
value: record.arg,
|
|
671
580
|
done: context.done
|
|
672
581
|
};
|
|
673
582
|
} else if (record.type === "throw") {
|
|
674
|
-
state = GenStateCompleted;
|
|
583
|
+
state = GenStateCompleted;
|
|
584
|
+
// Dispatch the exception by looping back around to the
|
|
675
585
|
// context.dispatchException(context.arg) call above.
|
|
676
|
-
|
|
677
586
|
context.method = "throw";
|
|
678
587
|
context.arg = record.arg;
|
|
679
588
|
}
|
|
680
589
|
}
|
|
681
590
|
};
|
|
682
|
-
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
683
594
|
// result, either by returning a { value, done } result from the
|
|
684
595
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
685
596
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
686
|
-
|
|
687
|
-
|
|
688
597
|
function maybeInvokeDelegate(delegate, context) {
|
|
689
598
|
var method = delegate.iterator[context.method];
|
|
690
|
-
|
|
691
599
|
if (method === undefined$1) {
|
|
692
600
|
// A .throw or .return when the delegate iterator has no .throw
|
|
693
601
|
// method always terminates the yield* loop.
|
|
694
602
|
context.delegate = null;
|
|
695
|
-
|
|
696
603
|
if (context.method === "throw") {
|
|
697
604
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
698
605
|
if (delegate.iterator["return"]) {
|
|
@@ -701,51 +608,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
701
608
|
context.method = "return";
|
|
702
609
|
context.arg = undefined$1;
|
|
703
610
|
maybeInvokeDelegate(delegate, context);
|
|
704
|
-
|
|
705
611
|
if (context.method === "throw") {
|
|
706
612
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
707
613
|
// "return" to "throw", let that override the TypeError below.
|
|
708
614
|
return ContinueSentinel;
|
|
709
615
|
}
|
|
710
616
|
}
|
|
711
|
-
|
|
712
617
|
context.method = "throw";
|
|
713
618
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
714
619
|
}
|
|
715
|
-
|
|
716
620
|
return ContinueSentinel;
|
|
717
621
|
}
|
|
718
|
-
|
|
719
622
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
720
|
-
|
|
721
623
|
if (record.type === "throw") {
|
|
722
624
|
context.method = "throw";
|
|
723
625
|
context.arg = record.arg;
|
|
724
626
|
context.delegate = null;
|
|
725
627
|
return ContinueSentinel;
|
|
726
628
|
}
|
|
727
|
-
|
|
728
629
|
var info = record.arg;
|
|
729
|
-
|
|
730
630
|
if (!info) {
|
|
731
631
|
context.method = "throw";
|
|
732
632
|
context.arg = new TypeError("iterator result is not an object");
|
|
733
633
|
context.delegate = null;
|
|
734
634
|
return ContinueSentinel;
|
|
735
635
|
}
|
|
736
|
-
|
|
737
636
|
if (info.done) {
|
|
738
637
|
// Assign the result of the finished delegate to the temporary
|
|
739
638
|
// variable specified by delegate.resultName (see delegateYield).
|
|
740
|
-
context[delegate.resultName] = info.value;
|
|
639
|
+
context[delegate.resultName] = info.value;
|
|
640
|
+
|
|
641
|
+
// Resume execution at the desired location (see delegateYield).
|
|
642
|
+
context.next = delegate.nextLoc;
|
|
741
643
|
|
|
742
|
-
|
|
644
|
+
// If context.method was "throw" but the delegate handled the
|
|
743
645
|
// exception, let the outer generator proceed normally. If
|
|
744
646
|
// context.method was "next", forget context.arg since it has been
|
|
745
647
|
// "consumed" by the delegate iterator. If context.method was
|
|
746
648
|
// "return", allow the original .return call to continue in the
|
|
747
649
|
// outer generator.
|
|
748
|
-
|
|
749
650
|
if (context.method !== "return") {
|
|
750
651
|
context.method = "next";
|
|
751
652
|
context.arg = undefined$1;
|
|
@@ -753,54 +654,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
753
654
|
} else {
|
|
754
655
|
// Re-yield the result returned by the delegate method.
|
|
755
656
|
return info;
|
|
756
|
-
}
|
|
757
|
-
// the outer generator.
|
|
758
|
-
|
|
657
|
+
}
|
|
759
658
|
|
|
659
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
660
|
+
// the outer generator.
|
|
760
661
|
context.delegate = null;
|
|
761
662
|
return ContinueSentinel;
|
|
762
|
-
}
|
|
763
|
-
// unified ._invoke helper method.
|
|
764
|
-
|
|
663
|
+
}
|
|
765
664
|
|
|
665
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
666
|
+
// unified ._invoke helper method.
|
|
766
667
|
defineIteratorMethods(Gp);
|
|
767
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
668
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
669
|
+
|
|
670
|
+
// A Generator should always return itself as the iterator object when the
|
|
768
671
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
769
672
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
770
673
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
771
674
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
772
|
-
|
|
773
675
|
define(Gp, iteratorSymbol, function () {
|
|
774
676
|
return this;
|
|
775
677
|
});
|
|
776
678
|
define(Gp, "toString", function () {
|
|
777
679
|
return "[object Generator]";
|
|
778
680
|
});
|
|
779
|
-
|
|
780
681
|
function pushTryEntry(locs) {
|
|
781
682
|
var entry = {
|
|
782
683
|
tryLoc: locs[0]
|
|
783
684
|
};
|
|
784
|
-
|
|
785
685
|
if (1 in locs) {
|
|
786
686
|
entry.catchLoc = locs[1];
|
|
787
687
|
}
|
|
788
|
-
|
|
789
688
|
if (2 in locs) {
|
|
790
689
|
entry.finallyLoc = locs[2];
|
|
791
690
|
entry.afterLoc = locs[3];
|
|
792
691
|
}
|
|
793
|
-
|
|
794
692
|
this.tryEntries.push(entry);
|
|
795
693
|
}
|
|
796
|
-
|
|
797
694
|
function resetTryEntry(entry) {
|
|
798
695
|
var record = entry.completion || {};
|
|
799
696
|
record.type = "normal";
|
|
800
697
|
delete record.arg;
|
|
801
698
|
entry.completion = record;
|
|
802
699
|
}
|
|
803
|
-
|
|
804
700
|
function Context(tryLocsList) {
|
|
805
701
|
// The root entry object (effectively a try statement without a catch
|
|
806
702
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -811,97 +707,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
811
707
|
tryLocsList.forEach(pushTryEntry, this);
|
|
812
708
|
this.reset(true);
|
|
813
709
|
}
|
|
814
|
-
|
|
815
710
|
exports.keys = function (object) {
|
|
816
711
|
var keys = [];
|
|
817
|
-
|
|
818
712
|
for (var key in object) {
|
|
819
713
|
keys.push(key);
|
|
820
714
|
}
|
|
715
|
+
keys.reverse();
|
|
821
716
|
|
|
822
|
-
|
|
717
|
+
// Rather than returning an object with a next method, we keep
|
|
823
718
|
// things simple and return the next function itself.
|
|
824
|
-
|
|
825
719
|
return function next() {
|
|
826
720
|
while (keys.length) {
|
|
827
721
|
var key = keys.pop();
|
|
828
|
-
|
|
829
722
|
if (key in object) {
|
|
830
723
|
next.value = key;
|
|
831
724
|
next.done = false;
|
|
832
725
|
return next;
|
|
833
726
|
}
|
|
834
|
-
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// To avoid creating an additional object, we just hang the .value
|
|
835
730
|
// and .done properties off the next function object itself. This
|
|
836
731
|
// also ensures that the minifier will not anonymize the function.
|
|
837
|
-
|
|
838
|
-
|
|
839
732
|
next.done = true;
|
|
840
733
|
return next;
|
|
841
734
|
};
|
|
842
735
|
};
|
|
843
|
-
|
|
844
736
|
function values(iterable) {
|
|
845
737
|
if (iterable) {
|
|
846
738
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
847
|
-
|
|
848
739
|
if (iteratorMethod) {
|
|
849
740
|
return iteratorMethod.call(iterable);
|
|
850
741
|
}
|
|
851
|
-
|
|
852
742
|
if (typeof iterable.next === "function") {
|
|
853
743
|
return iterable;
|
|
854
744
|
}
|
|
855
|
-
|
|
856
745
|
if (!isNaN(iterable.length)) {
|
|
857
746
|
var i = -1,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
747
|
+
next = function next() {
|
|
748
|
+
while (++i < iterable.length) {
|
|
749
|
+
if (hasOwn.call(iterable, i)) {
|
|
750
|
+
next.value = iterable[i];
|
|
751
|
+
next.done = false;
|
|
752
|
+
return next;
|
|
753
|
+
}
|
|
864
754
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
return next;
|
|
870
|
-
};
|
|
871
|
-
|
|
755
|
+
next.value = undefined$1;
|
|
756
|
+
next.done = true;
|
|
757
|
+
return next;
|
|
758
|
+
};
|
|
872
759
|
return next.next = next;
|
|
873
760
|
}
|
|
874
|
-
}
|
|
875
|
-
|
|
761
|
+
}
|
|
876
762
|
|
|
763
|
+
// Return an iterator with no values.
|
|
877
764
|
return {
|
|
878
765
|
next: doneResult
|
|
879
766
|
};
|
|
880
767
|
}
|
|
881
|
-
|
|
882
768
|
exports.values = values;
|
|
883
|
-
|
|
884
769
|
function doneResult() {
|
|
885
770
|
return {
|
|
886
771
|
value: undefined$1,
|
|
887
772
|
done: true
|
|
888
773
|
};
|
|
889
774
|
}
|
|
890
|
-
|
|
891
775
|
Context.prototype = {
|
|
892
776
|
constructor: Context,
|
|
893
777
|
reset: function reset(skipTempReset) {
|
|
894
778
|
this.prev = 0;
|
|
895
|
-
this.next = 0;
|
|
779
|
+
this.next = 0;
|
|
780
|
+
// Resetting context._sent for legacy support of Babel's
|
|
896
781
|
// function.sent implementation.
|
|
897
|
-
|
|
898
782
|
this.sent = this._sent = undefined$1;
|
|
899
783
|
this.done = false;
|
|
900
784
|
this.delegate = null;
|
|
901
785
|
this.method = "next";
|
|
902
786
|
this.arg = undefined$1;
|
|
903
787
|
this.tryEntries.forEach(resetTryEntry);
|
|
904
|
-
|
|
905
788
|
if (!skipTempReset) {
|
|
906
789
|
for (var name in this) {
|
|
907
790
|
// Not sure about the optimal order of these conditions:
|
|
@@ -915,50 +798,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
915
798
|
this.done = true;
|
|
916
799
|
var rootEntry = this.tryEntries[0];
|
|
917
800
|
var rootRecord = rootEntry.completion;
|
|
918
|
-
|
|
919
801
|
if (rootRecord.type === "throw") {
|
|
920
802
|
throw rootRecord.arg;
|
|
921
803
|
}
|
|
922
|
-
|
|
923
804
|
return this.rval;
|
|
924
805
|
},
|
|
925
806
|
dispatchException: function dispatchException(exception) {
|
|
926
807
|
if (this.done) {
|
|
927
808
|
throw exception;
|
|
928
809
|
}
|
|
929
|
-
|
|
930
810
|
var context = this;
|
|
931
|
-
|
|
932
811
|
function handle(loc, caught) {
|
|
933
812
|
record.type = "throw";
|
|
934
813
|
record.arg = exception;
|
|
935
814
|
context.next = loc;
|
|
936
|
-
|
|
937
815
|
if (caught) {
|
|
938
816
|
// If the dispatched exception was caught by a catch block,
|
|
939
817
|
// then let that catch block handle the exception normally.
|
|
940
818
|
context.method = "next";
|
|
941
819
|
context.arg = undefined$1;
|
|
942
820
|
}
|
|
943
|
-
|
|
944
821
|
return !!caught;
|
|
945
822
|
}
|
|
946
|
-
|
|
947
823
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
948
824
|
var entry = this.tryEntries[i];
|
|
949
825
|
var record = entry.completion;
|
|
950
|
-
|
|
951
826
|
if (entry.tryLoc === "root") {
|
|
952
827
|
// Exception thrown outside of any try block that could handle
|
|
953
828
|
// it, so set the completion value of the entire function to
|
|
954
829
|
// throw the exception.
|
|
955
830
|
return handle("end");
|
|
956
831
|
}
|
|
957
|
-
|
|
958
832
|
if (entry.tryLoc <= this.prev) {
|
|
959
833
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
960
834
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
961
|
-
|
|
962
835
|
if (hasCatch && hasFinally) {
|
|
963
836
|
if (this.prev < entry.catchLoc) {
|
|
964
837
|
return handle(entry.catchLoc, true);
|
|
@@ -982,36 +855,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
982
855
|
abrupt: function abrupt(type, arg) {
|
|
983
856
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
984
857
|
var entry = this.tryEntries[i];
|
|
985
|
-
|
|
986
858
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
987
859
|
var finallyEntry = entry;
|
|
988
860
|
break;
|
|
989
861
|
}
|
|
990
862
|
}
|
|
991
|
-
|
|
992
863
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
993
864
|
// Ignore the finally entry if control is not jumping to a
|
|
994
865
|
// location outside the try/catch block.
|
|
995
866
|
finallyEntry = null;
|
|
996
867
|
}
|
|
997
|
-
|
|
998
868
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
999
869
|
record.type = type;
|
|
1000
870
|
record.arg = arg;
|
|
1001
|
-
|
|
1002
871
|
if (finallyEntry) {
|
|
1003
872
|
this.method = "next";
|
|
1004
873
|
this.next = finallyEntry.finallyLoc;
|
|
1005
874
|
return ContinueSentinel;
|
|
1006
875
|
}
|
|
1007
|
-
|
|
1008
876
|
return this.complete(record);
|
|
1009
877
|
},
|
|
1010
878
|
complete: function complete(record, afterLoc) {
|
|
1011
879
|
if (record.type === "throw") {
|
|
1012
880
|
throw record.arg;
|
|
1013
881
|
}
|
|
1014
|
-
|
|
1015
882
|
if (record.type === "break" || record.type === "continue") {
|
|
1016
883
|
this.next = record.arg;
|
|
1017
884
|
} else if (record.type === "return") {
|
|
@@ -1021,13 +888,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1021
888
|
} else if (record.type === "normal" && afterLoc) {
|
|
1022
889
|
this.next = afterLoc;
|
|
1023
890
|
}
|
|
1024
|
-
|
|
1025
891
|
return ContinueSentinel;
|
|
1026
892
|
},
|
|
1027
893
|
finish: function finish(finallyLoc) {
|
|
1028
894
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1029
895
|
var entry = this.tryEntries[i];
|
|
1030
|
-
|
|
1031
896
|
if (entry.finallyLoc === finallyLoc) {
|
|
1032
897
|
this.complete(entry.completion, entry.afterLoc);
|
|
1033
898
|
resetTryEntry(entry);
|
|
@@ -1038,21 +903,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1038
903
|
"catch": function _catch(tryLoc) {
|
|
1039
904
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1040
905
|
var entry = this.tryEntries[i];
|
|
1041
|
-
|
|
1042
906
|
if (entry.tryLoc === tryLoc) {
|
|
1043
907
|
var record = entry.completion;
|
|
1044
|
-
|
|
1045
908
|
if (record.type === "throw") {
|
|
1046
909
|
var thrown = record.arg;
|
|
1047
910
|
resetTryEntry(entry);
|
|
1048
911
|
}
|
|
1049
|
-
|
|
1050
912
|
return thrown;
|
|
1051
913
|
}
|
|
1052
|
-
}
|
|
1053
|
-
// argument that corresponds to a known catch block.
|
|
1054
|
-
|
|
914
|
+
}
|
|
1055
915
|
|
|
916
|
+
// The context.catch method must only be called with a location
|
|
917
|
+
// argument that corresponds to a known catch block.
|
|
1056
918
|
throw new Error("illegal catch attempt");
|
|
1057
919
|
},
|
|
1058
920
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -1061,27 +923,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1061
923
|
resultName: resultName,
|
|
1062
924
|
nextLoc: nextLoc
|
|
1063
925
|
};
|
|
1064
|
-
|
|
1065
926
|
if (this.method === "next") {
|
|
1066
927
|
// Deliberately forget the last sent value so that we don't
|
|
1067
928
|
// accidentally pass it on to the delegate.
|
|
1068
929
|
this.arg = undefined$1;
|
|
1069
930
|
}
|
|
1070
|
-
|
|
1071
931
|
return ContinueSentinel;
|
|
1072
932
|
}
|
|
1073
|
-
};
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
1074
936
|
// or not, return the runtime object so that we can declare the variable
|
|
1075
937
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1076
938
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1077
|
-
|
|
1078
939
|
return exports;
|
|
1079
|
-
}(
|
|
940
|
+
}(
|
|
941
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
1080
942
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1081
943
|
// object. Either way, the resulting object will be used to initialize
|
|
1082
944
|
// the regeneratorRuntime variable at the top of this file.
|
|
1083
945
|
module.exports );
|
|
1084
|
-
|
|
1085
946
|
try {
|
|
1086
947
|
regeneratorRuntime = runtime;
|
|
1087
948
|
} catch (accidentalStrictMode) {
|
|
@@ -1108,14 +969,13 @@ function getPlasmicCookieValues() {
|
|
|
1108
969
|
if (!isBrowser$1) {
|
|
1109
970
|
return {};
|
|
1110
971
|
}
|
|
1111
|
-
|
|
1112
972
|
return Object.fromEntries(document.cookie.split('; ').filter(function (cookie) {
|
|
1113
973
|
return cookie.includes('plasmic:');
|
|
1114
974
|
}).map(function (cookie) {
|
|
1115
975
|
return cookie.split('=');
|
|
1116
976
|
}).map(function (_ref) {
|
|
1117
977
|
var key = _ref[0],
|
|
1118
|
-
|
|
978
|
+
value = _ref[1];
|
|
1119
979
|
return [key.split(':')[1], value];
|
|
1120
980
|
}));
|
|
1121
981
|
}
|
|
@@ -1126,17 +986,14 @@ function getVariationCookieValues() {
|
|
|
1126
986
|
}).filter(function (val) {
|
|
1127
987
|
return !!val[0];
|
|
1128
988
|
}));
|
|
1129
|
-
}
|
|
1130
|
-
|
|
989
|
+
}
|
|
990
|
+
// https://stackoverflow.com/a/8809472
|
|
1131
991
|
function generateUUID() {
|
|
1132
992
|
// Public Domain/MIT
|
|
1133
993
|
var d = new Date().getTime(); //Timestamp
|
|
1134
|
-
|
|
1135
994
|
var d2 = typeof performance !== 'undefined' && performance.now && performance.now() * 1000 || 0; //Time in microseconds since page-load or 0 if unsupported
|
|
1136
|
-
|
|
1137
995
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
1138
996
|
var r = Math.random() * 16; //random number between 0 and 16
|
|
1139
|
-
|
|
1140
997
|
if (d > 0) {
|
|
1141
998
|
//Use timestamp until depleted
|
|
1142
999
|
r = (d + r) % 16 | 0;
|
|
@@ -1146,7 +1003,6 @@ function generateUUID() {
|
|
|
1146
1003
|
r = (d2 + r) % 16 | 0;
|
|
1147
1004
|
d2 = Math.floor(d2 / 16);
|
|
1148
1005
|
}
|
|
1149
|
-
|
|
1150
1006
|
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
1151
1007
|
});
|
|
1152
1008
|
}
|
|
@@ -1154,35 +1010,29 @@ function getDistinctId() {
|
|
|
1154
1010
|
if (!isBrowser$1) {
|
|
1155
1011
|
return 'LOADER-SERVER';
|
|
1156
1012
|
}
|
|
1157
|
-
|
|
1158
1013
|
return generateUUID();
|
|
1159
1014
|
}
|
|
1160
|
-
|
|
1161
1015
|
function getCampaignParams() {
|
|
1162
1016
|
var _window = window,
|
|
1163
|
-
|
|
1017
|
+
location = _window.location;
|
|
1164
1018
|
var params = {};
|
|
1165
|
-
|
|
1166
1019
|
try {
|
|
1167
1020
|
var url = new URL(location.href);
|
|
1168
1021
|
var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid'];
|
|
1169
1022
|
CAMPAIGN_KEYWORDS.forEach(function (keyword) {
|
|
1170
1023
|
var value = url.searchParams.get(keyword);
|
|
1171
|
-
|
|
1172
1024
|
if (value) {
|
|
1173
1025
|
params[keyword] = value;
|
|
1174
1026
|
}
|
|
1175
1027
|
});
|
|
1176
1028
|
} catch (err) {}
|
|
1177
|
-
|
|
1178
1029
|
return params;
|
|
1179
1030
|
}
|
|
1180
|
-
|
|
1181
1031
|
function getLocationMeta() {
|
|
1182
1032
|
var _window2 = window,
|
|
1183
|
-
|
|
1033
|
+
location = _window2.location;
|
|
1184
1034
|
var _document = document,
|
|
1185
|
-
|
|
1035
|
+
referrer = _document.referrer;
|
|
1186
1036
|
return _extends({
|
|
1187
1037
|
url: location.href,
|
|
1188
1038
|
host: location.host,
|
|
@@ -1190,10 +1040,9 @@ function getLocationMeta() {
|
|
|
1190
1040
|
referrer: referrer
|
|
1191
1041
|
}, getCampaignParams());
|
|
1192
1042
|
}
|
|
1193
|
-
|
|
1194
1043
|
function getScreenMeta() {
|
|
1195
1044
|
var _window3 = window,
|
|
1196
|
-
|
|
1045
|
+
screen = _window3.screen;
|
|
1197
1046
|
return {
|
|
1198
1047
|
screen_height: screen.height,
|
|
1199
1048
|
screen_width: screen.width,
|
|
@@ -1201,13 +1050,11 @@ function getScreenMeta() {
|
|
|
1201
1050
|
viewport_width: window.innerWidth
|
|
1202
1051
|
};
|
|
1203
1052
|
}
|
|
1204
|
-
|
|
1205
1053
|
function getOS(userAgent) {
|
|
1206
1054
|
if (/Windows/i.test(userAgent)) {
|
|
1207
1055
|
if (/Phone/.test(userAgent) || /WPDesktop/.test(userAgent)) {
|
|
1208
1056
|
return 'Windows Phone';
|
|
1209
1057
|
}
|
|
1210
|
-
|
|
1211
1058
|
return 'Windows';
|
|
1212
1059
|
} else if (/(iPhone|iPad|iPod)/.test(userAgent)) {
|
|
1213
1060
|
return 'iOS';
|
|
@@ -1225,7 +1072,6 @@ function getOS(userAgent) {
|
|
|
1225
1072
|
return '';
|
|
1226
1073
|
}
|
|
1227
1074
|
}
|
|
1228
|
-
|
|
1229
1075
|
function getDeviceInfo(userAgent) {
|
|
1230
1076
|
var PATTERNS = [{
|
|
1231
1077
|
device: 'iPhone',
|
|
@@ -1255,19 +1101,16 @@ function getDeviceInfo(userAgent) {
|
|
|
1255
1101
|
os: getOS(userAgent)
|
|
1256
1102
|
};
|
|
1257
1103
|
}
|
|
1258
|
-
|
|
1259
1104
|
function getUserAgentMeta() {
|
|
1260
1105
|
var _window4 = window,
|
|
1261
|
-
|
|
1106
|
+
navigator = _window4.navigator;
|
|
1262
1107
|
var userAgent = navigator.userAgent;
|
|
1263
1108
|
return _extends({}, getDeviceInfo(userAgent));
|
|
1264
1109
|
}
|
|
1265
|
-
|
|
1266
1110
|
function getWindowMeta() {
|
|
1267
1111
|
if (!isBrowser$1) {
|
|
1268
1112
|
return {};
|
|
1269
1113
|
}
|
|
1270
|
-
|
|
1271
1114
|
return _extends({}, getLocationMeta(), getScreenMeta(), getUserAgentMeta());
|
|
1272
1115
|
}
|
|
1273
1116
|
var isProduction = "development" === 'production';
|
|
@@ -1281,8 +1124,7 @@ function rawSplitVariation(variation) {
|
|
|
1281
1124
|
var rawVariations = {};
|
|
1282
1125
|
Object.keys(variation).forEach(function (variationKey) {
|
|
1283
1126
|
var _variationKey$split = variationKey.split('.'),
|
|
1284
|
-
|
|
1285
|
-
|
|
1127
|
+
splitId = _variationKey$split[1];
|
|
1286
1128
|
if (splitId) {
|
|
1287
1129
|
rawVariations[splitId] = variation[variationKey];
|
|
1288
1130
|
}
|
|
@@ -1297,7 +1139,6 @@ function throttled(func) {
|
|
|
1297
1139
|
// will already be taken care of next time we run
|
|
1298
1140
|
return;
|
|
1299
1141
|
}
|
|
1300
|
-
|
|
1301
1142
|
if (isBrowser$1) {
|
|
1302
1143
|
timerId = window.requestAnimationFrame(function () {
|
|
1303
1144
|
timerId = undefined;
|
|
@@ -1318,7 +1159,6 @@ var TRACKER_VERSION = 3;
|
|
|
1318
1159
|
var PlasmicTracker = /*#__PURE__*/function () {
|
|
1319
1160
|
function PlasmicTracker(opts) {
|
|
1320
1161
|
var _this = this;
|
|
1321
|
-
|
|
1322
1162
|
this.opts = opts;
|
|
1323
1163
|
this.eventQueue = [];
|
|
1324
1164
|
this.sendEvents = throttled( /*#__PURE__*/function () {
|
|
@@ -1332,9 +1172,7 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1332
1172
|
_context.next = 2;
|
|
1333
1173
|
break;
|
|
1334
1174
|
}
|
|
1335
|
-
|
|
1336
1175
|
return _context.abrupt("return");
|
|
1337
|
-
|
|
1338
1176
|
case 2:
|
|
1339
1177
|
events = [].concat(_this.eventQueue);
|
|
1340
1178
|
_this.eventQueue.length = 0;
|
|
@@ -1342,10 +1180,8 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1342
1180
|
api_key: API_PUBLIC_KEY,
|
|
1343
1181
|
batch: events
|
|
1344
1182
|
};
|
|
1345
|
-
|
|
1346
1183
|
try {
|
|
1347
1184
|
stringBody = JSON.stringify(body);
|
|
1348
|
-
|
|
1349
1185
|
if (transport === 'beacon') {
|
|
1350
1186
|
// Triggers warning: https://chromestatus.com/feature/5629709824032768
|
|
1351
1187
|
window.navigator.sendBeacon(API_ENDPOINT, stringBody);
|
|
@@ -1359,7 +1195,6 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1359
1195
|
}).then(function () {})["catch"](function () {});
|
|
1360
1196
|
}
|
|
1361
1197
|
} catch (err) {}
|
|
1362
|
-
|
|
1363
1198
|
case 6:
|
|
1364
1199
|
case "end":
|
|
1365
1200
|
return _context.stop();
|
|
@@ -1367,36 +1202,29 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1367
1202
|
}
|
|
1368
1203
|
}, _callee);
|
|
1369
1204
|
}));
|
|
1370
|
-
|
|
1371
1205
|
return function (_x) {
|
|
1372
1206
|
return _ref.apply(this, arguments);
|
|
1373
1207
|
};
|
|
1374
1208
|
}());
|
|
1375
1209
|
}
|
|
1376
|
-
|
|
1377
1210
|
var _proto = PlasmicTracker.prototype;
|
|
1378
|
-
|
|
1379
1211
|
_proto.trackRender = function trackRender(opts) {
|
|
1380
1212
|
var _opts$renderCtx, _opts$variation;
|
|
1381
|
-
|
|
1382
1213
|
this.enqueue({
|
|
1383
1214
|
event: '$render',
|
|
1384
1215
|
properties: _extends({}, this.getProperties(), (_opts$renderCtx = opts == null ? void 0 : opts.renderCtx) != null ? _opts$renderCtx : {}, rawSplitVariation((_opts$variation = opts == null ? void 0 : opts.variation) != null ? _opts$variation : {}))
|
|
1385
1216
|
});
|
|
1386
1217
|
};
|
|
1387
|
-
|
|
1388
1218
|
_proto.trackFetch = function trackFetch() {
|
|
1389
1219
|
this.enqueue({
|
|
1390
1220
|
event: '$fetch',
|
|
1391
1221
|
properties: this.getProperties()
|
|
1392
1222
|
});
|
|
1393
1223
|
};
|
|
1394
|
-
|
|
1395
1224
|
_proto.trackConversion = function trackConversion(value) {
|
|
1396
1225
|
if (value === void 0) {
|
|
1397
1226
|
value = 0;
|
|
1398
1227
|
}
|
|
1399
|
-
|
|
1400
1228
|
this.enqueue({
|
|
1401
1229
|
event: '$conversion',
|
|
1402
1230
|
properties: _extends({}, this.getProperties(), {
|
|
@@ -1404,10 +1232,8 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1404
1232
|
})
|
|
1405
1233
|
});
|
|
1406
1234
|
};
|
|
1407
|
-
|
|
1408
1235
|
_proto.getProperties = function getProperties() {
|
|
1409
1236
|
var _Date$now;
|
|
1410
|
-
|
|
1411
1237
|
return _extends({
|
|
1412
1238
|
distinct_id: getDistinctId()
|
|
1413
1239
|
}, getWindowMeta(), getEnvMeta(), this.getContextMeta(), getVariationCookieValues(), {
|
|
@@ -1415,12 +1241,10 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1415
1241
|
trackerVersion: TRACKER_VERSION
|
|
1416
1242
|
});
|
|
1417
1243
|
};
|
|
1418
|
-
|
|
1419
1244
|
_proto.enqueue = function enqueue(event) {
|
|
1420
1245
|
this.eventQueue.push(event);
|
|
1421
1246
|
this.sendEvents('fetch');
|
|
1422
1247
|
};
|
|
1423
|
-
|
|
1424
1248
|
_proto.getContextMeta = function getContextMeta() {
|
|
1425
1249
|
return {
|
|
1426
1250
|
platform: this.opts.platform,
|
|
@@ -1428,7 +1252,6 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1428
1252
|
projectIds: this.opts.projectIds
|
|
1429
1253
|
};
|
|
1430
1254
|
};
|
|
1431
|
-
|
|
1432
1255
|
return PlasmicTracker;
|
|
1433
1256
|
}();
|
|
1434
1257
|
|