@plasmicpkgs/commerce 0.0.5 → 0.0.8

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.
@@ -172,205 +172,240 @@ function _objectWithoutPropertiesLoose(source, excluded) {
172
172
  return target;
173
173
  }
174
174
 
175
- function createCommonjsModule(fn, module) {
176
- return module = { exports: {} }, fn(module, module.exports), module.exports;
175
+ function _unsupportedIterableToArray(o, minLen) {
176
+ if (!o) return;
177
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
178
+ var n = Object.prototype.toString.call(o).slice(8, -1);
179
+ if (n === "Object" && o.constructor) n = o.constructor.name;
180
+ if (n === "Map" || n === "Set") return Array.from(o);
181
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
177
182
  }
178
183
 
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;
184
+ function _arrayLikeToArray(arr, len) {
185
+ if (len == null || len > arr.length) len = arr.length;
186
+
187
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
188
+
189
+ return arr2;
190
+ }
191
+
192
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
193
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
194
+ if (it) return (it = it.call(o)).next.bind(it);
195
+
196
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
197
+ if (it) o = it;
198
+ var i = 0;
199
+ return function () {
200
+ if (i >= o.length) return {
201
+ done: true
202
+ };
203
+ return {
204
+ done: false,
205
+ value: o[i++]
206
+ };
212
207
  };
213
208
  }
214
209
 
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 || []);
210
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
211
+ }
212
+
213
+ function createCommonjsModule(fn, module) {
214
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
215
+ }
220
216
 
221
- // The ._invoke method unifies the implementations of the .next,
222
- // .throw, and .return methods.
223
- generator._invoke = makeInvokeMethod(innerFn, self, context);
217
+ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
218
+ /**
219
+ * Copyright (c) 2014-present, Facebook, Inc.
220
+ *
221
+ * This source code is licensed under the MIT license found in the
222
+ * LICENSE file in the root directory of this source tree.
223
+ */
224
+ var runtime = function (exports) {
225
+
226
+ var Op = Object.prototype;
227
+ var hasOwn = Op.hasOwnProperty;
228
+ var undefined$1; // More compressible than void 0.
229
+
230
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
231
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
232
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
233
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
234
+
235
+ function define(obj, key, value) {
236
+ Object.defineProperty(obj, key, {
237
+ value: value,
238
+ enumerable: true,
239
+ configurable: true,
240
+ writable: true
241
+ });
242
+ return obj[key];
243
+ }
224
244
 
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
245
  try {
241
- return { type: "normal", arg: fn.call(obj, arg) };
246
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
247
+ define({}, "");
242
248
  } catch (err) {
243
- return { type: "throw", arg: err };
249
+ define = function define(obj, key, value) {
250
+ return obj[key] = value;
251
+ };
244
252
  }
245
- }
246
253
 
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
- define(IteratorPrototype, iteratorSymbol, function () {
268
- return this;
269
- });
254
+ function wrap(innerFn, outerFn, self, tryLocsList) {
255
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
256
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
257
+ var generator = Object.create(protoGenerator.prototype);
258
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
259
+ // .throw, and .return methods.
270
260
 
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
- }
261
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
262
+ return generator;
263
+ }
280
264
 
281
- var Gp = GeneratorFunctionPrototype.prototype =
282
- Generator.prototype = Object.create(IteratorPrototype);
283
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
284
- define(Gp, "constructor", GeneratorFunctionPrototype);
285
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
286
- GeneratorFunction.displayName = define(
287
- GeneratorFunctionPrototype,
288
- toStringTagSymbol,
289
- "GeneratorFunction"
290
- );
291
-
292
- // Helper for defining the .next, .throw, and .return methods of the
293
- // Iterator interface in terms of a single ._invoke method.
294
- function defineIteratorMethods(prototype) {
295
- ["next", "throw", "return"].forEach(function(method) {
296
- define(prototype, method, function(arg) {
297
- return this._invoke(method, arg);
298
- });
299
- });
300
- }
265
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
266
+ // record like context.tryEntries[i].completion. This interface could
267
+ // have been (and was previously) designed to take a closure to be
268
+ // invoked without arguments, but in all the cases we care about we
269
+ // already have an existing method we want to call, so there's no need
270
+ // to create a new function object. We can even get away with assuming
271
+ // the method takes exactly one argument, since that happens to be true
272
+ // in every case, so we don't have to touch the arguments object. The
273
+ // only additional allocation required is the completion record, which
274
+ // has a stable shape and so hopefully should be cheap to allocate.
275
+
276
+ function tryCatch(fn, obj, arg) {
277
+ try {
278
+ return {
279
+ type: "normal",
280
+ arg: fn.call(obj, arg)
281
+ };
282
+ } catch (err) {
283
+ return {
284
+ type: "throw",
285
+ arg: err
286
+ };
287
+ }
288
+ }
301
289
 
302
- exports.isGeneratorFunction = function(genFun) {
303
- var ctor = typeof genFun === "function" && genFun.constructor;
304
- return ctor
305
- ? ctor === GeneratorFunction ||
306
- // For the native GeneratorFunction constructor, the best we can
307
- // do is to check its .name property.
308
- (ctor.displayName || ctor.name) === "GeneratorFunction"
309
- : false;
310
- };
290
+ var GenStateSuspendedStart = "suspendedStart";
291
+ var GenStateSuspendedYield = "suspendedYield";
292
+ var GenStateExecuting = "executing";
293
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
294
+ // breaking out of the dispatch switch statement.
295
+
296
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
297
+ // .constructor.prototype properties for functions that return Generator
298
+ // objects. For full spec compliance, you may wish to configure your
299
+ // minifier not to mangle the names of these two functions.
300
+
301
+ function Generator() {}
302
+
303
+ function GeneratorFunction() {}
304
+
305
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
306
+ // don't natively support it.
307
+
308
+
309
+ var IteratorPrototype = {};
310
+
311
+ IteratorPrototype[iteratorSymbol] = function () {
312
+ return this;
313
+ };
314
+
315
+ var getProto = Object.getPrototypeOf;
316
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
311
317
 
312
- exports.mark = function(genFun) {
313
- if (Object.setPrototypeOf) {
314
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
315
- } else {
316
- genFun.__proto__ = GeneratorFunctionPrototype;
317
- define(genFun, toStringTagSymbol, "GeneratorFunction");
318
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
319
+ // This environment has a native %IteratorPrototype%; use it instead
320
+ // of the polyfill.
321
+ IteratorPrototype = NativeIteratorPrototype;
318
322
  }
319
- genFun.prototype = Object.create(Gp);
320
- return genFun;
321
- };
322
323
 
323
- // Within the body of any async function, `await x` is transformed to
324
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
325
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
326
- // meant to be awaited.
327
- exports.awrap = function(arg) {
328
- return { __await: arg };
329
- };
324
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
325
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
326
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
327
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
328
+ // Iterator interface in terms of a single ._invoke method.
330
329
 
