@dereekb/model 12.1.4 → 12.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -530,6 +530,2019 @@ class AbstractModelPermissionService {
530
530
  }
531
531
  }
532
532
 
533
+ function syncEntityCommonTypeIdPairFactory(commonType) {
534
+ return input => {
535
+ if (typeof input === 'string') {
536
+ return {
537
+ commonType,
538
+ commonId: input
539
+ };
540
+ } else {
541
+ return input;
542
+ }
543
+ };
544
+ }
545
+ /**
546
+ * Creates a SyncEntityFactory.
547
+ *
548
+ * @param config
549
+ * @returns
550
+ */
551
+ function syncEntityFactory(config) {
552
+ const {
553
+ idFactory: inputIdFactory,
554
+ sourceInfo
555
+ } = config;
556
+ const idFactory = inputIdFactory ?? util.MAP_IDENTITY;
557
+ return input => {
558
+ const {
559
+ commonType,
560
+ commonId
561
+ } = input;
562
+ const id = idFactory(commonId);
563
+ return {
564
+ commonType,
565
+ commonId,
566
+ id,
567
+ sourceInfo
568
+ };
569
+ };
570
+ }
571
+
572
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
573
+
574
+ var check = function (it) {
575
+ return it && it.Math === Math && it;
576
+ };
577
+
578
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
579
+ var global$b =
580
+ // eslint-disable-next-line es/no-global-this -- safe
581
+ check(typeof globalThis == 'object' && globalThis) ||
582
+ check(typeof window == 'object' && window) ||
583
+ // eslint-disable-next-line no-restricted-globals -- safe
584
+ check(typeof self == 'object' && self) ||
585
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
586
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
587
+ // eslint-disable-next-line no-new-func -- fallback
588
+ (function () { return this; })() || Function('return this')();
589
+
590
+ var objectGetOwnPropertyDescriptor = {};
591
+
592
+ var fails$c = function (exec) {
593
+ try {
594
+ return !!exec();
595
+ } catch (error) {
596
+ return true;
597
+ }
598
+ };
599
+
600
+ var fails$b = fails$c;
601
+
602
+ // Detect IE8's incomplete defineProperty implementation
603
+ var descriptors = !fails$b(function () {
604
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
605
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
606
+ });
607
+
608
+ var fails$a = fails$c;
609
+
610
+ var functionBindNative = !fails$a(function () {
611
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
612
+ var test = (function () { /* empty */ }).bind();
613
+ // eslint-disable-next-line no-prototype-builtins -- safe
614
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
615
+ });
616
+
617
+ var NATIVE_BIND$1 = functionBindNative;
618
+
619
+ var call$7 = Function.prototype.call;
620
+
621
+ var functionCall = NATIVE_BIND$1 ? call$7.bind(call$7) : function () {
622
+ return call$7.apply(call$7, arguments);
623
+ };
624
+
625
+ var objectPropertyIsEnumerable = {};
626
+
627
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
628
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
629
+ var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
630
+
631
+ // Nashorn ~ JDK8 bug
632
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
633
+
634
+ // `Object.prototype.propertyIsEnumerable` method implementation
635
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
636
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
637
+ var descriptor = getOwnPropertyDescriptor$2(this, V);
638
+ return !!descriptor && descriptor.enumerable;
639
+ } : $propertyIsEnumerable;
640
+
641
+ var createPropertyDescriptor$3 = function (bitmap, value) {
642
+ return {
643
+ enumerable: !(bitmap & 1),
644
+ configurable: !(bitmap & 2),
645
+ writable: !(bitmap & 4),
646
+ value: value
647
+ };
648
+ };
649
+
650
+ var NATIVE_BIND = functionBindNative;
651
+
652
+ var FunctionPrototype$1 = Function.prototype;
653
+ var call$6 = FunctionPrototype$1.call;
654
+ var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype$1.bind.bind(call$6, call$6);
655
+
656
+ var functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
657
+ return function () {
658
+ return call$6.apply(fn, arguments);
659
+ };
660
+ };
661
+
662
+ var uncurryThis$8 = functionUncurryThis;
663
+
664
+ var toString$1 = uncurryThis$8({}.toString);
665
+ var stringSlice$1 = uncurryThis$8(''.slice);
666
+
667
+ var classofRaw = function (it) {
668
+ return stringSlice$1(toString$1(it), 8, -1);
669
+ };
670
+
671
+ var uncurryThis$7 = functionUncurryThis;
672
+ var fails$9 = fails$c;
673
+ var classof$1 = classofRaw;
674
+
675
+ var $Object$3 = Object;
676
+ var split = uncurryThis$7(''.split);
677
+
678
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
679
+ var indexedObject = fails$9(function () {
680
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
681
+ // eslint-disable-next-line no-prototype-builtins -- safe
682
+ return !$Object$3('z').propertyIsEnumerable(0);
683
+ }) ? function (it) {
684
+ return classof$1(it) === 'String' ? split(it, '') : $Object$3(it);
685
+ } : $Object$3;
686
+
687
+ // we can't use just `it == null` since of `document.all` special case
688
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
689
+ var isNullOrUndefined$2 = function (it) {
690
+ return it === null || it === undefined;
691
+ };
692
+
693
+ var isNullOrUndefined$1 = isNullOrUndefined$2;
694
+
695
+ var $TypeError$9 = TypeError;
696
+
697
+ // `RequireObjectCoercible` abstract operation
698
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
699
+ var requireObjectCoercible$2 = function (it) {
700
+ if (isNullOrUndefined$1(it)) throw new $TypeError$9("Can't call method on " + it);
701
+ return it;
702
+ };
703
+
704
+ // toObject with fallback for non-array-like ES3 strings
705
+ var IndexedObject = indexedObject;
706
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
707
+
708
+ var toIndexedObject$4 = function (it) {
709
+ return IndexedObject(requireObjectCoercible$1(it));
710
+ };
711
+
712
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
713
+ var documentAll = typeof document == 'object' && document.all;
714
+
715
+ // `IsCallable` abstract operation
716
+ // https://tc39.es/ecma262/#sec-iscallable
717
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
718
+ var isCallable$d = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
719
+ return typeof argument == 'function' || argument === documentAll;
720
+ } : function (argument) {
721
+ return typeof argument == 'function';
722
+ };
723
+
724
+ var isCallable$c = isCallable$d;
725
+
726
+ var isObject$6 = function (it) {
727
+ return typeof it == 'object' ? it !== null : isCallable$c(it);
728
+ };
729
+
730
+ var global$a = global$b;
731
+ var isCallable$b = isCallable$d;
732
+
733
+ var aFunction = function (argument) {
734
+ return isCallable$b(argument) ? argument : undefined;
735
+ };
736
+
737
+ var getBuiltIn$3 = function (namespace, method) {
738
+ return arguments.length < 2 ? aFunction(global$a[namespace]) : global$a[namespace] && global$a[namespace][method];
739
+ };
740
+
741
+ var uncurryThis$6 = functionUncurryThis;
742
+
743
+ var objectIsPrototypeOf = uncurryThis$6({}.isPrototypeOf);
744
+
745
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
746
+
747
+ var global$9 = global$b;
748
+ var userAgent = engineUserAgent;
749
+
750
+ var process = global$9.process;
751
+ var Deno = global$9.Deno;
752
+ var versions = process && process.versions || Deno && Deno.version;
753
+ var v8 = versions && versions.v8;
754
+ var match, version;
755
+
756
+ if (v8) {
757
+ match = v8.split('.');
758
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
759
+ // but their correct versions are not interesting for us
760
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
761
+ }
762
+
763
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
764
+ // so check `userAgent` even if `.v8` exists, but 0
765
+ if (!version && userAgent) {
766
+ match = userAgent.match(/Edge\/(\d+)/);
767
+ if (!match || match[1] >= 74) {
768
+ match = userAgent.match(/Chrome\/(\d+)/);
769
+ if (match) version = +match[1];
770
+ }
771
+ }
772
+
773
+ var engineV8Version = version;
774
+
775
+ /* eslint-disable es/no-symbol -- required for testing */
776
+ var V8_VERSION = engineV8Version;
777
+ var fails$8 = fails$c;
778
+ var global$8 = global$b;
779
+
780
+ var $String$3 = global$8.String;
781
+
782
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
783
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$8(function () {
784
+ var symbol = Symbol('symbol detection');
785
+ // Chrome 38 Symbol has incorrect toString conversion
786
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
787
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
788
+ // of course, fail.
789
+ return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
790
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
791
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
792
+ });
793
+
794
+ /* eslint-disable es/no-symbol -- required for testing */
795
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
796
+
797
+ var useSymbolAsUid = NATIVE_SYMBOL$1
798
+ && !Symbol.sham
799
+ && typeof Symbol.iterator == 'symbol';
800
+
801
+ var getBuiltIn$2 = getBuiltIn$3;
802
+ var isCallable$a = isCallable$d;
803
+ var isPrototypeOf$1 = objectIsPrototypeOf;
804
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
805
+
806
+ var $Object$2 = Object;
807
+
808
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
809
+ return typeof it == 'symbol';
810
+ } : function (it) {
811
+ var $Symbol = getBuiltIn$2('Symbol');
812
+ return isCallable$a($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
813
+ };
814
+
815
+ var $String$2 = String;
816
+
817
+ var tryToString$1 = function (argument) {
818
+ try {
819
+ return $String$2(argument);
820
+ } catch (error) {
821
+ return 'Object';
822
+ }
823
+ };
824
+
825
+ var isCallable$9 = isCallable$d;
826
+ var tryToString = tryToString$1;
827
+
828
+ var $TypeError$8 = TypeError;
829
+
830
+ // `Assert: IsCallable(argument) is true`
831
+ var aCallable$2 = function (argument) {
832
+ if (isCallable$9(argument)) return argument;
833
+ throw new $TypeError$8(tryToString(argument) + ' is not a function');
834
+ };
835
+
836
+ var aCallable$1 = aCallable$2;
837
+ var isNullOrUndefined = isNullOrUndefined$2;
838
+
839
+ // `GetMethod` abstract operation
840
+ // https://tc39.es/ecma262/#sec-getmethod
841
+ var getMethod$3 = function (V, P) {
842
+ var func = V[P];
843
+ return isNullOrUndefined(func) ? undefined : aCallable$1(func);
844
+ };
845
+
846
+ var call$5 = functionCall;
847
+ var isCallable$8 = isCallable$d;
848
+ var isObject$5 = isObject$6;
849
+
850
+ var $TypeError$7 = TypeError;
851
+
852
+ // `OrdinaryToPrimitive` abstract operation
853
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
854
+ var ordinaryToPrimitive$1 = function (input, pref) {
855
+ var fn, val;
856
+ if (pref === 'string' && isCallable$8(fn = input.toString) && !isObject$5(val = call$5(fn, input))) return val;
857
+ if (isCallable$8(fn = input.valueOf) && !isObject$5(val = call$5(fn, input))) return val;
858
+ if (pref !== 'string' && isCallable$8(fn = input.toString) && !isObject$5(val = call$5(fn, input))) return val;
859
+ throw new $TypeError$7("Can't convert object to primitive value");
860
+ };
861
+
862
+ var sharedStore = {exports: {}};
863
+
864
+ var isPure = false;
865
+
866
+ var global$7 = global$b;
867
+
868
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
869
+ var defineProperty$2 = Object.defineProperty;
870
+
871
+ var defineGlobalProperty$3 = function (key, value) {
872
+ try {
873
+ defineProperty$2(global$7, key, { value: value, configurable: true, writable: true });
874
+ } catch (error) {
875
+ global$7[key] = value;
876
+ } return value;
877
+ };
878
+
879
+ var globalThis$1 = global$b;
880
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
881
+
882
+ var SHARED = '__core-js_shared__';
883
+ var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
884
+
885
+ (store$3.versions || (store$3.versions = [])).push({
886
+ version: '3.36.1',
887
+ mode: 'global',
888
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
889
+ license: 'https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE',
890
+ source: 'https://github.com/zloirock/core-js'
891
+ });
892
+
893
+ var sharedStoreExports = sharedStore.exports;
894
+
895
+ var store$2 = sharedStoreExports;
896
+
897
+ var shared$3 = function (key, value) {
898
+ return store$2[key] || (store$2[key] = value || {});
899
+ };
900
+
901
+ var requireObjectCoercible = requireObjectCoercible$2;
902
+
903
+ var $Object$1 = Object;
904
+
905
+ // `ToObject` abstract operation
906
+ // https://tc39.es/ecma262/#sec-toobject
907
+ var toObject$3 = function (argument) {
908
+ return $Object$1(requireObjectCoercible(argument));
909
+ };
910
+
911
+ var uncurryThis$5 = functionUncurryThis;
912
+ var toObject$2 = toObject$3;
913
+
914
+ var hasOwnProperty = uncurryThis$5({}.hasOwnProperty);
915
+
916
+ // `HasOwnProperty` abstract operation
917
+ // https://tc39.es/ecma262/#sec-hasownproperty
918
+ // eslint-disable-next-line es/no-object-hasown -- safe
919
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
920
+ return hasOwnProperty(toObject$2(it), key);
921
+ };
922
+
923
+ var uncurryThis$4 = functionUncurryThis;
924
+
925
+ var id = 0;
926
+ var postfix = Math.random();
927
+ var toString = uncurryThis$4(1.0.toString);
928
+
929
+ var uid$2 = function (key) {
930
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
931
+ };
932
+
933
+ var global$6 = global$b;
934
+ var shared$2 = shared$3;
935
+ var hasOwn$8 = hasOwnProperty_1;
936
+ var uid$1 = uid$2;
937
+ var NATIVE_SYMBOL = symbolConstructorDetection;
938
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
939
+
940
+ var Symbol$1 = global$6.Symbol;
941
+ var WellKnownSymbolsStore = shared$2('wks');
942
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
943
+
944
+ var wellKnownSymbol$4 = function (name) {
945
+ if (!hasOwn$8(WellKnownSymbolsStore, name)) {
946
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)
947
+ ? Symbol$1[name]
948
+ : createWellKnownSymbol('Symbol.' + name);
949
+ } return WellKnownSymbolsStore[name];
950
+ };
951
+
952
+ var call$4 = functionCall;
953
+ var isObject$4 = isObject$6;
954
+ var isSymbol$1 = isSymbol$2;
955
+ var getMethod$2 = getMethod$3;
956
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
957
+ var wellKnownSymbol$3 = wellKnownSymbol$4;
958
+
959
+ var $TypeError$6 = TypeError;
960
+ var TO_PRIMITIVE = wellKnownSymbol$3('toPrimitive');
961
+
962
+ // `ToPrimitive` abstract operation
963
+ // https://tc39.es/ecma262/#sec-toprimitive
964
+ var toPrimitive$1 = function (input, pref) {
965
+ if (!isObject$4(input) || isSymbol$1(input)) return input;
966
+ var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
967
+ var result;
968
+ if (exoticToPrim) {
969
+ if (pref === undefined) pref = 'default';
970
+ result = call$4(exoticToPrim, input, pref);
971
+ if (!isObject$4(result) || isSymbol$1(result)) return result;
972
+ throw new $TypeError$6("Can't convert object to primitive value");
973
+ }
974
+ if (pref === undefined) pref = 'number';
975
+ return ordinaryToPrimitive(input, pref);
976
+ };
977
+
978
+ var toPrimitive = toPrimitive$1;
979
+ var isSymbol = isSymbol$2;
980
+
981
+ // `ToPropertyKey` abstract operation
982
+ // https://tc39.es/ecma262/#sec-topropertykey
983
+ var toPropertyKey$2 = function (argument) {
984
+ var key = toPrimitive(argument, 'string');
985
+ return isSymbol(key) ? key : key + '';
986
+ };
987
+
988
+ var global$5 = global$b;
989
+ var isObject$3 = isObject$6;
990
+
991
+ var document$1 = global$5.document;
992
+ // typeof document.createElement is 'object' in old IE
993
+ var EXISTS$1 = isObject$3(document$1) && isObject$3(document$1.createElement);
994
+
995
+ var documentCreateElement$1 = function (it) {
996
+ return EXISTS$1 ? document$1.createElement(it) : {};
997
+ };
998
+
999
+ var DESCRIPTORS$a = descriptors;
1000
+ var fails$7 = fails$c;
1001
+ var createElement = documentCreateElement$1;
1002
+
1003
+ // Thanks to IE8 for its funny defineProperty
1004
+ var ie8DomDefine = !DESCRIPTORS$a && !fails$7(function () {
1005
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1006
+ return Object.defineProperty(createElement('div'), 'a', {
1007
+ get: function () { return 7; }
1008
+ }).a !== 7;
1009
+ });
1010
+
1011
+ var DESCRIPTORS$9 = descriptors;
1012
+ var call$3 = functionCall;
1013
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1014
+ var createPropertyDescriptor$2 = createPropertyDescriptor$3;
1015
+ var toIndexedObject$3 = toIndexedObject$4;
1016
+ var toPropertyKey$1 = toPropertyKey$2;
1017
+ var hasOwn$7 = hasOwnProperty_1;
1018
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
1019
+
1020
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1021
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
1022
+
1023
+ // `Object.getOwnPropertyDescriptor` method
1024
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
1025
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$9 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
1026
+ O = toIndexedObject$3(O);
1027
+ P = toPropertyKey$1(P);
1028
+ if (IE8_DOM_DEFINE$1) try {
1029
+ return $getOwnPropertyDescriptor$1(O, P);
1030
+ } catch (error) { /* empty */ }
1031
+ if (hasOwn$7(O, P)) return createPropertyDescriptor$2(!call$3(propertyIsEnumerableModule.f, O, P), O[P]);
1032
+ };
1033
+
1034
+ var objectDefineProperty = {};
1035
+
1036
+ var DESCRIPTORS$8 = descriptors;
1037
+ var fails$6 = fails$c;
1038
+
1039
+ // V8 ~ Chrome 36-
1040
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
1041
+ var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$6(function () {
1042
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1043
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
1044
+ value: 42,
1045
+ writable: false
1046
+ }).prototype !== 42;
1047
+ });
1048
+
1049
+ var isObject$2 = isObject$6;
1050
+
1051
+ var $String$1 = String;
1052
+ var $TypeError$5 = TypeError;
1053
+
1054
+ // `Assert: Type(argument) is Object`
1055
+ var anObject$8 = function (argument) {
1056
+ if (isObject$2(argument)) return argument;
1057
+ throw new $TypeError$5($String$1(argument) + ' is not an object');
1058
+ };
1059
+
1060
+ var DESCRIPTORS$7 = descriptors;
1061
+ var IE8_DOM_DEFINE = ie8DomDefine;
1062
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
1063
+ var anObject$7 = anObject$8;
1064
+ var toPropertyKey = toPropertyKey$2;
1065
+
1066
+ var $TypeError$4 = TypeError;
1067
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1068
+ var $defineProperty = Object.defineProperty;
1069
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1070
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1071
+ var ENUMERABLE = 'enumerable';
1072
+ var CONFIGURABLE$1 = 'configurable';
1073
+ var WRITABLE = 'writable';
1074
+
1075
+ // `Object.defineProperty` method
1076
+ // https://tc39.es/ecma262/#sec-object.defineproperty
1077
+ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
1078
+ anObject$7(O);
1079
+ P = toPropertyKey(P);
1080
+ anObject$7(Attributes);
1081
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
1082
+ var current = $getOwnPropertyDescriptor(O, P);
1083
+ if (current && current[WRITABLE]) {
1084
+ O[P] = Attributes.value;
1085
+ Attributes = {
1086
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
1087
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
1088
+ writable: false
1089
+ };
1090
+ }
1091
+ } return $defineProperty(O, P, Attributes);
1092
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
1093
+ anObject$7(O);
1094
+ P = toPropertyKey(P);
1095
+ anObject$7(Attributes);
1096
+ if (IE8_DOM_DEFINE) try {
1097
+ return $defineProperty(O, P, Attributes);
1098
+ } catch (error) { /* empty */ }
1099
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$4('Accessors not supported');
1100
+ if ('value' in Attributes) O[P] = Attributes.value;
1101
+ return O;
1102
+ };
1103
+
1104
+ var DESCRIPTORS$6 = descriptors;
1105
+ var definePropertyModule$4 = objectDefineProperty;
1106
+ var createPropertyDescriptor$1 = createPropertyDescriptor$3;
1107
+
1108
+ var createNonEnumerableProperty$3 = DESCRIPTORS$6 ? function (object, key, value) {
1109
+ return definePropertyModule$4.f(object, key, createPropertyDescriptor$1(1, value));
1110
+ } : function (object, key, value) {
1111
+ object[key] = value;
1112
+ return object;
1113
+ };
1114
+
1115
+ var makeBuiltIn$3 = {exports: {}};
1116
+
1117
+ var DESCRIPTORS$5 = descriptors;
1118
+ var hasOwn$6 = hasOwnProperty_1;
1119
+
1120
+ var FunctionPrototype = Function.prototype;
1121
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1122
+ var getDescriptor = DESCRIPTORS$5 && Object.getOwnPropertyDescriptor;
1123
+
1124
+ var EXISTS = hasOwn$6(FunctionPrototype, 'name');
1125
+ // additional protection from minified / mangled / dropped function names
1126
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
1127
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$5 || (DESCRIPTORS$5 && getDescriptor(FunctionPrototype, 'name').configurable));
1128
+
1129
+ var functionName = {
1130
+ EXISTS: EXISTS,
1131
+ PROPER: PROPER,
1132
+ CONFIGURABLE: CONFIGURABLE
1133
+ };
1134
+
1135
+ var uncurryThis$3 = functionUncurryThis;
1136
+ var isCallable$7 = isCallable$d;
1137
+ var store$1 = sharedStoreExports;
1138
+
1139
+ var functionToString = uncurryThis$3(Function.toString);
1140
+
1141
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
1142
+ if (!isCallable$7(store$1.inspectSource)) {
1143
+ store$1.inspectSource = function (it) {
1144
+ return functionToString(it);
1145
+ };
1146
+ }
1147
+
1148
+ var inspectSource$1 = store$1.inspectSource;
1149
+
1150
+ var global$4 = global$b;
1151
+ var isCallable$6 = isCallable$d;
1152
+
1153
+ var WeakMap$1 = global$4.WeakMap;
1154
+
1155
+ var weakMapBasicDetection = isCallable$6(WeakMap$1) && /native code/.test(String(WeakMap$1));
1156
+
1157
+ var shared$1 = shared$3;
1158
+ var uid = uid$2;
1159
+
1160
+ var keys = shared$1('keys');
1161
+
1162
+ var sharedKey$3 = function (key) {
1163
+ return keys[key] || (keys[key] = uid(key));
1164
+ };
1165
+
1166
+ var hiddenKeys$4 = {};
1167
+
1168
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
1169
+ var global$3 = global$b;
1170
+ var isObject$1 = isObject$6;
1171
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
1172
+ var hasOwn$5 = hasOwnProperty_1;
1173
+ var shared = sharedStoreExports;
1174
+ var sharedKey$2 = sharedKey$3;
1175
+ var hiddenKeys$3 = hiddenKeys$4;
1176
+
1177
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1178
+ var TypeError$1 = global$3.TypeError;
1179
+ var WeakMap = global$3.WeakMap;
1180
+ var set, get, has;
1181
+
1182
+ var enforce = function (it) {
1183
+ return has(it) ? get(it) : set(it, {});
1184
+ };
1185
+
1186
+ var getterFor = function (TYPE) {
1187
+ return function (it) {
1188
+ var state;
1189
+ if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
1190
+ throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
1191
+ } return state;
1192
+ };
1193
+ };
1194
+
1195
+ if (NATIVE_WEAK_MAP || shared.state) {
1196
+ var store = shared.state || (shared.state = new WeakMap());
1197
+ /* eslint-disable no-self-assign -- prototype methods protection */
1198
+ store.get = store.get;
1199
+ store.has = store.has;
1200
+ store.set = store.set;
1201
+ /* eslint-enable no-self-assign -- prototype methods protection */
1202
+ set = function (it, metadata) {
1203
+ if (store.has(it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
1204
+ metadata.facade = it;
1205
+ store.set(it, metadata);
1206
+ return metadata;
1207
+ };
1208
+ get = function (it) {
1209
+ return store.get(it) || {};
1210
+ };
1211
+ has = function (it) {
1212
+ return store.has(it);
1213
+ };
1214
+ } else {
1215
+ var STATE = sharedKey$2('state');
1216
+ hiddenKeys$3[STATE] = true;
1217
+ set = function (it, metadata) {
1218
+ if (hasOwn$5(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
1219
+ metadata.facade = it;
1220
+ createNonEnumerableProperty$2(it, STATE, metadata);
1221
+ return metadata;
1222
+ };
1223
+ get = function (it) {
1224
+ return hasOwn$5(it, STATE) ? it[STATE] : {};
1225
+ };
1226
+ has = function (it) {
1227
+ return hasOwn$5(it, STATE);
1228
+ };
1229
+ }
1230
+
1231
+ var internalState = {
1232
+ set: set,
1233
+ get: get,
1234
+ has: has,
1235
+ enforce: enforce,
1236
+ getterFor: getterFor
1237
+ };
1238
+
1239
+ var uncurryThis$2 = functionUncurryThis;
1240
+ var fails$5 = fails$c;
1241
+ var isCallable$5 = isCallable$d;
1242
+ var hasOwn$4 = hasOwnProperty_1;
1243
+ var DESCRIPTORS$4 = descriptors;
1244
+ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
1245
+ var inspectSource = inspectSource$1;
1246
+ var InternalStateModule$1 = internalState;
1247
+
1248
+ var enforceInternalState = InternalStateModule$1.enforce;
1249
+ var getInternalState = InternalStateModule$1.get;
1250
+ var $String = String;
1251
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1252
+ var defineProperty$1 = Object.defineProperty;
1253
+ var stringSlice = uncurryThis$2(''.slice);
1254
+ var replace = uncurryThis$2(''.replace);
1255
+ var join = uncurryThis$2([].join);
1256
+
1257
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$4 && !fails$5(function () {
1258
+ return defineProperty$1(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
1259
+ });
1260
+
1261
+ var TEMPLATE = String(String).split('String');
1262
+
1263
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
1264
+ if (stringSlice($String(name), 0, 7) === 'Symbol(') {
1265
+ name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
1266
+ }
1267
+ if (options && options.getter) name = 'get ' + name;
1268
+ if (options && options.setter) name = 'set ' + name;
1269
+ if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
1270
+ if (DESCRIPTORS$4) defineProperty$1(value, 'name', { value: name, configurable: true });
1271
+ else value.name = name;
1272
+ }
1273
+ if (CONFIGURABLE_LENGTH && options && hasOwn$4(options, 'arity') && value.length !== options.arity) {
1274
+ defineProperty$1(value, 'length', { value: options.arity });
1275
+ }
1276
+ try {
1277
+ if (options && hasOwn$4(options, 'constructor') && options.constructor) {
1278
+ if (DESCRIPTORS$4) defineProperty$1(value, 'prototype', { writable: false });
1279
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
1280
+ } else if (value.prototype) value.prototype = undefined;
1281
+ } catch (error) { /* empty */ }
1282
+ var state = enforceInternalState(value);
1283
+ if (!hasOwn$4(state, 'source')) {
1284
+ state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
1285
+ } return value;
1286
+ };
1287
+
1288
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1289
+ // eslint-disable-next-line no-extend-native -- required
1290
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
1291
+ return isCallable$5(this) && getInternalState(this).source || inspectSource(this);
1292
+ }, 'toString');
1293
+
1294
+ var makeBuiltInExports = makeBuiltIn$3.exports;
1295
+
1296
+ var isCallable$4 = isCallable$d;
1297
+ var definePropertyModule$3 = objectDefineProperty;
1298
+ var makeBuiltIn$1 = makeBuiltInExports;
1299
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
1300
+
1301
+ var defineBuiltIn$3 = function (O, key, value, options) {
1302
+ if (!options) options = {};
1303
+ var simple = options.enumerable;
1304
+ var name = options.name !== undefined ? options.name : key;
1305
+ if (isCallable$4(value)) makeBuiltIn$1(value, name, options);
1306
+ if (options.global) {
1307
+ if (simple) O[key] = value;
1308
+ else defineGlobalProperty$1(key, value);
1309
+ } else {
1310
+ try {
1311
+ if (!options.unsafe) delete O[key];
1312
+ else if (O[key]) simple = true;
1313
+ } catch (error) { /* empty */ }
1314
+ if (simple) O[key] = value;
1315
+ else definePropertyModule$3.f(O, key, {
1316
+ value: value,
1317
+ enumerable: false,
1318
+ configurable: !options.nonConfigurable,
1319
+ writable: !options.nonWritable
1320
+ });
1321
+ } return O;
1322
+ };
1323
+
1324
+ var objectGetOwnPropertyNames = {};
1325
+
1326
+ var ceil = Math.ceil;
1327
+ var floor = Math.floor;
1328
+
1329
+ // `Math.trunc` method
1330
+ // https://tc39.es/ecma262/#sec-math.trunc
1331
+ // eslint-disable-next-line es/no-math-trunc -- safe
1332
+ var mathTrunc = Math.trunc || function trunc(x) {
1333
+ var n = +x;
1334
+ return (n > 0 ? floor : ceil)(n);
1335
+ };
1336
+
1337
+ var trunc = mathTrunc;
1338
+
1339
+ // `ToIntegerOrInfinity` abstract operation
1340
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
1341
+ var toIntegerOrInfinity$2 = function (argument) {
1342
+ var number = +argument;
1343
+ // eslint-disable-next-line no-self-compare -- NaN check
1344
+ return number !== number || number === 0 ? 0 : trunc(number);
1345
+ };
1346
+
1347
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
1348
+
1349
+ var max = Math.max;
1350
+ var min$1 = Math.min;
1351
+
1352
+ // Helper for a popular repeating case of the spec:
1353
+ // Let integer be ? ToInteger(index).
1354
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
1355
+ var toAbsoluteIndex$1 = function (index, length) {
1356
+ var integer = toIntegerOrInfinity$1(index);
1357
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
1358
+ };
1359
+
1360
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
1361
+
1362
+ var min = Math.min;
1363
+
1364
+ // `ToLength` abstract operation
1365
+ // https://tc39.es/ecma262/#sec-tolength
1366
+ var toLength$1 = function (argument) {
1367
+ var len = toIntegerOrInfinity(argument);
1368
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
1369
+ };
1370
+
1371
+ var toLength = toLength$1;
1372
+
1373
+ // `LengthOfArrayLike` abstract operation
1374
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
1375
+ var lengthOfArrayLike$2 = function (obj) {
1376
+ return toLength(obj.length);
1377
+ };
1378
+
1379
+ var toIndexedObject$2 = toIndexedObject$4;
1380
+ var toAbsoluteIndex = toAbsoluteIndex$1;
1381
+ var lengthOfArrayLike$1 = lengthOfArrayLike$2;
1382
+
1383
+ // `Array.prototype.{ indexOf, includes }` methods implementation
1384
+ var createMethod = function (IS_INCLUDES) {
1385
+ return function ($this, el, fromIndex) {
1386
+ var O = toIndexedObject$2($this);
1387
+ var length = lengthOfArrayLike$1(O);
1388
+ if (length === 0) return !IS_INCLUDES && -1;
1389
+ var index = toAbsoluteIndex(fromIndex, length);
1390
+ var value;
1391
+ // Array#includes uses SameValueZero equality algorithm
1392
+ // eslint-disable-next-line no-self-compare -- NaN check
1393
+ if (IS_INCLUDES && el !== el) while (length > index) {
1394
+ value = O[index++];
1395
+ // eslint-disable-next-line no-self-compare -- NaN check
1396
+ if (value !== value) return true;
1397
+ // Array#indexOf ignores holes, Array#includes - not
1398
+ } else for (;length > index; index++) {
1399
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
1400
+ } return !IS_INCLUDES && -1;
1401
+ };
1402
+ };
1403
+
1404
+ var arrayIncludes = {
1405
+ // `Array.prototype.includes` method
1406
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
1407
+ includes: createMethod(true),
1408
+ // `Array.prototype.indexOf` method
1409
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
1410
+ indexOf: createMethod(false)
1411
+ };
1412
+
1413
+ var uncurryThis$1 = functionUncurryThis;
1414
+ var hasOwn$3 = hasOwnProperty_1;
1415
+ var toIndexedObject$1 = toIndexedObject$4;
1416
+ var indexOf = arrayIncludes.indexOf;
1417
+ var hiddenKeys$2 = hiddenKeys$4;
1418
+
1419
+ var push = uncurryThis$1([].push);
1420
+
1421
+ var objectKeysInternal = function (object, names) {
1422
+ var O = toIndexedObject$1(object);
1423
+ var i = 0;
1424
+ var result = [];
1425
+ var key;
1426
+ for (key in O) !hasOwn$3(hiddenKeys$2, key) && hasOwn$3(O, key) && push(result, key);
1427
+ // Don't enum bug & hidden keys
1428
+ while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
1429
+ ~indexOf(result, key) || push(result, key);
1430
+ }
1431
+ return result;
1432
+ };
1433
+
1434
+ // IE8- don't enum bug keys
1435
+ var enumBugKeys$3 = [
1436
+ 'constructor',
1437
+ 'hasOwnProperty',
1438
+ 'isPrototypeOf',
1439
+ 'propertyIsEnumerable',
1440
+ 'toLocaleString',
1441
+ 'toString',
1442
+ 'valueOf'
1443
+ ];
1444
+
1445
+ var internalObjectKeys$1 = objectKeysInternal;
1446
+ var enumBugKeys$2 = enumBugKeys$3;
1447
+
1448
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
1449
+
1450
+ // `Object.getOwnPropertyNames` method
1451
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
1452
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1453
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1454
+ return internalObjectKeys$1(O, hiddenKeys$1);
1455
+ };
1456
+
1457
+ var objectGetOwnPropertySymbols = {};
1458
+
1459
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1460
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1461
+
1462
+ var getBuiltIn$1 = getBuiltIn$3;
1463
+ var uncurryThis = functionUncurryThis;
1464
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1465
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1466
+ var anObject$6 = anObject$8;
1467
+
1468
+ var concat = uncurryThis([].concat);
1469
+
1470
+ // all object keys, includes non-enumerable and symbols
1471
+ var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
1472
+ var keys = getOwnPropertyNamesModule.f(anObject$6(it));
1473
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1474
+ return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
1475
+ };
1476
+
1477
+ var hasOwn$2 = hasOwnProperty_1;
1478
+ var ownKeys = ownKeys$1;
1479
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1480
+ var definePropertyModule$2 = objectDefineProperty;
1481
+
1482
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
1483
+ var keys = ownKeys(source);
1484
+ var defineProperty = definePropertyModule$2.f;
1485
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1486
+ for (var i = 0; i < keys.length; i++) {
1487
+ var key = keys[i];
1488
+ if (!hasOwn$2(target, key) && !(exceptions && hasOwn$2(exceptions, key))) {
1489
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1490
+ }
1491
+ }
1492
+ };
1493
+
1494
+ var fails$4 = fails$c;
1495
+ var isCallable$3 = isCallable$d;
1496
+
1497
+ var replacement = /#|\.prototype\./;
1498
+
1499
+ var isForced$1 = function (feature, detection) {
1500
+ var value = data[normalize(feature)];
1501
+ return value === POLYFILL ? true
1502
+ : value === NATIVE ? false
1503
+ : isCallable$3(detection) ? fails$4(detection)
1504
+ : !!detection;
1505
+ };
1506
+
1507
+ var normalize = isForced$1.normalize = function (string) {
1508
+ return String(string).replace(replacement, '.').toLowerCase();
1509
+ };
1510
+
1511
+ var data = isForced$1.data = {};
1512
+ var NATIVE = isForced$1.NATIVE = 'N';
1513
+ var POLYFILL = isForced$1.POLYFILL = 'P';
1514
+
1515
+ var isForced_1 = isForced$1;
1516
+
1517
+ var global$2 = global$b;
1518
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1519
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
1520
+ var defineBuiltIn$2 = defineBuiltIn$3;
1521
+ var defineGlobalProperty = defineGlobalProperty$3;
1522
+ var copyConstructorProperties = copyConstructorProperties$1;
1523
+ var isForced = isForced_1;
1524
+
1525
+ /*
1526
+ options.target - name of the target object
1527
+ options.global - target is the global object
1528
+ options.stat - export as static methods of target
1529
+ options.proto - export as prototype methods of target
1530
+ options.real - real prototype method for the `pure` version
1531
+ options.forced - export even if the native feature is available
1532
+ options.bind - bind methods to the target, required for the `pure` version
1533
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1534
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1535
+ options.sham - add a flag to not completely full polyfills
1536
+ options.enumerable - export as enumerable property
1537
+ options.dontCallGetSet - prevent calling a getter on target
1538
+ options.name - the .name of the function if it does not match the key
1539
+ */
1540
+ var _export = function (options, source) {
1541
+ var TARGET = options.target;
1542
+ var GLOBAL = options.global;
1543
+ var STATIC = options.stat;
1544
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1545
+ if (GLOBAL) {
1546
+ target = global$2;
1547
+ } else if (STATIC) {
1548
+ target = global$2[TARGET] || defineGlobalProperty(TARGET, {});
1549
+ } else {
1550
+ target = global$2[TARGET] && global$2[TARGET].prototype;
1551
+ }
1552
+ if (target) for (key in source) {
1553
+ sourceProperty = source[key];
1554
+ if (options.dontCallGetSet) {
1555
+ descriptor = getOwnPropertyDescriptor$1(target, key);
1556
+ targetProperty = descriptor && descriptor.value;
1557
+ } else targetProperty = target[key];
1558
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1559
+ // contained in target
1560
+ if (!FORCED && targetProperty !== undefined) {
1561
+ if (typeof sourceProperty == typeof targetProperty) continue;
1562
+ copyConstructorProperties(sourceProperty, targetProperty);
1563
+ }
1564
+ // add a flag to not completely full polyfills
1565
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1566
+ createNonEnumerableProperty$1(sourceProperty, 'sham', true);
1567
+ }
1568
+ defineBuiltIn$2(target, key, sourceProperty, options);
1569
+ }
1570
+ };
1571
+
1572
+ var isPrototypeOf = objectIsPrototypeOf;
1573
+
1574
+ var $TypeError$3 = TypeError;
1575
+
1576
+ var anInstance$1 = function (it, Prototype) {
1577
+ if (isPrototypeOf(Prototype, it)) return it;
1578
+ throw new $TypeError$3('Incorrect invocation');
1579
+ };
1580
+
1581
+ var fails$3 = fails$c;
1582
+
1583
+ var correctPrototypeGetter = !fails$3(function () {
1584
+ function F() { /* empty */ }
1585
+ F.prototype.constructor = null;
1586
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1587
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1588
+ });
1589
+
1590
+ var hasOwn$1 = hasOwnProperty_1;
1591
+ var isCallable$2 = isCallable$d;
1592
+ var toObject$1 = toObject$3;
1593
+ var sharedKey$1 = sharedKey$3;
1594
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1595
+
1596
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1597
+ var $Object = Object;
1598
+ var ObjectPrototype = $Object.prototype;
1599
+
1600
+ // `Object.getPrototypeOf` method
1601
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1602
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
1603
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
1604
+ var object = toObject$1(O);
1605
+ if (hasOwn$1(object, IE_PROTO$1)) return object[IE_PROTO$1];
1606
+ var constructor = object.constructor;
1607
+ if (isCallable$2(constructor) && object instanceof constructor) {
1608
+ return constructor.prototype;
1609
+ } return object instanceof $Object ? ObjectPrototype : null;
1610
+ };
1611
+
1612
+ var makeBuiltIn = makeBuiltInExports;
1613
+ var defineProperty = objectDefineProperty;
1614
+
1615
+ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1616
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1617
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1618
+ return defineProperty.f(target, name, descriptor);
1619
+ };
1620
+
1621
+ var DESCRIPTORS$3 = descriptors;
1622
+ var definePropertyModule$1 = objectDefineProperty;
1623
+ var createPropertyDescriptor = createPropertyDescriptor$3;
1624
+
1625
+ var createProperty$1 = function (object, key, value) {
1626
+ if (DESCRIPTORS$3) definePropertyModule$1.f(object, key, createPropertyDescriptor(0, value));
1627
+ else object[key] = value;
1628
+ };
1629
+
1630
+ var objectDefineProperties = {};
1631
+
1632
+ var internalObjectKeys = objectKeysInternal;
1633
+ var enumBugKeys$1 = enumBugKeys$3;
1634
+
1635
+ // `Object.keys` method
1636
+ // https://tc39.es/ecma262/#sec-object.keys
1637
+ // eslint-disable-next-line es/no-object-keys -- safe
1638
+ var objectKeys$1 = Object.keys || function keys(O) {
1639
+ return internalObjectKeys(O, enumBugKeys$1);
1640
+ };
1641
+
1642
+ var DESCRIPTORS$2 = descriptors;
1643
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1644
+ var definePropertyModule = objectDefineProperty;
1645
+ var anObject$5 = anObject$8;
1646
+ var toIndexedObject = toIndexedObject$4;
1647
+ var objectKeys = objectKeys$1;
1648
+
1649
+ // `Object.defineProperties` method
1650
+ // https://tc39.es/ecma262/#sec-object.defineproperties
1651
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
1652
+ objectDefineProperties.f = DESCRIPTORS$2 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1653
+ anObject$5(O);
1654
+ var props = toIndexedObject(Properties);
1655
+ var keys = objectKeys(Properties);
1656
+ var length = keys.length;
1657
+ var index = 0;
1658
+ var key;
1659
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1660
+ return O;
1661
+ };
1662
+
1663
+ var getBuiltIn = getBuiltIn$3;
1664
+
1665
+ var html$1 = getBuiltIn('document', 'documentElement');
1666
+
1667
+ /* global ActiveXObject -- old IE, WSH */
1668
+ var anObject$4 = anObject$8;
1669
+ var definePropertiesModule = objectDefineProperties;
1670
+ var enumBugKeys = enumBugKeys$3;
1671
+ var hiddenKeys = hiddenKeys$4;
1672
+ var html = html$1;
1673
+ var documentCreateElement = documentCreateElement$1;
1674
+ var sharedKey = sharedKey$3;
1675
+
1676
+ var GT = '>';
1677
+ var LT = '<';
1678
+ var PROTOTYPE = 'prototype';
1679
+ var SCRIPT = 'script';
1680
+ var IE_PROTO = sharedKey('IE_PROTO');
1681
+
1682
+ var EmptyConstructor = function () { /* empty */ };
1683
+
1684
+ var scriptTag = function (content) {
1685
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1686
+ };
1687
+
1688
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1689
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
1690
+ activeXDocument.write(scriptTag(''));
1691
+ activeXDocument.close();
1692
+ var temp = activeXDocument.parentWindow.Object;
1693
+ activeXDocument = null; // avoid memory leak
1694
+ return temp;
1695
+ };
1696
+
1697
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
1698
+ var NullProtoObjectViaIFrame = function () {
1699
+ // Thrash, waste and sodomy: IE GC bug
1700
+ var iframe = documentCreateElement('iframe');
1701
+ var JS = 'java' + SCRIPT + ':';
1702
+ var iframeDocument;
1703
+ iframe.style.display = 'none';
1704
+ html.appendChild(iframe);
1705
+ // https://github.com/zloirock/core-js/issues/475
1706
+ iframe.src = String(JS);
1707
+ iframeDocument = iframe.contentWindow.document;
1708
+ iframeDocument.open();
1709
+ iframeDocument.write(scriptTag('document.F=Object'));
1710
+ iframeDocument.close();
1711
+ return iframeDocument.F;
1712
+ };
1713
+
1714
+ // Check for document.domain and active x support
1715
+ // No need to use active x approach when document.domain is not set
1716
+ // see https://github.com/es-shims/es5-shim/issues/150
1717
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1718
+ // avoid IE GC bug
1719
+ var activeXDocument;
1720
+ var NullProtoObject = function () {
1721
+ try {
1722
+ activeXDocument = new ActiveXObject('htmlfile');
1723
+ } catch (error) { /* ignore */ }
1724
+ NullProtoObject = typeof document != 'undefined'
1725
+ ? document.domain && activeXDocument
1726
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1727
+ : NullProtoObjectViaIFrame()
1728
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
1729
+ var length = enumBugKeys.length;
1730
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1731
+ return NullProtoObject();
1732
+ };
1733
+
1734
+ hiddenKeys[IE_PROTO] = true;
1735
+
1736
+ // `Object.create` method
1737
+ // https://tc39.es/ecma262/#sec-object.create
1738
+ // eslint-disable-next-line es/no-object-create -- safe
1739
+ var objectCreate = Object.create || function create(O, Properties) {
1740
+ var result;
1741
+ if (O !== null) {
1742
+ EmptyConstructor[PROTOTYPE] = anObject$4(O);
1743
+ result = new EmptyConstructor();
1744
+ EmptyConstructor[PROTOTYPE] = null;
1745
+ // add "__proto__" for Object.getPrototypeOf polyfill
1746
+ result[IE_PROTO] = O;
1747
+ } else result = NullProtoObject();
1748
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1749
+ };
1750
+
1751
+ var fails$2 = fails$c;
1752
+ var isCallable$1 = isCallable$d;
1753
+ var isObject = isObject$6;
1754
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1755
+ var defineBuiltIn$1 = defineBuiltIn$3;
1756
+ var wellKnownSymbol$2 = wellKnownSymbol$4;
1757
+
1758
+ var ITERATOR$1 = wellKnownSymbol$2('iterator');
1759
+ var BUGGY_SAFARI_ITERATORS = false;
1760
+
1761
+ // `%IteratorPrototype%` object
1762
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1763
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1764
+
1765
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1766
+ if ([].keys) {
1767
+ arrayIterator = [].keys();
1768
+ // Safari 8 has buggy iterators w/o `next`
1769
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
1770
+ else {
1771
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1772
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1773
+ }
1774
+ }
1775
+
1776
+ var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$2) || fails$2(function () {
1777
+ var test = {};
1778
+ // FF44- legacy iterators case
1779
+ return IteratorPrototype$2[ITERATOR$1].call(test) !== test;
1780
+ });
1781
+
1782
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1783
+
1784
+ // `%IteratorPrototype%[@@iterator]()` method
1785
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1786
+ if (!isCallable$1(IteratorPrototype$2[ITERATOR$1])) {
1787
+ defineBuiltIn$1(IteratorPrototype$2, ITERATOR$1, function () {
1788
+ return this;
1789
+ });
1790
+ }
1791
+
1792
+ var iteratorsCore = {
1793
+ IteratorPrototype: IteratorPrototype$2,
1794
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1795
+ };
1796
+
1797
+ var $$2 = _export;
1798
+ var global$1 = global$b;
1799
+ var anInstance = anInstance$1;
1800
+ var anObject$3 = anObject$8;
1801
+ var isCallable = isCallable$d;
1802
+ var getPrototypeOf = objectGetPrototypeOf;
1803
+ var defineBuiltInAccessor = defineBuiltInAccessor$1;
1804
+ var createProperty = createProperty$1;
1805
+ var fails$1 = fails$c;
1806
+ var hasOwn = hasOwnProperty_1;
1807
+ var wellKnownSymbol$1 = wellKnownSymbol$4;
1808
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1809
+ var DESCRIPTORS$1 = descriptors;
1810
+
1811
+ var CONSTRUCTOR = 'constructor';
1812
+ var ITERATOR = 'Iterator';
1813
+ var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
1814
+
1815
+ var $TypeError$2 = TypeError;
1816
+ var NativeIterator = global$1[ITERATOR];
1817
+
1818
+ // FF56- have non-standard global helper `Iterator`
1819
+ var FORCED$1 = !isCallable(NativeIterator)
1820
+ || NativeIterator.prototype !== IteratorPrototype$1
1821
+ // FF44- non-standard `Iterator` passes previous tests
1822
+ || !fails$1(function () { NativeIterator({}); });
1823
+
1824
+ var IteratorConstructor = function Iterator() {
1825
+ anInstance(this, IteratorPrototype$1);
1826
+ if (getPrototypeOf(this) === IteratorPrototype$1) throw new $TypeError$2('Abstract class Iterator not directly constructable');
1827
+ };
1828
+
1829
+ var defineIteratorPrototypeAccessor = function (key, value) {
1830
+ if (DESCRIPTORS$1) {
1831
+ defineBuiltInAccessor(IteratorPrototype$1, key, {
1832
+ configurable: true,
1833
+ get: function () {
1834
+ return value;
1835
+ },
1836
+ set: function (replacement) {
1837
+ anObject$3(this);
1838
+ if (this === IteratorPrototype$1) throw new $TypeError$2("You can't redefine this property");
1839
+ if (hasOwn(this, key)) this[key] = replacement;
1840
+ else createProperty(this, key, replacement);
1841
+ }
1842
+ });
1843
+ } else IteratorPrototype$1[key] = value;
1844
+ };
1845
+
1846
+ if (!hasOwn(IteratorPrototype$1, TO_STRING_TAG$1)) defineIteratorPrototypeAccessor(TO_STRING_TAG$1, ITERATOR);
1847
+
1848
+ if (FORCED$1 || !hasOwn(IteratorPrototype$1, CONSTRUCTOR) || IteratorPrototype$1[CONSTRUCTOR] === Object) {
1849
+ defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
1850
+ }
1851
+
1852
+ IteratorConstructor.prototype = IteratorPrototype$1;
1853
+
1854
+ // `Iterator` constructor
1855
+ // https://github.com/tc39/proposal-iterator-helpers
1856
+ $$2({ global: true, constructor: true, forced: FORCED$1 }, {
1857
+ Iterator: IteratorConstructor
1858
+ });
1859
+
1860
+ // `GetIteratorDirect(obj)` abstract operation
1861
+ // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
1862
+ var getIteratorDirect$1 = function (obj) {
1863
+ return {
1864
+ iterator: obj,
1865
+ next: obj.next,
1866
+ done: false
1867
+ };
1868
+ };
1869
+
1870
+ var defineBuiltIn = defineBuiltIn$3;
1871
+
1872
+ var defineBuiltIns$1 = function (target, src, options) {
1873
+ for (var key in src) defineBuiltIn(target, key, src[key], options);
1874
+ return target;
1875
+ };
1876
+
1877
+ // `CreateIterResultObject` abstract operation
1878
+ // https://tc39.es/ecma262/#sec-createiterresultobject
1879
+ var createIterResultObject$1 = function (value, done) {
1880
+ return { value: value, done: done };
1881
+ };
1882
+
1883
+ var call$2 = functionCall;
1884
+ var anObject$2 = anObject$8;
1885
+ var getMethod$1 = getMethod$3;
1886
+
1887
+ var iteratorClose$2 = function (iterator, kind, value) {
1888
+ var innerResult, innerError;
1889
+ anObject$2(iterator);
1890
+ try {
1891
+ innerResult = getMethod$1(iterator, 'return');
1892
+ if (!innerResult) {
1893
+ if (kind === 'throw') throw value;
1894
+ return value;
1895
+ }
1896
+ innerResult = call$2(innerResult, iterator);
1897
+ } catch (error) {
1898
+ innerError = true;
1899
+ innerResult = error;
1900
+ }
1901
+ if (kind === 'throw') throw value;
1902
+ if (innerError) throw innerResult;
1903
+ anObject$2(innerResult);
1904
+ return value;
1905
+ };
1906
+
1907
+ var call$1 = functionCall;
1908
+ var create = objectCreate;
1909
+ var createNonEnumerableProperty = createNonEnumerableProperty$3;
1910
+ var defineBuiltIns = defineBuiltIns$1;
1911
+ var wellKnownSymbol = wellKnownSymbol$4;
1912
+ var InternalStateModule = internalState;
1913
+ var getMethod = getMethod$3;
1914
+ var IteratorPrototype = iteratorsCore.IteratorPrototype;
1915
+ var createIterResultObject = createIterResultObject$1;
1916
+ var iteratorClose$1 = iteratorClose$2;
1917
+
1918
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1919
+ var ITERATOR_HELPER = 'IteratorHelper';
1920
+ var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
1921
+ var setInternalState = InternalStateModule.set;
1922
+
1923
+ var createIteratorProxyPrototype = function (IS_ITERATOR) {
1924
+ var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
1925
+
1926
+ return defineBuiltIns(create(IteratorPrototype), {
1927
+ next: function next() {
1928
+ var state = getInternalState(this);
1929
+ // for simplification:
1930
+ // for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject`
1931
+ // for `%IteratorHelperPrototype%.next` - just a value
1932
+ if (IS_ITERATOR) return state.nextHandler();
1933
+ try {
1934
+ var result = state.done ? undefined : state.nextHandler();
1935
+ return createIterResultObject(result, state.done);
1936
+ } catch (error) {
1937
+ state.done = true;
1938
+ throw error;
1939
+ }
1940
+ },
1941
+ 'return': function () {
1942
+ var state = getInternalState(this);
1943
+ var iterator = state.iterator;
1944
+ state.done = true;
1945
+ if (IS_ITERATOR) {
1946
+ var returnMethod = getMethod(iterator, 'return');
1947
+ return returnMethod ? call$1(returnMethod, iterator) : createIterResultObject(undefined, true);
1948
+ }
1949
+ if (state.inner) try {
1950
+ iteratorClose$1(state.inner.iterator, 'normal');
1951
+ } catch (error) {
1952
+ return iteratorClose$1(iterator, 'throw', error);
1953
+ }
1954
+ iteratorClose$1(iterator, 'normal');
1955
+ return createIterResultObject(undefined, true);
1956
+ }
1957
+ });
1958
+ };
1959
+
1960
+ var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
1961
+ var IteratorHelperPrototype = createIteratorProxyPrototype(false);
1962
+
1963
+ createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
1964
+
1965
+ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
1966
+ var IteratorProxy = function Iterator(record, state) {
1967
+ if (state) {
1968
+ state.iterator = record.iterator;
1969
+ state.next = record.next;
1970
+ } else state = record;
1971
+ state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
1972
+ state.nextHandler = nextHandler;
1973
+ state.counter = 0;
1974
+ state.done = false;
1975
+ setInternalState(this, state);
1976
+ };
1977
+
1978
+ IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
1979
+
1980
+ return IteratorProxy;
1981
+ };
1982
+
1983
+ var anObject$1 = anObject$8;
1984
+ var iteratorClose = iteratorClose$2;
1985
+
1986
+ // call something on iterator step with safe closing on error
1987
+ var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
1988
+ try {
1989
+ return ENTRIES ? fn(anObject$1(value)[0], value[1]) : fn(value);
1990
+ } catch (error) {
1991
+ iteratorClose(iterator, 'throw', error);
1992
+ }
1993
+ };
1994
+
1995
+ var call = functionCall;
1996
+ var aCallable = aCallable$2;
1997
+ var anObject = anObject$8;
1998
+ var getIteratorDirect = getIteratorDirect$1;
1999
+ var createIteratorProxy = iteratorCreateProxy;
2000
+ var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
2001
+
2002
+ var IteratorProxy = createIteratorProxy(function () {
2003
+ var iterator = this.iterator;
2004
+ var result = anObject(call(this.next, iterator));
2005
+ var done = this.done = !!result.done;
2006
+ if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
2007
+ });
2008
+
2009
+ // `Iterator.prototype.map` method
2010
+ // https://github.com/tc39/proposal-iterator-helpers
2011
+ var iteratorMap = function map(mapper) {
2012
+ anObject(this);
2013
+ aCallable(mapper);
2014
+ return new IteratorProxy(getIteratorDirect(this), {
2015
+ mapper: mapper
2016
+ });
2017
+ };
2018
+
2019
+ var $$1 = _export;
2020
+ var map = iteratorMap;
2021
+ var IS_PURE = isPure;
2022
+
2023
+ // `Iterator.prototype.map` method
2024
+ // https://github.com/tc39/proposal-iterator-helpers
2025
+ $$1({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
2026
+ map: map
2027
+ });
2028
+
2029
+ var makeError = {exports: {}};
2030
+
2031
+ (function (module, exports) {
2032
+
2033
+ // ===================================================================
2034
+
2035
+ var construct = typeof Reflect !== "undefined" ? Reflect.construct : undefined;
2036
+ var defineProperty = Object.defineProperty;
2037
+
2038
+ // -------------------------------------------------------------------
2039
+
2040
+ var captureStackTrace = Error.captureStackTrace;
2041
+ if (captureStackTrace === undefined) {
2042
+ captureStackTrace = function captureStackTrace(error) {
2043
+ var container = new Error();
2044
+
2045
+ defineProperty(error, "stack", {
2046
+ configurable: true,
2047
+ get: function getStack() {
2048
+ var stack = container.stack;
2049
+
2050
+ // Replace property with value for faster future accesses.
2051
+ defineProperty(this, "stack", {
2052
+ configurable: true,
2053
+ value: stack,
2054
+ writable: true,
2055
+ });
2056
+
2057
+ return stack;
2058
+ },
2059
+ set: function setStack(stack) {
2060
+ defineProperty(error, "stack", {
2061
+ configurable: true,
2062
+ value: stack,
2063
+ writable: true,
2064
+ });
2065
+ },
2066
+ });
2067
+ };
2068
+ }
2069
+
2070
+ // -------------------------------------------------------------------
2071
+
2072
+ function BaseError(message) {
2073
+ if (message !== undefined) {
2074
+ defineProperty(this, "message", {
2075
+ configurable: true,
2076
+ value: message,
2077
+ writable: true,
2078
+ });
2079
+ }
2080
+
2081
+ var cname = this.constructor.name;
2082
+ if (cname !== undefined && cname !== this.name) {
2083
+ defineProperty(this, "name", {
2084
+ configurable: true,
2085
+ value: cname,
2086
+ writable: true,
2087
+ });
2088
+ }
2089
+
2090
+ captureStackTrace(this, this.constructor);
2091
+ }
2092
+
2093
+ BaseError.prototype = Object.create(Error.prototype, {
2094
+ // See: https://github.com/JsCommunity/make-error/issues/4
2095
+ constructor: {
2096
+ configurable: true,
2097
+ value: BaseError,
2098
+ writable: true,
2099
+ },
2100
+ });
2101
+
2102
+ // -------------------------------------------------------------------
2103
+
2104
+ // Sets the name of a function if possible (depends of the JS engine).
2105
+ var setFunctionName = (function() {
2106
+ function setFunctionName(fn, name) {
2107
+ return defineProperty(fn, "name", {
2108
+ configurable: true,
2109
+ value: name,
2110
+ });
2111
+ }
2112
+ try {
2113
+ var f = function() {};
2114
+ setFunctionName(f, "foo");
2115
+ if (f.name === "foo") {
2116
+ return setFunctionName;
2117
+ }
2118
+ } catch (_) {}
2119
+ })();
2120
+
2121
+ // -------------------------------------------------------------------
2122
+
2123
+ function makeError(constructor, super_) {
2124
+ if (super_ == null || super_ === Error) {
2125
+ super_ = BaseError;
2126
+ } else if (typeof super_ !== "function") {
2127
+ throw new TypeError("super_ should be a function");
2128
+ }
2129
+
2130
+ var name;
2131
+ if (typeof constructor === "string") {
2132
+ name = constructor;
2133
+ constructor =
2134
+ construct !== undefined
2135
+ ? function() {
2136
+ return construct(super_, arguments, this.constructor);
2137
+ }
2138
+ : function() {
2139
+ super_.apply(this, arguments);
2140
+ };
2141
+
2142
+ // If the name can be set, do it once and for all.
2143
+ if (setFunctionName !== undefined) {
2144
+ setFunctionName(constructor, name);
2145
+ name = undefined;
2146
+ }
2147
+ } else if (typeof constructor !== "function") {
2148
+ throw new TypeError("constructor should be either a string or a function");
2149
+ }
2150
+
2151
+ // Also register the super constructor also as `constructor.super_` just
2152
+ // like Node's `util.inherits()`.
2153
+ //
2154
+ // eslint-disable-next-line dot-notation
2155
+ constructor.super_ = constructor["super"] = super_;
2156
+
2157
+ var properties = {
2158
+ constructor: {
2159
+ configurable: true,
2160
+ value: constructor,
2161
+ writable: true,
2162
+ },
2163
+ };
2164
+
2165
+ // If the name could not be set on the constructor, set it on the
2166
+ // prototype.
2167
+ if (name !== undefined) {
2168
+ properties.name = {
2169
+ configurable: true,
2170
+ value: name,
2171
+ writable: true,
2172
+ };
2173
+ }
2174
+ constructor.prototype = Object.create(super_.prototype, properties);
2175
+
2176
+ return constructor;
2177
+ }
2178
+ exports = module.exports = makeError;
2179
+ exports.BaseError = BaseError;
2180
+ } (makeError, makeError.exports));
2181
+
2182
+ var makeErrorExports = makeError.exports;
2183
+
2184
+ /**
2185
+ * Error thrown when the common type is not known/registered.
2186
+ */
2187
+ class UnregisteredSyncEntityCommonTypeError extends makeErrorExports.BaseError {
2188
+ constructor(commonType) {
2189
+ super(`The common type "${commonType}" is not registered.`);
2190
+ this.commonType = void 0;
2191
+ this.commonType = commonType;
2192
+ }
2193
+ }
2194
+ /**
2195
+ * Error thrown when no primary sync source is found for an entity.
2196
+ */
2197
+ class NoPrimarySyncSourceError extends makeErrorExports.BaseError {
2198
+ constructor(entity) {
2199
+ super(`No primary sync source found for entity "${entity.commonType}:${entity.commonId}".`);
2200
+ this.entity = void 0;
2201
+ this.entity = entity;
2202
+ }
2203
+ }
2204
+ /**
2205
+ * Error thrown when multiple primary sync sources are found for an entity.
2206
+ */
2207
+ class MultiplePrimarySyncSourceError extends makeErrorExports.BaseError {
2208
+ constructor(entity) {
2209
+ super(`Multiple primary sync sources found for entity "${entity.commonType}:${entity.commonId}".`);
2210
+ this.entity = void 0;
2211
+ this.entity = entity;
2212
+ }
2213
+ }
2214
+ /**
2215
+ * Error thrown when a synchronization fails for an entity.
2216
+ */
2217
+ class SynchronizationFailedError extends makeErrorExports.BaseError {
2218
+ constructor(entity, error) {
2219
+ super(`Synchronization failed for entity "${entity.commonType}:${entity.commonId}". Error: ${error}`);
2220
+ this.entity = void 0;
2221
+ this.error = void 0;
2222
+ this.entity = entity;
2223
+ this.error = error;
2224
+ }
2225
+ }
2226
+
2227
+ function syncEntitySynchronizer(config) {
2228
+ const map = new Map(config.commonTypeSynchronizers.map(x => [x.commonType, x]));
2229
+ const commonTypes = Array.from(map.keys());
2230
+ const commonTypeSynchronizer = input => {
2231
+ const synchronizer = map.get(input);
2232
+ if (!synchronizer) {
2233
+ throw new UnregisteredSyncEntityCommonTypeError(input);
2234
+ }
2235
+ return synchronizer;
2236
+ };
2237
+ return {
2238
+ commonTypes,
2239
+ commonTypeSynchronizer,
2240
+ synchronizeInstance: input => {
2241
+ const synchronizer = commonTypeSynchronizer(input.commonType);
2242
+ return synchronizer.synchronizeInstance(input);
2243
+ }
2244
+ };
2245
+ }
2246
+
2247
+ var classof = classofRaw;
2248
+
2249
+ // `IsArray` abstract operation
2250
+ // https://tc39.es/ecma262/#sec-isarray
2251
+ // eslint-disable-next-line es/no-array-isarray -- safe
2252
+ var isArray$1 = Array.isArray || function isArray(argument) {
2253
+ return classof(argument) === 'Array';
2254
+ };
2255
+
2256
+ var DESCRIPTORS = descriptors;
2257
+ var isArray = isArray$1;
2258
+
2259
+ var $TypeError$1 = TypeError;
2260
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2261
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2262
+
2263
+ // Safari < 13 does not throw an error in this case
2264
+ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
2265
+ // makes no sense without proper strict mode support
2266
+ if (this !== undefined) return true;
2267
+ try {
2268
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
2269
+ Object.defineProperty([], 'length', { writable: false }).length = 1;
2270
+ } catch (error) {
2271
+ return error instanceof TypeError;
2272
+ }
2273
+ }();
2274
+
2275
+ var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
2276
+ if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
2277
+ throw new $TypeError$1('Cannot set read only .length');
2278
+ } return O.length = length;
2279
+ } : function (O, length) {
2280
+ return O.length = length;
2281
+ };
2282
+
2283
+ var $TypeError = TypeError;
2284
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
2285
+
2286
+ var doesNotExceedSafeInteger$1 = function (it) {
2287
+ if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
2288
+ return it;
2289
+ };
2290
+
2291
+ var $ = _export;
2292
+ var toObject = toObject$3;
2293
+ var lengthOfArrayLike = lengthOfArrayLike$2;
2294
+ var setArrayLength = arraySetLength;
2295
+ var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
2296
+ var fails = fails$c;
2297
+
2298
+ var INCORRECT_TO_LENGTH = fails(function () {
2299
+ return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
2300
+ });
2301
+
2302
+ // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
2303
+ // https://bugs.chromium.org/p/v8/issues/detail?id=12681
2304
+ var properErrorOnNonWritableLength = function () {
2305
+ try {
2306
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
2307
+ Object.defineProperty([], 'length', { writable: false }).push();
2308
+ } catch (error) {
2309
+ return error instanceof TypeError;
2310
+ }
2311
+ };
2312
+
2313
+ var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
2314
+
2315
+ // `Array.prototype.push` method
2316
+ // https://tc39.es/ecma262/#sec-array.prototype.push
2317
+ $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
2318
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
2319
+ push: function push(item) {
2320
+ var O = toObject(this);
2321
+ var len = lengthOfArrayLike(O);
2322
+ var argCount = arguments.length;
2323
+ doesNotExceedSafeInteger(len + argCount);
2324
+ for (var i = 0; i < argCount; i++) {
2325
+ O[len] = arguments[i];
2326
+ len++;
2327
+ }
2328
+ setArrayLength(O, len);
2329
+ return len;
2330
+ }
2331
+ });
2332
+
2333
+ function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config) {
2334
+ const {
2335
+ commonType,
2336
+ sources,
2337
+ entitySourceContextLoader,
2338
+ dynamicSources = false
2339
+ } = config;
2340
+ const syncEntityCommonTypeIdPairForType = syncEntityCommonTypeIdPairFactory(commonType);
2341
+ const sourcesByContextType = util.makeValuesGroupMap(sources, x => x.contextType);
2342
+ const allGlobalSources = sourcesByContextType.get('global') ?? [];
2343
+ const allContextSources = sourcesByContextType.get('context') ?? [];
2344
+ /**
2345
+ * Loads the relevant sources for the given entity and context.
2346
+ *
2347
+ * @param entitySourceContext The contextual information for the entity.
2348
+ * @returns The relevant sources for the entity.
2349
+ */
2350
+ function loadSources(entityCommonTypeIdPair, entitySourceContext) {
2351
+ const {
2352
+ globalSources,
2353
+ contextSources
2354
+ } = entitySourceContext;
2355
+ // load/filter global sources
2356
+ const globalMap = new Map(globalSources.map(x => {
2357
+ let sourceId;
2358
+ let flowType;
2359
+ if (typeof x === 'string') {
2360
+ sourceId = x;
2361
+ flowType = 'unset';
2362
+ } else {
2363
+ sourceId = x.sourceId;
2364
+ flowType = x.flowType;
2365
+ }
2366
+ return [sourceId, {
2367
+ sourceId,
2368
+ flowType
2369
+ }];
2370
+ }));
2371
+ const relevantGlobalSources = util.filterMaybeArrayValues(allGlobalSources.map(x => {
2372
+ const sourceContext = globalMap.get(x.info.id);
2373
+ let result;
2374
+ if (sourceContext != null) {
2375
+ result = {
2376
+ entityCommonTypeIdPair,
2377
+ flowType: sourceContext.flowType ?? x.defaultFlowType ?? 'unset',
2378
+ source: x
2379
+ };
2380
+ }
2381
+ return result;
2382
+ }));
2383
+ // load/filter context sources
2384
+ const contextMap = new Map(contextSources.map(x => [x.sourceId, x]));
2385
+ const relevantContextSources = util.filterMaybeArrayValues(allContextSources.map(x => {
2386
+ const sourceContext = contextMap.get(x.info.id);
2387
+ let result;
2388
+ if (sourceContext != null) {
2389
+ const flowType = sourceContext.flowType ?? x.defaultFlowType ?? 'unset';
2390
+ result = {
2391
+ entityCommonTypeIdPair,
2392
+ flowType,
2393
+ source: x,
2394
+ context: sourceContext
2395
+ };
2396
+ }
2397
+ return result;
2398
+ }));
2399
+ const allSources = [...relevantGlobalSources, ...relevantContextSources];
2400
+ // sort by order, with primary first
2401
+ allSources.sort(util.sortByNumberFunction(x => {
2402
+ let result;
2403
+ switch (x.flowType) {
2404
+ case 'primary':
2405
+ result = 1;
2406
+ break;
2407
+ case 'secondary':
2408
+ result = 2;
2409
+ break;
2410
+ case 'unset':
2411
+ default:
2412
+ result = 3;
2413
+ break;
2414
+ }
2415
+ return result;
2416
+ }));
2417
+ return allSources;
2418
+ }
2419
+ const synchronizeInstance = async input => {
2420
+ const syncEntityCommonTypeIdPair = syncEntityCommonTypeIdPairForType(input);
2421
+ const _loadRelevantSources = async () => {
2422
+ const entitySourceContext = await entitySourceContextLoader(syncEntityCommonTypeIdPair);
2423
+ const relevantSources = loadSources(syncEntityCommonTypeIdPair, entitySourceContext);
2424
+ return relevantSources;
2425
+ };
2426
+ let loadRelevantSources;
2427
+ if (dynamicSources) {
2428
+ // if dynamic, reload each time and do not cache
2429
+ loadRelevantSources = _loadRelevantSources;
2430
+ } else {
2431
+ // if not dynamic, make a cached getter
2432
+ loadRelevantSources = util.cachedGetter(_loadRelevantSources);
2433
+ }
2434
+ /**
2435
+ * Performs the synchonization
2436
+ */
2437
+ const synchronize = async context => {
2438
+ const relevantSources = await loadRelevantSources();
2439
+ const syncEntityInstances = await Promise.all(relevantSources.map(x => x.source.syncEntityInstance(x).then(y => [x, y])));
2440
+ const sourcesByFlowType = util.makeValuesGroupMap(syncEntityInstances, x => x[0].flowType);
2441
+ const primarySources = sourcesByFlowType.get('primary') ?? [];
2442
+ const secondarySources = sourcesByFlowType.get('secondary') ?? [];
2443
+ const replicaSources = sourcesByFlowType.get('replica') ?? [];
2444
+ // assert primary sources count
2445
+ switch (primarySources.length) {
2446
+ case 0:
2447
+ throw new NoPrimarySyncSourceError(syncEntityCommonTypeIdPair);
2448
+ case 1:
2449
+ break;
2450
+ default:
2451
+ throw new MultiplePrimarySyncSourceError(syncEntityCommonTypeIdPair);
2452
+ }
2453
+ function synchronizeInstance(source, deleted) {
2454
+ const [input, sourceInstance] = source;
2455
+ const promise = deleted ? sourceInstance.synchronizeDelete() : sourceInstance.synchronize();
2456
+ return promise.catch(error => {
2457
+ const errorResult = {
2458
+ type: 'error',
2459
+ error,
2460
+ entity: {
2461
+ ...syncEntityCommonTypeIdPair,
2462
+ sourceInfo: input.source.info,
2463
+ id: ''
2464
+ }
2465
+ };
2466
+ return errorResult;
2467
+ });
2468
+ }
2469
+ async function performSynchronizationOfSources(input) {
2470
+ const {
2471
+ syncRecursionDepth,
2472
+ secondaryFlaggedDelete
2473
+ } = input;
2474
+ let result;
2475
+ // synchronize the primary source
2476
+ const primarySource = primarySources[0];
2477
+ const primarySyncResult = await synchronizeInstance(primarySource, secondaryFlaggedDelete ?? false);
2478
+ const synchronizedEntityResults = [primarySyncResult];
2479
+ let primaryFlaggedDelete = false;
2480
+ switch (primarySyncResult.type) {
2481
+ case 'deleted':
2482
+ primaryFlaggedDelete = true;
2483
+ break;
2484
+ case 'failed':
2485
+ case 'error':
2486
+ throw new SynchronizationFailedError(syncEntityCommonTypeIdPair, primarySyncResult.error);
2487
+ }
2488
+ // synchronize all secondary sources, one after the other. If any secondary source returns deleted and the primary source was not flagged as deleted, then the synchronization will be restarted.
2489
+ for (const secondarySource of secondarySources) {
2490
+ const secondarySyncResult = await synchronizeInstance(secondarySource, primaryFlaggedDelete);
2491
+ synchronizedEntityResults.push(secondarySyncResult);
2492
+ switch (secondarySyncResult.type) {
2493
+ case 'deleted':
2494
+ if (primaryFlaggedDelete === false) {
2495
+ if (syncRecursionDepth === 1) {
2496
+ result = await performSynchronizationOfSources({
2497
+ syncRecursionDepth: syncRecursionDepth + 1,
2498
+ secondaryFlaggedDelete: true
2499
+ });
2500
+ }
2501
+ break;
2502
+ }
2503
+ break;
2504
+ case 'failed':
2505
+ case 'error':
2506
+ throw new SynchronizationFailedError(syncEntityCommonTypeIdPair, secondarySyncResult.error);
2507
+ }
2508
+ }
2509
+ // if result was already set, then it was completed in a recursive result
2510
+ if (result == null) {
2511
+ // synchronize all replica sources concurrently
2512
+ const replicaTaskResults = await util.performAsyncTasks(replicaSources, x => synchronizeInstance(x, primaryFlaggedDelete), {
2513
+ sequential: false,
2514
+ maxParallelTasks: 3
2515
+ });
2516
+ // add all the results
2517
+ util.pushArrayItemsIntoArray(synchronizedEntityResults, replicaTaskResults.results.map(x => x[1]));
2518
+ // compute final result
2519
+ result = {
2520
+ synchronizedEntityResults
2521
+ };
2522
+ }
2523
+ return result;
2524
+ }
2525
+ const result = await performSynchronizationOfSources({
2526
+ syncRecursionDepth: 0
2527
+ });
2528
+ return {
2529
+ targetPair: syncEntityCommonTypeIdPair,
2530
+ entitiesSynchronized: result.synchronizedEntityResults
2531
+ };
2532
+ };
2533
+ const instance = {
2534
+ entityPair: syncEntityCommonTypeIdPair,
2535
+ synchronize
2536
+ };
2537
+ return instance;
2538
+ };
2539
+ const result = {
2540
+ commonType,
2541
+ synchronizeInstance
2542
+ };
2543
+ return result;
2544
+ }
2545
+
533
2546
  // MARK: String
