@plasmicapp/loader-core 1.0.76 → 1.0.77

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.
@@ -4,6 +4,60 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var loaderFetcher = require('@plasmicapp/loader-fetcher');
6
6
 
7
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8
+ try {
9
+ var info = gen[key](arg);
10
+ var value = info.value;
11
+ } catch (error) {
12
+ reject(error);
13
+ return;
14
+ }
15
+
16
+ if (info.done) {
17
+ resolve(value);
18
+ } else {
19
+ Promise.resolve(value).then(_next, _throw);
20
+ }
21
+ }
22
+
23
+ function _asyncToGenerator(fn) {
24
+ return function () {
25
+ var self = this,
26
+ args = arguments;
27
+ return new Promise(function (resolve, reject) {
28
+ var gen = fn.apply(self, args);
29
+
30
+ function _next(value) {
31
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
32
+ }
33
+
34
+ function _throw(err) {
35
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
36
+ }
37
+
38
+ _next(undefined);
39
+ });
40
+ };
41
+ }
42
+
43
+ function _extends() {
44
+ _extends = Object.assign || function (target) {
45
+ for (var i = 1; i < arguments.length; i++) {
46
+ var source = arguments[i];
47
+
48
+ for (var key in source) {
49
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
50
+ target[key] = source[key];
51
+ }
52
+ }
53
+ }
54
+
55
+ return target;
56
+ };
57
+
58
+ return _extends.apply(this, arguments);
59
+ }
60
+
7
61
  function _unsupportedIterableToArray(o, minLen) {
8
62
  if (!o) return;
9
63
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -302,6 +356,1081 @@ function resolvePath(path, from) {
302
356
  }
303
357
  }
304
358
 