331
- function AsyncIterator(generator, PromiseImpl) {
332
- function invoke(method, arg, resolve, reject) {
333
- var record = tryCatch(generator[method], generator, arg);
334
- if (record.type === "throw") {
335
- reject(record.arg);
330
+ function defineIteratorMethods(prototype) {
331
+ ["next", "throw", "return"].forEach(function (method) {
332
+ define(prototype, method, function (arg) {
333
+ return this._invoke(method, arg);
334
+ });
335
+ });
336
+ }
337
+
338
+ exports.isGeneratorFunction = function (genFun) {
339
+ var ctor = typeof genFun === "function" && genFun.constructor;
340
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
341
+ // do is to check its .name property.
342
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
343
+ };
344
+
345
+ exports.mark = function (genFun) {
346
+ if (Object.setPrototypeOf) {
347
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
336
348
  } else {
337
- var result = record.arg;
338
- var value = result.value;
339
- if (value &&
340
- typeof value === "object" &&
341
- hasOwn.call(value, "__await")) {
342
- return PromiseImpl.resolve(value.__await).then(function(value) {
343
- invoke("next", value, resolve, reject);
344
- }, function(err) {
345
- invoke("throw", err, resolve, reject);
349
+ genFun.__proto__ = GeneratorFunctionPrototype;
350
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
351
+ }
352
+
353
+ genFun.prototype = Object.create(Gp);
354
+ return genFun;
355
+ }; // Within the body of any async function, `await x` is transformed to
356
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
357
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
358
+ // meant to be awaited.
359
+
360
+
361
+ exports.awrap = function (arg) {
362
+ return {
363
+ __await: arg
364
+ };
365
+ };
366
+
367
+ function AsyncIterator(generator, PromiseImpl) {
368
+ function invoke(method, arg, resolve, reject) {
369
+ var record = tryCatch(generator[method], generator, arg);
370
+
371
+ if (record.type === "throw") {
372
+ reject(record.arg);
373
+ } else {
374
+ var result = record.arg;
375
+ var value = result.value;
376
+
377
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
378
+ return PromiseImpl.resolve(value.__await).then(function (value) {
379
+ invoke("next", value, resolve, reject);
380
+ }, function (err) {
381
+ invoke("throw", err, resolve, reject);
382
+ });
383
+ }
384
+
385
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
386
+ // When a yielded Promise is resolved, its final value becomes
387
+ // the .value of the Promise<{value,done}> result for the
388
+ // current iteration.
389
+ result.value = unwrapped;
390
+ resolve(result);
391
+ }, function (error) {
392
+ // If a rejected Promise was yielded, throw the rejection back
393
+ // into the async generator function so it can be handled there.
394
+ return invoke("throw", error, resolve, reject);
346
395
  });
347
396
  }
348
-
349
- return PromiseImpl.resolve(value).then(function(unwrapped) {
350
- // When a yielded Promise is resolved, its final value becomes
351
- // the .value of the Promise<{value,done}> result for the
352
- // current iteration.
353
- result.value = unwrapped;
354
- resolve(result);
355
- }, function(error) {
356
- // If a rejected Promise was yielded, throw the rejection back
357
- // into the async generator function so it can be handled there.
358
- return invoke("throw", error, resolve, reject);
359
- });
360
397
  }
361
- }
362
398
 
363
- var previousPromise;
399
+ var previousPromise;
364
400
 
365
- function enqueue(method, arg) {
366
- function callInvokeWithMethodAndArg() {
367
- return new PromiseImpl(function(resolve, reject) {
368
- invoke(method, arg, resolve, reject);
369
- });
370
- }
401
+ function enqueue(method, arg) {
402
+ function callInvokeWithMethodAndArg() {
403
+ return new PromiseImpl(function (resolve, reject) {
404
+ invoke(method, arg, resolve, reject);
405
+ });
406
+ }
371
407
 
372
- return previousPromise =
373
- // If enqueue has been called before, then we want to wait until
408
+ return previousPromise = // If enqueue has been called before, then we want to wait until
374
409
  // all previous Promises have been resolved before calling invoke,
375
410
  // so that results are always delivered in the correct order. If
376
411
  // enqueue has not been called before, then it is important to
@@ -382,554 +417,525 @@ var runtime = (function (exports) {
382
417
  // execute code before the first await. Since we implement simple
383
418
  // async functions in terms of async generators, it is especially
384
419
  // important to get this right, even though it requires care.
385
- previousPromise ? previousPromise.then(
386
- callInvokeWithMethodAndArg,
387
- // Avoid propagating failures to Promises returned by later
388
- // invocations of the iterator.
389
- callInvokeWithMethodAndArg
390
- ) : callInvokeWithMethodAndArg();
420
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
421
+ // invocations of the iterator.
422
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
423
+ } // Define the unified helper method that is used to implement .next,
424
+ // .throw, and .return (see defineIteratorMethods).
425
+
426
+
427
+ this._invoke = enqueue;
391
428
  }
392
429
 
393
- // Define the unified helper method that is used to implement .next,
394
- // .throw, and .return (see defineIteratorMethods).
395
- this._invoke = enqueue;
396
- }
430
+ defineIteratorMethods(AsyncIterator.prototype);
397
431
 
398
- defineIteratorMethods(AsyncIterator.prototype);
399
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
400
- return this;
401
- });
402
- exports.AsyncIterator = AsyncIterator;
403
-
404
- // Note that simple async functions are implemented on top of
405
- // AsyncIterator objects; they just return a Promise for the value of
406
- // the final result produced by the iterator.
407
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
408
- if (PromiseImpl === void 0) PromiseImpl = Promise;
409
-
410
- var iter = new AsyncIterator(
411
- wrap(innerFn, outerFn, self, tryLocsList),
412
- PromiseImpl
413
- );
414
-
415
- return exports.isGeneratorFunction(outerFn)
416
- ? iter // If outerFn is a generator, return the full iterator.
417
- : iter.next().then(function(result) {
418
- return result.done ? result.value : iter.next();
419
- });
420
- };
432
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
433
+ return this;
434
+ };
421
435
 
