@plasmicpkgs/commerce 0.0.2 → 0.0.6

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.
@@ -176,200 +176,198 @@ function createCommonjsModule(fn, module) {
176
176
  return module = { exports: {} }, fn(module, module.exports), module.exports;
177
177
  }
178
178
 
179
- var runtime_1 = createCommonjsModule(function (module) {
180
- /**
181
- * Copyright (c) 2014-present, Facebook, Inc.
182
- *
183
- * This source code is licensed under the MIT license found in the
184
- * LICENSE file in the root directory of this source tree.
185
- */
186
-
187
- var runtime = (function (exports) {
188
-
189
- var Op = Object.prototype;
190
- var hasOwn = Op.hasOwnProperty;
191
- var undefined$1; // More compressible than void 0.
192
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
193
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
194
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
195
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
196
-
197
- function define(obj, key, value) {
198
- Object.defineProperty(obj, key, {
199
- value: value,
200
- enumerable: true,
201
- configurable: true,
202
- writable: true
203
- });
204
- return obj[key];
205
- }
206
- try {
207
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
208
- define({}, "");
209
- } catch (err) {
210
- define = function(obj, key, value) {
211
- return obj[key] = value;
212
- };
213
- }
214
-
215
- function wrap(innerFn, outerFn, self, tryLocsList) {
216
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
217
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
218
- var generator = Object.create(protoGenerator.prototype);
219
- var context = new Context(tryLocsList || []);
220
-
221
- // The ._invoke method unifies the implementations of the .next,
222
- // .throw, and .return methods.
223
- generator._invoke = makeInvokeMethod(innerFn, self, context);
179
+ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
180
+ /**
181
+ * Copyright (c) 2014-present, Facebook, Inc.
182
+ *
183
+ * This source code is licensed under the MIT license found in the
184
+ * LICENSE file in the root directory of this source tree.
185
+ */
186
+ var runtime = function (exports) {
187
+
188
+ var Op = Object.prototype;
189
+ var hasOwn = Op.hasOwnProperty;
190
+ var undefined$1; // More compressible than void 0.
191
+
192
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
193
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
194
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
195
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
196
+
197
+ function define(obj, key, value) {
198
+ Object.defineProperty(obj, key, {
199
+ value: value,
200
+ enumerable: true,
201
+ configurable: true,
202
+ writable: true
203
+ });
204
+ return obj[key];
205
+ }
224
206
 
225
- return generator;
226
- }
227
- exports.wrap = wrap;
228
-
229
- // Try/catch helper to minimize deoptimizations. Returns a completion
230
- // record like context.tryEntries[i].completion. This interface could
231
- // have been (and was previously) designed to take a closure to be
232
- // invoked without arguments, but in all the cases we care about we
233
- // already have an existing method we want to call, so there's no need
234
- // to create a new function object. We can even get away with assuming
235
- // the method takes exactly one argument, since that happens to be true
236
- // in every case, so we don't have to touch the arguments object. The
237
- // only additional allocation required is the completion record, which
238
- // has a stable shape and so hopefully should be cheap to allocate.
239
- function tryCatch(fn, obj, arg) {
240
207
  try {
241
- return { type: "normal", arg: fn.call(obj, arg) };
208
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
209
+ define({}, "");
242
210
  } catch (err) {
243
- return { type: "throw", arg: err };
211
+ define = function define(obj, key, value) {
212
+ return obj[key] = value;
213
+ };
244
214
  }
245
- }
246
215
 
247
- var GenStateSuspendedStart = "suspendedStart";
248
- var GenStateSuspendedYield = "suspendedYield";
249
- var GenStateExecuting = "executing";
250
- var GenStateCompleted = "completed";
251
-
252
- // Returning this object from the innerFn has the same effect as
253
- // breaking out of the dispatch switch statement.
254
- var ContinueSentinel = {};
255
-
256
- // Dummy constructor functions that we use as the .constructor and
257
- // .constructor.prototype properties for functions that return Generator
258
- // objects. For full spec compliance, you may wish to configure your
259
- // minifier not to mangle the names of these two functions.
260
- function Generator() {}
261
- function GeneratorFunction() {}
262
- function GeneratorFunctionPrototype() {}
263
-
264
- // This is a polyfill for %IteratorPrototype% for environments that
265
- // don't natively support it.
266
- var IteratorPrototype = {};
267
- IteratorPrototype[iteratorSymbol] = function () {
268
- return this;
269
- };
216
+ function wrap(innerFn, outerFn, self, tryLocsList) {
217
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
218
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
219
+ var generator = Object.create(protoGenerator.prototype);
220
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
221
+ // .throw, and .return methods.
270
222
 
271
- var getProto = Object.getPrototypeOf;
272
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
273
- if (NativeIteratorPrototype &&
274
- NativeIteratorPrototype !== Op &&
275
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
276
- // This environment has a native %IteratorPrototype%; use it instead
277
- // of the polyfill.
278
- IteratorPrototype = NativeIteratorPrototype;
279
- }
223
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
224
+ return generator;
225
+ }
280
226
 
281
- var Gp = GeneratorFunctionPrototype.prototype =
282
- Generator.prototype = Object.create(IteratorPrototype);
283
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
284
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
285
- GeneratorFunction.displayName = define(
286
- GeneratorFunctionPrototype,
287
- toStringTagSymbol,
288
- "GeneratorFunction"
289
- );
290
-
291
- // Helper for defining the .next, .throw, and .return methods of the
292
- // Iterator interface in terms of a single ._invoke method.
293
- function defineIteratorMethods(prototype) {
294
- ["next", "throw", "return"].forEach(function(method) {
295
- define(prototype, method, function(arg) {
296
- return this._invoke(method, arg);
297
- });
298
- });
299
- }
227
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
228
+ // record like context.tryEntries[i].completion. This interface could
229
+ // have been (and was previously) designed to take a closure to be
230
+ // invoked without arguments, but in all the cases we care about we
231
+ // already have an existing method we want to call, so there's no need
232
+ // to create a new function object. We can even get away with assuming
233
+ // the method takes exactly one argument, since that happens to be true
234
+ // in every case, so we don't have to touch the arguments object. The
235
+ // only additional allocation required is the completion record, which
236
+ // has a stable shape and so hopefully should be cheap to allocate.
237
+
238
+ function tryCatch(fn, obj, arg) {
239
+ try {
240
+ return {
241
+ type: "normal",
242
+ arg: fn.call(obj, arg)
243
+ };
244
+ } catch (err) {
245
+ return {
246
+ type: "throw",
247
+ arg: err
248
+ };
249
+ }
250
+ }
300
251
 
301
- exports.isGeneratorFunction = function(genFun) {
302
- var ctor = typeof genFun === "function" && genFun.constructor;
303
- return ctor
304
- ? ctor === GeneratorFunction ||
305
- // For the native GeneratorFunction constructor, the best we can
306
- // do is to check its .name property.
307
- (ctor.displayName || ctor.name) === "GeneratorFunction"
308
- : false;
309
- };
252
+ var GenStateSuspendedStart = "suspendedStart";
253
+ var GenStateSuspendedYield = "suspendedYield";
254
+ var GenStateExecuting = "executing";
255
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
256
+ // breaking out of the dispatch switch statement.
257
+
258
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
259
+ // .constructor.prototype properties for functions that return Generator
260
+ // objects. For full spec compliance, you may wish to configure your
261
+ // minifier not to mangle the names of these two functions.
262
+
263
+ function Generator() {}
264
+
265
+ function GeneratorFunction() {}
266
+
267
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
268
+ // don't natively support it.
310
269
 
311
- exports.mark = function(genFun) {
312
- if (Object.setPrototypeOf) {
313
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
314
- } else {
315
- genFun.__proto__ = GeneratorFunctionPrototype;
316
- define(genFun, toStringTagSymbol, "GeneratorFunction");
270
+
271
+ var IteratorPrototype = {};
272
+
273
+ IteratorPrototype[iteratorSymbol] = function () {
274
+ return this;
275
+ };
276
+
277
+ var getProto = Object.getPrototypeOf;
278
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
279
+
280
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
281
+ // This environment has a native %IteratorPrototype%; use it instead
282
+ // of the polyfill.
283
+ IteratorPrototype = NativeIteratorPrototype;
317
284
  }
318
- genFun.prototype = Object.create(Gp);
319
- return genFun;
320
- };
321
285
 
322
- // Within the body of any async function, `await x` is transformed to
323
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
324
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
325
- // meant to be awaited.
326
- exports.awrap = function(arg) {
327
- return { __await: arg };
328
- };
286
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
287
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
288
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
289
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
290
+ // Iterator interface in terms of a single ._invoke method.
329
291
 
330
- function AsyncIterator(generator, PromiseImpl) {
331
- function invoke(method, arg, resolve, reject) {
332
- var record = tryCatch(generator[method], generator, arg);
333
- if (record.type === "throw") {
334
- reject(record.arg);
292
+ function defineIteratorMethods(prototype) {
293
+ ["next", "throw", "return"].forEach(function (method) {
294
+ define(prototype, method, function (arg) {
295
+ return this._invoke(method, arg);
296
+ });
297
+ });
298
+ }
299
+
300
+ exports.isGeneratorFunction = function (genFun) {
301
+ var ctor = typeof genFun === "function" && genFun.constructor;
302
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
303
+ // do is to check its .name property.
304
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
305
+ };
306
+
307
+ exports.mark = function (genFun) {
308
+ if (Object.setPrototypeOf) {
309
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
335
310
  } else {
336
- var result = record.arg;
337
- var value = result.value;
338
- if (value &&
339
- typeof value === "object" &&
340
- hasOwn.call(value, "__await")) {
341
- return PromiseImpl.resolve(value.__await).then(function(value) {
342
- invoke("next", value, resolve, reject);
343
- }, function(err) {
344
- invoke("throw", err, resolve, reject);
311
+ genFun.__proto__ = GeneratorFunctionPrototype;
312
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
313
+ }
314
+
315
+ genFun.prototype = Object.create(Gp);
316
+ return genFun;
317
+ }; // Within the body of any async function, `await x` is transformed to
318
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
319
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
320
+ // meant to be awaited.
321
+
322
+
323
+ exports.awrap = function (arg) {
324
+ return {
325
+ __await: arg
326
+ };
327
+ };
328
+
329
+ function AsyncIterator(generator, PromiseImpl) {
330
+ function invoke(method, arg, resolve, reject) {
331
+ var record = tryCatch(generator[method], generator, arg);
332
+
333
+ if (record.type === "throw") {
334
+ reject(record.arg);
335
+ } else {
336
+ var result = record.arg;
337
+ var value = result.value;
338
+
339
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
340
+ return PromiseImpl.resolve(value.__await).then(function (value) {
341
+ invoke("next", value, resolve, reject);
342
+ }, function (err) {
343
+ invoke("throw", err, resolve, reject);
344
+ });
345
+ }
346
+
347
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
348
+ // When a yielded Promise is resolved, its final value becomes
349
+ // the .value of the Promise<{value,done}> result for the
350
+ // current iteration.
351
+ result.value = unwrapped;
352
+ resolve(result);
353
+ }, function (error) {
354
+ // If a rejected Promise was yielded, throw the rejection back
355
+ // into the async generator function so it can be handled there.
356
+ return invoke("throw", error, resolve, reject);
345
357
  });
346
358
  }
347
-
348
- return PromiseImpl.resolve(value).then(function(unwrapped) {
349
- // When a yielded Promise is resolved, its final value becomes
350
- // the .value of the Promise<{value,done}> result for the
351
- // current iteration.
352
- result.value = unwrapped;
353
- resolve(result);
354
- }, function(error) {
355
- // If a rejected Promise was yielded, throw the rejection back
356
- // into the async generator function so it can be handled there.
357
- return invoke("throw", error, resolve, reject);
358
- });
359
359
  }
360
- }
361
360
 
362
- var previousPromise;
361
+ var previousPromise;
363
362
 
364
- function enqueue(method, arg) {
365
- function callInvokeWithMethodAndArg() {
366
- return new PromiseImpl(function(resolve, reject) {
367
- invoke(method, arg, resolve, reject);
368
- });
369
- }
363
+ function enqueue(method, arg) {
364
+ function callInvokeWithMethodAndArg() {
365
+ return new PromiseImpl(function (resolve, reject) {
366
+ invoke(method, arg, resolve, reject);
367
+ });
368
+ }
370
369
 
371
- return previousPromise =
372
- // If enqueue has been called before, then we want to wait until
370
+ return previousPromise = // If enqueue has been called before, then we want to wait until
373
371
  // all previous Promises have been resolved before calling invoke,
374
372
  // so that results are always delivered in the correct order. If
375
373
  // enqueue has not been called before, then it is important to
@@ -381,549 +379,525 @@ var runtime = (function (exports) {
381
379
  // execute code before the first await. Since we implement simple
382
380
  // async functions in terms of async generators, it is especially
383
381
  // important to get this right, even though it requires care.
384
- previousPromise ? previousPromise.then(
385
- callInvokeWithMethodAndArg,
386
- // Avoid propagating failures to Promises returned by later
387
- // invocations of the iterator.
388
- callInvokeWithMethodAndArg
389
- ) : callInvokeWithMethodAndArg();
382
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
383
+ // invocations of the iterator.
384
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
385
+ } // Define the unified helper method that is used to implement .next,
386
+ // .throw, and .return (see defineIteratorMethods).
387
+
388
+
389
+ this._invoke = enqueue;
390
390
  }
391
391
 
392
- // Define the unified helper method that is used to implement .next,
393
- // .throw, and .return (see defineIteratorMethods).
394
- this._invoke = enqueue;
395
- }
392
+ defineIteratorMethods(AsyncIterator.prototype);
396
393
 
397
- defineIteratorMethods(AsyncIterator.prototype);
398
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
399
- return this;
400
- };
401
- exports.AsyncIterator = AsyncIterator;
402
-
403
- // Note that simple async functions are implemented on top of
404
- // AsyncIterator objects; they just return a Promise for the value of
405
- // the final result produced by the iterator.
406
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
407
- if (PromiseImpl === void 0) PromiseImpl = Promise;
408
-
409
- var iter = new AsyncIterator(
410
- wrap(innerFn, outerFn, self, tryLocsList),
411
- PromiseImpl
412
- );
413
-
414
- return exports.isGeneratorFunction(outerFn)
415
- ? iter // If outerFn is a generator, return the full iterator.
416
- : iter.next().then(function(result) {
417
- return result.done ? result.value : iter.next();
418
- });
419
- };
394
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
395
+ return this;
396
+ };
420
397
 
421
- function makeInvokeMethod(innerFn, self, context) {
422
- var state = GenStateSuspendedStart;
398
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
399
+ // AsyncIterator objects; they just return a Promise for the value of
400
+ // the final result produced by the iterator.
423
401
 
424
- return function invoke(method, arg) {
425
- if (state === GenStateExecuting) {
426
- throw new Error("Generator is already running");
427
- }
402
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
403
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
404
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
405
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
406
+ : iter.next().then(function (result) {
407
+ return result.done ? result.value : iter.next();
408
+ });
409
+ };
428
410
 
429
- if (state === GenStateCompleted) {
430
- if (method === "throw") {
431
- throw arg;
411
+ function makeInvokeMethod(innerFn, self, context) {
412
+ var state = GenStateSuspendedStart;
413
+ return function invoke(method, arg) {
414
+ if (state === GenStateExecuting) {
415
+ throw new Error("Generator is already running");
432
416
  }
433
417
 
434
- // Be forgiving, per 25.3.3.3.3 of the spec:
435
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
436
- return doneResult();
437
- }
418
+ if (state === GenStateCompleted) {
419
+ if (method === "throw") {
420
+ throw arg;
421
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
422
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
438
423
 
439
- context.method = method;
440
- context.arg = arg;
441
424
 
442
- while (true) {
443
- var delegate = context.delegate;
444
- if (delegate) {
445
- var delegateResult = maybeInvokeDelegate(delegate, context);
446
- if (delegateResult) {
447
- if (delegateResult === ContinueSentinel) continue;
448
- return delegateResult;
449
- }
425
+ return doneResult();
450
426
  }
451
427
 
452
- if (context.method === "next") {
453
- // Setting context._sent for legacy support of Babel's
454
- // function.sent implementation.
455
- context.sent = context._sent = context.arg;
428
+ context.method = method;
429
+ context.arg = arg;
430
+
431
+ while (true) {
432
+ var delegate = context.delegate;
456
433
 
457
- } else if (context.method === "throw") {
458
- if (state === GenStateSuspendedStart) {
459
- state = GenStateCompleted;
460
- throw context.arg;
434
+ if (delegate) {
435
+ var delegateResult = maybeInvokeDelegate(delegate, context);
436
+
437
+ if (delegateResult) {
438
+ if (delegateResult === ContinueSentinel) continue;
439
+ return delegateResult;
440
+ }
461
441
  }
462
442
 
463
- context.dispatchException(context.arg);
443
+ if (context.method === "next") {
444
+ // Setting context._sent for legacy support of Babel's
445
+ // function.sent implementation.
446
+ context.sent = context._sent = context.arg;
447
+ } else if (context.method === "throw") {
448
+ if (state === GenStateSuspendedStart) {
449
+ state = GenStateCompleted;
450
+ throw context.arg;
451
+ }
464
452
 
465
- } else if (context.method === "return") {
466
- context.abrupt("return", context.arg);
467
- }
453
+ context.dispatchException(context.arg);
454
+ } else if (context.method === "return") {
455
+ context.abrupt("return", context.arg);
456
+ }
468
457
 
469
- state = GenStateExecuting;
458
+ state = GenStateExecuting;
459
+ var record = tryCatch(innerFn, self, context);
470
460
 
471
- var record = tryCatch(innerFn, self, context);
472
- if (record.type === "normal") {
473
- // If an exception is thrown from innerFn, we leave state ===
474
- // GenStateExecuting and loop back for another invocation.
475
- state = context.done
476
- ? GenStateCompleted
477
- : GenStateSuspendedYield;
461
+ if (record.type === "normal") {
462
+ // If an exception is thrown from innerFn, we leave state ===
463
+ // GenStateExecuting and loop back for another invocation.
464
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
478
465
 
479
- if (record.arg === ContinueSentinel) {
480
- continue;
481
- }
466
+ if (record.arg === ContinueSentinel) {
467
+ continue;
468
+ }
482
469
 
483
- return {
484
- value: record.arg,
485
- done: context.done
486
- };
470
+ return {
471
+ value: record.arg,
472
+ done: context.done
473
+ };
474
+ } else if (record.type === "throw") {
475
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
476
+ // context.dispatchException(context.arg) call above.
477
+
478
+ context.method = "throw";
479
+ context.arg = record.arg;
480
+ }
481
+ }
482
+ };
483
+ } // Call delegate.iterator[context.method](context.arg) and handle the
484
+ // result, either by returning a { value, done } result from the
485
+ // delegate iterator, or by modifying context.method and context.arg,
486
+ // setting context.delegate to null, and returning the ContinueSentinel.
487
+
488
+
489
+ function maybeInvokeDelegate(delegate, context) {
490
+ var method = delegate.iterator[context.method];
491
+
492
+ if (method === undefined$1) {
493
+ // A .throw or .return when the delegate iterator has no .throw
494
+ // method always terminates the yield* loop.
495
+ context.delegate = null;
496
+
497
+ if (context.method === "throw") {
498
+ // Note: ["return"] must be used for ES3 parsing compatibility.
499
+ if (delegate.iterator["return"]) {
500
+ // If the delegate iterator has a return method, give it a
501
+ // chance to clean up.
502
+ context.method = "return";
503
+ context.arg = undefined$1;
504
+ maybeInvokeDelegate(delegate, context);
505
+
506
+ if (context.method === "throw") {
507
+ // If maybeInvokeDelegate(context) changed context.method from
508
+ // "return" to "throw", let that override the TypeError below.
509
+ return ContinueSentinel;
510
+ }
511
+ }
487
512
 
488
- } else if (record.type === "throw") {
489
- state = GenStateCompleted;
490
- // Dispatch the exception by looping back around to the
491
- // context.dispatchException(context.arg) call above.
492
513
  context.method = "throw";
493
- context.arg = record.arg;
514
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
494
515
  }
516
+
517
+ return ContinueSentinel;
495
518
  }
496
- };
497
- }
498
519
 
499
- // Call delegate.iterator[context.method](context.arg) and handle the
500
- // result, either by returning a { value, done } result from the
501
- // delegate iterator, or by modifying context.method and context.arg,
502
- // setting context.delegate to null, and returning the ContinueSentinel.
503
- function maybeInvokeDelegate(delegate, context) {
504
- var method = delegate.iterator[context.method];
505
- if (method === undefined$1) {
506
- // A .throw or .return when the delegate iterator has no .throw
507
- // method always terminates the yield* loop.
508
- context.delegate = null;
520
+ var record = tryCatch(method, delegate.iterator, context.arg);
509
521
 
510
- if (context.method === "throw") {
511
- // Note: ["return"] must be used for ES3 parsing compatibility.
512
- if (delegate.iterator["return"]) {
513
- // If the delegate iterator has a return method, give it a
514
- // chance to clean up.
515
- context.method = "return";
516
- context.arg = undefined$1;
517
- maybeInvokeDelegate(delegate, context);
522
+ if (record.type === "throw") {
523
+ context.method = "throw";
524
+ context.arg = record.arg;
525
+ context.delegate = null;
526
+ return ContinueSentinel;
527
+ }
518
528
 
519
- if (context.method === "throw") {
520
- // If maybeInvokeDelegate(context) changed context.method from
521
- // "return" to "throw", let that override the TypeError below.
522
- return ContinueSentinel;
523
- }
524
- }
529
+ var info = record.arg;
525
530
 
531
+ if (!info) {
526
532
  context.method = "throw";
527
- context.arg = new TypeError(
528
- "The iterator does not provide a 'throw' method");
533
+ context.arg = new TypeError("iterator result is not an object");
534
+ context.delegate = null;
535
+ return ContinueSentinel;
529
536
  }
530
537
 
531
- return ContinueSentinel;
532
- }
538
+ if (info.done) {
539
+ // Assign the result of the finished delegate to the temporary
540
+ // variable specified by delegate.resultName (see delegateYield).
541
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
533
542
 
534
- var record = tryCatch(method, delegate.iterator, context.arg);
543
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
544
+ // exception, let the outer generator proceed normally. If
545
+ // context.method was "next", forget context.arg since it has been
546
+ // "consumed" by the delegate iterator. If context.method was
547
+ // "return", allow the original .return call to continue in the
548
+ // outer generator.
535
549
 
536
- if (record.type === "throw") {
537
- context.method = "throw";
538
- context.arg = record.arg;
539
- context.delegate = null;
540
- return ContinueSentinel;
541
- }
550
+ if (context.method !== "return") {
551
+ context.method = "next";
552
+ context.arg = undefined$1;
553
+ }
554
+ } else {
555
+ // Re-yield the result returned by the delegate method.
556
+ return info;
557
+ } // The delegate iterator is finished, so forget it and continue with
558
+ // the outer generator.
542
559
 
543
- var info = record.arg;
544
560
 
545
- if (! info) {
546
- context.method = "throw";
547
- context.arg = new TypeError("iterator result is not an object");
548
561
  context.delegate = null;
549
562
  return ContinueSentinel;
550
- }
563
+ } // Define Generator.prototype.{next,throw,return} in terms of the
564
+ // unified ._invoke helper method.
551
565
 
552
- if (info.done) {
553
- // Assign the result of the finished delegate to the temporary
554
- // variable specified by delegate.resultName (see delegateYield).
555
- context[delegate.resultName] = info.value;
556
-
557
- // Resume execution at the desired location (see delegateYield).
558
- context.next = delegate.nextLoc;
559
-
560
- // If context.method was "throw" but the delegate handled the
561
- // exception, let the outer generator proceed normally. If
562
- // context.method was "next", forget context.arg since it has been
563
- // "consumed" by the delegate iterator. If context.method was
564
- // "return", allow the original .return call to continue in the
565
- // outer generator.
566
- if (context.method !== "return") {
567
- context.method = "next";
568
- context.arg = undefined$1;
569
- }
570
566
 
571
- } else {
572
- // Re-yield the result returned by the delegate method.
573
- return info;
574
- }
575
-
576
- // The delegate iterator is finished, so forget it and continue with
577
- // the outer generator.
578
- context.delegate = null;
579
- return ContinueSentinel;
580
- }
567
+ defineIteratorMethods(Gp);
568
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
569
+ // @@iterator function is called on it. Some browsers' implementations of the
570
+ // iterator prototype chain incorrectly implement this, causing the Generator
571
+ // object to not be returned from this call. This ensures that doesn't happen.
572
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
581
573
 
582
- // Define Generator.prototype.{next,throw,return} in terms of the
583
- // unified ._invoke helper method.
584
- defineIteratorMethods(Gp);
574
+ Gp[iteratorSymbol] = function () {
575
+ return this;
576
+ };
585
577
 
586
- define(Gp, toStringTagSymbol, "Generator");
578
+ Gp.toString = function () {
579
+ return "[object Generator]";
580
+ };
587
581
 
588
- // A Generator should always return itself as the iterator object when the
589
- // @@iterator function is called on it. Some browsers' implementations of the
590
- // iterator prototype chain incorrectly implement this, causing the Generator
591
- // object to not be returned from this call. This ensures that doesn't happen.
592
- // See https://github.com/facebook/regenerator/issues/274 for more details.
593
- Gp[iteratorSymbol] = function() {
594
- return this;
595
- };
582
+ function pushTryEntry(locs) {
583
+ var entry = {
584
+ tryLoc: locs[0]
585
+ };
596
586
 
597
- Gp.toString = function() {
598
- return "[object Generator]";
599
- };
587
+ if (1 in locs) {
588
+ entry.catchLoc = locs[1];
589
+ }
600
590
 
601
- function pushTryEntry(locs) {
602
- var entry = { tryLoc: locs[0] };
591
+ if (2 in locs) {
592
+ entry.finallyLoc = locs[2];
593
+ entry.afterLoc = locs[3];
594
+ }
603
595
 
604
- if (1 in locs) {
605
- entry.catchLoc = locs[1];
596
+ this.tryEntries.push(entry);
606
597
  }
607
598
 
608
- if (2 in locs) {
609
- entry.finallyLoc = locs[2];
610
- entry.afterLoc = locs[3];
599
+ function resetTryEntry(entry) {
600
+ var record = entry.completion || {};
601
+ record.type = "normal";
602
+ delete record.arg;
603
+ entry.completion = record;
611
604
  }
612
605
 
613
- this.tryEntries.push(entry);
614
- }
615
-
616
- function resetTryEntry(entry) {
617
- var record = entry.completion || {};
618
- record.type = "normal";
619
- delete record.arg;
620
- entry.completion = record;
621
- }
622
-
623
- function Context(tryLocsList) {
624
- // The root entry object (effectively a try statement without a catch
625
- // or a finally block) gives us a place to store values thrown from
626
- // locations where there is no enclosing try statement.
627
- this.tryEntries = [{ tryLoc: "root" }];
628
- tryLocsList.forEach(pushTryEntry, this);
629
- this.reset(true);
630
- }
631
-
632
- exports.keys = function(object) {
633
- var keys = [];
634
- for (var key in object) {
635
- keys.push(key);
606
+ function Context(tryLocsList) {
607
+ // The root entry object (effectively a try statement without a catch
608
+ // or a finally block) gives us a place to store values thrown from
609
+ // locations where there is no enclosing try statement.
610
+ this.tryEntries = [{
611
+ tryLoc: "root"
612
+ }];
613
+ tryLocsList.forEach(pushTryEntry, this);
614
+ this.reset(true);
636
615
  }
637
- keys.reverse();
638
-
639
- // Rather than returning an object with a next method, we keep
640
- // things simple and return the next function itself.
641
- return function next() {
642
- while (keys.length) {
643
- var key = keys.pop();
644
- if (key in object) {
645
- next.value = key;
646
- next.done = false;
647
- return next;
648
- }
649
- }
650
616
 
651
- // To avoid creating an additional object, we just hang the .value
652
- // and .done properties off the next function object itself. This
653
- // also ensures that the minifier will not anonymize the function.
654
- next.done = true;
655
- return next;
656
- };
657
- };
617
+ exports.keys = function (object) {
618
+ var keys = [];
658
619
 
659
- function values(iterable) {
660
- if (iterable) {
661
- var iteratorMethod = iterable[iteratorSymbol];
662
- if (iteratorMethod) {
663
- return iteratorMethod.call(iterable);
620
+ for (var key in object) {
621
+ keys.push(key);
664
622
  }
665
623
 
666
- if (typeof iterable.next === "function") {
667
- return iterable;
668
- }
624
+ keys.reverse(); // Rather than returning an object with a next method, we keep
625
+ // things simple and return the next function itself.
669
626
 
670
- if (!isNaN(iterable.length)) {
671
- var i = -1, next = function next() {
672
- while (++i < iterable.length) {
673
- if (hasOwn.call(iterable, i)) {
674
- next.value = iterable[i];
675
- next.done = false;
676
- return next;
677
- }
678
- }
627
+ return function next() {
628
+ while (keys.length) {
629
+ var key = keys.pop();
679
630
 
680
- next.value = undefined$1;
681
- next.done = true;
631
+ if (key in object) {
632
+ next.value = key;
633
+ next.done = false;
634
+ return next;
635
+ }
636
+ } // To avoid creating an additional object, we just hang the .value
637
+ // and .done properties off the next function object itself. This
638
+ // also ensures that the minifier will not anonymize the function.
682
639
 
683
- return next;
684
- };
685
640
 
686
- return next.next = next;
687
- }
688
- }
641
+ next.done = true;
642
+ return next;
643
+ };
644
+ };
689
645
 
690
- // Return an iterator with no values.
691
- return { next: doneResult };
692
- }
693
- exports.values = values;
646
+ function values(iterable) {
647
+ if (iterable) {
648
+ var iteratorMethod = iterable[iteratorSymbol];
694
649
 
695
- function doneResult() {
696
- return { value: undefined$1, done: true };
697
- }
650
+ if (iteratorMethod) {
651
+ return iteratorMethod.call(iterable);
652
+ }
698
653
 
699
- Context.prototype = {
700
- constructor: Context,
701
-
702
- reset: function(skipTempReset) {
703
- this.prev = 0;
704
- this.next = 0;
705
- // Resetting context._sent for legacy support of Babel's
706
- // function.sent implementation.
707
- this.sent = this._sent = undefined$1;
708
- this.done = false;
709
- this.delegate = null;
710
-
711
- this.method = "next";
712
- this.arg = undefined$1;
713
-
714
- this.tryEntries.forEach(resetTryEntry);
715
-
716
- if (!skipTempReset) {
717
- for (var name in this) {
718
- // Not sure about the optimal order of these conditions:
719
- if (name.charAt(0) === "t" &&
720
- hasOwn.call(this, name) &&
721
- !isNaN(+name.slice(1))) {
722
- this[name] = undefined$1;
723
- }
654
+ if (typeof iterable.next === "function") {
655
+ return iterable;
724
656
  }
725
- }
726
- },
727
657
 
728
- stop: function() {
729
- this.done = true;
658
+ if (!isNaN(iterable.length)) {
659
+ var i = -1,
660
+ next = function next() {
661
+ while (++i < iterable.length) {
662
+ if (hasOwn.call(iterable, i)) {
663
+ next.value = iterable[i];
664
+ next.done = false;
665
+ return next;
666
+ }
667
+ }
730
668
 
731
- var rootEntry = this.tryEntries[0];
732
- var rootRecord = rootEntry.completion;
733
- if (rootRecord.type === "throw") {
734
- throw rootRecord.arg;
735
- }
669
+ next.value = undefined$1;
670
+ next.done = true;
671
+ return next;
672
+ };
736
673
 
737
- return this.rval;
738
- },
674
+ return next.next = next;
675
+ }
676
+ } // Return an iterator with no values.
739
677
 
740
- dispatchException: function(exception) {
741
- if (this.done) {
742
- throw exception;
743
- }
744
678
 
745
- var context = this;
746
- function handle(loc, caught) {
747
- record.type = "throw";
748
- record.arg = exception;
749
- context.next = loc;
679
+ return {
680
+ next: doneResult
681
+ };
682
+ }
750
683
 
751
- if (caught) {
752
- // If the dispatched exception was caught by a catch block,
753
- // then let that catch block handle the exception normally.
754
- context.method = "next";
755
- context.arg = undefined$1;
756
- }
684
+ exports.values = values;
757
685
 
758
- return !! caught;
759
- }
686
+ function doneResult() {
687
+ return {
688
+ value: undefined$1,
689
+ done: true
690
+ };
691
+ }
692
+
693
+ Context.prototype = {
694
+ constructor: Context,
695
+ reset: function reset(skipTempReset) {
696
+ this.prev = 0;
697
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
698
+ // function.sent implementation.
760
699
 
761
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
762
- var entry = this.tryEntries[i];
763
- var record = entry.completion;
700
+ this.sent = this._sent = undefined$1;
701
+ this.done = false;
702
+ this.delegate = null;
703
+ this.method = "next";
704
+ this.arg = undefined$1;
705
+ this.tryEntries.forEach(resetTryEntry);
764
706
 
765
- if (entry.tryLoc === "root") {
766
- // Exception thrown outside of any try block that could handle
767
- // it, so set the completion value of the entire function to
768
- // throw the exception.
769
- return handle("end");
707
+ if (!skipTempReset) {
708
+ for (var name in this) {
709
+ // Not sure about the optimal order of these conditions:
710
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
711
+ this[name] = undefined$1;
712
+ }
713
+ }
770
714
  }
715
+ },
716
+ stop: function stop() {
717
+ this.done = true;
718
+ var rootEntry = this.tryEntries[0];
719
+ var rootRecord = rootEntry.completion;
771
720
 
772
- if (entry.tryLoc <= this.prev) {
773
- var hasCatch = hasOwn.call(entry, "catchLoc");
774
- var hasFinally = hasOwn.call(entry, "finallyLoc");
721
+ if (rootRecord.type === "throw") {
722
+ throw rootRecord.arg;
723
+ }
775
724
 
776
- if (hasCatch && hasFinally) {
777
- if (this.prev < entry.catchLoc) {
778
- return handle(entry.catchLoc, true);
779
- } else if (this.prev < entry.finallyLoc) {
780
- return handle(entry.finallyLoc);
781
- }
725
+ return this.rval;
726
+ },
727
+ dispatchException: function dispatchException(exception) {
728
+ if (this.done) {
729
+ throw exception;
730
+ }
782
731
 
783
- } else if (hasCatch) {
784
- if (this.prev < entry.catchLoc) {
785
- return handle(entry.catchLoc, true);
786
- }
732
+ var context = this;
787
733
 
788
- } else if (hasFinally) {
789
- if (this.prev < entry.finallyLoc) {
790
- return handle(entry.finallyLoc);
791
- }
734
+ function handle(loc, caught) {
735
+ record.type = "throw";
736
+ record.arg = exception;
737
+ context.next = loc;
792
738
 
793
- } else {
794
- throw new Error("try statement without catch or finally");
739
+ if (caught) {
740
+ // If the dispatched exception was caught by a catch block,
741
+ // then let that catch block handle the exception normally.
742
+ context.method = "next";
743
+ context.arg = undefined$1;
795
744
  }
796
- }
797
- }
798
- },
799
745
 
800
- abrupt: function(type, arg) {
801
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
802
- var entry = this.tryEntries[i];
803
- if (entry.tryLoc <= this.prev &&
804
- hasOwn.call(entry, "finallyLoc") &&
805
- this.prev < entry.finallyLoc) {
806
- var finallyEntry = entry;
807
- break;
746
+ return !!caught;
808
747
  }
809
- }
810
748
 
811
- if (finallyEntry &&
812
- (type === "break" ||
813
- type === "continue") &&
814
- finallyEntry.tryLoc <= arg &&
815
- arg <= finallyEntry.finallyLoc) {
816
- // Ignore the finally entry if control is not jumping to a
817
- // location outside the try/catch block.
818
- finallyEntry = null;
819
- }
749
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
750
+ var entry = this.tryEntries[i];
751
+ var record = entry.completion;
820
752
 
821
- var record = finallyEntry ? finallyEntry.completion : {};
822
- record.type = type;
823
- record.arg = arg;
753
+ if (entry.tryLoc === "root") {
754
+ // Exception thrown outside of any try block that could handle
755
+ // it, so set the completion value of the entire function to
756
+ // throw the exception.
757
+ return handle("end");
758
+ }
824
759
 
825
- if (finallyEntry) {
826
- this.method = "next";
827
- this.next = finallyEntry.finallyLoc;
828
- return ContinueSentinel;
829
- }
760
+ if (entry.tryLoc <= this.prev) {
761
+ var hasCatch = hasOwn.call(entry, "catchLoc");
762
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
830
763
 
831
- return this.complete(record);
832
- },
764
+ if (hasCatch && hasFinally) {
765
+ if (this.prev < entry.catchLoc) {
766
+ return handle(entry.catchLoc, true);
767
+ } else if (this.prev < entry.finallyLoc) {
768
+ return handle(entry.finallyLoc);
769
+ }
770
+ } else if (hasCatch) {
771
+ if (this.prev < entry.catchLoc) {
772
+ return handle(entry.catchLoc, true);
773
+ }
774
+ } else if (hasFinally) {
775
+ if (this.prev < entry.finallyLoc) {
776
+ return handle(entry.finallyLoc);
777
+ }
778
+ } else {
779
+ throw new Error("try statement without catch or finally");
780
+ }
781
+ }
782
+ }
783
+ },
784
+ abrupt: function abrupt(type, arg) {
785
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
786
+ var entry = this.tryEntries[i];
833
787
 
834
- complete: function(record, afterLoc) {
835
- if (record.type === "throw") {
836
- throw record.arg;
837
- }
788
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
789
+ var finallyEntry = entry;
790
+ break;
791
+ }
792
+ }
838
793
 
839
- if (record.type === "break" ||
840
- record.type === "continue") {
841
- this.next = record.arg;
842
- } else if (record.type === "return") {
843
- this.rval = this.arg = record.arg;
844
- this.method = "return";
845
- this.next = "end";
846
- } else if (record.type === "normal" && afterLoc) {
847
- this.next = afterLoc;
848
- }
794
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
795
+ // Ignore the finally entry if control is not jumping to a
796
+ // location outside the try/catch block.
797
+ finallyEntry = null;
798
+ }
849
799
 
850
- return ContinueSentinel;
851
- },
800
+ var record = finallyEntry ? finallyEntry.completion : {};
801
+ record.type = type;
802
+ record.arg = arg;
852
803
 
853
- finish: function(finallyLoc) {
854
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
855
- var entry = this.tryEntries[i];
856
- if (entry.finallyLoc === finallyLoc) {
857
- this.complete(entry.completion, entry.afterLoc);
858
- resetTryEntry(entry);
804
+ if (finallyEntry) {
805
+ this.method = "next";
806
+ this.next = finallyEntry.finallyLoc;
859
807
  return ContinueSentinel;
860
808
  }
861
- }
862
- },
863
809
 
864
- "catch": function(tryLoc) {
865
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
866
- var entry = this.tryEntries[i];
867
- if (entry.tryLoc === tryLoc) {
868
- var record = entry.completion;
869
- if (record.type === "throw") {
870
- var thrown = record.arg;
810
+ return this.complete(record);
811
+ },
812
+ complete: function complete(record, afterLoc) {
813
+ if (record.type === "throw") {
814
+ throw record.arg;
815
+ }
816
+
817
+ if (record.type === "break" || record.type === "continue") {
818
+ this.next = record.arg;
819
+ } else if (record.type === "return") {
820
+ this.rval = this.arg = record.arg;
821
+ this.method = "return";
822
+ this.next = "end";
823
+ } else if (record.type === "normal" && afterLoc) {
824
+ this.next = afterLoc;
825
+ }
826
+
827
+ return ContinueSentinel;
828
+ },
829
+ finish: function finish(finallyLoc) {
830
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
831
+ var entry = this.tryEntries[i];
832
+
833
+ if (entry.finallyLoc === finallyLoc) {
834
+ this.complete(entry.completion, entry.afterLoc);
871
835
  resetTryEntry(entry);
836
+ return ContinueSentinel;
872
837
  }
873
- return thrown;
874
838
  }
875
- }
839
+ },
840
+ "catch": function _catch(tryLoc) {
841
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
842
+ var entry = this.tryEntries[i];
876
843
 
877
- // The context.catch method must only be called with a location
878
- // argument that corresponds to a known catch block.
879
- throw new Error("illegal catch attempt");
880
- },
844
+ if (entry.tryLoc === tryLoc) {
845
+ var record = entry.completion;
881
846
 
882
- delegateYield: function(iterable, resultName, nextLoc) {
883
- this.delegate = {
884
- iterator: values(iterable),
885
- resultName: resultName,
886
- nextLoc: nextLoc
887
- };
847
+ if (record.type === "throw") {
848
+ var thrown = record.arg;
849
+ resetTryEntry(entry);
850
+ }
888
851
 
889
- if (this.method === "next") {
890
- // Deliberately forget the last sent value so that we don't
891
- // accidentally pass it on to the delegate.
892
- this.arg = undefined$1;
893
- }
852
+ return thrown;
853
+ }
854
+ } // The context.catch method must only be called with a location
855
+ // argument that corresponds to a known catch block.
894
856
 
895
- return ContinueSentinel;
896
- }
897
- };
898
857
 
899
- // Regardless of whether this script is executing as a CommonJS module
900
- // or not, return the runtime object so that we can declare the variable
901
- // regeneratorRuntime in the outer scope, which allows this module to be
902
- // injected easily by `bin/regenerator --include-runtime script.js`.
903
- return exports;
858
+ throw new Error("illegal catch attempt");
859
+ },
860
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
861
+ this.delegate = {
862
+ iterator: values(iterable),
863
+ resultName: resultName,
864
+ nextLoc: nextLoc
865
+ };
866
+
867
+ if (this.method === "next") {
868
+ // Deliberately forget the last sent value so that we don't
869
+ // accidentally pass it on to the delegate.
870
+ this.arg = undefined$1;
871
+ }
872
+
873
+ return ContinueSentinel;
874
+ }
875
+ }; // Regardless of whether this script is executing as a CommonJS module
876
+ // or not, return the runtime object so that we can declare the variable
877
+ // regeneratorRuntime in the outer scope, which allows this module to be
878
+ // injected easily by `bin/regenerator --include-runtime script.js`.
904
879
 
905
- }(
906
- // If this script is executing as a CommonJS module, use module.exports
880
+ return exports;
881
+ }( // If this script is executing as a CommonJS module, use module.exports
907
882
  // as the regeneratorRuntime namespace. Otherwise create a new empty
908
883
  // object. Either way, the resulting object will be used to initialize
909
884
  // the regeneratorRuntime variable at the top of this file.
910
- module.exports
911
- ));
912
-
913
- try {
914
- regeneratorRuntime = runtime;
915
- } catch (accidentalStrictMode) {
916
- // This module should not be running in strict mode, so the above
917
- // assignment should always work unless something is misconfigured. Just
918
- // in case runtime.js accidentally runs in strict mode, we can escape
919
- // strict mode using a global Function call. This could conceivably fail
920
- // if a Content Security Policy forbids using Function, but in that case
921
- // the proper solution is to fix the accidental strict mode problem. If
922
- // you've misconfigured your bundler to force strict mode and applied a
923
- // CSP to forbid Function, and you're not willing to fix either of those
924
- // problems, please detail your unique predicament in a GitHub issue.
925
- Function("r", "regeneratorRuntime = r")(runtime);
926
- }
885
+ module.exports );
886
+
887
+ try {
888
+ regeneratorRuntime = runtime;
889
+ } catch (accidentalStrictMode) {
890
+ // This module should not be running in strict mode, so the above
891
+ // assignment should always work unless something is misconfigured. Just
892
+ // in case runtime.js accidentally runs in strict mode, we can escape
893
+ // strict mode using a global Function call. This could conceivably fail
894
+ // if a Content Security Policy forbids using Function, but in that case
895
+ // the proper solution is to fix the accidental strict mode problem. If
896
+ // you've misconfigured your bundler to force strict mode and applied a
897
+ // CSP to forbid Function, and you're not willing to fix either of those
898
+ // problems, please detail your unique predicament in a GitHub issue.
899
+ Function("r", "regeneratorRuntime = r")(runtime);
900
+ }
927
901
  });
928
902
 
929
903
  var ProductContext = /*#__PURE__*/React__default.createContext(undefined);
@@ -940,6 +914,7 @@ function useProduct() {
940
914
  return React.useContext(ProductContext);
941
915
  }
942
916
 
917
+ var _excluded = ["children"];
943
918
  var Commerce = /*#__PURE__*/React.createContext({});
944
919
  function CoreCommerceProvider(_ref) {
945
920
  var provider = _ref.provider,
@@ -967,7 +942,7 @@ function CoreCommerceProvider(_ref) {
967
942
  function getCommerceProvider(provider) {
968
943
  return function CommerceProvider(_ref2) {
969
944
  var children = _ref2.children,
970
- props = _objectWithoutPropertiesLoose(_ref2, ["children"]);
945
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded);
971
946
 
972
947
  return React__default.createElement(CoreCommerceProvider, {
973
948
  provider: _extends({}, provider, props)
@@ -1294,7 +1269,6 @@ var fn$1 = function fn(provider) {
1294
1269
 
1295
1270
  var useSearch = function useSearch(input) {
1296
1271
  var hook = useHook(fn$1);
1297
- console.log("dale", "commerce", input);
1298
1272
  return useSWRHook(_extends({
1299
1273
  fetcher: fetcher$1
1300
1274
  }, hook))(input);
@@ -1319,17 +1293,47 @@ var productCollectionMeta = {
1319
1293
  name: "plasmic-commerce-product-media"
1320
1294
  }],
1321
1295
  styles: {
1322
- width: "100%"
1296
+ width: "100%",
1297
+ minWidth: 0
1323
1298
  }
1324
1299
  }]
1325
1300
  },
1326
1301
  count: "number",
1327
- categoryId: "string",
1328
- brandId: "string"
1302
+ category: {
1303
+ type: "choice",
1304
+ options: function options(props, ctx) {
1305
+ var _ctx$categories$map;
1306
+
1307
+ return (_ctx$categories$map = ctx == null ? void 0 : ctx.categories.map(function (category) {
1308
+ return {
1309
+ label: category.name,
1310
+ value: category.id
1311
+ };
1312
+ })) != null ? _ctx$categories$map : [];
1313
+ }
1314
+ },
1315
+ brand: {
1316
+ type: "choice",
1317
+ options: function options(props, ctx) {
1318
+ var _ctx$brands$map;
1319
+
1320
+ return (_ctx$brands$map = ctx == null ? void 0 : ctx.brands.map(function (brand) {
1321
+ return {
1322
+ label: brand.name,
1323
+ value: brand.entityId
1324
+ };
1325
+ })) != null ? _ctx$brands$map : [];
1326
+ }
1327
+ },
1328
+ noLayout: "boolean"
1329
1329
  },
1330
1330
  defaultStyles: {
1331
1331
  display: "grid",
1332
- gridTemplateColumns: "1fr 1fr 1fr 1fr"
1332
+ gridTemplateColumns: "1fr 1fr 1fr 1fr",
1333
+ gridRowGap: "8px",
1334
+ gridColumnGap: "8px",
1335
+ padding: "8px",
1336
+ maxWidth: "100%"
1333
1337
  },
1334
1338
  importPath: "commerce-providers/commerce",
1335
1339
  importName: "ProductCollection"
@@ -1339,24 +1343,40 @@ function ProductCollection(props) {
1339
1343
  var className = props.className,
1340
1344
  children = props.children,
1341
1345
  count = props.count,
1342
- categoryId = props.categoryId,
1343
- brandId = props.brandId;
1346
+ category = props.category,
1347
+ brand = props.brand,
1348
+ noLayout = props.noLayout,
1349
+ setControlContextData = props.setControlContextData;
1344
1350
 
1345
1351
  var _useSearch = useSearch({
1346
- categoryId: categoryId,
1347
- brandId: brandId,
1352
+ categoryId: category,
1353
+ brandId: brand,
1348
1354
  count: count
1349
1355
  }),
1350
1356
  data = _useSearch.data;
1351
1357
 
1352
- return React__default.createElement("div", {
1353
- className: className
1354
- }, data == null ? void 0 : data.products.map(function (product, i) {
1358
+ var _useCategories = useCategories({}),
1359
+ categories = _useCategories.data;
1360
+
1361
+ var _useBrands = useBrands({}),
1362
+ brands = _useBrands.data;
1363
+
1364
+ if (categories && brands) {
1365
+ setControlContextData == null ? void 0 : setControlContextData({
1366
+ categories: categories,
1367
+ brands: brands
1368
+ });
1369
+ }
1370
+
1371
+ var renderedData = data == null ? void 0 : data.products.map(function (product, i) {
1355
1372
  return React__default.createElement(ProductProvider, {
1356
1373
  product: product,
1357
1374
  key: product.id
1358
1375
  }, host.repeatedElement(i === 0, children));
1359
- }));
1376
+ });
1377
+ return noLayout ? React__default.createElement(React__default.Fragment, null, renderedData) : React__default.createElement("div", {
1378
+ className: className
1379
+ }, renderedData);
1360
1380
  }
1361
1381
 
1362
1382
  function registerProductCollection(loader, customProductCollectionMeta) {
@@ -1372,8 +1392,6 @@ var productMediaMeta = {
1372
1392
  name: "plasmic-commerce-product-media",
1373
1393
  displayName: "Product Media",
1374
1394
  props: {
1375
- children: "slot",
1376
- style: "object",
1377
1395
  mediaIndex: "number"
1378
1396
  },
1379
1397
  importPath: "commerce-providers/commerce",
@@ -1383,7 +1401,6 @@ function ProductMedia(props) {
1383
1401
  var _image$url;
1384
1402
 
1385
1403
  var className = props.className,
1386
- style = props.style,
1387
1404
  _props$mediaIndex = props.mediaIndex,
1388
1405
  mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex;
1389
1406
  var product = useProduct();
@@ -1392,8 +1409,7 @@ function ProductMedia(props) {
1392
1409
  alt: (product == null ? void 0 : product.name) || 'Product Image',
1393
1410
  src: product ? (_image$url = image == null ? void 0 : image.url) != null ? _image$url : "" : placeholderImage,
1394
1411
  loading: 'lazy',
1395
- className: className,
1396
- style: style
1412
+ className: className
1397
1413
  });
1398
1414
  }
1399
1415
  function registerProductMedia(loader, customProductMediaMeta) {
@@ -1490,6 +1506,11 @@ function ProductPrice(props) {
1490
1506
  var className = props.className;
1491
1507
  var product = useProduct();
1492
1508
  var form = reactHookForm.useFormContext();
1509
+
1510
+ if (!product) {
1511
+ throw new Error("This component must be within a product context.");
1512
+ }
1513
+
1493
1514
  var watchProductVariant = form.watch("ProductVariant", product == null ? void 0 : product.variants[0].id);
1494
1515
 
1495
1516
  var _usePrice = usePrice({
@@ -1778,33 +1799,63 @@ var product = {
1778
1799
  __proto__: null
1779
1800
  };
1780
1801
 
1781
- var fetcher$3 = mutationFetcher;
1802
+ var fetcher$3 = SWRFetcher;
1782
1803
 
1783
1804
  var fn$3 = function fn(provider) {
1805
+ var _provider$site;
1806
+
1807
+ return (_provider$site = provider.site) == null ? void 0 : _provider$site.useCategories;
1808
+ };
1809
+
1810
+ var useCategories = function useCategories(input) {
1811
+ var hook = useHook(fn$3);
1812
+ return useSWRHook(_extends({
1813
+ fetcher: fetcher$3
1814
+ }, hook))(input);
1815
+ };
1816
+
1817
+ var fetcher$4 = SWRFetcher;
1818
+
1819
+ var fn$4 = function fn(provider) {
1820
+ var _provider$site;
1821
+
1822
+ return (_provider$site = provider.site) == null ? void 0 : _provider$site.useBrands;
1823
+ };
1824
+
1825
+ var useBrands = function useBrands(input) {
1826
+ var hook = useHook(fn$4);
1827
+ return useSWRHook(_extends({
1828
+ fetcher: fetcher$4
1829
+ }, hook))(input);
1830
+ };
1831
+
1832
+ var fetcher$5 = mutationFetcher;
1833
+
1834
+ var fn$5 = function fn(provider) {
1784
1835
  var _provider$cart;
1785
1836
 
1786
1837
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useRemoveItem;
1787
1838
  };
1788
1839
 
1789
1840
  var useRemoveItem = function useRemoveItem(input) {
1790
- var hook = useHook(fn$3);
1841
+ var hook = useHook(fn$5);
1791
1842
  return useMutationHook(_extends({
1792
- fetcher: fetcher$3
1843
+ fetcher: fetcher$5
1793
1844
  }, hook))(input);
1794
1845
  };
1795
1846
 
1796
- var fetcher$4 = mutationFetcher;
1847
+ var fetcher$6 = mutationFetcher;
1797
1848
 
1798
- var fn$4 = function fn(provider) {
1849
+ var fn$6 = function fn(provider) {
1799
1850
  var _provider$cart;
1800
1851
 
1801
1852
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useUpdateItem;
1802
1853
  };
1803
1854
 
1804
1855
  var useUpdateItem = function useUpdateItem(input) {
1805
- var hook = useHook(fn$4);
1856
+ var hook = useHook(fn$6);
1806
1857
  return useMutationHook(_extends({
1807
- fetcher: fetcher$4
1858
+ fetcher: fetcher$6
1808
1859
  }, hook))(input);
1809
1860
  };
1810
1861
 
@@ -1842,7 +1893,9 @@ exports.fetcher = fetcher$1;
1842
1893
  exports.getCommerceProvider = getCommerceProvider;
1843
1894
  exports.registerAll = registerAll;
1844
1895
  exports.useAddItem = useAddItem;
1896
+ exports.useBrands = useBrands;
1845
1897
  exports.useCart = useCart;
1898
+ exports.useCategories = useCategories;
1846
1899
  exports.useCommerce = useCommerce;
1847
1900
  exports.useRemoveItem = useRemoveItem;
1848
1901
  exports.useSearch = useSearch;