534
2547
  function transformStringToBoolean(defaultValue) {
535
2548
  return params => {
@@ -924,6 +2937,7 @@ exports.WebsiteLink = WebsiteLink;
924
2937
  exports.YOUTUBE_BASE_URL = YOUTUBE_BASE_URL;
925
2938
  exports.YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID = YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID;
926
2939
  exports.YOUTUBE_WEBSITE_LINK_TYPE = YOUTUBE_WEBSITE_LINK_TYPE;
2940
+ exports.basicSyncEntityCommonTypeSynchronizerInstanceFactory = basicSyncEntityCommonTypeSynchronizerInstanceFactory;
927
2941
  exports.cashappProfileUrl = cashappProfileUrl;
928
2942
  exports.cashappProfileUrlToWebsiteLink = cashappProfileUrlToWebsiteLink;
929
2943
  exports.contextGrantedModelRoles = contextGrantedModelRoles;
@@ -951,6 +2965,9 @@ exports.snapchatProfileUrl = snapchatProfileUrl;
951
2965
  exports.snapchatProfileUrlToWebsiteLink = snapchatProfileUrlToWebsiteLink;
952
2966
  exports.spotifyProfileUrl = spotifyProfileUrl;
953
2967
  exports.spotifyProfileUrlToWebsiteLink = spotifyProfileUrlToWebsiteLink;
2968
+ exports.syncEntityCommonTypeIdPairFactory = syncEntityCommonTypeIdPairFactory;
2969
+ exports.syncEntityFactory = syncEntityFactory;
2970
+ exports.syncEntitySynchronizer = syncEntitySynchronizer;
954
2971
  exports.tiktokProfileUrl = tiktokProfileUrl;
955
2972
  exports.tiktokProfileUrlToWebsiteLink = tiktokProfileUrlToWebsiteLink;
956
2973
  exports.toTransformAndValidateFunctionResult = toTransformAndValidateFunctionResult;