422
- function makeInvokeMethod(innerFn, self, context) {
423
- var state = GenStateSuspendedStart;
436
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
437
+ // AsyncIterator objects; they just return a Promise for the value of
438
+ // the final result produced by the iterator.
424
439
 
425
- return function invoke(method, arg) {
426
- if (state === GenStateExecuting) {
427
- throw new Error("Generator is already running");
428
- }
440
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
441
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
442
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
443
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
444
+ : iter.next().then(function (result) {
445
+ return result.done ? result.value : iter.next();
446
+ });
447
+ };
429
448
 
430
- if (state === GenStateCompleted) {
431
- if (method === "throw") {
432
- throw arg;
449
+ function makeInvokeMethod(innerFn, self, context) {
450
+ var state = GenStateSuspendedStart;
451
+ return function invoke(method, arg) {
452
+ if (state === GenStateExecuting) {
453
+ throw new Error("Generator is already running");
433
454
  }
434
455
 
435
- // Be forgiving, per 25.3.3.3.3 of the spec:
436
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
437
- return doneResult();
438
- }
456
+ if (state === GenStateCompleted) {
457
+ if (method === "throw") {
458
+ throw arg;
459
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
460
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
439
461
 
440
- context.method = method;
441
- context.arg = arg;
442
462
 
443
- while (true) {
444
- var delegate = context.delegate;
445
- if (delegate) {
446
- var delegateResult = maybeInvokeDelegate(delegate, context);
447
- if (delegateResult) {
448
- if (delegateResult === ContinueSentinel) continue;
449
- return delegateResult;
450
- }
463
+ return doneResult();
451
464
  }
452
465
 
453
- if (context.method === "next") {
454
- // Setting context._sent for legacy support of Babel's
455
- // function.sent implementation.
456
- context.sent = context._sent = context.arg;
466
+ context.method = method;
467
+ context.arg = arg;
468
+
469
+ while (true) {
470
+ var delegate = context.delegate;
457
471
 
458
- } else if (context.method === "throw") {
459
- if (state === GenStateSuspendedStart) {
460
- state = GenStateCompleted;
461
- throw context.arg;
472
+ if (delegate) {
473
+ var delegateResult = maybeInvokeDelegate(delegate, context);
474
+
475
+ if (delegateResult) {
476
+ if (delegateResult === ContinueSentinel) continue;
477
+ return delegateResult;
478
+ }
462
479
  }
463
480
 
464
- context.dispatchException(context.arg);
481
+ if (context.method === "next") {
482
+ // Setting context._sent for legacy support of Babel's
483
+ // function.sent implementation.
484
+ context.sent = context._sent = context.arg;
485
+ } else if (context.method === "throw") {
486
+ if (state === GenStateSuspendedStart) {
487
+ state = GenStateCompleted;
488
+ throw context.arg;
489
+ }
465
490
 
466
- } else if (context.method === "return") {
467
- context.abrupt("return", context.arg);
468
- }
491
+ context.dispatchException(context.arg);
492
+ } else if (context.method === "return") {
493
+ context.abrupt("return", context.arg);
494
+ }
469
495
 
470
- state = GenStateExecuting;
496
+ state = GenStateExecuting;
497
+ var record = tryCatch(innerFn, self, context);
471
498
 
472
- var record = tryCatch(innerFn, self, context);
473
- if (record.type === "normal") {
474
- // If an exception is thrown from innerFn, we leave state ===
475
- // GenStateExecuting and loop back for another invocation.
476
- state = context.done
477
- ? GenStateCompleted
478
- : GenStateSuspendedYield;
499
+ if (record.type === "normal") {
500
+ // If an exception is thrown from innerFn, we leave state ===
501
+ // GenStateExecuting and loop back for another invocation.
502
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
479
503
 
480
- if (record.arg === ContinueSentinel) {
481
- continue;
482
- }
504
+ if (record.arg === ContinueSentinel) {
505
+ continue;
506
+ }
483
507
 
484
- return {
485
- value: record.arg,
486
- done: context.done
487
- };
508
+ return {
509
+ value: record.arg,
510
+ done: context.done
511
+ };
512
+ } else if (record.type === "throw") {
513
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
514
+ // context.dispatchException(context.arg) call above.
515
+
516
+ context.method = "throw";
517
+ context.arg = record.arg;
518
+ }
519
+ }
520
+ };
521
+ } // Call delegate.iterator[context.method](context.arg) and handle the
522
+ // result, either by returning a { value, done } result from the
523
+ // delegate iterator, or by modifying context.method and context.arg,
524
+ // setting context.delegate to null, and returning the ContinueSentinel.
525
+
526
+
527
+ function maybeInvokeDelegate(delegate, context) {
528
+ var method = delegate.iterator[context.method];
529
+
530
+ if (method === undefined$1) {
531
+ // A .throw or .return when the delegate iterator has no .throw
532
+ // method always terminates the yield* loop.
533
+ context.delegate = null;
534
+
535
+ if (context.method === "throw") {
536
+ // Note: ["return"] must be used for ES3 parsing compatibility.
537
+ if (delegate.iterator["return"]) {
538
+ // If the delegate iterator has a return method, give it a
539
+ // chance to clean up.
540
+ context.method = "return";
541
+ context.arg = undefined$1;
542
+ maybeInvokeDelegate(delegate, context);
543
+
544
+ if (context.method === "throw") {
545
+ // If maybeInvokeDelegate(context) changed context.method from
546
+ // "return" to "throw", let that override the TypeError below.
547
+ return ContinueSentinel;
548
+ }
549
+ }
488
550
 
489
- } else if (record.type === "throw") {
490
- state = GenStateCompleted;
491
- // Dispatch the exception by looping back around to the
492
- // context.dispatchException(context.arg) call above.
493
551
  context.method = "throw";
494
- context.arg = record.arg;
552
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
495
553
  }
554
+
555
+ return ContinueSentinel;
496
556
  }
497
- };
498
- }
499
557
 
500
- // Call delegate.iterator[context.method](context.arg) and handle the
501
- // result, either by returning a { value, done } result from the
502
- // delegate iterator, or by modifying context.method and context.arg,
503
- // setting context.delegate to null, and returning the ContinueSentinel.
504
- function maybeInvokeDelegate(delegate, context) {
505
- var method = delegate.iterator[context.method];
506
- if (method === undefined$1) {
507
- // A .throw or .return when the delegate iterator has no .throw
508
- // method always terminates the yield* loop.
509
- context.delegate = null;
558
+ var record = tryCatch(method, delegate.iterator, context.arg);
510
559
 
511
- if (context.method === "throw") {
512
- // Note: ["return"] must be used for ES3 parsing compatibility.
513
- if (delegate.iterator["return"]) {
514
- // If the delegate iterator has a return method, give it a
515
- // chance to clean up.
516
- context.method = "return";
517
- context.arg = undefined$1;
518
- maybeInvokeDelegate(delegate, context);
560
+ if (record.type === "throw") {
561
+ context.method = "throw";
562
+ context.arg = record.arg;
563
+ context.delegate = null;
564
+ return ContinueSentinel;
565
+ }
519
566
 
520
- if (context.method === "throw") {
521
- // If maybeInvokeDelegate(context) changed context.method from
522
- // "return" to "throw", let that override the TypeError below.
523
- return ContinueSentinel;
524
- }
525
- }
567
+ var info = record.arg;
526
568
 
569
+ if (!info) {
527
570
  context.method = "throw";
528
- context.arg = new TypeError(
529
- "The iterator does not provide a 'throw' method");
571
+ context.arg = new TypeError("iterator result is not an object");
572
+ context.delegate = null;
573
+ return ContinueSentinel;
530
574
  }
531
575
 
532
- return ContinueSentinel;
533
- }
576
+ if (info.done) {
577
+ // Assign the result of the finished delegate to the temporary
578
+ // variable specified by delegate.resultName (see delegateYield).
579
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
534
580
 
535
- var record = tryCatch(method, delegate.iterator, context.arg);
581
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
582
+ // exception, let the outer generator proceed normally. If
583
+ // context.method was "next", forget context.arg since it has been
584
+ // "consumed" by the delegate iterator. If context.method was
585
+ // "return", allow the original .return call to continue in the
586
+ // outer generator.
536
587
 
537
- if (record.type === "throw") {
538
- context.method = "throw";
539
- context.arg = record.arg;
540
- context.delegate = null;
541
- return ContinueSentinel;
542
- }
588
+ if (context.method !== "return") {
589
+ context.method = "next";
590
+ context.arg = undefined$1;
591
+ }
592
+ } else {
593
+ // Re-yield the result returned by the delegate method.
594
+ return info;
595
+ } // The delegate iterator is finished, so forget it and continue with
596
+ // the outer generator.
543
597
 
544
- var info = record.arg;
545
598
 
546
- if (! info) {
547
- context.method = "throw";
548
- context.arg = new TypeError("iterator result is not an object");
549
599
  context.delegate = null;
550
600
  return ContinueSentinel;
551
- }
601
+ } // Define Generator.prototype.{next,throw,return} in terms of the
602
+ // unified ._invoke helper method.
552
603
 
553
- if (info.done) {
554
- // Assign the result of the finished delegate to the temporary
555
- // variable specified by delegate.resultName (see delegateYield).
556
- context[delegate.resultName] = info.value;
557
-
558
- // Resume execution at the desired location (see delegateYield).
559
- context.next = delegate.nextLoc;
560
-
561
- // If context.method was "throw" but the delegate handled the
562
- // exception, let the outer generator proceed normally. If
563
- // context.method was "next", forget context.arg since it has been
564
- // "consumed" by the delegate iterator. If context.method was
565
- // "return", allow the original .return call to continue in the
566
- // outer generator.
567
- if (context.method !== "return") {
568
- context.method = "next";
569
- context.arg = undefined$1;
570
- }
571
604
 
572
- } else {
573
- // Re-yield the result returned by the delegate method.
574
- return info;
575
- }
605
+ defineIteratorMethods(Gp);
606
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
607
+ // @@iterator function is called on it. Some browsers' implementations of the
608
+ // iterator prototype chain incorrectly implement this, causing the Generator
609
+ // object to not be returned from this call. This ensures that doesn't happen.
610
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
576
611
 
577
- // The delegate iterator is finished, so forget it and continue with
578
- // the outer generator.
579
- context.delegate = null;
580
- return ContinueSentinel;
581
- }
582
-
583
- // Define Generator.prototype.{next,throw,return} in terms of the
584
- // unified ._invoke helper method.
585
- defineIteratorMethods(Gp);
612
+ Gp[iteratorSymbol] = function () {
613
+ return this;
614
+ };
586
615
 
587
- define(Gp, toStringTagSymbol, "Generator");
616
+ Gp.toString = function () {
617
+ return "[object Generator]";
618
+ };
588
619
 
589
- // A Generator should always return itself as the iterator object when the
590
- // @@iterator function is called on it. Some browsers' implementations of the
591
- // iterator prototype chain incorrectly implement this, causing the Generator
592
- // object to not be returned from this call. This ensures that doesn't happen.
593
- // See https://github.com/facebook/regenerator/issues/274 for more details.
594
- define(Gp, iteratorSymbol, function() {
595
- return this;
596
- });
620
+ function pushTryEntry(locs) {
621
+ var entry = {
622
+ tryLoc: locs[0]
623
+ };
597
624
 
598
- define(Gp, "toString", function() {
599
- return "[object Generator]";
600
- });
625
+ if (1 in locs) {
626
+ entry.catchLoc = locs[1];
627
+ }
601
628
 
602
- function pushTryEntry(locs) {
603
- var entry = { tryLoc: locs[0] };
629
+ if (2 in locs) {
630
+ entry.finallyLoc = locs[2];
631
+ entry.afterLoc = locs[3];
632
+ }
604
633
 
605
- if (1 in locs) {
606
- entry.catchLoc = locs[1];
634
+ this.tryEntries.push(entry);
607
635
  }
608
636
 
609
- if (2 in locs) {
610
- entry.finallyLoc = locs[2];
611
- entry.afterLoc = locs[3];
637
+ function resetTryEntry(entry) {
638
+ var record = entry.completion || {};
639
+ record.type = "normal";
640
+ delete record.arg;
641
+ entry.completion = record;
612
642
  }
613
643
 
614
- this.tryEntries.push(entry);
615
- }
616
-
617
- function resetTryEntry(entry) {
618
- var record = entry.completion || {};
619
- record.type = "normal";
620
- delete record.arg;
621
- entry.completion = record;
622
- }
623
-
624
- function Context(tryLocsList) {
625
- // The root entry object (effectively a try statement without a catch
626
- // or a finally block) gives us a place to store values thrown from
627
- // locations where there is no enclosing try statement.
628
- this.tryEntries = [{ tryLoc: "root" }];
629
- tryLocsList.forEach(pushTryEntry, this);
630
- this.reset(true);
631
- }
632
-
633
- exports.keys = function(object) {
634
- var keys = [];
635
- for (var key in object) {
636
- keys.push(key);
644
+ function Context(tryLocsList) {
645
+ // The root entry object (effectively a try statement without a catch
646
+ // or a finally block) gives us a place to store values thrown from
647
+ // locations where there is no enclosing try statement.
648
+ this.tryEntries = [{
649
+ tryLoc: "root"
650
+ }];
651
+ tryLocsList.forEach(pushTryEntry, this);
652
+ this.reset(true);
637
653
  }
638
- keys.reverse();
639
-
640
- // Rather than returning an object with a next method, we keep
641
- // things simple and return the next function itself.
642
- return function next() {
643
- while (keys.length) {
644
- var key = keys.pop();
645
- if (key in object) {
646
- next.value = key;
647
- next.done = false;
648
- return next;
649
- }
650
- }
651
654
 
652
- // To avoid creating an additional object, we just hang the .value
653
- // and .done properties off the next function object itself. This
654
- // also ensures that the minifier will not anonymize the function.
655
- next.done = true;
656
- return next;
657
- };
658
- };
655
+ exports.keys = function (object) {
656
+ var keys = [];
659
657
 
660
- function values(iterable) {
661
- if (iterable) {
662
- var iteratorMethod = iterable[iteratorSymbol];
663
- if (iteratorMethod) {
664
- return iteratorMethod.call(iterable);
658
+ for (var key in object) {
659
+ keys.push(key);
665
660
  }
666
661
 
667
- if (typeof iterable.next === "function") {
668
- return iterable;
669
- }
662
+ keys.reverse(); // Rather than returning an object with a next method, we keep
663
+ // things simple and return the next function itself.
670
664
 
671
- if (!isNaN(iterable.length)) {
672
- var i = -1, next = function next() {
673
- while (++i < iterable.length) {
674
- if (hasOwn.call(iterable, i)) {
675
- next.value = iterable[i];
676
- next.done = false;
677
- return next;
678
- }
679
- }
665
+ return function next() {
666
+ while (keys.length) {
667
+ var key = keys.pop();
680
668
 
681
- next.value = undefined$1;
682
- next.done = true;
669
+ if (key in object) {
670
+ next.value = key;
671
+ next.done = false;
672
+ return next;
673
+ }
674
+ } // To avoid creating an additional object, we just hang the .value
675
+ // and .done properties off the next function object itself. This
676
+ // also ensures that the minifier will not anonymize the function.
683
677
 
684
- return next;
685
- };
686
678
 
687
- return next.next = next;
688
- }
689
- }
679
+ next.done = true;
680
+ return next;
681
+ };
682
+ };
690
683
 
691
- // Return an iterator with no values.
692
- return { next: doneResult };
693
- }
694
- exports.values = values;
684
+ function values(iterable) {
685
+ if (iterable) {
686
+ var iteratorMethod = iterable[iteratorSymbol];
695
687
 
696
- function doneResult() {
697
- return { value: undefined$1, done: true };
698
- }
688
+ if (iteratorMethod) {
689
+ return iteratorMethod.call(iterable);
690
+ }
699
691
 
700
- Context.prototype = {
701
- constructor: Context,
702
-
703
- reset: function(skipTempReset) {
704
- this.prev = 0;
705
- this.next = 0;
706
- // Resetting context._sent for legacy support of Babel's
707
- // function.sent implementation.
708
- this.sent = this._sent = undefined$1;
709
- this.done = false;
710
- this.delegate = null;
711
-
712
- this.method = "next";
713
- this.arg = undefined$1;
714
-
715
- this.tryEntries.forEach(resetTryEntry);
716
-
717
- if (!skipTempReset) {
718
- for (var name in this) {
719
- // Not sure about the optimal order of these conditions:
720
- if (name.charAt(0) === "t" &&
721
- hasOwn.call(this, name) &&
722
- !isNaN(+name.slice(1))) {
723
- this[name] = undefined$1;
724
- }
692
+ if (typeof iterable.next === "function") {
693
+ return iterable;
725
694
  }
726
- }
727
- },
728
695
 
729
- stop: function() {
730
- this.done = true;
696
+ if (!isNaN(iterable.length)) {
697
+ var i = -1,
698
+ next = function next() {
699
+ while (++i < iterable.length) {
700
+ if (hasOwn.call(iterable, i)) {
701
+ next.value = iterable[i];
702
+ next.done = false;
703
+ return next;
704
+ }
705
+ }
731
706
 
732
- var rootEntry = this.tryEntries[0];
733
- var rootRecord = rootEntry.completion;
734
- if (rootRecord.type === "throw") {
735
- throw rootRecord.arg;
736
- }
707
+ next.value = undefined$1;
708
+ next.done = true;
709
+ return next;
710
+ };
737
711
 
738
- return this.rval;
739
- },
712
+ return next.next = next;
713
+ }
714
+ } // Return an iterator with no values.
740
715
 
741
- dispatchException: function(exception) {
742
- if (this.done) {
743
- throw exception;
744
- }
745
716
 
746
- var context = this;
747
- function handle(loc, caught) {
748
- record.type = "throw";
749
- record.arg = exception;
750
- context.next = loc;
717
+ return {
718
+ next: doneResult
719
+ };
720
+ }
751
721
 
752
- if (caught) {
753
- // If the dispatched exception was caught by a catch block,
754
- // then let that catch block handle the exception normally.
755
- context.method = "next";
756
- context.arg = undefined$1;
757
- }
722
+ exports.values = values;
758
723
 
759
- return !! caught;
760
- }
724
+ function doneResult() {
725
+ return {
726
+ value: undefined$1,
727
+ done: true
728
+ };
729
+ }
730
+
731
+ Context.prototype = {
732
+ constructor: Context,
733
+ reset: function reset(skipTempReset) {
734
+ this.prev = 0;
735
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
736
+ // function.sent implementation.
761
737
 
762
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
763
- var entry = this.tryEntries[i];
764
- var record = entry.completion;
738
+ this.sent = this._sent = undefined$1;
739
+ this.done = false;
740
+ this.delegate = null;
741
+ this.method = "next";
742
+ this.arg = undefined$1;
743
+ this.tryEntries.forEach(resetTryEntry);
765
744
 
766
- if (entry.tryLoc === "root") {
767
- // Exception thrown outside of any try block that could handle
768
- // it, so set the completion value of the entire function to
769
- // throw the exception.
770
- return handle("end");
745
+ if (!skipTempReset) {
746
+ for (var name in this) {
747
+ // Not sure about the optimal order of these conditions:
748
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
749
+ this[name] = undefined$1;
750
+ }
751
+ }
771
752
  }
753
+ },
754
+ stop: function stop() {
755
+ this.done = true;
756
+ var rootEntry = this.tryEntries[0];
757
+ var rootRecord = rootEntry.completion;
772
758
 
773
- if (entry.tryLoc <= this.prev) {
774
- var hasCatch = hasOwn.call(entry, "catchLoc");
775
- var hasFinally = hasOwn.call(entry, "finallyLoc");
759
+ if (rootRecord.type === "throw") {
760
+ throw rootRecord.arg;
761
+ }
776
762
 
777
- if (hasCatch && hasFinally) {
778
- if (this.prev < entry.catchLoc) {
779
- return handle(entry.catchLoc, true);
780
- } else if (this.prev < entry.finallyLoc) {
781
- return handle(entry.finallyLoc);
782
- }
763
+ return this.rval;
764
+ },
765
+ dispatchException: function dispatchException(exception) {
766
+ if (this.done) {
767
+ throw exception;
768
+ }
783
769
 
784
- } else if (hasCatch) {
785
- if (this.prev < entry.catchLoc) {
786
- return handle(entry.catchLoc, true);
787
- }
770
+ var context = this;
788
771
 
789
- } else if (hasFinally) {
790
- if (this.prev < entry.finallyLoc) {
791
- return handle(entry.finallyLoc);
792
- }
772
+ function handle(loc, caught) {
773
+ record.type = "throw";
774
+ record.arg = exception;
775
+ context.next = loc;
793
776
 
794
- } else {
795
- throw new Error("try statement without catch or finally");
777
+ if (caught) {
778
+ // If the dispatched exception was caught by a catch block,
779
+ // then let that catch block handle the exception normally.
780
+ context.method = "next";
781
+ context.arg = undefined$1;
796
782
  }
797
- }
798
- }
799
- },
800
783
 
801
- abrupt: function(type, arg) {
802
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
803
- var entry = this.tryEntries[i];
804
- if (entry.tryLoc <= this.prev &&
805
- hasOwn.call(entry, "finallyLoc") &&
806
- this.prev < entry.finallyLoc) {
807
- var finallyEntry = entry;
808
- break;
784
+ return !!caught;
809
785
  }
810
- }
811
786
 
812
- if (finallyEntry &&
813
- (type === "break" ||
814
- type === "continue") &&
815
- finallyEntry.tryLoc <= arg &&
816
- arg <= finallyEntry.finallyLoc) {
817
- // Ignore the finally entry if control is not jumping to a
818
- // location outside the try/catch block.
819
- finallyEntry = null;
820
- }
787
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
788
+ var entry = this.tryEntries[i];
789
+ var record = entry.completion;
821
790
 
822
- var record = finallyEntry ? finallyEntry.completion : {};
823
- record.type = type;
824
- record.arg = arg;
791
+ if (entry.tryLoc === "root") {
792
+ // Exception thrown outside of any try block that could handle
793
+ // it, so set the completion value of the entire function to
794
+ // throw the exception.
795
+ return handle("end");
796
+ }
825
797
 
826
- if (finallyEntry) {
827
- this.method = "next";
828
- this.next = finallyEntry.finallyLoc;
829
- return ContinueSentinel;
830
- }
798
+ if (entry.tryLoc <= this.prev) {
799
+ var hasCatch = hasOwn.call(entry, "catchLoc");
800
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
831
801
 
832
- return this.complete(record);
833
- },
802
+ if (hasCatch && hasFinally) {
803
+ if (this.prev < entry.catchLoc) {
804
+ return handle(entry.catchLoc, true);
805
+ } else if (this.prev < entry.finallyLoc) {
806
+ return handle(entry.finallyLoc);
807
+ }
808
+ } else if (hasCatch) {
809
+ if (this.prev < entry.catchLoc) {
810
+ return handle(entry.catchLoc, true);
811
+ }
812
+ } else if (hasFinally) {
813
+ if (this.prev < entry.finallyLoc) {
814
+ return handle(entry.finallyLoc);
815
+ }
816
+ } else {
817
+ throw new Error("try statement without catch or finally");
818
+ }
819
+ }
820
+ }
821
+ },
822
+ abrupt: function abrupt(type, arg) {
823
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
824
+ var entry = this.tryEntries[i];
834
825
 
835
- complete: function(record, afterLoc) {
836
- if (record.type === "throw") {
837
- throw record.arg;
838
- }
826
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
827
+ var finallyEntry = entry;
828
+ break;
829
+ }
830
+ }
839
831
 
840
- if (record.type === "break" ||
841
- record.type === "continue") {
842
- this.next = record.arg;
843
- } else if (record.type === "return") {
844
- this.rval = this.arg = record.arg;
845
- this.method = "return";
846
- this.next = "end";
847
- } else if (record.type === "normal" && afterLoc) {
848
- this.next = afterLoc;
849
- }
832
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
833
+ // Ignore the finally entry if control is not jumping to a
834
+ // location outside the try/catch block.
835
+ finallyEntry = null;
836
+ }
850
837
 
851
- return ContinueSentinel;
852
- },
838
+ var record = finallyEntry ? finallyEntry.completion : {};
839
+ record.type = type;
840
+ record.arg = arg;
853
841
 
854
- finish: function(finallyLoc) {
855
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
856
- var entry = this.tryEntries[i];
857
- if (entry.finallyLoc === finallyLoc) {
858
- this.complete(entry.completion, entry.afterLoc);
859
- resetTryEntry(entry);
842
+ if (finallyEntry) {
843
+ this.method = "next";
844
+ this.next = finallyEntry.finallyLoc;
860
845
  return ContinueSentinel;
861
846
  }
862
- }
863
- },
864
847
 
865
- "catch": function(tryLoc) {
866
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
867
- var entry = this.tryEntries[i];
868
- if (entry.tryLoc === tryLoc) {
869
- var record = entry.completion;
870
- if (record.type === "throw") {
871
- var thrown = record.arg;
848
+ return this.complete(record);
849
+ },
850
+ complete: function complete(record, afterLoc) {
851
+ if (record.type === "throw") {
852
+ throw record.arg;
853
+ }
854
+
855
+ if (record.type === "break" || record.type === "continue") {
856
+ this.next = record.arg;
857
+ } else if (record.type === "return") {
858
+ this.rval = this.arg = record.arg;
859
+ this.method = "return";
860
+ this.next = "end";
861
+ } else if (record.type === "normal" && afterLoc) {
862
+ this.next = afterLoc;
863
+ }
864
+
865
+ return ContinueSentinel;
866
+ },
867
+ finish: function finish(finallyLoc) {
868
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
869
+ var entry = this.tryEntries[i];
870
+
871
+ if (entry.finallyLoc === finallyLoc) {
872
+ this.complete(entry.completion, entry.afterLoc);
872
873
  resetTryEntry(entry);
874
+ return ContinueSentinel;
873
875
  }
874
- return thrown;
875
876
  }
876
- }
877
+ },
878
+ "catch": function _catch(tryLoc) {
879
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
880
+ var entry = this.tryEntries[i];
877
881
 
878
- // The context.catch method must only be called with a location
879
- // argument that corresponds to a known catch block.
880
- throw new Error("illegal catch attempt");
881
- },
882
+ if (entry.tryLoc === tryLoc) {
883
+ var record = entry.completion;
882
884
 
883
- delegateYield: function(iterable, resultName, nextLoc) {
884
- this.delegate = {
885
- iterator: values(iterable),
886
- resultName: resultName,
887
- nextLoc: nextLoc
888
- };
885
+ if (record.type === "throw") {
886
+ var thrown = record.arg;
887
+ resetTryEntry(entry);
888
+ }
889
889
 
890
- if (this.method === "next") {
891
- // Deliberately forget the last sent value so that we don't
892
- // accidentally pass it on to the delegate.
893
- this.arg = undefined$1;
894
- }
890
+ return thrown;
891
+ }
892
+ } // The context.catch method must only be called with a location
893
+ // argument that corresponds to a known catch block.
895
894
 
896
- return ContinueSentinel;
897
- }
898
- };
899
895
 
900
- // Regardless of whether this script is executing as a CommonJS module
901
- // or not, return the runtime object so that we can declare the variable
902
- // regeneratorRuntime in the outer scope, which allows this module to be
903
- // injected easily by `bin/regenerator --include-runtime script.js`.
904
- return exports;
896
+ throw new Error("illegal catch attempt");
897
+ },
898
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
899
+ this.delegate = {
900
+ iterator: values(iterable),
901
+ resultName: resultName,
902
+ nextLoc: nextLoc
903
+ };
904
+
905
+ if (this.method === "next") {
906
+ // Deliberately forget the last sent value so that we don't
907
+ // accidentally pass it on to the delegate.
908
+ this.arg = undefined$1;
909
+ }
905
910
 
906
- }(
907
- // If this script is executing as a CommonJS module, use module.exports
911
+ return ContinueSentinel;
912
+ }
913
+ }; // Regardless of whether this script is executing as a CommonJS module
914
+ // or not, return the runtime object so that we can declare the variable
915
+ // regeneratorRuntime in the outer scope, which allows this module to be
916
+ // injected easily by `bin/regenerator --include-runtime script.js`.
917
+
918
+ return exports;
919
+ }( // If this script is executing as a CommonJS module, use module.exports
908
920
  // as the regeneratorRuntime namespace. Otherwise create a new empty
909
921
  // object. Either way, the resulting object will be used to initialize
910
922
  // the regeneratorRuntime variable at the top of this file.
911
- module.exports
912
- ));
913
-
914
- try {
915
- regeneratorRuntime = runtime;
916
- } catch (accidentalStrictMode) {
917
- // This module should not be running in strict mode, so the above
918
- // assignment should always work unless something is misconfigured. Just
919
- // in case runtime.js accidentally runs in strict mode, in modern engines
920
- // we can explicitly access globalThis. In older engines we can escape
921
- // strict mode using a global Function call. This could conceivably fail
922
- // if a Content Security Policy forbids using Function, but in that case
923
- // the proper solution is to fix the accidental strict mode problem. If
924
- // you've misconfigured your bundler to force strict mode and applied a
925
- // CSP to forbid Function, and you're not willing to fix either of those
926
- // problems, please detail your unique predicament in a GitHub issue.
927
- if (typeof globalThis === "object") {
928
- globalThis.regeneratorRuntime = runtime;
929
- } else {
923
+ module.exports );
924
+
925
+ try {
926
+ regeneratorRuntime = runtime;
927
+ } catch (accidentalStrictMode) {
928
+ // This module should not be running in strict mode, so the above
929
+ // assignment should always work unless something is misconfigured. Just
930
+ // in case runtime.js accidentally runs in strict mode, we can escape
931
+ // strict mode using a global Function call. This could conceivably fail
932
+ // if a Content Security Policy forbids using Function, but in that case
933
+ // the proper solution is to fix the accidental strict mode problem. If
934
+ // you've misconfigured your bundler to force strict mode and applied a
935
+ // CSP to forbid Function, and you're not willing to fix either of those
936
+ // problems, please detail your unique predicament in a GitHub issue.
930
937
  Function("r", "regeneratorRuntime = r")(runtime);
931
938
  }
932
- }
933
939
  });
934
940
 
935
941
  var ProductContext = /*#__PURE__*/React__default.createContext(undefined);
@@ -1215,10 +1221,9 @@ var addToCartButtonMeta = {
1215
1221
  }]
