@magmacomputing/tempo-plugin-geo 1.0.0 → 1.2.0
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/CHANGELOG.md +15 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.global.min.js +1 -1
- package/dist/index.js +492 -132
- package/dist/install.d.ts +2 -0
- package/dist/install.global.min.js +1 -0
- package/dist/install.js +3262 -0
- package/package.json +13 -10
package/dist/index.js
CHANGED
|
@@ -257,32 +257,55 @@ var init_type_library = __esm({
|
|
|
257
257
|
});
|
|
258
258
|
|
|
259
259
|
// ../../library/dist/common/primitives/assertion.library.js
|
|
260
|
-
|
|
260
|
+
function isNumeric(str) {
|
|
261
|
+
const type = typeof str;
|
|
262
|
+
switch (type) {
|
|
263
|
+
case "number":
|
|
264
|
+
return Number.isFinite(str);
|
|
265
|
+
case "bigint":
|
|
266
|
+
return true;
|
|
267
|
+
case "string": {
|
|
268
|
+
const val = str.trim();
|
|
269
|
+
if (val.length === 0)
|
|
270
|
+
return false;
|
|
271
|
+
return RE_BIGINT_LITERAL.test(val) || isNumber(Number(val));
|
|
272
|
+
}
|
|
273
|
+
default:
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
var isType, isPrimitive, isReference, isIterable, isString, isText, isNumber, RE_BIGINT_LITERAL, isInteger, isArray, isArrayLike, isObject, isDate, isRegExp, isSymbol, isSymbolFor, isSafeKey, isNullish, isUndefined, isDefined, isFunction, isCallable, isMap, isSet, isError, isLocale, isEmpty;
|
|
261
278
|
var init_assertion_library = __esm({
|
|
262
279
|
"../../library/dist/common/primitives/assertion.library.js"() {
|
|
263
280
|
"use strict";
|
|
264
281
|
init_symbol_library();
|
|
265
282
|
init_type_library();
|
|
266
283
|
isType = (obj, ...types) => types.includes(getType(obj));
|
|
267
|
-
isPrimitive = (obj) =>
|
|
284
|
+
isPrimitive = (obj) => obj === null || typeof obj !== "object" && typeof obj !== "function";
|
|
268
285
|
isReference = (obj) => !isPrimitive(obj);
|
|
269
|
-
|
|
270
|
-
|
|
286
|
+
isIterable = (obj) => Symbol.iterator in Object(obj) && !isString(obj);
|
|
287
|
+
isString = (obj) => typeof obj === "string";
|
|
288
|
+
isText = (obj) => typeof obj === "string" && obj.trim().length > 0;
|
|
271
289
|
isNumber = (obj) => Number.isFinite(obj);
|
|
272
|
-
|
|
273
|
-
|
|
290
|
+
RE_BIGINT_LITERAL = /^[+-]?[0-9]+n$/;
|
|
291
|
+
isInteger = (obj) => typeof obj === "bigint";
|
|
292
|
+
isArray = (obj) => Array.isArray(obj);
|
|
293
|
+
isArrayLike = (obj) => protoType(obj) === "Object" && "length" in obj && Object.keys(obj).every((key) => key === "length" || isNumber(Number(key)));
|
|
274
294
|
isObject = (obj) => isType(obj, "Object");
|
|
275
295
|
isDate = (obj) => isType(obj, "Date");
|
|
276
|
-
|
|
277
|
-
|
|
296
|
+
isRegExp = (obj) => isType(obj, "RegExp");
|
|
297
|
+
isSymbol = (obj) => typeof obj === "symbol";
|
|
298
|
+
isSymbolFor = (obj) => typeof obj === "symbol" && Symbol.keyFor(obj) !== void 0;
|
|
278
299
|
isSafeKey = (key) => key !== "__proto__" && key !== "constructor" && key !== "prototype";
|
|
279
|
-
isNullish = (obj) => isType(obj, "
|
|
280
|
-
isUndefined = (obj) => isType(obj, "
|
|
281
|
-
isDefined = (obj) => !isNullish(obj);
|
|
300
|
+
isNullish = (obj) => obj === null || obj === void 0 || isType(obj, "Void", "Empty");
|
|
301
|
+
isUndefined = (obj) => obj === void 0 || isType(obj, "Void", "Empty");
|
|
302
|
+
isDefined = (obj) => obj !== null && obj !== void 0 && !isNullish(obj);
|
|
282
303
|
isFunction = (obj) => isType(obj, "Function", "AsyncFunction", "GeneratorFunction", "AsyncGeneratorFunction");
|
|
304
|
+
isCallable = (obj) => typeof obj === "function";
|
|
283
305
|
isMap = (obj) => isType(obj, "Map");
|
|
284
306
|
isSet = (obj) => isType(obj, "Set");
|
|
285
307
|
isError = (err, constructor) => isType(err, "Error") && (constructor ? err instanceof constructor : true);
|
|
308
|
+
isLocale = (obj) => typeof Intl !== "undefined" && typeof Intl.Locale === "function" && obj instanceof Intl.Locale;
|
|
286
309
|
isEmpty = (obj) => isNullish(obj) || isObject(obj) && Reflect.ownKeys(obj).length === 0 || isString(obj) && obj.trim().length === 0 || typeof obj === "number" && Number.isNaN(obj) || isArray(obj) && obj.length === 0 || isSet(obj) && obj.size === 0 || isMap(obj) && obj.size === 0 || ArrayBuffer.isView(obj) && obj.byteLength === 0 || isDate(obj) && Number.isNaN(obj.getTime());
|
|
287
310
|
}
|
|
288
311
|
});
|
|
@@ -514,6 +537,8 @@ function serialize(val, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
514
537
|
if (seen.has(value2))
|
|
515
538
|
return "<Circular>";
|
|
516
539
|
seen.add(value2);
|
|
540
|
+
if (isLocale(value2))
|
|
541
|
+
return value2.toString();
|
|
517
542
|
if (isMap(value2))
|
|
518
543
|
return `map:[${Array.from(value2.entries()).map((e) => serialize(e, seen)).sort().join(",")}]`;
|
|
519
544
|
if (isSet(value2))
|
|
@@ -570,15 +595,86 @@ var init_function_library = __esm({
|
|
|
570
595
|
});
|
|
571
596
|
|
|
572
597
|
// ../../library/dist/common/runtime/json.library.js
|
|
598
|
+
function cleanify(obj) {
|
|
599
|
+
try {
|
|
600
|
+
return JSON.parse(JSON.stringify(obj));
|
|
601
|
+
} catch (error) {
|
|
602
|
+
console.warn("Could not clean object:", error?.message ?? error);
|
|
603
|
+
throw error;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
573
606
|
var init_json_library = __esm({
|
|
574
607
|
"../../library/dist/common/runtime/json.library.js"() {
|
|
575
608
|
"use strict";
|
|
609
|
+
init_assertion_library();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// ../../library/dist/common/primitives/object.library.js
|
|
614
|
+
function looseIndex(arg) {
|
|
615
|
+
if (isDefined(arg))
|
|
616
|
+
return isFunction(arg) ? arg() : arg;
|
|
617
|
+
return (obj) => isFunction(obj) ? obj() : obj;
|
|
618
|
+
}
|
|
619
|
+
var getObjectKeys, asObject;
|
|
620
|
+
var init_object_library = __esm({
|
|
621
|
+
"../../library/dist/common/primitives/object.library.js"() {
|
|
622
|
+
"use strict";
|
|
623
|
+
init_primitive_library();
|
|
624
|
+
init_assertion_library();
|
|
625
|
+
init_type_library();
|
|
626
|
+
getObjectKeys = (obj) => {
|
|
627
|
+
const keys = /* @__PURE__ */ new Set();
|
|
628
|
+
let curr = obj;
|
|
629
|
+
let depth = 0;
|
|
630
|
+
while (curr && curr !== Object.prototype && depth++ < 10) {
|
|
631
|
+
const descs = Object.getOwnPropertyDescriptors(curr);
|
|
632
|
+
for (const [key, desc] of Object.entries(descs)) {
|
|
633
|
+
if (!isSafeKey(key))
|
|
634
|
+
continue;
|
|
635
|
+
if (desc.enumerable || isFunction(desc.get)) {
|
|
636
|
+
keys.add(key);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
curr = Object.getPrototypeOf(curr);
|
|
640
|
+
}
|
|
641
|
+
return Array.from(keys);
|
|
642
|
+
};
|
|
643
|
+
asObject = (obj) => {
|
|
644
|
+
if (isPrimitive(obj) || isFunction(obj))
|
|
645
|
+
return obj;
|
|
646
|
+
if (isArray(obj))
|
|
647
|
+
return obj.map((item) => asObject(item));
|
|
648
|
+
if (isDate(obj) || isRegExp(obj) || isMap(obj) || isSet(obj))
|
|
649
|
+
return obj;
|
|
650
|
+
try {
|
|
651
|
+
if (isFunction(obj.toJSON))
|
|
652
|
+
return asObject(obj.toJSON());
|
|
653
|
+
} catch {
|
|
654
|
+
}
|
|
655
|
+
const temp = {};
|
|
656
|
+
for (const key of getObjectKeys(obj)) {
|
|
657
|
+
try {
|
|
658
|
+
temp[key] = asObject(obj[key]);
|
|
659
|
+
} catch {
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return temp;
|
|
663
|
+
};
|
|
664
|
+
looseIndex.stringSymbol = looseIndex();
|
|
665
|
+
looseIndex.symbolRegExp = looseIndex();
|
|
666
|
+
looseIndex.symbolString = looseIndex();
|
|
667
|
+
looseIndex.stringString = looseIndex();
|
|
576
668
|
}
|
|
577
669
|
});
|
|
578
670
|
|
|
579
671
|
// ../../library/dist/common/runtime/serialize.library.js
|
|
580
|
-
function
|
|
581
|
-
|
|
672
|
+
function clone(obj, opts) {
|
|
673
|
+
try {
|
|
674
|
+
return globalThis.structuredClone(obj, opts);
|
|
675
|
+
} catch {
|
|
676
|
+
return cleanify(obj);
|
|
677
|
+
}
|
|
582
678
|
}
|
|
583
679
|
function reviver(_key, val) {
|
|
584
680
|
return decode(val);
|
|
@@ -624,19 +720,34 @@ function toSymbol(value2) {
|
|
|
624
720
|
return Symbol(desc);
|
|
625
721
|
}
|
|
626
722
|
}
|
|
627
|
-
function stringify(obj) {
|
|
628
|
-
|
|
723
|
+
function stringify(obj, options) {
|
|
724
|
+
const prevCompact = activeCompact;
|
|
725
|
+
activeCompact = options?.compact !== false;
|
|
726
|
+
try {
|
|
727
|
+
const str = stringize(obj, false);
|
|
728
|
+
if (options?.signed) {
|
|
729
|
+
if (!isString(options.secret) || !options.secret)
|
|
730
|
+
throw new TypeError("stringify: signed serialization requires an explicit secret string");
|
|
731
|
+
return `$sig:${fastDigest(str, options.secret)}:${str}`;
|
|
732
|
+
}
|
|
733
|
+
return str;
|
|
734
|
+
} finally {
|
|
735
|
+
activeCompact = prevCompact;
|
|
736
|
+
}
|
|
629
737
|
}
|
|
630
738
|
function stringize(obj, recurse = true) {
|
|
631
739
|
const arg = asType(obj);
|
|
632
740
|
const one = curry(oneKey)(arg.type);
|
|
633
741
|
switch (arg.type) {
|
|
634
|
-
case "String":
|
|
742
|
+
case "String": {
|
|
743
|
+
let strVal = arg.value;
|
|
744
|
+
if (strVal.startsWith("~"))
|
|
745
|
+
strVal = `~${strVal}`;
|
|
635
746
|
if (!recurse) {
|
|
636
|
-
recurse =
|
|
747
|
+
recurse = strVal === "true" || strVal === "false" || strVal === "null" || parseFloat(strVal).toString() === strVal || strVal.startsWith("~");
|
|
637
748
|
}
|
|
638
|
-
return recurse ? JSON.stringify(encode(
|
|
639
|
-
|
|
749
|
+
return recurse ? JSON.stringify(encode(strVal)) : encode(strVal);
|
|
750
|
+
}
|
|
640
751
|
case "Boolean":
|
|
641
752
|
case "Null":
|
|
642
753
|
case "Number":
|
|
@@ -644,11 +755,13 @@ function stringize(obj, recurse = true) {
|
|
|
644
755
|
// JSON.stringify will correctly handle these
|
|
645
756
|
case "Void":
|
|
646
757
|
case "Undefined":
|
|
647
|
-
return one(JSON.stringify("void"));
|
|
758
|
+
return activeCompact ? JSON.stringify("~u") : one(JSON.stringify("void"));
|
|
648
759
|
// preserve 'undefined' values
|
|
649
760
|
case "BigInt":
|
|
650
|
-
return one(arg.value.toString());
|
|
761
|
+
return activeCompact ? JSON.stringify(`~n${arg.value.toString()}`) : one(arg.value.toString());
|
|
651
762
|
// even though BigInt has a toString method, it is not supported in JSON.stringify
|
|
763
|
+
case "Date":
|
|
764
|
+
return activeCompact ? JSON.stringify(`~t${arg.value.getTime()}`) : one(stringize(arg.value.toJSON()));
|
|
652
765
|
case "Object": {
|
|
653
766
|
const obj2 = ownEntries(arg.value).filter(([, val]) => isStringable(val)).map(([key, val]) => `${fromSymbol(key)}: ${stringize(val)}`).join(",");
|
|
654
767
|
return `{${obj2}}`;
|
|
@@ -665,8 +778,10 @@ function stringize(obj, recurse = true) {
|
|
|
665
778
|
const set = Array.from(arg.value.values()).filter((val) => isStringable(val)).map((val) => stringize(val)).join(",");
|
|
666
779
|
return one(`[${set}]`);
|
|
667
780
|
}
|
|
668
|
-
case "Symbol":
|
|
669
|
-
|
|
781
|
+
case "Symbol": {
|
|
782
|
+
const symStr = `${isSymbolFor(arg.value) ? "@" : ""}@(${arg.value.description ?? ""})`;
|
|
783
|
+
return activeCompact ? JSON.stringify(`~y${symStr}`) : one(JSON.stringify(symStr));
|
|
784
|
+
}
|
|
670
785
|
case "RegExp":
|
|
671
786
|
return one(stringize({ source: arg.value.source, flags: arg.value.flags }));
|
|
672
787
|
case "Class":
|
|
@@ -677,21 +792,55 @@ function stringize(obj, recurse = true) {
|
|
|
677
792
|
return void 0;
|
|
678
793
|
case isFunction(value2.toJSON):
|
|
679
794
|
return one(stringize(value2.toJSON()));
|
|
680
|
-
case isFunction(value2.toString): {
|
|
795
|
+
case (isFunction(value2.toString) && value2.toString !== Object.prototype.toString): {
|
|
681
796
|
const str = value2.toString();
|
|
682
797
|
return one(str.includes('"') ? str : JSON.stringify(str));
|
|
683
798
|
}
|
|
684
|
-
case isFunction(value2.valueOf):
|
|
799
|
+
case (isFunction(value2.valueOf) && value2.valueOf !== Object.prototype.valueOf):
|
|
685
800
|
return one(JSON.stringify(value2.valueOf()));
|
|
686
|
-
default:
|
|
687
|
-
|
|
801
|
+
default: {
|
|
802
|
+
const plain = asObject(value2);
|
|
803
|
+
return isReference(plain) && Object.keys(plain).length > 0 ? stringize(plain) : one(JSON.stringify(value2, (key, o) => isEmpty(key) ? o : stringize(o)));
|
|
804
|
+
}
|
|
688
805
|
}
|
|
689
806
|
}
|
|
690
807
|
}
|
|
691
808
|
}
|
|
692
|
-
function objectify(str,
|
|
809
|
+
function objectify(str, optionsOrSentinel) {
|
|
693
810
|
if (!isString(str))
|
|
694
811
|
return str;
|
|
812
|
+
const options = isFunction(optionsOrSentinel) ? { sentinel: optionsOrSentinel } : optionsOrSentinel ?? {};
|
|
813
|
+
if (str.startsWith("$sig:")) {
|
|
814
|
+
const secondColon = str.indexOf(":", 5);
|
|
815
|
+
if (secondColon !== -1) {
|
|
816
|
+
const sig = str.substring(5, secondColon);
|
|
817
|
+
const payload = str.substring(secondColon + 1);
|
|
818
|
+
if (!isString(options.secret) || !options.secret) {
|
|
819
|
+
console.warn("objectify: signature verification requires an explicit secret string");
|
|
820
|
+
if (options.throwOnError)
|
|
821
|
+
throw new TypeError("objectify: signature verification requires an explicit secret string");
|
|
822
|
+
return str;
|
|
823
|
+
}
|
|
824
|
+
const expectedSig = fastDigest(payload, options.secret);
|
|
825
|
+
if (!constantTimeEqual(sig, expectedSig)) {
|
|
826
|
+
console.warn("objectify: signature verification failed");
|
|
827
|
+
if (options.throwOnError)
|
|
828
|
+
throw new Error("objectify: signature verification failed");
|
|
829
|
+
return str;
|
|
830
|
+
}
|
|
831
|
+
str = payload;
|
|
832
|
+
} else if (options.requireSigned) {
|
|
833
|
+
console.warn("objectify: malformed signed payload");
|
|
834
|
+
if (options.throwOnError)
|
|
835
|
+
throw new Error("objectify: malformed signed payload");
|
|
836
|
+
return str;
|
|
837
|
+
}
|
|
838
|
+
} else if (options.requireSigned) {
|
|
839
|
+
console.warn("objectify: unsigned string rejected by requireSigned policy");
|
|
840
|
+
if (options.throwOnError)
|
|
841
|
+
throw new Error("objectify: unsigned string rejected by requireSigned policy");
|
|
842
|
+
return str;
|
|
843
|
+
}
|
|
695
844
|
let parse;
|
|
696
845
|
try {
|
|
697
846
|
parse = JSON.parse(str, reviver);
|
|
@@ -700,28 +849,50 @@ function objectify(str, sentinel) {
|
|
|
700
849
|
console.warn(`objectify.parse: -> ${str}, ${error.message}`);
|
|
701
850
|
return str;
|
|
702
851
|
} else
|
|
703
|
-
return objectify(`"${str}"`,
|
|
852
|
+
return objectify(`"${str}"`, options.requireSigned ? { ...options, requireSigned: false } : options);
|
|
704
853
|
}
|
|
705
854
|
switch (true) {
|
|
706
855
|
case (str.startsWith("{") && str.endsWith("}")):
|
|
707
856
|
// looks like Object
|
|
708
857
|
case (str.startsWith("[") && str.endsWith("]")):
|
|
709
|
-
return traverse(parse,
|
|
858
|
+
return traverse(parse, options, 0);
|
|
710
859
|
// recurse into object
|
|
711
860
|
default:
|
|
712
|
-
return parse;
|
|
861
|
+
return typeify(parse, options);
|
|
713
862
|
}
|
|
714
863
|
}
|
|
715
|
-
function traverse(obj,
|
|
864
|
+
function traverse(obj, options, depth = 0) {
|
|
865
|
+
const maxDepth = options.maxDepth ?? MAX_TRAVERSE_DEPTH;
|
|
866
|
+
if (depth >= maxDepth)
|
|
867
|
+
return obj;
|
|
716
868
|
if (isObject(obj)) {
|
|
717
|
-
return typeify(ownEntries(obj).reduce((acc, [key, val]) => Object.assign(acc, { [toSymbol(key)]: typeify(traverse(val,
|
|
869
|
+
return typeify(ownEntries(obj).filter(([key]) => isSafeKey(key)).reduce((acc, [key, val]) => Object.assign(acc, { [toSymbol(key)]: typeify(traverse(val, options, depth + 1), options) }), {}), options);
|
|
718
870
|
}
|
|
719
871
|
if (isArray(obj)) {
|
|
720
|
-
return ownValues(obj).map((val) => typeify(traverse(val,
|
|
872
|
+
return ownValues(obj).map((val) => typeify(traverse(val, options, depth + 1), options));
|
|
721
873
|
}
|
|
722
|
-
return obj;
|
|
874
|
+
return typeify(obj, options);
|
|
723
875
|
}
|
|
724
|
-
function typeify(json,
|
|
876
|
+
function typeify(json, options) {
|
|
877
|
+
if (isString(json) && json.startsWith("~")) {
|
|
878
|
+
try {
|
|
879
|
+
if (json.startsWith("~~"))
|
|
880
|
+
return json.substring(1);
|
|
881
|
+
if (json.startsWith("~n"))
|
|
882
|
+
return BigInt(json.substring(2));
|
|
883
|
+
if (json.startsWith("~t")) {
|
|
884
|
+
const timeVal = json.substring(2);
|
|
885
|
+
const d = new Date(isNumeric(timeVal) ? Number(timeVal) : timeVal);
|
|
886
|
+
return isNaN(d.getTime()) ? json : d;
|
|
887
|
+
}
|
|
888
|
+
if (json === "~u")
|
|
889
|
+
return options.sentinel?.();
|
|
890
|
+
if (json.startsWith("~y"))
|
|
891
|
+
return toSymbol(json.substring(2));
|
|
892
|
+
} catch {
|
|
893
|
+
return json;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
725
896
|
if (!isObject(json) || ownKeys(json).length !== 1)
|
|
726
897
|
return json;
|
|
727
898
|
const [$type, value2] = ownEntries(json)[0];
|
|
@@ -745,12 +916,14 @@ function typeify(json, sentinel) {
|
|
|
745
916
|
case "Undefined":
|
|
746
917
|
case "Empty":
|
|
747
918
|
case "Void":
|
|
748
|
-
return sentinel?.();
|
|
919
|
+
return options.sentinel?.();
|
|
749
920
|
// run Sentinel function to handle undefined values
|
|
750
921
|
case "Date":
|
|
751
922
|
return new Date(value2);
|
|
752
923
|
case "RegExp":
|
|
753
|
-
if (
|
|
924
|
+
if (options.allowRegExp === false)
|
|
925
|
+
return json;
|
|
926
|
+
if (!isObject(value2) || !isString(value2.source) || value2.source.length > MAX_REGEXP_SOURCE_LENGTH)
|
|
754
927
|
return json;
|
|
755
928
|
return new RegExp(value2.source, value2.flags);
|
|
756
929
|
case "Symbol":
|
|
@@ -763,25 +936,34 @@ function typeify(json, sentinel) {
|
|
|
763
936
|
if (!isArray(value2))
|
|
764
937
|
return json;
|
|
765
938
|
return new Set(value2);
|
|
766
|
-
default:
|
|
939
|
+
default: {
|
|
940
|
+
if (options.allowClasses === false)
|
|
941
|
+
return json;
|
|
942
|
+
if (options.allowedClasses) {
|
|
943
|
+
const allowed = options.allowedClasses instanceof Set ? options.allowedClasses.has($type) || options.allowedClasses.has(type) : options.allowedClasses.includes($type) || options.allowedClasses.includes(type);
|
|
944
|
+
if (!allowed)
|
|
945
|
+
return json;
|
|
946
|
+
}
|
|
767
947
|
const cls = Registry.get($type);
|
|
768
948
|
if (!cls) {
|
|
769
949
|
console.warn(`objectify: dont know how to deserialize '${type}'`);
|
|
770
950
|
return json;
|
|
771
951
|
}
|
|
772
952
|
return Reflect.construct(cls, [value2]);
|
|
953
|
+
}
|
|
773
954
|
}
|
|
774
955
|
} catch {
|
|
775
956
|
return json;
|
|
776
957
|
}
|
|
777
958
|
}
|
|
778
|
-
var Registry, getSafeTag2, registerSerializable, SAFE_URI_MAP, RE_SAFE_URI_CODES, symKey;
|
|
959
|
+
var Registry, getSafeTag2, registerSerializable, SAFE_URI_MAP, RE_SAFE_URI_CODES, symKey, RUNTIME_SALT, fastDigest, constantTimeEqual, activeCompact, MAX_TRAVERSE_DEPTH, MAX_REGEXP_SOURCE_LENGTH;
|
|
779
960
|
var init_serialize_library = __esm({
|
|
780
961
|
"../../library/dist/common/runtime/serialize.library.js"() {
|
|
781
962
|
"use strict";
|
|
782
963
|
init_function_library();
|
|
783
964
|
init_primitive_library();
|
|
784
965
|
init_json_library();
|
|
966
|
+
init_object_library();
|
|
785
967
|
init_type_library();
|
|
786
968
|
init_assertion_library();
|
|
787
969
|
init_symbol_library();
|
|
@@ -824,6 +1006,31 @@ var init_serialize_library = __esm({
|
|
|
824
1006
|
};
|
|
825
1007
|
RE_SAFE_URI_CODES = new RegExp(Object.keys(SAFE_URI_MAP).join("|"), "gi");
|
|
826
1008
|
symKey = /^@(@)?\(([^\)]*)\)$/;
|
|
1009
|
+
RUNTIME_SALT = globalThis.crypto?.randomUUID ? globalThis.crypto.randomUUID().split("-")[0] : Math.random().toString(36).slice(2, 10);
|
|
1010
|
+
fastDigest = (str, secret = RUNTIME_SALT) => {
|
|
1011
|
+
let h1 = 2166136261;
|
|
1012
|
+
let h2 = 2654435769;
|
|
1013
|
+
const input = `${secret}:${str}`;
|
|
1014
|
+
for (let i = 0; i < input.length; i++) {
|
|
1015
|
+
const c = input.charCodeAt(i);
|
|
1016
|
+
h1 = Math.imul(h1 ^ c, 16777619);
|
|
1017
|
+
h2 = Math.imul(h2 ^ c, 2246822507);
|
|
1018
|
+
}
|
|
1019
|
+
return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
|
|
1020
|
+
};
|
|
1021
|
+
constantTimeEqual = (a, b) => {
|
|
1022
|
+
if (!isString(a) || !isString(b))
|
|
1023
|
+
return false;
|
|
1024
|
+
if (a.length !== b.length)
|
|
1025
|
+
return false;
|
|
1026
|
+
let result = 0;
|
|
1027
|
+
for (let i = 0; i < a.length; i++)
|
|
1028
|
+
result |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
1029
|
+
return result === 0;
|
|
1030
|
+
};
|
|
1031
|
+
activeCompact = true;
|
|
1032
|
+
MAX_TRAVERSE_DEPTH = 64;
|
|
1033
|
+
MAX_REGEXP_SOURCE_LENGTH = 512;
|
|
827
1034
|
}
|
|
828
1035
|
});
|
|
829
1036
|
|
|
@@ -917,7 +1124,7 @@ function StringTag(tagOrValue, context3) {
|
|
|
917
1124
|
}
|
|
918
1125
|
return value2;
|
|
919
1126
|
};
|
|
920
|
-
if (
|
|
1127
|
+
if (isCallable(tagOrValue) && context3?.kind === "class")
|
|
921
1128
|
return applyTag(tagOrValue, void 0, context3.name);
|
|
922
1129
|
return (value2, ctx) => {
|
|
923
1130
|
return applyTag(value2, isString(tagOrValue) ? tagOrValue : void 0, ctx?.name);
|
|
@@ -1230,7 +1437,7 @@ var init_cache_class = __esm({
|
|
|
1230
1437
|
this.evictExpired();
|
|
1231
1438
|
const stringEntries = [];
|
|
1232
1439
|
for (const [k, v] of super.entries()) {
|
|
1233
|
-
if (
|
|
1440
|
+
if (isString(k))
|
|
1234
1441
|
stringEntries.push([k, v]);
|
|
1235
1442
|
}
|
|
1236
1443
|
return Object.fromEntries(stringEntries);
|
|
@@ -1354,7 +1561,7 @@ var init_storage_library = __esm({
|
|
|
1354
1561
|
getSafeStorage = (name = "localStorage") => {
|
|
1355
1562
|
try {
|
|
1356
1563
|
const target = globalThis?.[name];
|
|
1357
|
-
if (target &&
|
|
1564
|
+
if (target && isCallable(target.getItem) && isCallable(target.setItem) && isCallable(target.removeItem) && isCallable(target.clear) && isCallable(target.key) && isNumber(target.length))
|
|
1358
1565
|
return target;
|
|
1359
1566
|
} catch {
|
|
1360
1567
|
}
|
|
@@ -1378,37 +1585,6 @@ var init_storage_library = __esm({
|
|
|
1378
1585
|
}
|
|
1379
1586
|
});
|
|
1380
1587
|
|
|
1381
|
-
// ../../library/dist/common/primitives/object.library.js
|
|
1382
|
-
function looseIndex(arg) {
|
|
1383
|
-
if (isDefined(arg))
|
|
1384
|
-
return isFunction(arg) ? arg() : arg;
|
|
1385
|
-
return (obj) => isFunction(obj) ? obj() : obj;
|
|
1386
|
-
}
|
|
1387
|
-
var asObject;
|
|
1388
|
-
var init_object_library = __esm({
|
|
1389
|
-
"../../library/dist/common/primitives/object.library.js"() {
|
|
1390
|
-
"use strict";
|
|
1391
|
-
init_primitive_library();
|
|
1392
|
-
init_assertion_library();
|
|
1393
|
-
init_type_library();
|
|
1394
|
-
asObject = (obj) => {
|
|
1395
|
-
if (isNullish(obj) || !isObject(obj))
|
|
1396
|
-
return obj;
|
|
1397
|
-
const temp = isArray(obj) ? [] : {};
|
|
1398
|
-
ownKeys(obj).forEach((key) => {
|
|
1399
|
-
if (!isSafeKey(key))
|
|
1400
|
-
return;
|
|
1401
|
-
temp[key] = asObject(obj[key]);
|
|
1402
|
-
});
|
|
1403
|
-
return temp;
|
|
1404
|
-
};
|
|
1405
|
-
looseIndex.stringSymbol = looseIndex();
|
|
1406
|
-
looseIndex.symbolRegExp = looseIndex();
|
|
1407
|
-
looseIndex.symbolString = looseIndex();
|
|
1408
|
-
looseIndex.stringString = looseIndex();
|
|
1409
|
-
}
|
|
1410
|
-
});
|
|
1411
|
-
|
|
1412
1588
|
// ../../library/dist/common/primitives/string.library.js
|
|
1413
1589
|
var init_string_library = __esm({
|
|
1414
1590
|
"../../library/dist/common/primitives/string.library.js"() {
|
|
@@ -1419,6 +1595,10 @@ var init_string_library = __esm({
|
|
|
1419
1595
|
});
|
|
1420
1596
|
|
|
1421
1597
|
// ../../library/dist/common/primitives/coercion.library.js
|
|
1598
|
+
function asArray(arr = [], fill) {
|
|
1599
|
+
const mapFn = (val) => isUndefined(fill) || isDefined(val) ? val : clone(fill);
|
|
1600
|
+
return isArrayLike(arr) || isIterable(arr) && !isString(arr) ? Array.from(arr, mapFn) : [arr];
|
|
1601
|
+
}
|
|
1422
1602
|
function asError(err) {
|
|
1423
1603
|
if (isError(err))
|
|
1424
1604
|
return err;
|
|
@@ -1486,55 +1666,87 @@ var init_temporal_library = __esm({
|
|
|
1486
1666
|
});
|
|
1487
1667
|
|
|
1488
1668
|
// ../../library/dist/common/runtime/international.library.js
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1491
|
-
}
|
|
1492
|
-
function getHemisphere(timeZone = getDateTimeFormat().timeZone) {
|
|
1493
|
-
try {
|
|
1494
|
-
const { jan, jul } = getOffsets(timeZone);
|
|
1495
|
-
const southPrefixes = ["Australia", "Antarctica", "Africa/Johannesburg", "America/Argentina/Buenos_Aires", "America/Sao_Paulo"];
|
|
1496
|
-
const isSouthZone = southPrefixes.some((p) => timeZone.startsWith(p));
|
|
1497
|
-
switch (true) {
|
|
1498
|
-
case jul > jan:
|
|
1499
|
-
return "north";
|
|
1500
|
-
case jul < jan:
|
|
1501
|
-
return "south";
|
|
1502
|
-
default:
|
|
1503
|
-
return isSouthZone ? "south" : void 0;
|
|
1504
|
-
}
|
|
1505
|
-
} catch (e) {
|
|
1669
|
+
function getPropOrCall(obj, method, fallbackProp) {
|
|
1670
|
+
if (!obj)
|
|
1506
1671
|
return void 0;
|
|
1507
|
-
|
|
1672
|
+
if (isCallable(obj[method]))
|
|
1673
|
+
return obj[method]();
|
|
1674
|
+
if (fallbackProp && fallbackProp in obj)
|
|
1675
|
+
return obj[fallbackProp];
|
|
1676
|
+
return void 0;
|
|
1677
|
+
}
|
|
1678
|
+
function getFallbackFirstDay(region) {
|
|
1679
|
+
if (!region)
|
|
1680
|
+
return 1;
|
|
1681
|
+
if (FRIDAY_START_REGIONS.has(region))
|
|
1682
|
+
return 5;
|
|
1683
|
+
if (SATURDAY_START_REGIONS.has(region))
|
|
1684
|
+
return 6;
|
|
1685
|
+
if (SUNDAY_START_REGIONS.has(region))
|
|
1686
|
+
return 7;
|
|
1687
|
+
return 1;
|
|
1688
|
+
}
|
|
1689
|
+
function getFallbackWeekend(region) {
|
|
1690
|
+
if (!region)
|
|
1691
|
+
return WEEKEND_SAT_SUN;
|
|
1692
|
+
if (region === "IR")
|
|
1693
|
+
return WEEKEND_FRI;
|
|
1694
|
+
if (region === "AF")
|
|
1695
|
+
return WEEKEND_THU_FRI;
|
|
1696
|
+
if (FRI_SAT_WEEKEND_REGIONS.has(region))
|
|
1697
|
+
return WEEKEND_FRI_SAT;
|
|
1698
|
+
return WEEKEND_SAT_SUN;
|
|
1508
1699
|
}
|
|
1509
|
-
|
|
1700
|
+
function getFallbackDirection(loc, language) {
|
|
1701
|
+
const script = loc?.script ?? (isCallable(loc?.maximize) ? loc.maximize().script : void 0);
|
|
1702
|
+
return script && RTL_SCRIPTS.has(script) || language && RTL_LANGUAGES.has(language) ? "rtl" : "ltr";
|
|
1703
|
+
}
|
|
1704
|
+
var RE_UNDERSCORE, RE_LOCALE_CLEANSE, hasIntl, cleanLocaleTag, getRTF, getLF, getDTF, getPR, getNF, getDF, SUNDAY_START_REGIONS, SATURDAY_START_REGIONS, FRIDAY_START_REGIONS, FRI_SAT_WEEKEND_REGIONS, RTL_LANGUAGES, RTL_SCRIPTS, WEEKEND_SAT_SUN, WEEKEND_FRI_SAT, WEEKEND_FRI, WEEKEND_THU_FRI, getLC, getLI, getDigitsMap, FALLBACK_DTF_OPTIONS, getDateTimeFormat, canonicalLocale, canonicalLocales, getHemisphere, probeMDY;
|
|
1510
1705
|
var init_international_library = __esm({
|
|
1511
1706
|
"../../library/dist/common/runtime/international.library.js"() {
|
|
1512
1707
|
"use strict";
|
|
1513
1708
|
init_temporal_library();
|
|
1514
1709
|
init_function_library();
|
|
1515
1710
|
init_assertion_library();
|
|
1516
|
-
|
|
1517
|
-
|
|
1711
|
+
init_coercion_library();
|
|
1712
|
+
RE_UNDERSCORE = /_/g;
|
|
1713
|
+
RE_LOCALE_CLEANSE = /[.@]/;
|
|
1714
|
+
hasIntl = (feature) => typeof Intl !== "undefined" && (!feature || Object.hasOwn(Intl, feature) && isCallable(Intl[feature]));
|
|
1715
|
+
cleanLocaleTag = (tag2) => {
|
|
1716
|
+
if (isLocale(tag2))
|
|
1717
|
+
tag2 = tag2.toString();
|
|
1718
|
+
if (!isString(tag2))
|
|
1719
|
+
return void 0;
|
|
1720
|
+
const trimmed = tag2.trim();
|
|
1721
|
+
if (isEmpty(trimmed))
|
|
1722
|
+
return void 0;
|
|
1723
|
+
const stripped = trimmed.split(RE_LOCALE_CLEANSE)[0];
|
|
1724
|
+
if (isEmpty(stripped))
|
|
1725
|
+
return void 0;
|
|
1726
|
+
return stripped.replace(RE_UNDERSCORE, "-");
|
|
1727
|
+
};
|
|
1728
|
+
getRTF = memoizeFunction((locale, options) => {
|
|
1729
|
+
return new Intl.RelativeTimeFormat(cleanLocaleTag(locale), options);
|
|
1518
1730
|
});
|
|
1519
|
-
getLF = memoizeFunction((locale,
|
|
1520
|
-
return new Intl.ListFormat(locale,
|
|
1731
|
+
getLF = memoizeFunction((locale, options) => {
|
|
1732
|
+
return new Intl.ListFormat(cleanLocaleTag(locale), options);
|
|
1521
1733
|
});
|
|
1522
1734
|
getDTF = memoizeFunction((locale, options) => {
|
|
1523
|
-
return new Intl.DateTimeFormat(locale, options);
|
|
1735
|
+
return new Intl.DateTimeFormat(cleanLocaleTag(locale), options);
|
|
1524
1736
|
});
|
|
1525
1737
|
getPR = memoizeFunction((locale, options) => {
|
|
1526
1738
|
try {
|
|
1527
|
-
return new Intl.PluralRules(locale, options);
|
|
1739
|
+
return new Intl.PluralRules(cleanLocaleTag(locale), options);
|
|
1528
1740
|
} catch (e) {
|
|
1529
1741
|
return { select: () => "other" };
|
|
1530
1742
|
}
|
|
1531
1743
|
});
|
|
1532
1744
|
getNF = memoizeFunction((locale, options) => {
|
|
1533
|
-
return new Intl.NumberFormat(locale, options);
|
|
1745
|
+
return new Intl.NumberFormat(cleanLocaleTag(locale), options);
|
|
1534
1746
|
});
|
|
1535
1747
|
getDF = memoizeFunction((locale, options) => {
|
|
1536
1748
|
try {
|
|
1537
|
-
const df = new Intl.DurationFormat(locale, options);
|
|
1749
|
+
const df = new Intl.DurationFormat(cleanLocaleTag(locale), options);
|
|
1538
1750
|
if (isFunction(df.format))
|
|
1539
1751
|
return df;
|
|
1540
1752
|
throw new Error("No format method");
|
|
@@ -1542,6 +1754,135 @@ var init_international_library = __esm({
|
|
|
1542
1754
|
return { format: (duration) => String(duration) };
|
|
1543
1755
|
}
|
|
1544
1756
|
});
|
|
1757
|
+
SUNDAY_START_REGIONS = /* @__PURE__ */ new Set(["US", "CA", "MX", "BR", "IL", "JP", "TW", "HK", "MO", "PH", "SG", "TH", "IN", "KR", "CO", "PE", "VE", "ZA"]);
|
|
1758
|
+
SATURDAY_START_REGIONS = /* @__PURE__ */ new Set(["SA", "AF", "BH", "DJ", "DZ", "EG", "IQ", "IR", "JO", "KW", "LY", "OM", "QA", "SD", "SY", "YE"]);
|
|
1759
|
+
FRIDAY_START_REGIONS = /* @__PURE__ */ new Set(["MV"]);
|
|
1760
|
+
FRI_SAT_WEEKEND_REGIONS = /* @__PURE__ */ new Set(["SA", "BH", "DJ", "DZ", "EG", "IQ", "JO", "KW", "LY", "OM", "QA", "SD", "SY", "YE"]);
|
|
1761
|
+
RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "yi", "ps", "sd", "ug", "ckb"]);
|
|
1762
|
+
RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Mand", "Samr", "Nkoo"]);
|
|
1763
|
+
WEEKEND_SAT_SUN = Object.freeze([6, 7]);
|
|
1764
|
+
WEEKEND_FRI_SAT = Object.freeze([5, 6]);
|
|
1765
|
+
WEEKEND_FRI = Object.freeze([5]);
|
|
1766
|
+
WEEKEND_THU_FRI = Object.freeze([4, 5]);
|
|
1767
|
+
getLC = memoizeFunction((localeTag) => {
|
|
1768
|
+
if (isLocale(localeTag))
|
|
1769
|
+
return localeTag;
|
|
1770
|
+
if (!hasIntl("Locale"))
|
|
1771
|
+
return void 0;
|
|
1772
|
+
try {
|
|
1773
|
+
const cleaned = cleanLocaleTag(localeTag);
|
|
1774
|
+
return new Intl.Locale(cleaned || "en-US");
|
|
1775
|
+
} catch {
|
|
1776
|
+
return void 0;
|
|
1777
|
+
}
|
|
1778
|
+
});
|
|
1779
|
+
getLI = memoizeFunction((localeTag) => {
|
|
1780
|
+
const loc = getLC(localeTag) ?? getLC("en-US");
|
|
1781
|
+
const baseName = loc?.baseName ?? canonicalLocale(localeTag) ?? "en-US";
|
|
1782
|
+
const language = loc?.language ?? baseName.split("-")[0]?.toLowerCase();
|
|
1783
|
+
const regionSubtags = [];
|
|
1784
|
+
for (const sub of baseName.split("-").slice(1)) {
|
|
1785
|
+
if (sub.length === 1)
|
|
1786
|
+
break;
|
|
1787
|
+
regionSubtags.push(sub);
|
|
1788
|
+
}
|
|
1789
|
+
const region = loc?.region ?? (isCallable(loc?.maximize) ? loc.maximize().region : void 0) ?? regionSubtags.find((subtag) => /^[a-zA-Z]{2}$|^\d{3}$/.test(subtag))?.toUpperCase();
|
|
1790
|
+
const script = loc?.script ?? (isCallable(loc?.maximize) ? loc.maximize().script : void 0);
|
|
1791
|
+
const rawWeek = getPropOrCall(loc, "getWeekInfo", "weekInfo");
|
|
1792
|
+
const firstDay = rawWeek?.firstDay ?? getFallbackFirstDay(region);
|
|
1793
|
+
const weekend = Array.isArray(rawWeek?.weekend) ? Object.freeze([...rawWeek.weekend]) : getFallbackWeekend(region);
|
|
1794
|
+
const rawCycles = getPropOrCall(loc, "getHourCycles", "hourCycles") ?? loc?.hourCycle;
|
|
1795
|
+
const resolvedHc = rawCycles ?? (hasIntl("DateTimeFormat") ? getDTF(baseName, { hour: "numeric" }).resolvedOptions().hourCycle : void 0);
|
|
1796
|
+
const hourCycles = Array.isArray(resolvedHc) && resolvedHc.length > 0 ? Object.freeze([...resolvedHc]) : isString(resolvedHc) ? Object.freeze([resolvedHc]) : Object.freeze(["h23"]);
|
|
1797
|
+
const rawText = getPropOrCall(loc, "getTextInfo", "textInfo");
|
|
1798
|
+
const direction = rawText?.direction === "rtl" || rawText?.direction === "ltr" ? rawText.direction : getFallbackDirection(loc, language);
|
|
1799
|
+
const rawSystems = getPropOrCall(loc, "getNumberingSystems", "numberingSystems") ?? loc?.numberingSystem;
|
|
1800
|
+
const resolvedNs = rawSystems ?? (hasIntl("NumberFormat") ? getNF(baseName).resolvedOptions().numberingSystem : void 0);
|
|
1801
|
+
const numberingSystems = Array.isArray(resolvedNs) && resolvedNs.length > 0 ? Object.freeze([...resolvedNs]) : isString(resolvedNs) ? Object.freeze([resolvedNs]) : Object.freeze(["latn"]);
|
|
1802
|
+
const rawTimeZones = getPropOrCall(loc, "getTimeZones", "timeZones");
|
|
1803
|
+
const timeZones = Array.isArray(rawTimeZones) && rawTimeZones.length > 0 ? Object.freeze([...rawTimeZones]) : Object.freeze([]);
|
|
1804
|
+
const weekInfo = Object.freeze({ firstDay, weekend });
|
|
1805
|
+
return Object.freeze({
|
|
1806
|
+
locale: loc,
|
|
1807
|
+
baseName,
|
|
1808
|
+
language,
|
|
1809
|
+
region,
|
|
1810
|
+
script,
|
|
1811
|
+
weekInfo,
|
|
1812
|
+
firstDay,
|
|
1813
|
+
weekend,
|
|
1814
|
+
hourCycle: hourCycles[0],
|
|
1815
|
+
hourCycles,
|
|
1816
|
+
direction,
|
|
1817
|
+
numberingSystem: numberingSystems[0],
|
|
1818
|
+
numberingSystems,
|
|
1819
|
+
timeZones
|
|
1820
|
+
});
|
|
1821
|
+
});
|
|
1822
|
+
getDigitsMap = memoizeFunction((numberingSystem = "latn") => {
|
|
1823
|
+
if (!numberingSystem || numberingSystem === "latn" || !hasIntl("NumberFormat"))
|
|
1824
|
+
return void 0;
|
|
1825
|
+
try {
|
|
1826
|
+
const nf = new Intl.NumberFormat(`en-u-nu-${numberingSystem}`, { useGrouping: false });
|
|
1827
|
+
const digits = Array.from({ length: 10 }, (_, i) => nf.format(i));
|
|
1828
|
+
if (digits[0] === "0" && digits[9] === "9")
|
|
1829
|
+
return void 0;
|
|
1830
|
+
return Object.freeze(digits);
|
|
1831
|
+
} catch {
|
|
1832
|
+
return void 0;
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
FALLBACK_DTF_OPTIONS = Object.freeze({
|
|
1836
|
+
locale: "en-US",
|
|
1837
|
+
calendar: "iso8601",
|
|
1838
|
+
numberingSystem: "latn",
|
|
1839
|
+
timeZone: "UTC"
|
|
1840
|
+
});
|
|
1841
|
+
getDateTimeFormat = memoizeFunction(() => {
|
|
1842
|
+
return hasIntl("DateTimeFormat") ? Object.freeze(getDTF().resolvedOptions()) : FALLBACK_DTF_OPTIONS;
|
|
1843
|
+
});
|
|
1844
|
+
canonicalLocale = memoizeFunction((locale) => {
|
|
1845
|
+
const cleaned = cleanLocaleTag(locale);
|
|
1846
|
+
if (!cleaned)
|
|
1847
|
+
return void 0;
|
|
1848
|
+
if (hasIntl("getCanonicalLocales")) {
|
|
1849
|
+
try {
|
|
1850
|
+
return Intl.getCanonicalLocales(cleaned)[0];
|
|
1851
|
+
} catch {
|
|
1852
|
+
return void 0;
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return getLC(cleaned)?.baseName ?? cleaned;
|
|
1856
|
+
});
|
|
1857
|
+
canonicalLocales = memoizeFunction((locales) => {
|
|
1858
|
+
return Object.freeze(asArray(locales).map((l) => canonicalLocale(l)).filter(Boolean));
|
|
1859
|
+
});
|
|
1860
|
+
getHemisphere = memoizeFunction((timeZone = getDateTimeFormat().timeZone) => {
|
|
1861
|
+
try {
|
|
1862
|
+
const { jan, jul } = getOffsets(timeZone);
|
|
1863
|
+
const southPrefixes = ["Australia", "Antarctica", "Africa/Johannesburg", "America/Argentina/Buenos_Aires", "America/Sao_Paulo"];
|
|
1864
|
+
const isSouthZone = southPrefixes.some((p) => timeZone.startsWith(p));
|
|
1865
|
+
switch (true) {
|
|
1866
|
+
case jul > jan:
|
|
1867
|
+
return "north";
|
|
1868
|
+
case jul < jan:
|
|
1869
|
+
return "south";
|
|
1870
|
+
default:
|
|
1871
|
+
return isSouthZone ? "south" : void 0;
|
|
1872
|
+
}
|
|
1873
|
+
} catch (e) {
|
|
1874
|
+
return void 0;
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
probeMDY = memoizeFunction((locale) => {
|
|
1878
|
+
try {
|
|
1879
|
+
const date = new Date(2024, 11, 24);
|
|
1880
|
+
const parts = getDTF(locale).formatToParts(date);
|
|
1881
|
+
return parts[0].type === "month" && parts[0].value === "12";
|
|
1882
|
+
} catch {
|
|
1883
|
+
return false;
|
|
1884
|
+
}
|
|
1885
|
+
});
|
|
1545
1886
|
}
|
|
1546
1887
|
});
|
|
1547
1888
|
|
|
@@ -2028,7 +2369,12 @@ var init_mapper_library = __esm({
|
|
|
2028
2369
|
if (context2.type === CONTEXT.Browser) {
|
|
2029
2370
|
Promise.resolve().then(() => (init_webstore_class(), webstore_class_exports)).then(({ WebStore: WebStore2 }) => {
|
|
2030
2371
|
const local = new WebStore2("local");
|
|
2031
|
-
|
|
2372
|
+
const stashed = local.get(MAP_KEY, {});
|
|
2373
|
+
if (isReference(stashed)) {
|
|
2374
|
+
if (stashed.geolocation && (!stashed.geolocation.coords || stashed.geolocation.$GeolocationPosition))
|
|
2375
|
+
delete stashed.geolocation;
|
|
2376
|
+
Object.assign(mapStore, stashed);
|
|
2377
|
+
}
|
|
2032
2378
|
resolve(local);
|
|
2033
2379
|
}).catch(reject);
|
|
2034
2380
|
} else {
|
|
@@ -2428,8 +2774,8 @@ __export(sdk_exports, {
|
|
|
2428
2774
|
__reExport(sdk_exports, sdk_star);
|
|
2429
2775
|
import * as sdk_star from "@magmacomputing/tempo/plugin/sdk";
|
|
2430
2776
|
import { definePlugin as originalPlugin, defineTerm as originalTerm } from "@magmacomputing/tempo/plugin/sdk";
|
|
2431
|
-
var definePlugin = (config) => originalPlugin({ ...config, version: "1.
|
|
2432
|
-
var defineTerm = (config) => originalTerm({ ...config, version: "1.
|
|
2777
|
+
var definePlugin = (config) => originalPlugin({ ...config, version: "1.2.0" });
|
|
2778
|
+
var defineTerm = (config) => originalTerm({ ...config, version: "1.2.0" });
|
|
2433
2779
|
|
|
2434
2780
|
// ../../library/dist/common/runtime/mapper.library.js
|
|
2435
2781
|
init_utility_library();
|
|
@@ -2801,40 +3147,54 @@ init_mapper_library();
|
|
|
2801
3147
|
init_assertion_library();
|
|
2802
3148
|
var GeoPlugin = definePlugin({
|
|
2803
3149
|
name: "geo",
|
|
2804
|
-
install(TempoClass) {
|
|
2805
|
-
const
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
browser: geoLocation,
|
|
2816
|
-
get current() {
|
|
2817
|
-
return getStashedGeo() ?? TempoClass.config?.geo;
|
|
2818
|
-
}
|
|
3150
|
+
install(TempoClass, options) {
|
|
3151
|
+
const installedClass = TempoClass || this;
|
|
3152
|
+
const getEffectiveOptions = (callSiteOpts, instance) => {
|
|
3153
|
+
const classOpts = installedClass.config?.pluginOptions?.geo;
|
|
3154
|
+
const instanceOpts = instance?.config?.pluginOptions?.geo;
|
|
3155
|
+
return {
|
|
3156
|
+
...isObject(options) ? options : {},
|
|
3157
|
+
...isObject(classOpts) ? classOpts : {},
|
|
3158
|
+
...isObject(instanceOpts) ? instanceOpts : {},
|
|
3159
|
+
...isObject(callSiteOpts) ? callSiteOpts : {}
|
|
3160
|
+
};
|
|
2819
3161
|
};
|
|
2820
|
-
Object.
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
3162
|
+
if (!Object.hasOwn(installedClass, "geo")) {
|
|
3163
|
+
const geoNamespace = {
|
|
3164
|
+
lookup: (opts) => geoLookup(getEffectiveOptions(opts)),
|
|
3165
|
+
resolve: (target, opts) => resolveGeoCoordinates(target, getEffectiveOptions(opts, target)),
|
|
3166
|
+
coerce: coerceGeo,
|
|
3167
|
+
distance: haversineDistance,
|
|
3168
|
+
solarOffset,
|
|
3169
|
+
stash: stashGeo,
|
|
3170
|
+
clear: clearStashedGeo,
|
|
3171
|
+
get: getStashedGeo,
|
|
3172
|
+
server: serverGeoLocation,
|
|
3173
|
+
browser: geoLocation,
|
|
3174
|
+
get current() {
|
|
3175
|
+
return getStashedGeo() ?? installedClass.config?.geo;
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
Object.defineProperty(installedClass, "geo", {
|
|
3179
|
+
value: (0, sdk_exports.deepFreeze)(geoNamespace),
|
|
3180
|
+
writable: false,
|
|
3181
|
+
configurable: false,
|
|
3182
|
+
enumerable: false
|
|
3183
|
+
});
|
|
3184
|
+
}
|
|
2826
3185
|
TempoClass.prototype.geoLocate = async function(opts) {
|
|
2827
|
-
const
|
|
2828
|
-
const
|
|
3186
|
+
const effectiveOpts = getEffectiveOptions(opts, this);
|
|
3187
|
+
const setTimezone = effectiveOpts?.setTimezone !== false;
|
|
3188
|
+
const coords = await resolveGeoCoordinates(this, effectiveOpts);
|
|
2829
3189
|
if (coords) {
|
|
2830
|
-
const existingGeo =
|
|
3190
|
+
const existingGeo = isObject(this.config.geo) ? this.config.geo : {};
|
|
2831
3191
|
const customKeys = {};
|
|
2832
3192
|
for (const key of Object.keys(existingGeo)) {
|
|
2833
3193
|
if (isSafeKey(key) && !GEO_PROPERTIES.includes(key))
|
|
2834
3194
|
customKeys[key] = existingGeo[key];
|
|
2835
3195
|
}
|
|
2836
3196
|
const callSiteGeo = coerceGeo(opts) ?? {};
|
|
2837
|
-
if (opts
|
|
3197
|
+
if (isObject(opts)) {
|
|
2838
3198
|
for (const key of Object.keys(opts)) {
|
|
2839
3199
|
if (isSafeKey(key) && !["setTimezone", "refresh", "ttl", "endpoint", "timeout", "catch", "debug", "geo"].includes(key)) {
|
|
2840
3200
|
if (!GEO_PROPERTIES.includes(key))
|
|
@@ -2867,13 +3227,13 @@ var GeoPlugin = definePlugin({
|
|
|
2867
3227
|
return this;
|
|
2868
3228
|
};
|
|
2869
3229
|
TempoClass.prototype.geoLookup = async function(opts) {
|
|
2870
|
-
return resolveGeoCoordinates(this, opts);
|
|
3230
|
+
return resolveGeoCoordinates(this, getEffectiveOptions(opts, this));
|
|
2871
3231
|
};
|
|
2872
3232
|
TempoClass.prototype.geoDistance = function(other, unit) {
|
|
2873
3233
|
return haversineDistance(this, other, unit);
|
|
2874
3234
|
};
|
|
2875
|
-
TempoClass.prototype.geoSolarOffset = function(
|
|
2876
|
-
return solarOffset(this,
|
|
3235
|
+
TempoClass.prototype.geoSolarOffset = function(options2) {
|
|
3236
|
+
return solarOffset(this, options2);
|
|
2877
3237
|
};
|
|
2878
3238
|
}
|
|
2879
3239
|
});
|