359
+ function createCommonjsModule(fn, module) {
360
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
361
+ }
362
+
363
+ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
364
+ /**
365
+ * Copyright (c) 2014-present, Facebook, Inc.
366
+ *
367
+ * This source code is licensed under the MIT license found in the
368
+ * LICENSE file in the root directory of this source tree.
369
+ */
370
+ var runtime = function (exports) {
371
+
372
+ var Op = Object.prototype;
373
+ var hasOwn = Op.hasOwnProperty;
374
+ var undefined$1; // More compressible than void 0.
375
+
376
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
377
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
378
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
379
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
380
+
381
+ function define(obj, key, value) {
382
+ Object.defineProperty(obj, key, {
383
+ value: value,
384
+ enumerable: true,
385
+ configurable: true,
386
+ writable: true
387
+ });
388
+ return obj[key];
389
+ }
390
+
391
+ try {
392
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
393
+ define({}, "");
394
+ } catch (err) {
395
+ define = function define(obj, key, value) {
396
+ return obj[key] = value;
397
+ };
398
+ }
399
+
400
+ function wrap(innerFn, outerFn, self, tryLocsList) {
401
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
402
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
403
+ var generator = Object.create(protoGenerator.prototype);
404
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
405
+ // .throw, and .return methods.
406
+
407
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
408
+ return generator;
409
+ }
410
+
411
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
412
+ // record like context.tryEntries[i].completion. This interface could
413
+ // have been (and was previously) designed to take a closure to be
414
+ // invoked without arguments, but in all the cases we care about we
415
+ // already have an existing method we want to call, so there's no need
416
+ // to create a new function object. We can even get away with assuming
417
+ // the method takes exactly one argument, since that happens to be true
418
+ // in every case, so we don't have to touch the arguments object. The
419
+ // only additional allocation required is the completion record, which
420
+ // has a stable shape and so hopefully should be cheap to allocate.
421
+
422
+ function tryCatch(fn, obj, arg) {
423
+ try {
424
+ return {
425
+ type: "normal",
426
+ arg: fn.call(obj, arg)
427
+ };
428
+ } catch (err) {
429
+ return {
430
+ type: "throw",
431
+ arg: err
432
+ };
433
+ }
434
+ }
435
+
436
+ var GenStateSuspendedStart = "suspendedStart";
437
+ var GenStateSuspendedYield = "suspendedYield";
438
+ var GenStateExecuting = "executing";
439
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
440
+ // breaking out of the dispatch switch statement.
441
+
442
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
443
+ // .constructor.prototype properties for functions that return Generator
444
+ // objects. For full spec compliance, you may wish to configure your
445
+ // minifier not to mangle the names of these two functions.
446
+
447
+ function Generator() {}
448
+
449
+ function GeneratorFunction() {}
450
+
451
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
452
+ // don't natively support it.
453
+
454
+
455
+ var IteratorPrototype = {};
456
+ define(IteratorPrototype, iteratorSymbol, function () {
457
+ return this;
458
+ });
459
+ var getProto = Object.getPrototypeOf;
460
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
461
+
462
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
463
+ // This environment has a native %IteratorPrototype%; use it instead
464
+ // of the polyfill.
465
+ IteratorPrototype = NativeIteratorPrototype;
466
+ }
467
+
468
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
469
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
470
+ define(Gp, "constructor", GeneratorFunctionPrototype);
471
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
472
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
473
+ // Iterator interface in terms of a single ._invoke method.
474
+
475
+ function defineIteratorMethods(prototype) {
476
+ ["next", "throw", "return"].forEach(function (method) {
477
+ define(prototype, method, function (arg) {
478
+ return this._invoke(method, arg);
479
+ });
480
+ });
481
+ }
482
+
483
+ exports.isGeneratorFunction = function (genFun) {
484
+ var ctor = typeof genFun === "function" && genFun.constructor;
485
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
486
+ // do is to check its .name property.
487
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
488
+ };
489
+
490
+ exports.mark = function (genFun) {
491
+ if (Object.setPrototypeOf) {
492
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
493
+ } else {
494
+ genFun.__proto__ = GeneratorFunctionPrototype;
495
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
496
+ }
497
+
498
+ genFun.prototype = Object.create(Gp);
499
+ return genFun;
500
+ }; // Within the body of any async function, `await x` is transformed to
501
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
502
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
503
+ // meant to be awaited.
504
+
505
+
506
+ exports.awrap = function (arg) {
507
+ return {
508
+ __await: arg
509
+ };
510
+ };
511
+
512
+ function AsyncIterator(generator, PromiseImpl) {
513
+ function invoke(method, arg, resolve, reject) {
514
+ var record = tryCatch(generator[method], generator, arg);
515
+
516
+ if (record.type === "throw") {
517
+ reject(record.arg);
518
+ } else {
519
+ var result = record.arg;
520
+ var value = result.value;
521
+
522
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
523
+ return PromiseImpl.resolve(value.__await).then(function (value) {
524
+ invoke("next", value, resolve, reject);
525
+ }, function (err) {
526
+ invoke("throw", err, resolve, reject);
527
+ });
528
+ }
529
+
530
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
531
+ // When a yielded Promise is resolved, its final value becomes
532
+ // the .value of the Promise<{value,done}> result for the
533
+ // current iteration.
534
+ result.value = unwrapped;
535
+ resolve(result);
536
+ }, function (error) {
537
+ // If a rejected Promise was yielded, throw the rejection back
538
+ // into the async generator function so it can be handled there.
539
+ return invoke("throw", error, resolve, reject);
540
+ });
541
+ }
542
+ }
543
+
544
+ var previousPromise;
545
+
546
+ function enqueue(method, arg) {
547
+ function callInvokeWithMethodAndArg() {
548
+ return new PromiseImpl(function (resolve, reject) {
549
+ invoke(method, arg, resolve, reject);
550
+ });
551
+ }
552
+
553
+ return previousPromise = // If enqueue has been called before, then we want to wait until
554
+ // all previous Promises have been resolved before calling invoke,
555
+ // so that results are always delivered in the correct order. If
556
+ // enqueue has not been called before, then it is important to
557
+ // call invoke immediately, without waiting on a callback to fire,
558
+ // so that the async generator function has the opportunity to do
559
+ // any necessary setup in a predictable way. This predictability
560
+ // is why the Promise constructor synchronously invokes its
561
+ // executor callback, and why async functions synchronously
562
+ // execute code before the first await. Since we implement simple
563
+ // async functions in terms of async generators, it is especially
564
+ // important to get this right, even though it requires care.
565
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
566
+ // invocations of the iterator.
567
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
568
+ } // Define the unified helper method that is used to implement .next,
569
+ // .throw, and .return (see defineIteratorMethods).
570
+
571
+
572
+ this._invoke = enqueue;
573
+ }
574
+
575
+ defineIteratorMethods(AsyncIterator.prototype);
576
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
577
+ return this;
578
+ });
579
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
580
+ // AsyncIterator objects; they just return a Promise for the value of
581
+ // the final result produced by the iterator.
582
+
583
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
584
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
585
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
586
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
587
+ : iter.next().then(function (result) {
588
+ return result.done ? result.value : iter.next();
589
+ });
590
+ };
591
+
592
+ function makeInvokeMethod(innerFn, self, context) {
593
+ var state = GenStateSuspendedStart;
594
+ return function invoke(method, arg) {
595
+ if (state === GenStateExecuting) {
596
+ throw new Error("Generator is already running");
597
+ }
598
+
599
+ if (state === GenStateCompleted) {
600
+ if (method === "throw") {
601
+ throw arg;
602
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
603
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
604
+
605
+
606
+ return doneResult();
607
+ }
608
+
609
+ context.method = method;
610
+ context.arg = arg;
611
+
612
+ while (true) {
613
+ var delegate = context.delegate;
614
+
615
+ if (delegate) {
616
+ var delegateResult = maybeInvokeDelegate(delegate, context);
617
+
618
+ if (delegateResult) {
619
+ if (delegateResult === ContinueSentinel) continue;
620
+ return delegateResult;
621
+ }
622
+ }
623
+
624
+ if (context.method === "next") {
625
+ // Setting context._sent for legacy support of Babel's
626
+ // function.sent implementation.
627
+ context.sent = context._sent = context.arg;
628
+ } else if (context.method === "throw") {
629
+ if (state === GenStateSuspendedStart) {
630
+ state = GenStateCompleted;
631
+ throw context.arg;
632
+ }
633
+
634
+ context.dispatchException(context.arg);
635
+ } else if (context.method === "return") {
636
+ context.abrupt("return", context.arg);
637
+ }
638
+
639
+ state = GenStateExecuting;
640
+ var record = tryCatch(innerFn, self, context);
641
+
642
+ if (record.type === "normal") {
643
+ // If an exception is thrown from innerFn, we leave state ===
644
+ // GenStateExecuting and loop back for another invocation.
645
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
646
+
647
+ if (record.arg === ContinueSentinel) {
648
+ continue;
649
+ }
650
+
651
+ return {
652
+ value: record.arg,
653
+ done: context.done
654
+ };
655
+ } else if (record.type === "throw") {
656
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
657
+ // context.dispatchException(context.arg) call above.
658
+
659
+ context.method = "throw";
660
+ context.arg = record.arg;
661
+ }
662
+ }
663
+ };
664
+ } // Call delegate.iterator[context.method](context.arg) and handle the
665
+ // result, either by returning a { value, done } result from the
666
+ // delegate iterator, or by modifying context.method and context.arg,
667
+ // setting context.delegate to null, and returning the ContinueSentinel.
668
+
669
+
670
+ function maybeInvokeDelegate(delegate, context) {
671
+ var method = delegate.iterator[context.method];
672
+
673
+ if (method === undefined$1) {
674
+ // A .throw or .return when the delegate iterator has no .throw
675
+ // method always terminates the yield* loop.
676
+ context.delegate = null;
677
+
678
+ if (context.method === "throw") {
679
+ // Note: ["return"] must be used for ES3 parsing compatibility.
680
+ if (delegate.iterator["return"]) {
681
+ // If the delegate iterator has a return method, give it a
682
+ // chance to clean up.
683
+ context.method = "return";
684
+ context.arg = undefined$1;
685
+ maybeInvokeDelegate(delegate, context);
686
+
687
+ if (context.method === "throw") {
688
+ // If maybeInvokeDelegate(context) changed context.method from
689
+ // "return" to "throw", let that override the TypeError below.
690
+ return ContinueSentinel;
691
+ }
692
+ }
693
+
694
+ context.method = "throw";
695
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
696
+ }
697
+
698
+ return ContinueSentinel;
699
+ }
700
+
701
+ var record = tryCatch(method, delegate.iterator, context.arg);
702
+
703
+ if (record.type === "throw") {
704
+ context.method = "throw";
705
+ context.arg = record.arg;
706
+ context.delegate = null;
707
+ return ContinueSentinel;
708
+ }
709
+
710
+ var info = record.arg;
711
+
712
+ if (!info) {
713
+ context.method = "throw";
714
+ context.arg = new TypeError("iterator result is not an object");
715
+ context.delegate = null;
716
+ return ContinueSentinel;
717
+ }
718
+
719
+ if (info.done) {
720
+ // Assign the result of the finished delegate to the temporary
721
+ // variable specified by delegate.resultName (see delegateYield).
722
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
723
+
724
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
725
+ // exception, let the outer generator proceed normally. If
726
+ // context.method was "next", forget context.arg since it has been
727
+ // "consumed" by the delegate iterator. If context.method was
728
+ // "return", allow the original .return call to continue in the
729
+ // outer generator.
730
+
731
+ if (context.method !== "return") {
732
+ context.method = "next";
733
+ context.arg = undefined$1;
734
+ }
735
+ } else {
736
+ // Re-yield the result returned by the delegate method.
737
+ return info;
738
+ } // The delegate iterator is finished, so forget it and continue with
739
+ // the outer generator.
740
+
741
+
742
+ context.delegate = null;
743
+ return ContinueSentinel;
744
+ } // Define Generator.prototype.{next,throw,return} in terms of the
745
+ // unified ._invoke helper method.
746
+
747
+
748
+ defineIteratorMethods(Gp);
749
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
750
+ // @@iterator function is called on it. Some browsers' implementations of the
751
+ // iterator prototype chain incorrectly implement this, causing the Generator
752
+ // object to not be returned from this call. This ensures that doesn't happen.
753
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
754
+
755
+ define(Gp, iteratorSymbol, function () {
756
+ return this;
757
+ });
758
+ define(Gp, "toString", function () {
759
+ return "[object Generator]";
760
+ });
761
+
762
+ function pushTryEntry(locs) {
763
+ var entry = {
764
+ tryLoc: locs[0]
765
+ };
766
+
767
+ if (1 in locs) {
768
+ entry.catchLoc = locs[1];
769
+ }
770
+
771
+ if (2 in locs) {
772
+ entry.finallyLoc = locs[2];
773
+ entry.afterLoc = locs[3];
774
+ }
775
+
776
+ this.tryEntries.push(entry);
777
+ }
778
+
779
+ function resetTryEntry(entry) {
780
+ var record = entry.completion || {};
781
+ record.type = "normal";
782
+ delete record.arg;
783
+ entry.completion = record;
784
+ }
785
+
786
+ function Context(tryLocsList) {
787
+ // The root entry object (effectively a try statement without a catch
788
+ // or a finally block) gives us a place to store values thrown from
789
+ // locations where there is no enclosing try statement.
790
+ this.tryEntries = [{
791
+ tryLoc: "root"
792
+ }];
793
+ tryLocsList.forEach(pushTryEntry, this);
794
+ this.reset(true);
795
+ }
796
+
797
+ exports.keys = function (object) {
798
+ var keys = [];
799
+
800
+ for (var key in object) {
801
+ keys.push(key);
802
+ }
803
+
804
+ keys.reverse(); // Rather than returning an object with a next method, we keep
805
+ // things simple and return the next function itself.
806
+
807
+ return function next() {
808
+ while (keys.length) {
809
+ var key = keys.pop();
810
+
811
+ if (key in object) {
812
+ next.value = key;
813
+ next.done = false;
814
+ return next;
815
+ }
816
+ } // To avoid creating an additional object, we just hang the .value
817
+ // and .done properties off the next function object itself. This
818
+ // also ensures that the minifier will not anonymize the function.
819
+
820
+
821
+ next.done = true;
822
+ return next;
823
+ };
824
+ };
825
+
826
+ function values(iterable) {
827
+ if (iterable) {
828
+ var iteratorMethod = iterable[iteratorSymbol];
829
+
830
+ if (iteratorMethod) {
831
+ return iteratorMethod.call(iterable);
832
+ }
833
+
834
+ if (typeof iterable.next === "function") {
835
+ return iterable;
836
+ }
837
+
838
+ if (!isNaN(iterable.length)) {
839
+ var i = -1,
840
+ next = function next() {
841
+ while (++i < iterable.length) {
842
+ if (hasOwn.call(iterable, i)) {
843
+ next.value = iterable[i];
844
+ next.done = false;
845
+ return next;
846
+ }
847
+ }
848
+
849
+ next.value = undefined$1;
850
+ next.done = true;
851
+ return next;
852
+ };
853
+
854
+ return next.next = next;
855
+ }
856
+ } // Return an iterator with no values.
857
+
858
+
859
+ return {
860
+ next: doneResult
861
+ };
862
+ }
863
+
864
+ exports.values = values;
865
+
866
+ function doneResult() {
867
+ return {
868
+ value: undefined$1,
869
+ done: true
870
+ };
871
+ }
872
+
873
+ Context.prototype = {
874
+ constructor: Context,
875
+ reset: function reset(skipTempReset) {
876
+ this.prev = 0;
877
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
878
+ // function.sent implementation.
879
+
880
+ this.sent = this._sent = undefined$1;
881
+ this.done = false;
882
+ this.delegate = null;
883
+ this.method = "next";
884
+ this.arg = undefined$1;
885
+ this.tryEntries.forEach(resetTryEntry);
886
+
887
+ if (!skipTempReset) {
888
+ for (var name in this) {
889
+ // Not sure about the optimal order of these conditions:
890
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
891
+ this[name] = undefined$1;
892
+ }
893
+ }
894
+ }
895
+ },
896
+ stop: function stop() {
897
+ this.done = true;
898
+ var rootEntry = this.tryEntries[0];
899
+ var rootRecord = rootEntry.completion;
900
+
901
+ if (rootRecord.type === "throw") {
902
+ throw rootRecord.arg;
903
+ }
904
+
905
+ return this.rval;
906
+ },
907
+ dispatchException: function dispatchException(exception) {
908
+ if (this.done) {
909
+ throw exception;
910
+ }
911
+
912
+ var context = this;
913
+
914
+ function handle(loc, caught) {
915
+ record.type = "throw";
916
+ record.arg = exception;
917
+ context.next = loc;
918
+
919
+ if (caught) {
920
+ // If the dispatched exception was caught by a catch block,
921
+ // then let that catch block handle the exception normally.
922
+ context.method = "next";
923
+ context.arg = undefined$1;
924
+ }
925
+
926
+ return !!caught;
927
+ }
928
+
929
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
930
+ var entry = this.tryEntries[i];
931
+ var record = entry.completion;
932
+
933
+ if (entry.tryLoc === "root") {
934
+ // Exception thrown outside of any try block that could handle
935
+ // it, so set the completion value of the entire function to
936
+ // throw the exception.
937
+ return handle("end");
938
+ }
939
+
940
+ if (entry.tryLoc <= this.prev) {
941
+ var hasCatch = hasOwn.call(entry, "catchLoc");
942
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
943
+
944
+ if (hasCatch && hasFinally) {
945
+ if (this.prev < entry.catchLoc) {
946
+ return handle(entry.catchLoc, true);
947
+ } else if (this.prev < entry.finallyLoc) {
948
+ return handle(entry.finallyLoc);
949
+ }
950
+ } else if (hasCatch) {
951
+ if (this.prev < entry.catchLoc) {
952
+ return handle(entry.catchLoc, true);
953
+ }
954
+ } else if (hasFinally) {
955
+ if (this.prev < entry.finallyLoc) {
956
+ return handle(entry.finallyLoc);
957
+ }
958
+ } else {
959
+ throw new Error("try statement without catch or finally");
960
+ }
961
+ }
962
+ }
963
+ },
964
+ abrupt: function abrupt(type, arg) {
965
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
966
+ var entry = this.tryEntries[i];
967
+
968
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
969
+ var finallyEntry = entry;
970
+ break;
971
+ }
972
+ }
973
+
974
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
975
+ // Ignore the finally entry if control is not jumping to a
976
+ // location outside the try/catch block.
977
+ finallyEntry = null;
978
+ }
979
+
980
+ var record = finallyEntry ? finallyEntry.completion : {};
981
+ record.type = type;
982
+ record.arg = arg;
983
+
984
+ if (finallyEntry) {
985
+ this.method = "next";
986
+ this.next = finallyEntry.finallyLoc;
987
+ return ContinueSentinel;
988
+ }
989
+
990
+ return this.complete(record);
991
+ },
992
+ complete: function complete(record, afterLoc) {
993
+ if (record.type === "throw") {
994
+ throw record.arg;
995
+ }
996
+
997
+ if (record.type === "break" || record.type === "continue") {
998
+ this.next = record.arg;
999
+ } else if (record.type === "return") {
1000
+ this.rval = this.arg = record.arg;
1001
+ this.method = "return";
1002
+ this.next = "end";
1003
+ } else if (record.type === "normal" && afterLoc) {
1004
+ this.next = afterLoc;
1005
+ }
1006
+
1007
+ return ContinueSentinel;
1008
+ },
1009
+ finish: function finish(finallyLoc) {
1010
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1011
+ var entry = this.tryEntries[i];
1012
+
1013
+ if (entry.finallyLoc === finallyLoc) {
1014
+ this.complete(entry.completion, entry.afterLoc);
1015
+ resetTryEntry(entry);
1016
+ return ContinueSentinel;
1017
+ }
1018
+ }
1019
+ },
1020
+ "catch": function _catch(tryLoc) {
1021
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1022
+ var entry = this.tryEntries[i];
1023
+
1024
+ if (entry.tryLoc === tryLoc) {
1025
+ var record = entry.completion;
1026
+
1027
+ if (record.type === "throw") {
1028
+ var thrown = record.arg;
1029
+ resetTryEntry(entry);
1030
+ }
1031
+
1032
+ return thrown;
1033
+ }
1034
+ } // The context.catch method must only be called with a location
1035
+ // argument that corresponds to a known catch block.
1036
+
1037
+
1038
+ throw new Error("illegal catch attempt");
1039
+ },
1040
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
1041
+ this.delegate = {
1042
+ iterator: values(iterable),
1043
+ resultName: resultName,
1044
+ nextLoc: nextLoc
1045
+ };
1046
+
1047
+ if (this.method === "next") {
1048
+ // Deliberately forget the last sent value so that we don't
1049
+ // accidentally pass it on to the delegate.
1050
+ this.arg = undefined$1;
1051
+ }
1052
+
1053
+ return ContinueSentinel;
1054
+ }
1055
+ }; // Regardless of whether this script is executing as a CommonJS module
1056
+ // or not, return the runtime object so that we can declare the variable
1057
+ // regeneratorRuntime in the outer scope, which allows this module to be
1058
+ // injected easily by `bin/regenerator --include-runtime script.js`.
1059
+
1060
+ return exports;
1061
+ }( // If this script is executing as a CommonJS module, use module.exports
1062
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
1063
+ // object. Either way, the resulting object will be used to initialize
1064
+ // the regeneratorRuntime variable at the top of this file.
1065
+ module.exports );
1066
+
1067
+ try {
1068
+ regeneratorRuntime = runtime;
1069
+ } catch (accidentalStrictMode) {
1070
+ // This module should not be running in strict mode, so the above
1071
+ // assignment should always work unless something is misconfigured. Just
1072
+ // in case runtime.js accidentally runs in strict mode, in modern engines
1073
+ // we can explicitly access globalThis. In older engines we can escape
1074
+ // strict mode using a global Function call. This could conceivably fail
1075
+ // if a Content Security Policy forbids using Function, but in that case
1076
+ // the proper solution is to fix the accidental strict mode problem. If
1077
+ // you've misconfigured your bundler to force strict mode and applied a
1078
+ // CSP to forbid Function, and you're not willing to fix either of those
1079
+ // problems, please detail your unique predicament in a GitHub issue.
1080
+ if (typeof globalThis === "object") {
1081
+ globalThis.regeneratorRuntime = runtime;
1082
+ } else {
1083
+ Function("r", "regeneratorRuntime = r")(runtime);
1084
+ }
1085
+ }
1086
+ });
1087
+
1088
+ var isBrowser$1 = typeof window !== 'undefined' && window != null && typeof window.document !== 'undefined';
1089
+ function getPlasmicCookieValues() {
1090
+ if (!isBrowser$1) {
1091
+ return {};
1092
+ }
1093
+
1094
+ return Object.fromEntries(document.cookie.split('; ').filter(function (cookie) {
1095
+ return cookie.includes('plasmic:');
1096
+ }).map(function (cookie) {
1097
+ return cookie.split('=');
1098
+ }).map(function (_ref) {
1099
+ var key = _ref[0],
1100
+ value = _ref[1];
1101
+ return [key.split(':')[1], value];
1102
+ }));
1103
+ }
1104
+ function getVariationCookieValues() {
1105
+ var cookies = getPlasmicCookieValues();
1106
+ return Object.fromEntries(Object.keys(cookies).map(function (key) {
1107
+ return [key.split('.')[1], cookies[key]];
1108
+ }).filter(function (val) {
1109
+ return !!val[0];
1110
+ }));
1111
+ } // https://stackoverflow.com/a/8809472
1112
+
1113
+ function generateUUID() {
1114
+ // Public Domain/MIT
1115
+ var d = new Date().getTime(); //Timestamp
1116
+
1117
+ var d2 = typeof performance !== 'undefined' && performance.now && performance.now() * 1000 || 0; //Time in microseconds since page-load or 0 if unsupported
1118
+
1119
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1120
+ var r = Math.random() * 16; //random number between 0 and 16
1121
+
1122
+ if (d > 0) {
1123
+ //Use timestamp until depleted
1124
+ r = (d + r) % 16 | 0;
1125
+ d = Math.floor(d / 16);
1126
+ } else {
1127
+ //Use microseconds since page-load if supported
1128
+ r = (d2 + r) % 16 | 0;
1129
+ d2 = Math.floor(d2 / 16);
1130
+ }
1131
+
1132
+ return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
1133
+ });
1134
+ }
1135
+ function getDistinctId() {
1136
+ if (!isBrowser$1) {
1137
+ return 'LOADER-SERVER';
1138
+ }
1139
+
1140
+ try {
1141
+ // we try to store data in sessionStorage so that the id is persisted between loads/reloads
1142
+ var cookies = getPlasmicCookieValues();
1143
+ var uuid = cookies['user_id'];
1144
+
1145
+ if (uuid) {
1146
+ return uuid;
1147
+ }
1148
+
1149
+ uuid = generateUUID();
1150
+ document.cookie = "plasmic:user_id=" + uuid;
1151
+ return uuid;
1152
+ } catch (err) {
1153
+ // if we are not able to use cookies for some reason we fallback to window, which is going to be lost on reloads
1154
+ if (!window.__plasmicPageSessionId) {
1155
+ window.__plasmicPageSessionId = generateUUID();
1156
+ }
1157
+
1158
+ return window.__plasmicPageSessionId;
1159
+ }
1160
+ }
1161
+
1162
+ function getCampaignParams() {
1163
+ var _window = window,
1164
+ location = _window.location;
1165
+ var params = {};
1166
+
1167
+ try {
1168
+ var url = new URL(location.href);
1169
+ var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid'];
1170
+ CAMPAIGN_KEYWORDS.forEach(function (keyword) {
1171
+ var value = url.searchParams.get(keyword);
1172
+
1173
+ if (value) {
1174
+ params[keyword] = value;
1175
+ }
1176
+ });
1177
+ } catch (err) {}
1178
+
1179
+ return params;
1180
+ }
1181
+
1182
+ function getLocationMeta() {
1183
+ var _window2 = window,
1184
+ location = _window2.location;
1185
+ var _document = document,
1186
+ referrer = _document.referrer;
1187
+ return _extends({
1188
+ url: location.href,
1189
+ host: location.host,
1190
+ pathname: location.pathname,
1191
+ referrer: referrer
1192
+ }, getCampaignParams());
1193
+ }
1194
+
1195
+ function getScreenMeta() {
1196
+ var _window3 = window,
1197
+ screen = _window3.screen;
1198
+ return {
1199
+ screen_height: screen.height,
1200
+ screen_width: screen.width,
1201
+ viewport_height: window.innerHeight,
1202
+ viewport_width: window.innerWidth
1203
+ };
1204
+ }
1205
+
1206
+ function getOS(userAgent) {
1207
+ if (/Windows/i.test(userAgent)) {
1208
+ if (/Phone/.test(userAgent) || /WPDesktop/.test(userAgent)) {
1209
+ return 'Windows Phone';
1210
+ }
1211
+
1212
+ return 'Windows';
1213
+ } else if (/(iPhone|iPad|iPod)/.test(userAgent)) {
1214
+ return 'iOS';
1215
+ } else if (/Android/.test(userAgent)) {
1216
+ return 'Android';
1217
+ } else if (/(BlackBerry|PlayBook|BB10)/i.test(userAgent)) {
1218
+ return 'BlackBerry';
1219
+ } else if (/Mac/i.test(userAgent)) {
1220
+ return 'Mac OS X';
1221
+ } else if (/Linux/.test(userAgent)) {
1222
+ return 'Linux';
1223
+ } else if (/CrOS/.test(userAgent)) {
1224
+ return 'Chrome OS';
1225
+ } else {
1226
+ return '';
1227
+ }
1228
+ }
1229
+
1230
+ function getDeviceInfo(userAgent) {
1231
+ var PATTERNS = [{
1232
+ device: 'iPhone',
1233
+ patterns: [/iPhone/]
1234
+ }, {
1235
+ device: 'iPad',
1236
+ patterns: [/iPad/]
1237
+ }, {
1238
+ device: 'iPod Touch',
1239
+ patterns: [/iPod/]
1240
+ }, {
1241
+ device: 'Windows Phone',
1242
+ patterns: [/Windows Phone/i, /WPDesktop/]
1243
+ }, {
1244
+ device: 'Android',
1245
+ patterns: [/Android/]
1246
+ }];
1247
+ var match = PATTERNS.find(function (pattern) {
1248
+ return pattern.patterns.some(function (expr) {
1249
+ return expr.test(userAgent);
1250
+ });
1251
+ });
1252
+ var device = match == null ? void 0 : match.device;
1253
+ return {
1254
+ device: device != null ? device : '',
1255
+ deviceType: device ? 'Mobile' : 'Desktop',
1256
+ os: getOS(userAgent)
1257
+ };
1258
+ }
1259
+
1260
+ function getUserAgentMeta() {
1261
+ var _window4 = window,
1262
+ navigator = _window4.navigator;
1263
+ var userAgent = navigator.userAgent;
1264
+ return _extends({}, getDeviceInfo(userAgent));
1265
+ }
1266
+
1267
+ function getWindowMeta() {
1268
+ if (!isBrowser$1) {
1269
+ return {};
1270
+ }
1271
+
1272
+ return _extends({}, getLocationMeta(), getScreenMeta(), getUserAgentMeta());
1273
+ }
1274
+ var isProduction = "development" === 'production';
1275
+ function getEnvMeta() {
1276
+ return {
1277
+ isBrowser: isBrowser$1,
1278
+ isProduction: isProduction
1279
+ };
1280
+ }
1281
+ function rawSplitVariation(variation) {
1282
+ var rawVariations = {};
1283
+ Object.keys(variation).forEach(function (variationKey) {
1284
+ var _variationKey$split = variationKey.split('.'),
1285
+ splitId = _variationKey$split[1];
1286
+
1287
+ if (splitId) {
1288
+ rawVariations[splitId] = variation[variationKey];
1289
+ }
1290
+ });
1291
+ return rawVariations;
1292
+ }
1293
+ var POLL_TIME = 5000;
1294
+ function throttled(func) {
1295
+ var timerId = undefined;
1296
+ return function (param) {
1297
+ if (timerId) {
1298
+ // will already be taken care of next time we run
1299
+ return;
1300
+ }
1301
+
1302
+ if (isBrowser$1) {
1303
+ timerId = window.requestAnimationFrame(function () {
1304
+ timerId = undefined;
1305
+ func(param);
1306
+ });
1307
+ } else {
1308
+ timerId = setTimeout(function () {
1309
+ timerId = undefined;
1310
+ func(param);
1311
+ }, POLL_TIME);
1312
+ }
1313
+ };
1314
+ }
1315
+
1316
+ var API_ENDPOINT = 'https://posthog.plasmic.app/capture';
1317
+ var API_PUBLIC_KEY = 'phc_BRvYTAoMoam9fDHfrIneF67KdtMJagLVVCM6ELNYd4n';
1318
+ var PlasmicTracker = /*#__PURE__*/function () {
1319
+ function PlasmicTracker(opts) {
1320
+ var _this = this;
1321
+
1322
+ this.opts = opts;
1323
+ this.eventQueue = [];
1324
+ this.sendEvents = throttled( /*#__PURE__*/function () {
1325
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(transport) {
1326
+ var events, body, stringBody;
1327
+ return runtime_1.wrap(function _callee$(_context) {
1328
+ while (1) {
1329
+ switch (_context.prev = _context.next) {
1330
+ case 0:
1331
+ if (!(_this.eventQueue.length === 0)) {
1332
+ _context.next = 2;
1333
+ break;
1334
+ }
1335
+
1336
+ return _context.abrupt("return");
1337
+
1338
+ case 2:
1339
+ events = [].concat(_this.eventQueue);
1340
+ _this.eventQueue.length = 0;
1341
+ body = {
1342
+ api_key: API_PUBLIC_KEY,
1343
+ batch: events
1344
+ };
1345
+
1346
+ try {
1347
+ stringBody = JSON.stringify(body);
1348
+
1349
+ if (transport === 'beacon') {
1350
+ // Triggers warning: https://chromestatus.com/feature/5629709824032768
1351
+ window.navigator.sendBeacon(API_ENDPOINT, stringBody);
1352
+ } else {
1353
+ fetch(API_ENDPOINT, {
1354
+ method: 'POST',
1355
+ headers: {
1356
+ Accept: 'application/json'
1357
+ },
1358
+ body: stringBody
1359
+ }).then(function () {})["catch"](function () {});
1360
+ }
1361
+ } catch (err) {}
1362
+
1363
+ case 6:
1364
+ case "end":
1365
+ return _context.stop();
1366
+ }
1367
+ }
1368
+ }, _callee);
1369
+ }));
1370
+
1371
+ return function (_x) {
1372
+ return _ref.apply(this, arguments);
1373
+ };
1374
+ }());
1375
+ }
1376
+
1377
+ var _proto = PlasmicTracker.prototype;
1378
+
1379
+ _proto.trackRender = function trackRender(opts) {
1380
+ var _opts$renderCtx, _opts$variation;
1381
+
1382
+ this.enqueue({
1383
+ event: '$render',
1384
+ properties: _extends({}, this.getProperties(), (_opts$renderCtx = opts == null ? void 0 : opts.renderCtx) != null ? _opts$renderCtx : {}, rawSplitVariation((_opts$variation = opts == null ? void 0 : opts.variation) != null ? _opts$variation : {}))
1385
+ });
1386
+ };
1387
+
1388
+ _proto.trackFetch = function trackFetch() {
1389
+ this.enqueue({
1390
+ event: '$fetch',
1391
+ properties: this.getProperties()
1392
+ });
1393
+ };
1394
+
1395
+ _proto.trackConversion = function trackConversion(value) {
1396
+ if (value === void 0) {
1397
+ value = 0;
1398
+ }
1399
+
1400
+ this.enqueue({
1401
+ event: '$conversion',
1402
+ properties: _extends({}, this.getProperties(), {
1403
+ value: value
1404
+ })
1405
+ });
1406
+ };
1407
+
1408
+ _proto.getProperties = function getProperties() {
1409
+ var _Date$now;
1410
+
1411
+ return _extends({
1412
+ distinct_id: getDistinctId()
1413
+ }, getWindowMeta(), getEnvMeta(), this.getContextMeta(), getVariationCookieValues(), {
1414
+ timestamp: (_Date$now = Date.now()) != null ? _Date$now : +new Date()
1415
+ });
1416
+ };
1417
+
1418
+ _proto.enqueue = function enqueue(event) {
1419
+ this.eventQueue.push(event);
1420
+ this.sendEvents('fetch');
1421
+ };
1422
+
1423
+ _proto.getContextMeta = function getContextMeta() {
1424
+ return {
1425
+ platform: this.opts.platform,
1426
+ preview: this.opts.preview,
1427
+ projectIds: this.opts.projectIds
1428
+ };
1429
+ };
1430
+
1431
+ return PlasmicTracker;
1432
+ }();
1433
+
305
1434
  Object.defineProperty(exports, 'Api', {
306
1435
  enumerable: true,
307
1436
  get: function () {
@@ -314,6 +1443,7 @@ Object.defineProperty(exports, 'PlasmicModulesFetcher', {
314
1443
  return loaderFetcher.PlasmicModulesFetcher;
315
1444
  }
316
1445
  });
1446
+ exports.PlasmicTracker = PlasmicTracker;
317
1447
  exports.Registry = Registry;
318
1448
  exports.getBundleSubset = getBundleSubset;
319
1449
  //# sourceMappingURL=loader-core.cjs.development.js.map