1216
1222
  }
1217
1223
  },
1218
- importPath: "commerce-providers/commerce",
1224
+ importPath: "@plasmicpkgs/commerce",
1219
1225
  importName: "AddToCartButton"
1220
1226
  };
1221
-
1222
1227
  function AddToCartButton(props) {
1223
1228
  var children = props.children;
1224
1229
  var product = useProduct();
@@ -1229,12 +1234,13 @@ function AddToCartButton(props) {
1229
1234
  var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1230
1235
  var _form$getValues$Produ;
1231
1236
 
1232
- var quantity, variantId;
1237
+ var quantity, _form$getValues$Produ2, variantId;
1238
+
1233
1239
  return runtime_1.wrap(function _callee$(_context) {
1234
1240
  while (1) {
1235
1241
  switch (_context.prev = _context.next) {
1236
1242
  case 0:
1237
- quantity = (_form$getValues$Produ = +form.getValues()["ProductQuantity"]) != null ? _form$getValues$Produ : 1;
1243
+ quantity = +((_form$getValues$Produ = form.getValues()["ProductQuantity"]) != null ? _form$getValues$Produ : 1);
1238
1244
 
1239
1245
  if (!(isNaN(quantity) || quantity < 1)) {
1240
1246
  _context.next = 3;
@@ -1251,7 +1257,7 @@ function AddToCartButton(props) {
1251
1257
  break;
1252
1258
  }
1253
1259
 
1254
- variantId = form.getValues()["ProductVariant"];
1260
+ variantId = (_form$getValues$Produ2 = form.getValues()["ProductVariant"]) != null ? _form$getValues$Produ2 : product.variants[0].id;
1255
1261
  _context.next = 7;
1256
1262
  return addItem({
1257
1263
  productId: product.id,
@@ -1282,7 +1288,6 @@ function AddToCartButton(props) {
1282
1288
  }
1283
1289
  }) : null;
1284
1290
  }
1285
-
1286
1291
  function registerAddToCartButton(loader, customAddToCartButtonMeta) {
1287
1292
  var doRegisterComponent = function doRegisterComponent() {
1288
1293
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
@@ -1296,16 +1301,148 @@ var fetcher$1 = SWRFetcher;
1296
1301
  var fn$1 = function fn(provider) {
1297
1302
  var _provider$products;
1298
1303
 
1299
- return (_provider$products = provider.products) == null ? void 0 : _provider$products.useSearch;
1304
+ return (_provider$products = provider.products) == null ? void 0 : _provider$products.useProduct;
1300
1305
  };
1301
1306
 
1302
- var useSearch = function useSearch(input) {
1307
+ var useProduct$1 = function useProduct(input) {
1303
1308
  var hook = useHook(fn$1);
1304
1309
  return useSWRHook(_extends({
1305
1310
  fetcher: fetcher$1
1306
1311
  }, hook))(input);
1307
1312
  };
1308
1313
 
1314
+ var productBoxMeta = {
1315
+ name: "plasmic-commerce-product-box",
1316
+ displayName: "Product Box",
1317
+ props: {
1318
+ children: {
1319
+ type: "slot",
1320
+ defaultValue: [{
1321
+ type: "vbox",
1322
+ children: [{
1323
+ type: "component",
1324
+ name: "plasmic-commerce-product-text-field",
1325
+ props: {
1326
+ field: "name"
1327
+ }
1328
+ }, {
1329
+ type: "component",
1330
+ name: "plasmic-commerce-product-media"
1331
+ }],
1332
+ styles: {
1333
+ width: "100%",
1334
+ minWidth: 0
1335
+ }
1336
+ }]
1337
+ },
1338
+ noLayout: "boolean",
1339
+ id: {
1340
+ type: "string",
1341
+ description: "Fetch a product by its slug or ID"
1342
+ }
1343
+ },
1344
+ importPath: "@plasmicpkgs/commerce",
1345
+ importName: "ProductBox"
1346
+ };
1347
+ function ProductBox(props) {
1348
+ var className = props.className,
1349
+ children = props.children,
1350
+ noLayout = props.noLayout,
1351
+ id = props.id;
1352
+
1353
+ var _useProduct = useProduct$1({
1354
+ id: id
1355
+ }),
1356
+ data = _useProduct.data,
1357
+ error = _useProduct.error,
1358
+ isLoading = _useProduct.isLoading;
1359
+
1360
+ if (!id) {
1361
+ return React__default.createElement("span", null, "You must set the id prop");
1362
+ }
1363
+
1364
+ if (error) {
1365
+ throw new CommerceError({
1366
+ message: error.message,
1367
+ code: error.code
1368
+ });
1369
+ }
1370
+
1371
+ if (isLoading) {
1372
+ return React__default.createElement("span", null, "Loading...");
1373
+ }
1374
+
1375
+ if (!data) {
1376
+ throw new Error("Product not found!");
1377
+ }
1378
+
1379
+ var renderedData = React__default.createElement(ProductProvider, {
1380
+ product: data
1381
+ }, children);
1382
+ return noLayout ? React__default.createElement(React__default.Fragment, null, renderedData) : React__default.createElement("div", {
1383
+ className: className
1384
+ }, renderedData);
1385
+ }
1386
+ function registerProductBox(loader, customProductBoxMeta) {
1387
+ var doRegisterComponent = function doRegisterComponent() {
1388
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1389
+ };
1390
+
1391
+ doRegisterComponent(ProductBox, customProductBoxMeta != null ? customProductBoxMeta : productBoxMeta);
1392
+ }
1393
+
1394
+ var fetcher$2 = SWRFetcher;
1395
+
1396
+ var fn$2 = function fn(provider) {
1397
+ var _provider$products;
1398
+
1399
+ return (_provider$products = provider.products) == null ? void 0 : _provider$products.useSearch;
1400
+ };
1401
+
1402
+ var useSearch = function useSearch(input) {
1403
+ var hook = useHook(fn$2);
1404
+ return useSWRHook(_extends({
1405
+ fetcher: fetcher$2
1406
+ }, hook))(input);
1407
+ };
1408
+
1409
+ var fetcher$3 = SWRFetcher;
1410
+
1411
+ var fn$3 = function fn(provider) {
1412
+ var _provider$site;
1413
+
1414
+ return (_provider$site = provider.site) == null ? void 0 : _provider$site.useCategories;
1415
+ };
1416
+
1417
+ var useCategories = function useCategories(input) {
1418
+ var hook = useHook(fn$3);
1419
+ return useSWRHook(_extends({
1420
+ fetcher: fetcher$3
1421
+ }, hook))(input);
1422
+ };
1423
+
1424
+ var fetcher$4 = SWRFetcher;
1425
+
1426
+ var fn$4 = function fn(provider) {
1427
+ var _provider$site;
1428
+
1429
+ return (_provider$site = provider.site) == null ? void 0 : _provider$site.useBrands;
1430
+ };
1431
+
1432
+ var useBrands = function useBrands(input) {
1433
+ var hook = useHook(fn$4);
1434
+ return useSWRHook(_extends({
1435
+ fetcher: fetcher$4
1436
+ }, hook))(input);
1437
+ };
1438
+
1439
+ var useCommerceExtraFeatures = function useCommerceExtraFeatures() {
1440
+ var _useCommerce = useCommerce(),
1441
+ providerRef = _useCommerce.providerRef;
1442
+
1443
+ return providerRef.current.extraFeatures;
1444
+ };
1445
+
1309
1446
  var productCollectionMeta = {
1310
1447
  name: "plasmic-commerce-product-collection",
1311
1448
  displayName: "Product Collection",
@@ -1344,6 +1481,14 @@ var productCollectionMeta = {
1344
1481
  })) != null ? _ctx$categories$map : [];
1345
1482
  }
1346
1483
  },
1484
+ includeSubCategories: {
1485
+ type: "boolean",
1486
+ hidden: function hidden(props, ctx) {
1487
+ var _ctx$features;
1488
+
1489
+ return !(ctx != null && (_ctx$features = ctx.features) != null && _ctx$features.includeSubCategories);
1490
+ }
1491
+ },
1347
1492
  brand: {
1348
1493
  type: "choice",
1349
1494
  options: function options(props, ctx) {
@@ -1356,7 +1501,8 @@ var productCollectionMeta = {
1356
1501
  };
1357
1502
  })) != null ? _ctx$brands$map : [];
1358
1503
  }
1359
- }
1504
+ },
1505
+ noLayout: "boolean"
1360
1506
  },
1361
1507
  defaultStyles: {
1362
1508
  display: "grid",
@@ -1366,48 +1512,54 @@ var productCollectionMeta = {
1366
1512
  padding: "8px",
1367
1513
  maxWidth: "100%"
1368
1514
  },
1369
- importPath: "commerce-providers/commerce",
1515
+ importPath: "@plasmicpkgs/commerce",
1370
1516
  importName: "ProductCollection"
1371
1517
  };
1372
-
1373
1518
  function ProductCollection(props) {
1374
1519
  var className = props.className,
1375
1520
  children = props.children,
1376
1521
  count = props.count,
1377
1522
  category = props.category,
1523
+ includeSubCategories = props.includeSubCategories,
1378
1524
  brand = props.brand,
1525
+ noLayout = props.noLayout,
1379
1526
  setControlContextData = props.setControlContextData;
1380
1527
 
1528
+ var _useCategories = useCategories(),
1529
+ categories = _useCategories.data;
1530
+
1531
+ var _useBrands = useBrands(),
1532
+ brands = _useBrands.data;
1533
+
1381
1534
  var _useSearch = useSearch({
1382
1535
  categoryId: category,
1383
1536
  brandId: brand,
1384
- count: count
1537
+ count: count,
1538
+ categories: categories != null ? categories : [],
1539
+ includeSubCategories: includeSubCategories
1385
1540
  }),
1386
1541
  data = _useSearch.data;
1387
1542
 
1388
- var _useCategories = useCategories({}),
1389
- categories = _useCategories.data;
1390
-
1391
- var _useBrands = useBrands({}),
1392
- brands = _useBrands.data;
1543
+ var features = useCommerceExtraFeatures();
1393
1544
 
1394
1545
  if (categories && brands) {
1395
1546
  setControlContextData == null ? void 0 : setControlContextData({
1396
1547
  categories: categories,
1397
- brands: brands
1548
+ brands: brands,
1549
+ features: features
1398
1550
  });
1399
1551
  }
1400
1552
 
1401
- return React__default.createElement("div", {
1402
- className: className
1403
- }, data == null ? void 0 : data.products.map(function (product, i) {
1553
+ var renderedData = data == null ? void 0 : data.products.map(function (product, i) {
1404
1554
  return React__default.createElement(ProductProvider, {
1405
1555
  product: product,
1406
1556
  key: product.id
1407
1557
  }, host.repeatedElement(i === 0, children));
1408
- }));
1558
+ });
1559
+ return noLayout ? React__default.createElement(React__default.Fragment, null, renderedData) : React__default.createElement("div", {
1560
+ className: className
1561
+ }, renderedData);
1409
1562
  }
1410
-
1411
1563
  function registerProductCollection(loader, customProductCollectionMeta) {
1412
1564
  var doRegisterComponent = function doRegisterComponent() {
1413
1565
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
@@ -1416,6 +1568,69 @@ function registerProductCollection(loader, customProductCollectionMeta) {
1416
1568
  doRegisterComponent(ProductCollection, customProductCollectionMeta != null ? customProductCollectionMeta : productCollectionMeta);
1417
1569
  }
1418
1570
 
1571
+ var productLinkMeta = {
1572
+ name: "plasmic-commerce-product-link",
1573
+ displayName: "Product Link",
1574
+ props: {
1575
+ children: "slot",
1576
+ linkDest: {
1577
+ type: "string",
1578
+ defaultValueHint: "products/{slug}",
1579
+ description: "Set the link destination. You can use {slug} to replace by the product slug"
1580
+ }
1581
+ },
1582
+ importPath: "@plasmicpkgs/commerce",
1583
+ importName: "ProductLink"
1584
+ };
1585
+ function ProductLink(props) {
1586
+ var className = props.className,
1587
+ children = props.children,
1588
+ linkDest = props.linkDest;
1589
+ var product = useProduct();
1590
+
1591
+ var resolveLink = function resolveLink(linkDest) {
1592
+ var _linkDest$match;
1593
+
1594
+ if (!product || !linkDest) {
1595
+ return undefined;
1596
+ }
1597
+
1598
+ var regex = /{[^}]*}/;
1599
+ var regexAll = new RegExp(regex, "g");
1600
+ var matches = (_linkDest$match = linkDest.match(regexAll)) != null ? _linkDest$match : [];
1601
+ var resolvedLink = linkDest;
1602
+
1603
+ for (var _iterator = _createForOfIteratorHelperLoose(matches), _step; !(_step = _iterator()).done;) {
1604
+ var match = _step.value;
1605
+ var field = match.slice(1, -1);
1606
+
1607
+ if (!(field in product)) {
1608
+ return undefined;
1609
+ }
1610
+
1611
+ resolvedLink = resolvedLink.replace(regex, product[field]);
1612
+ }
1613
+
1614
+ return resolvedLink;
1615
+ };
1616
+
1617
+ return React__default.createElement("a", {
1618
+ className: className,
1619
+ href: resolveLink(linkDest),
1620
+ style: {
1621
+ color: "inherit",
1622
+ textDecoration: "inherit"
1623
+ }
1624
+ }, children);
1625
+ }
1626
+ function registerProductLink(loader, customProductLinkMeta) {
1627
+ var doRegisterComponent = function doRegisterComponent() {
1628
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1629
+ };
1630
+
1631
+ doRegisterComponent(ProductLink, customProductLinkMeta != null ? customProductLinkMeta : productLinkMeta);
1632
+ }
1633
+
1419
1634
  var placeholderImage = "https://static1.plasmic.app/commerce/lightweight-jacket-0.png";
1420
1635
  var productMediaMeta = {
1421
1636
  name: "plasmic-commerce-product-media",
@@ -1423,7 +1638,7 @@ var productMediaMeta = {
1423
1638
  props: {
1424
1639
  mediaIndex: "number"
1425
1640
  },
1426
- importPath: "commerce-providers/commerce",
1641
+ importPath: "@plasmicpkgs/commerce",
1427
1642
  importName: "ProductMedia"
1428
1643
  };
1429
1644
  function ProductMedia(props) {
@@ -1528,10 +1743,10 @@ var productPriceMeta = {
1528
1743
  name: "plasmic-commerce-product-price",
1529
1744
  displayName: "Product Price",
1530
1745
  props: {},
1531
- importPath: "commerce-providers/commerce",
1746
+ importPath: "@plasmicpkgs/commerce",
1532
1747
  importName: "ProductPrice"
1533
1748
  };
1534
- function ProductPrice(props) {
1749
+ function ProductPriceComponent(props) {
1535
1750
  var className = props.className;
1536
1751
  var product = useProduct();
1537
1752
  var form = reactHookForm.useFormContext();
@@ -1557,7 +1772,7 @@ function registerProductPrice(loader, customProductPriceMeta) {
1557
1772
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1558
1773
  };
1559
1774
 
1560
- doRegisterComponent(ProductPrice, customProductPriceMeta != null ? customProductPriceMeta : productPriceMeta);
1775
+ doRegisterComponent(ProductPriceComponent, customProductPriceMeta != null ? customProductPriceMeta : productPriceMeta);
1561
1776
  }
1562
1777
 
1563
1778
  var productQuantityMeta = {
@@ -1574,7 +1789,7 @@ var productQuantityMeta = {
1574
1789
  }]
1575
1790
  }
1576
1791
  },
1577
- importPath: "commerce-providers/commerce",
1792
+ importPath: "@plasmicpkgs/commerce",
1578
1793
  importName: "ProductQuantity"
1579
1794
  };
1580
1795
  function ProductQuantity(props) {
@@ -1612,7 +1827,7 @@ var productTextFieldMeta = {
1612
1827
  options: ["id", "name", "description", "sku", "slug", "path"]
1613
1828
  }
1614
1829
  },
1615
- importPath: "commerce-providers/commerce",
1830
+ importPath: "@plasmicpkgs/commerce",
1616
1831
  importName: "ProductTextField"
1617
1832
  };
1618
1833
  function ProductTextField(props) {
@@ -1663,7 +1878,7 @@ var productVariantPickerMeta = {
1663
1878
  name: "plasmic-commerce-product-variant-picker",
1664
1879
  displayName: "Product Variant Picker",
1665
1880
  props: {},
1666
- importPath: "commerce-providers/commerce",
1881
+ importPath: "@plasmicpkgs/commerce",
1667
1882
  importName: "ProductVariantPicker"
1668
1883
  };
1669
1884
  function ProductVariantPicker(props) {
@@ -1696,7 +1911,7 @@ function registerProductVariantPicker(loader, customProductVariantPickerMeta) {
1696
1911
  doRegisterComponent(ProductVariantPicker, customProductVariantPickerMeta != null ? customProductVariantPickerMeta : productVariantPickerMeta);
1697
1912
  }
1698
1913
 
1699
- var fetcher$2 = /*#__PURE__*/function () {
1914
+ var fetcher$5 = /*#__PURE__*/function () {
1700
1915
  var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
1701
1916
  var options, cartId, fetch;
1702
1917
  return runtime_1.wrap(function _callee$(_context) {
@@ -1737,7 +1952,7 @@ var fetcher$2 = /*#__PURE__*/function () {
1737
1952
  };
1738
1953
  }();
1739
1954
 
1740
- var fn$2 = function fn(provider) {
1955
+ var fn$5 = function fn(provider) {
1741
1956
  var _provider$cart;
1742
1957
 
1743
1958
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useCart;
@@ -1746,12 +1961,12 @@ var fn$2 = function fn(provider) {
1746
1961
  var useCart = function useCart(input) {
1747
1962
  var _hook$fetcher;
1748
1963
 
1749
- var hook = useHook(fn$2);
1964
+ var hook = useHook(fn$5);
1750
1965
 
1751
1966
  var _useCommerce = useCommerce(),
1752
1967
  cartCookie = _useCommerce.cartCookie;
1753
1968
 
1754
- var fetcherFn = (_hook$fetcher = hook.fetcher) != null ? _hook$fetcher : fetcher$2;
1969
+ var fetcherFn = (_hook$fetcher = hook.fetcher) != null ? _hook$fetcher : fetcher$5;
1755
1970
 
1756
1971
  var wrapper = function wrapper(context) {
1757
1972
  context.input.cartId = Cookies.get(cartCookie);
@@ -1763,20 +1978,19 @@ var useCart = function useCart(input) {
1763
1978
  }))(input);
1764
1979
  };
1765
1980
 
1766
- var useCartMeta = {
1767
- name: "plasmic-commerce-use-cart",
1768
- displayName: "Use Cart",
1981
+ var cartMeta = {
1982
+ name: "plasmic-commerce-cart",
1983
+ displayName: "Cart",
1769
1984
  props: {
1770
1985
  field: {
1771
1986
  type: "choice",
1772
1987
  options: ["Size", "Total Price"]
1773
1988
  }
1774
1989
  },
1775
- importPath: "commerce-providers/commerce",
1776
- importName: "UseCart"
1990
+ importPath: "@plasmicpkgs/commerce",
1991
+ importName: "Cart"
1777
1992
  };
1778
-
1779
- function UseCartComponent(props) {
1993
+ function CartComponent(props) {
1780
1994
  var _data$totalPrice, _data$currency$code;
1781
1995
 
1782
1996
  var className = props.className,
@@ -1809,82 +2023,47 @@ function UseCartComponent(props) {
1809
2023
  className: className
1810
2024
  }, value);
1811
2025
  }
1812
-
1813
- function registerUseCart(loader, customUseCartMeta) {
2026
+ function registerCart(loader, customCartMeta) {
1814
2027
  var doRegisterComponent = function doRegisterComponent() {
1815
2028
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1816
2029
  };
1817
2030
 
1818
- doRegisterComponent(UseCartComponent, customUseCartMeta != null ? customUseCartMeta : useCartMeta);
2031
+ doRegisterComponent(CartComponent, customCartMeta != null ? customCartMeta : cartMeta);
1819
2032
  }
1820
2033
 
1821
- var x = function x() {
1822
- return 2;
1823
- };
1824
-
1825
2034
 
1826
2035
 
1827
2036
  var product = {
1828
2037
  __proto__: null
1829
2038
  };
1830
2039
 
1831
- var fetcher$3 = SWRFetcher;
1832
-
1833
- var fn$3 = function fn(provider) {
1834
- var _provider$site;
1835
-
1836
- return (_provider$site = provider.site) == null ? void 0 : _provider$site.useCategories;
1837
- };
1838
-
1839
- var useCategories = function useCategories(input) {
1840
- var hook = useHook(fn$3);
1841
- return useSWRHook(_extends({
1842
- fetcher: fetcher$3
1843
- }, hook))(input);
1844
- };
1845
-
1846
- var fetcher$4 = SWRFetcher;
1847
-
1848
- var fn$4 = function fn(provider) {
1849
- var _provider$site;
1850
-
1851
- return (_provider$site = provider.site) == null ? void 0 : _provider$site.useBrands;
1852
- };
1853
-
1854
- var useBrands = function useBrands(input) {
1855
- var hook = useHook(fn$4);
1856
- return useSWRHook(_extends({
1857
- fetcher: fetcher$4
1858
- }, hook))(input);
1859
- };
1860
-
1861
- var fetcher$5 = mutationFetcher;
2040
+ var fetcher$6 = mutationFetcher;
1862
2041
 
1863
- var fn$5 = function fn(provider) {
2042
+ var fn$6 = function fn(provider) {
1864
2043
  var _provider$cart;
1865
2044
 
1866
2045
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useRemoveItem;
1867
2046
  };
1868
2047
 
1869
2048
  var useRemoveItem = function useRemoveItem(input) {
1870
- var hook = useHook(fn$5);
2049
+ var hook = useHook(fn$6);
1871
2050
  return useMutationHook(_extends({
1872
- fetcher: fetcher$5
2051
+ fetcher: fetcher$6
1873
2052
  }, hook))(input);
1874
2053
  };
1875
2054
 
1876
- var fetcher$6 = mutationFetcher;
2055
+ var fetcher$7 = mutationFetcher;
1877
2056
 
1878
- var fn$6 = function fn(provider) {
2057
+ var fn$7 = function fn(provider) {
1879
2058
  var _provider$cart;
1880
2059
 
1881
2060
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useUpdateItem;
1882
2061
  };
1883
2062
 
1884
2063
  var useUpdateItem = function useUpdateItem(input) {
1885
- var hook = useHook(fn$6);
2064
+ var hook = useHook(fn$7);
1886
2065
  return useMutationHook(_extends({
1887
- fetcher: fetcher$6
2066
+ fetcher: fetcher$7
1888
2067
  }, hook))(input);
1889
2068
  };
1890
2069
 
@@ -1905,29 +2084,61 @@ function registerAll(loader) {
1905
2084
  registerTextField(loader);
1906
2085
  registerProductPrice(loader);
1907
2086
  registerProductMedia(loader);
1908
- registerUseCart(loader);
2087
+ registerCart(loader);
1909
2088
  registerAddToCartButton(loader);
1910
2089
  registerProductQuantity(loader);
1911
2090
  registerProductVariantPicker(loader);
2091
+ registerProductBox(loader);
2092
+ registerProductLink(loader);
1912
2093
  }
1913
2094
 
2095
+ exports.AddToCartButton = AddToCartButton;
2096
+ exports.CartComponent = CartComponent;
1914
2097
  exports.CartType = cart;
1915
2098
  exports.CommerceError = CommerceError;
1916
2099
  exports.CoreCommerceProvider = CoreCommerceProvider;
1917
2100
  exports.FetcherError = FetcherError;
2101
+ exports.ProductBox = ProductBox;
2102
+ exports.ProductCollection = ProductCollection;
2103
+ exports.ProductLink = ProductLink;
2104
+ exports.ProductMedia = ProductMedia;
2105
+ exports.ProductPriceComponent = ProductPriceComponent;
2106
+ exports.ProductQuantity = ProductQuantity;
2107
+ exports.ProductTextField = ProductTextField;
1918
2108
  exports.ProductTypes = product;
2109
+ exports.ProductVariantPicker = ProductVariantPicker;
1919
2110
  exports.SiteTypes = site;
1920
2111
  exports.ValidationError = ValidationError;
1921
- exports.fetcher = fetcher$1;
2112
+ exports.addToCartButtonMeta = addToCartButtonMeta;
2113
+ exports.cartMeta = cartMeta;
2114
+ exports.fetcher = fetcher$2;
1922
2115
  exports.getCommerceProvider = getCommerceProvider;
2116
+ exports.productBoxMeta = productBoxMeta;
2117
+ exports.productCollectionMeta = productCollectionMeta;
2118
+ exports.productLinkMeta = productLinkMeta;
2119
+ exports.productMediaMeta = productMediaMeta;
2120
+ exports.productPriceMeta = productPriceMeta;
2121
+ exports.productQuantityMeta = productQuantityMeta;
2122
+ exports.productTextFieldMeta = productTextFieldMeta;
2123
+ exports.productVariantPickerMeta = productVariantPickerMeta;
2124
+ exports.registerAddToCartButton = registerAddToCartButton;
1923
2125
  exports.registerAll = registerAll;
2126
+ exports.registerCart = registerCart;
2127
+ exports.registerProductBox = registerProductBox;
2128
+ exports.registerProductCollection = registerProductCollection;
2129
+ exports.registerProductLink = registerProductLink;
2130
+ exports.registerProductMedia = registerProductMedia;
2131
+ exports.registerProductPrice = registerProductPrice;
2132
+ exports.registerProductQuantity = registerProductQuantity;
2133
+ exports.registerProductVariantPicker = registerProductVariantPicker;
2134
+ exports.registerTextField = registerTextField;
1924
2135
  exports.useAddItem = useAddItem;
1925
2136
  exports.useBrands = useBrands;
1926
2137
  exports.useCart = useCart;
1927
2138
  exports.useCategories = useCategories;
1928
2139
  exports.useCommerce = useCommerce;
2140
+ exports.useProduct = useProduct$1;
1929
2141
  exports.useRemoveItem = useRemoveItem;
1930
2142
  exports.useSearch = useSearch;
1931
2143
  exports.useUpdateItem = useUpdateItem;
1932
- exports.x = x;
1933
2144
  //# sourceMappingURL=commerce.cjs.development.js.map