inferred-types 0.55.1 → 0.55.3
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/modules/constants/dist/index.cjs +3 -3
- package/modules/inferred-types/dist/index.cjs +1913 -1856
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +23183 -22963
- package/modules/inferred-types/dist/index.js +1906 -1853
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +2217 -2154
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +9376 -9248
- package/modules/runtime/dist/index.js +2210 -2151
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.cjs +3 -3
- package/modules/types/dist/index.d.ts +11912 -11820
- package/package.json +15 -13
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
ACCELERATION_METRICS_LOOKUP: () => ACCELERATION_METRICS_LOOKUP,
|
|
24
24
|
ALPHA_CHARS: () => ALPHA_CHARS,
|
|
25
25
|
AMAZON_BOOKS: () => AMAZON_BOOKS,
|
|
@@ -263,6 +263,7 @@ __export(src_exports, {
|
|
|
263
263
|
defineObject: () => defineObject,
|
|
264
264
|
defineObjectApi: () => defineObjectApi,
|
|
265
265
|
defineTuple: () => defineTuple,
|
|
266
|
+
doesExtend: () => doesExtend,
|
|
266
267
|
endsWith: () => endsWith,
|
|
267
268
|
ensureLeading: () => ensureLeading,
|
|
268
269
|
ensureSurround: () => ensureSurround,
|
|
@@ -273,6 +274,7 @@ __export(src_exports, {
|
|
|
273
274
|
find: () => find,
|
|
274
275
|
fnMeta: () => fnMeta,
|
|
275
276
|
fromDefineObject: () => fromDefineObject,
|
|
277
|
+
fromKeyValue: () => fromKeyValue,
|
|
276
278
|
get: () => get,
|
|
277
279
|
getDaysBetween: () => getDaysBetween,
|
|
278
280
|
getEach: () => getEach,
|
|
@@ -555,6 +557,7 @@ __export(src_exports, {
|
|
|
555
557
|
isVoltageUom: () => isVoltageUom,
|
|
556
558
|
isVolumeMetric: () => isVolumeMetric,
|
|
557
559
|
isVolumeUom: () => isVolumeUom,
|
|
560
|
+
isVueRef: () => isVueRef,
|
|
558
561
|
isWalgreensUrl: () => isWalgreensUrl,
|
|
559
562
|
isWalmartUrl: () => isWalmartUrl,
|
|
560
563
|
isWayfairUrl: () => isWayfairUrl,
|
|
@@ -648,6 +651,7 @@ __export(src_exports, {
|
|
|
648
651
|
takeProp: () => takeProp,
|
|
649
652
|
toCamelCase: () => toCamelCase,
|
|
650
653
|
toKebabCase: () => toKebabCase,
|
|
654
|
+
toKeyValue: () => toKeyValue,
|
|
651
655
|
toNumber: () => toNumber,
|
|
652
656
|
toNumericArray: () => toNumericArray,
|
|
653
657
|
toPascalCase: () => toPascalCase,
|
|
@@ -664,7 +668,7 @@ __export(src_exports, {
|
|
|
664
668
|
twColor: () => twColor,
|
|
665
669
|
unbox: () => unbox,
|
|
666
670
|
uncapitalize: () => uncapitalize,
|
|
667
|
-
union: () =>
|
|
671
|
+
union: () => union3,
|
|
668
672
|
unionize: () => unionize,
|
|
669
673
|
unique: () => unique,
|
|
670
674
|
uniqueKeys: () => uniqueKeys,
|
|
@@ -682,7 +686,7 @@ __export(src_exports, {
|
|
|
682
686
|
youtubeEmbed: () => youtubeEmbed,
|
|
683
687
|
youtubeMeta: () => youtubeMeta
|
|
684
688
|
});
|
|
685
|
-
module.exports = __toCommonJS(
|
|
689
|
+
module.exports = __toCommonJS(index_exports);
|
|
686
690
|
|
|
687
691
|
// ../constants/dist/index.js
|
|
688
692
|
var LOWER_ALPHA_CHARS = [
|
|
@@ -3297,54 +3301,6 @@ function asApi(api2) {
|
|
|
3297
3301
|
function handleDoneFn(val, call_bare_fn = false) {
|
|
3298
3302
|
return isObject(val) || isFunction(val) ? isDoneFn(val) ? val.done() : isFunction(val) ? call_bare_fn ? val() : val : val : isFunction(val) ? call_bare_fn ? val() : val : val;
|
|
3299
3303
|
}
|
|
3300
|
-
function addPropsToFn(fn2, clone_fn) {
|
|
3301
|
-
const localFn = clone_fn ? (...args) => fn2(args) : fn2;
|
|
3302
|
-
return (obj) => {
|
|
3303
|
-
for (const k in obj) {
|
|
3304
|
-
localFn[k] = obj[k];
|
|
3305
|
-
}
|
|
3306
|
-
return localFn;
|
|
3307
|
-
};
|
|
3308
|
-
}
|
|
3309
|
-
function addFnToProps(props, _clone_fn) {
|
|
3310
|
-
return (fn2) => {
|
|
3311
|
-
const localFn = (...args) => fn2(args);
|
|
3312
|
-
for (const k in props) {
|
|
3313
|
-
localFn[k] = props[k];
|
|
3314
|
-
}
|
|
3315
|
-
return localFn;
|
|
3316
|
-
};
|
|
3317
|
-
}
|
|
3318
|
-
function createCssSelector(_opt) {
|
|
3319
|
-
return (...selectors) => {
|
|
3320
|
-
return selectors.join(" ");
|
|
3321
|
-
};
|
|
3322
|
-
}
|
|
3323
|
-
function createFnWithProps(fn2, props, narrowing = false) {
|
|
3324
|
-
const fnWithProps = fn2;
|
|
3325
|
-
for (const prop of Object.keys(props)) {
|
|
3326
|
-
fnWithProps[prop] = props[prop];
|
|
3327
|
-
}
|
|
3328
|
-
return isTrue(narrowing) ? fnWithProps : fnWithProps;
|
|
3329
|
-
}
|
|
3330
|
-
function createFnWithPropsExplicit(fn2, props) {
|
|
3331
|
-
const fnWithProps = fn2;
|
|
3332
|
-
for (const prop of Object.keys(props)) {
|
|
3333
|
-
fnWithProps[prop] = props[prop];
|
|
3334
|
-
}
|
|
3335
|
-
return fnWithProps;
|
|
3336
|
-
}
|
|
3337
|
-
function defineObj(literal2 = {}) {
|
|
3338
|
-
return (wide22 = {}) => {
|
|
3339
|
-
const obj = literal2 ? { ...literal2, ...wide22 } : wide22;
|
|
3340
|
-
return obj;
|
|
3341
|
-
};
|
|
3342
|
-
}
|
|
3343
|
-
function defineTuple(...values) {
|
|
3344
|
-
return values.map(
|
|
3345
|
-
(i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i
|
|
3346
|
-
);
|
|
3347
|
-
}
|
|
3348
3304
|
function objectToApi(obj, def = null) {
|
|
3349
3305
|
const transformed = Object.keys(obj).reduce(
|
|
3350
3306
|
(acc, key) => {
|
|
@@ -5157,21 +5113,6 @@ function ifSameType(value, comparator, same, notSame) {
|
|
|
5157
5113
|
typeof value === typeof comparator ? same(value) : notSame(value)
|
|
5158
5114
|
);
|
|
5159
5115
|
}
|
|
5160
|
-
function isNull(value) {
|
|
5161
|
-
return value === null;
|
|
5162
|
-
}
|
|
5163
|
-
function isString(value) {
|
|
5164
|
-
return typeof value === "string";
|
|
5165
|
-
}
|
|
5166
|
-
function isSymbol(value) {
|
|
5167
|
-
return typeof value === "symbol";
|
|
5168
|
-
}
|
|
5169
|
-
function isNumber(value) {
|
|
5170
|
-
return typeof value === "number";
|
|
5171
|
-
}
|
|
5172
|
-
function isScalar(value) {
|
|
5173
|
-
return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
|
|
5174
|
-
}
|
|
5175
5116
|
function ifScalar(value, ifCallback, notCallback) {
|
|
5176
5117
|
const result2 = isScalar(value) ? ifCallback(
|
|
5177
5118
|
value
|
|
@@ -5394,7 +5335,7 @@ function get(value, dotPath, options = {
|
|
|
5394
5335
|
return outcome;
|
|
5395
5336
|
}
|
|
5396
5337
|
function keysOf(container) {
|
|
5397
|
-
const keys = Array.isArray(container) ? Object.keys(container).map((i) => Number(i)) : isObject(container) ?
|
|
5338
|
+
const keys = isVueRef(container) ? ["value"] : Array.isArray(container) ? Object.keys(container).map((i) => Number(i)) : isObject(container) ? Object.keys(container) : [];
|
|
5398
5339
|
return keys;
|
|
5399
5340
|
}
|
|
5400
5341
|
function callback() {
|
|
@@ -5482,88 +5423,6 @@ function withKeys(dict, ...keys) {
|
|
|
5482
5423
|
function withoutKeys(dict, ...exclude) {
|
|
5483
5424
|
return omit(dict, ...exclude);
|
|
5484
5425
|
}
|
|
5485
|
-
function doesExtend(type) {
|
|
5486
|
-
return (val) => {
|
|
5487
|
-
let response = false;
|
|
5488
|
-
if (isString(val)) {
|
|
5489
|
-
if (type === "string") {
|
|
5490
|
-
response = true;
|
|
5491
|
-
}
|
|
5492
|
-
if (type.startsWith("string(")) {
|
|
5493
|
-
const literals = stripAfter(
|
|
5494
|
-
stripBefore(type, "string("),
|
|
5495
|
-
")"
|
|
5496
|
-
).split(/,\s*/);
|
|
5497
|
-
if (literals.includes(val)) {
|
|
5498
|
-
response = true;
|
|
5499
|
-
}
|
|
5500
|
-
}
|
|
5501
|
-
}
|
|
5502
|
-
if (isNumber(val)) {
|
|
5503
|
-
if (type === "number") {
|
|
5504
|
-
response = true;
|
|
5505
|
-
}
|
|
5506
|
-
if (type.startsWith("number(")) {
|
|
5507
|
-
const literals = stripAfter(
|
|
5508
|
-
stripBefore(type, "number("),
|
|
5509
|
-
")"
|
|
5510
|
-
).split(/,\s*/).map(Number);
|
|
5511
|
-
if (literals.includes(val)) {
|
|
5512
|
-
response = true;
|
|
5513
|
-
}
|
|
5514
|
-
}
|
|
5515
|
-
}
|
|
5516
|
-
if (isNull(val) && (type === "null" || type === "Opt<null>")) {
|
|
5517
|
-
response = true;
|
|
5518
|
-
}
|
|
5519
|
-
if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
|
|
5520
|
-
response = true;
|
|
5521
|
-
}
|
|
5522
|
-
if (isBoolean(val)) {
|
|
5523
|
-
if (type === "boolean") {
|
|
5524
|
-
response = true;
|
|
5525
|
-
}
|
|
5526
|
-
if (type === "true" && val === true || type === "false" && val === false) {
|
|
5527
|
-
response = true;
|
|
5528
|
-
}
|
|
5529
|
-
}
|
|
5530
|
-
if (isNarrowableObject(val)) {
|
|
5531
|
-
if (type === "Dict" || type === "Dict<string, unknown>") {
|
|
5532
|
-
response = true;
|
|
5533
|
-
}
|
|
5534
|
-
if (startsWith("Dict<")(type)) {
|
|
5535
|
-
const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
|
|
5536
|
-
if (match) {
|
|
5537
|
-
const { value } = match;
|
|
5538
|
-
const isOpt = value.includes(`Opt<`);
|
|
5539
|
-
const values = objectValues(val);
|
|
5540
|
-
if (values.every((i) => isOpt ? isString(i) || isUndefined(i) : isString(i)) && type === "Dict<string, string>" || values.every((i) => isOpt ? isUndefined(i) || isNumber(i) : isNumber(i)) && type === "Dict<string, number>" || values.every((i) => isOpt ? isUndefined(i) || isBoolean(i) : isBoolean(i)) && type === "Dict<string, boolean>") {
|
|
5541
|
-
response = true;
|
|
5542
|
-
}
|
|
5543
|
-
}
|
|
5544
|
-
}
|
|
5545
|
-
}
|
|
5546
|
-
if (isArray(val)) {
|
|
5547
|
-
if (type === "Array" || type === "Array<unknown>") {
|
|
5548
|
-
return true;
|
|
5549
|
-
}
|
|
5550
|
-
if (type === "Array<Dict>" && val.every(isObject) || type === "Array<boolean>" && val.every(isBoolean) || type === "Array<string>" && val.every(isString) || type === "Array<number>" && val.every(isNumber) || type === "Array<Map>" && val.every(isMap) || type === "Array<Set>" && val.every(isSetContainer)) {
|
|
5551
|
-
response = true;
|
|
5552
|
-
}
|
|
5553
|
-
}
|
|
5554
|
-
if (isMap(val)) {
|
|
5555
|
-
if (type === "Map" || type === "Map<Dict, Array>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isArray) || type === "Map<Dict, Dict>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isObject) || type === "Map<Dict, boolean>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isBoolean) || type === "Map<Dict, number>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isNumber) || type === "Map<Dict, string>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isString) || type === "Map<Dict, unknown>" && Array.from(val.keys()).every(isObject) || type === "Map<string, string>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isString) || type === "Map<string, number>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isNumber) || type === "Map<string, boolean>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isBoolean) || type === "Map<string, unknown>" && Array.from(val.keys()).every(isString) || type === "Map<number, string>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isString) || type === "Map<number, number>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isNumber) || type === "Map<number, boolean>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isBoolean) || type === "Map<number, unknown>" && Array.from(val.keys()).every(isNumber)) {
|
|
5556
|
-
response = true;
|
|
5557
|
-
}
|
|
5558
|
-
}
|
|
5559
|
-
if (isSetContainer(val)) {
|
|
5560
|
-
if (type === "Set" || type === "Set<unknown>" || type === "Set<boolean>" && Array.from(val).every(isBoolean) || type === "Set<string>" && Array.from(val).every(isString) || type === "Set<number>" && Array.from(val).every(isNumber) || type === "Set<Opt<boolean>>" && Array.from(val).every((i) => isBoolean(i) || isUndefined(i)) || type === "Set<Opt<string>>" && Array.from(val).every((i) => isString(i) || isUndefined(i)) || type === "Set<Opt<number>>" && Array.from(val).every((i) => isNumber(i) || isUndefined(i))) {
|
|
5561
|
-
response = true;
|
|
5562
|
-
}
|
|
5563
|
-
}
|
|
5564
|
-
return response;
|
|
5565
|
-
};
|
|
5566
|
-
}
|
|
5567
5426
|
function withoutValue(wo) {
|
|
5568
5427
|
return (obj) => {
|
|
5569
5428
|
const output = {};
|
|
@@ -5616,6 +5475,54 @@ function fnMeta(func) {
|
|
|
5616
5475
|
};
|
|
5617
5476
|
}
|
|
5618
5477
|
var wrapFn = "NOT IMPLEMENTED";
|
|
5478
|
+
function addPropsToFn(fn2, clone_fn) {
|
|
5479
|
+
const localFn = clone_fn ? (...args) => fn2(args) : fn2;
|
|
5480
|
+
return (obj) => {
|
|
5481
|
+
for (const k in obj) {
|
|
5482
|
+
localFn[k] = obj[k];
|
|
5483
|
+
}
|
|
5484
|
+
return localFn;
|
|
5485
|
+
};
|
|
5486
|
+
}
|
|
5487
|
+
function addFnToProps(props, _clone_fn) {
|
|
5488
|
+
return (fn2) => {
|
|
5489
|
+
const localFn = (...args) => fn2(args);
|
|
5490
|
+
for (const k in props) {
|
|
5491
|
+
localFn[k] = props[k];
|
|
5492
|
+
}
|
|
5493
|
+
return localFn;
|
|
5494
|
+
};
|
|
5495
|
+
}
|
|
5496
|
+
function createCssSelector(_opt) {
|
|
5497
|
+
return (...selectors) => {
|
|
5498
|
+
return selectors.join(" ");
|
|
5499
|
+
};
|
|
5500
|
+
}
|
|
5501
|
+
function createFnWithProps(fn2, props, narrowing = false) {
|
|
5502
|
+
const fnWithProps = fn2;
|
|
5503
|
+
for (const prop of Object.keys(props)) {
|
|
5504
|
+
fnWithProps[prop] = props[prop];
|
|
5505
|
+
}
|
|
5506
|
+
return isTrue(narrowing) ? fnWithProps : fnWithProps;
|
|
5507
|
+
}
|
|
5508
|
+
function createFnWithPropsExplicit(fn2, props) {
|
|
5509
|
+
const fnWithProps = fn2;
|
|
5510
|
+
for (const prop of Object.keys(props)) {
|
|
5511
|
+
fnWithProps[prop] = props[prop];
|
|
5512
|
+
}
|
|
5513
|
+
return fnWithProps;
|
|
5514
|
+
}
|
|
5515
|
+
function defineObj(literal2 = {}) {
|
|
5516
|
+
return (wide22 = {}) => {
|
|
5517
|
+
const obj = literal2 ? { ...literal2, ...wide22 } : wide22;
|
|
5518
|
+
return obj;
|
|
5519
|
+
};
|
|
5520
|
+
}
|
|
5521
|
+
function defineTuple(...values) {
|
|
5522
|
+
return values.map(
|
|
5523
|
+
(i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i
|
|
5524
|
+
);
|
|
5525
|
+
}
|
|
5619
5526
|
function asArray(thing) {
|
|
5620
5527
|
return Array.isArray(thing) === true ? thing : typeof thing === "undefined" ? [] : [thing];
|
|
5621
5528
|
}
|
|
@@ -5798,312 +5705,270 @@ function ensureTrailing(content, ensure) {
|
|
|
5798
5705
|
content.endsWith(ensure) ? content : `${content}${ensure}`
|
|
5799
5706
|
);
|
|
5800
5707
|
}
|
|
5801
|
-
function
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5708
|
+
function getTypeSubtype(str) {
|
|
5709
|
+
if (isTypeSubtype(str)) {
|
|
5710
|
+
const [t, st] = str.split("/");
|
|
5711
|
+
return [t, st];
|
|
5712
|
+
} else {
|
|
5713
|
+
const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
|
|
5714
|
+
err.name = "InvalidTypeSubtype";
|
|
5715
|
+
throw err;
|
|
5716
|
+
}
|
|
5806
5717
|
}
|
|
5807
|
-
function
|
|
5808
|
-
return
|
|
5718
|
+
function identity(...values) {
|
|
5719
|
+
return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
|
|
5809
5720
|
}
|
|
5810
|
-
function
|
|
5811
|
-
|
|
5721
|
+
function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
|
|
5722
|
+
if (ch.length !== 1) {
|
|
5723
|
+
throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
|
|
5724
|
+
}
|
|
5725
|
+
return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
|
|
5812
5726
|
}
|
|
5813
|
-
function
|
|
5814
|
-
|
|
5727
|
+
function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
|
|
5728
|
+
if (ch.length !== 1) {
|
|
5729
|
+
throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
|
|
5730
|
+
}
|
|
5731
|
+
return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
|
|
5815
5732
|
}
|
|
5816
|
-
function
|
|
5817
|
-
|
|
5733
|
+
function parseTemplate(template) {
|
|
5734
|
+
const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
|
|
5735
|
+
let lastIndex = 0;
|
|
5736
|
+
let match;
|
|
5737
|
+
const segments = [];
|
|
5738
|
+
while (match = pattern.exec(template)) {
|
|
5739
|
+
const [fullMatch, varName, asType2] = match;
|
|
5740
|
+
const staticPart = template.slice(lastIndex, match.index);
|
|
5741
|
+
if (staticPart) {
|
|
5742
|
+
segments.push({ dynamic: false, text: staticPart });
|
|
5743
|
+
}
|
|
5744
|
+
segments.push({
|
|
5745
|
+
dynamic: true,
|
|
5746
|
+
varName,
|
|
5747
|
+
type: asType2 ? asType2 : "string"
|
|
5748
|
+
});
|
|
5749
|
+
lastIndex = match.index + fullMatch.length;
|
|
5750
|
+
}
|
|
5751
|
+
const remainder = template.slice(lastIndex);
|
|
5752
|
+
if (remainder) {
|
|
5753
|
+
segments.push({ dynamic: false, text: remainder });
|
|
5754
|
+
}
|
|
5755
|
+
return segments;
|
|
5818
5756
|
}
|
|
5819
|
-
function
|
|
5820
|
-
return
|
|
5757
|
+
function escapeRegex(str) {
|
|
5758
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5821
5759
|
}
|
|
5822
|
-
function
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
return false;
|
|
5840
|
-
}
|
|
5841
|
-
;
|
|
5842
|
-
const daysInMonth = new Date(year, month, 0).getDate();
|
|
5843
|
-
if (day < 1 || day > daysInMonth) {
|
|
5844
|
-
return false;
|
|
5845
|
-
}
|
|
5846
|
-
;
|
|
5847
|
-
const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
|
|
5848
|
-
if (tzMatch) {
|
|
5849
|
-
const [_2, _sign, tzHours, tzMinutes] = tzMatch;
|
|
5850
|
-
const numHours = Number.parseInt(tzHours, 10);
|
|
5851
|
-
const numMinutes = Number.parseInt(tzMinutes, 10);
|
|
5852
|
-
if (numHours > 14 || numMinutes > 59) {
|
|
5853
|
-
return false;
|
|
5854
|
-
}
|
|
5855
|
-
if (numHours === 14 && numMinutes > 0) {
|
|
5856
|
-
return false;
|
|
5760
|
+
function buildRegexPattern(segments) {
|
|
5761
|
+
let regexStr = "^";
|
|
5762
|
+
for (const seg of segments) {
|
|
5763
|
+
if (!seg.dynamic) {
|
|
5764
|
+
regexStr += escapeRegex(seg.text);
|
|
5765
|
+
} else {
|
|
5766
|
+
switch (seg.type) {
|
|
5767
|
+
case "string":
|
|
5768
|
+
regexStr += "(.*?)";
|
|
5769
|
+
break;
|
|
5770
|
+
case "number":
|
|
5771
|
+
regexStr += "(\\d+)";
|
|
5772
|
+
break;
|
|
5773
|
+
case "boolean":
|
|
5774
|
+
regexStr += "(true|false)";
|
|
5775
|
+
break;
|
|
5776
|
+
}
|
|
5857
5777
|
}
|
|
5858
5778
|
}
|
|
5859
|
-
|
|
5779
|
+
regexStr += "$";
|
|
5780
|
+
return new RegExp(regexStr);
|
|
5860
5781
|
}
|
|
5861
|
-
function
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5782
|
+
function convertValue(type, value) {
|
|
5783
|
+
switch (type) {
|
|
5784
|
+
case "string":
|
|
5785
|
+
return value;
|
|
5786
|
+
case "number":
|
|
5787
|
+
return Number(value);
|
|
5788
|
+
case "boolean":
|
|
5789
|
+
return value === "true";
|
|
5867
5790
|
}
|
|
5868
5791
|
}
|
|
5869
|
-
function
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
|
|
5875
|
-
} else {
|
|
5792
|
+
function matchTemplate(template, test) {
|
|
5793
|
+
const segments = parseTemplate(template);
|
|
5794
|
+
const regex = buildRegexPattern(segments);
|
|
5795
|
+
const match = regex.exec(test);
|
|
5796
|
+
if (!match)
|
|
5876
5797
|
return false;
|
|
5798
|
+
let captureIndex = 1;
|
|
5799
|
+
const result2 = {};
|
|
5800
|
+
for (const seg of segments) {
|
|
5801
|
+
if (seg.dynamic) {
|
|
5802
|
+
const rawVal = match[captureIndex++];
|
|
5803
|
+
if (rawVal === void 0)
|
|
5804
|
+
return false;
|
|
5805
|
+
result2[seg.varName] = convertValue(seg.type, rawVal);
|
|
5806
|
+
}
|
|
5877
5807
|
}
|
|
5808
|
+
return result2;
|
|
5878
5809
|
}
|
|
5879
|
-
function
|
|
5880
|
-
|
|
5881
|
-
return
|
|
5882
|
-
}
|
|
5883
|
-
return false;
|
|
5884
|
-
}
|
|
5810
|
+
function infer(inference) {
|
|
5811
|
+
return (test) => {
|
|
5812
|
+
return matchTemplate(inference, test);
|
|
5813
|
+
};
|
|
5885
5814
|
}
|
|
5886
|
-
function
|
|
5887
|
-
|
|
5888
|
-
const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
|
|
5889
|
-
return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
|
|
5890
|
-
} else {
|
|
5891
|
-
return false;
|
|
5892
|
-
}
|
|
5815
|
+
function idLiteral(o) {
|
|
5816
|
+
return { ...o, id: o.id };
|
|
5893
5817
|
}
|
|
5894
|
-
function
|
|
5895
|
-
|
|
5896
|
-
const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
|
|
5897
|
-
return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
|
|
5898
|
-
} else {
|
|
5899
|
-
return false;
|
|
5900
|
-
}
|
|
5818
|
+
function nameLiteral(o) {
|
|
5819
|
+
return o;
|
|
5901
5820
|
}
|
|
5902
|
-
function
|
|
5903
|
-
return
|
|
5821
|
+
function kindLiteral(o) {
|
|
5822
|
+
return o;
|
|
5904
5823
|
}
|
|
5905
|
-
function
|
|
5906
|
-
return
|
|
5824
|
+
function idTypeGuard(_o) {
|
|
5825
|
+
return true;
|
|
5907
5826
|
}
|
|
5908
|
-
function
|
|
5909
|
-
return
|
|
5827
|
+
function literal(obj) {
|
|
5828
|
+
return obj;
|
|
5910
5829
|
}
|
|
5911
|
-
function
|
|
5912
|
-
|
|
5913
|
-
return false;
|
|
5914
|
-
}
|
|
5915
|
-
return isObject(val) && typeof val.format === "function" && typeof val.year === "function" && typeof val.month === "function" && typeof val.date === "function" && "_isAMomentObject" in val && "_isValid" in val && typeof val.add === "function" && typeof val.subtract === "function" && typeof val.toISOString === "function" && typeof val.isValid === "function";
|
|
5830
|
+
function lowercase(str) {
|
|
5831
|
+
return str.toLowerCase();
|
|
5916
5832
|
}
|
|
5917
|
-
function
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5833
|
+
function narrow(...values) {
|
|
5834
|
+
return values.length === 1 ? values[0] : values;
|
|
5835
|
+
}
|
|
5836
|
+
function pathJoin(...segments) {
|
|
5837
|
+
const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
|
|
5838
|
+
const original_path = segments.join("/");
|
|
5839
|
+
const pre = original_path.startsWith("/") ? "/" : "";
|
|
5840
|
+
const post = original_path.endsWith("/") ? "/" : "";
|
|
5841
|
+
return `${pre}${clean_path}${post}`;
|
|
5842
|
+
}
|
|
5843
|
+
var asPhoneFormat = () => `NOT IMPLEMENTED`;
|
|
5844
|
+
function getPhoneCountryCode(phone) {
|
|
5845
|
+
return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
|
|
5846
|
+
stripLeading(stripLeading(phone.trim(), "+"), "00"),
|
|
5847
|
+
...NUMERIC_CHAR2
|
|
5848
|
+
) : "";
|
|
5849
|
+
}
|
|
5850
|
+
function removePhoneCountryCode(phone) {
|
|
5851
|
+
const countryCode = getPhoneCountryCode(phone);
|
|
5852
|
+
return countryCode !== "" ? stripLeading(stripLeading(
|
|
5853
|
+
phone.trim(),
|
|
5854
|
+
"+",
|
|
5855
|
+
"00"
|
|
5856
|
+
), countryCode).trim() : phone.trim();
|
|
5857
|
+
}
|
|
5858
|
+
var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
|
|
5859
|
+
function endingIn(word, postfix) {
|
|
5860
|
+
switch (postfix) {
|
|
5861
|
+
case "is":
|
|
5862
|
+
return word.endsWith(postfix) ? `${word}es` : void 0;
|
|
5863
|
+
case "singular-noun":
|
|
5864
|
+
return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
|
|
5865
|
+
case "f":
|
|
5866
|
+
return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
|
|
5867
|
+
case "y":
|
|
5868
|
+
return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
|
|
5869
|
+
default:
|
|
5870
|
+
throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
|
|
5930
5871
|
}
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5872
|
+
}
|
|
5873
|
+
function pluralize(word) {
|
|
5874
|
+
const right = rightWhitespace(word);
|
|
5875
|
+
const w = word.trimEnd();
|
|
5876
|
+
const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
|
|
5877
|
+
return `${result2}${right}`;
|
|
5878
|
+
}
|
|
5879
|
+
function retainAfter(content, ...find2) {
|
|
5880
|
+
const idx = Math.min(
|
|
5881
|
+
...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
|
|
5882
|
+
);
|
|
5883
|
+
const min = Math.min(...find2.map((i) => i.length));
|
|
5884
|
+
let len = Math.max(...find2.map((i) => i.length));
|
|
5885
|
+
if (min !== len) {
|
|
5886
|
+
if (!find2.includes(content.slice(idx, len))) {
|
|
5887
|
+
len = min;
|
|
5941
5888
|
}
|
|
5942
5889
|
}
|
|
5943
|
-
return
|
|
5890
|
+
return idx && idx > 0 ? content.slice(idx + len) : "";
|
|
5944
5891
|
}
|
|
5945
|
-
function
|
|
5946
|
-
const
|
|
5947
|
-
|
|
5948
|
-
|
|
5892
|
+
function retainAfterInclusive(content, ...find2) {
|
|
5893
|
+
const minFound = Math.min(
|
|
5894
|
+
...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
|
|
5895
|
+
);
|
|
5896
|
+
return minFound > 0 ? content.slice(minFound) : "";
|
|
5897
|
+
}
|
|
5898
|
+
function retainChars(content, ...retain2) {
|
|
5899
|
+
const chars = asChars(content);
|
|
5900
|
+
return chars.filter((c) => retain2.includes(c)).join("");
|
|
5901
|
+
}
|
|
5902
|
+
function retainUntil(content, ...find2) {
|
|
5903
|
+
const chars = asChars(content);
|
|
5904
|
+
let idx = 0;
|
|
5905
|
+
while (!find2.includes(chars[idx]) && idx <= chars.length) {
|
|
5906
|
+
idx = idx + 1;
|
|
5949
5907
|
}
|
|
5950
|
-
|
|
5951
|
-
const targetWeek = getWeekNumber(targetDate);
|
|
5952
|
-
return currentWeek === targetWeek;
|
|
5908
|
+
return idx === 0 ? "" : content.slice(0, idx);
|
|
5953
5909
|
}
|
|
5954
|
-
function
|
|
5955
|
-
const
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
return date.getFullYear() === currentYear;
|
|
5960
|
-
} else {
|
|
5961
|
-
return false;
|
|
5962
|
-
}
|
|
5910
|
+
function retainUntilInclusive(content, ...find2) {
|
|
5911
|
+
const chars = asChars(content);
|
|
5912
|
+
let idx = 0;
|
|
5913
|
+
while (!find2.includes(chars[idx]) && idx <= chars.length) {
|
|
5914
|
+
idx = idx + 1;
|
|
5963
5915
|
}
|
|
5964
|
-
return
|
|
5916
|
+
return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
|
|
5965
5917
|
}
|
|
5966
|
-
function
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
return isIsoExplicitDate(justDate) && justDate === getToday();
|
|
5970
|
-
} else if (isMoment(test) || isDate(test)) {
|
|
5971
|
-
return stripAfter(test.toISOString(), "T") === getToday();
|
|
5972
|
-
} else if (isLuxonDateTime(test)) {
|
|
5973
|
-
return stripAfter(test.toISO(), "T") === getToday();
|
|
5974
|
-
}
|
|
5975
|
-
return false;
|
|
5976
|
-
}
|
|
5977
|
-
function isTomorrow(test) {
|
|
5978
|
-
if (isString(test)) {
|
|
5979
|
-
const justDate = stripAfter(test, "T");
|
|
5980
|
-
return isIsoExplicitDate(justDate) && justDate === getTomorrow();
|
|
5981
|
-
} else if (isMoment(test) || isDate(test)) {
|
|
5982
|
-
return stripAfter(test.toISOString(), "T") === getTomorrow();
|
|
5983
|
-
} else if (isLuxonDateTime(test)) {
|
|
5984
|
-
return stripAfter(test.toISO(), "T") === getTomorrow();
|
|
5985
|
-
}
|
|
5986
|
-
return false;
|
|
5987
|
-
}
|
|
5988
|
-
function isYesterday(test) {
|
|
5989
|
-
if (isString(test)) {
|
|
5990
|
-
const justDate = stripAfter(test, "T");
|
|
5991
|
-
return isIsoExplicitDate(justDate) && justDate === getYesterday();
|
|
5992
|
-
} else if (isMoment(test) || isDate(test)) {
|
|
5993
|
-
return stripAfter(test.toISOString(), "T") === getYesterday();
|
|
5994
|
-
} else if (isLuxonDateTime(test)) {
|
|
5995
|
-
return stripAfter(test.toISO(), "T") === getYesterday();
|
|
5996
|
-
}
|
|
5997
|
-
return false;
|
|
5998
|
-
}
|
|
5999
|
-
function isIso3166Alpha2(val) {
|
|
6000
|
-
const codes = ISO3166_12.map((i) => i.alpha2);
|
|
6001
|
-
return isString(val) && codes.includes(val);
|
|
6002
|
-
}
|
|
6003
|
-
function isCountryCode2(val) {
|
|
6004
|
-
const codes = ISO3166_12.map((i) => i.alpha2);
|
|
6005
|
-
return isString(val) && codes.includes(val);
|
|
6006
|
-
}
|
|
6007
|
-
function isIso3166Alpha3(val) {
|
|
6008
|
-
const codes = ISO3166_12.map((i) => i.alpha3);
|
|
6009
|
-
return isString(val) && codes.includes(val);
|
|
6010
|
-
}
|
|
6011
|
-
function isCountryCode3(val) {
|
|
6012
|
-
const codes = ISO3166_12.map((i) => i.alpha3);
|
|
6013
|
-
return isString(val) && codes.includes(val);
|
|
6014
|
-
}
|
|
6015
|
-
function isIso3166CountryCode(val) {
|
|
6016
|
-
const codes = ISO3166_12.map((i) => i.countryCode);
|
|
6017
|
-
return isString(val) && codes.includes(val);
|
|
6018
|
-
}
|
|
6019
|
-
function isCountryAbbrev(val) {
|
|
6020
|
-
return isCountryCode2(val) || isCountryCode3(val);
|
|
6021
|
-
}
|
|
6022
|
-
function isIso3166CountryName(val) {
|
|
6023
|
-
const codes = ISO3166_12.map((i) => i.name);
|
|
6024
|
-
return isString(val) && codes.includes(val);
|
|
6025
|
-
}
|
|
6026
|
-
function isCountryName(val) {
|
|
6027
|
-
const codes = ISO3166_12.map((i) => i.name);
|
|
6028
|
-
return isString(val) && codes.includes(val);
|
|
6029
|
-
}
|
|
6030
|
-
var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
|
|
6031
|
-
var NAME = US_STATE_LOOKUP2.map((i) => i.name);
|
|
6032
|
-
function isUsStateAbbreviation(val) {
|
|
6033
|
-
return isString(val) && ABBREV.includes(val);
|
|
5918
|
+
function retainWhile(content, ...retain2) {
|
|
5919
|
+
const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
|
|
5920
|
+
return content.slice(0, stopIdx);
|
|
6034
5921
|
}
|
|
6035
|
-
function
|
|
6036
|
-
|
|
5922
|
+
function rightWhitespace(content) {
|
|
5923
|
+
const trimmed = content.trimStart();
|
|
5924
|
+
return retainAfterInclusive(
|
|
5925
|
+
trimmed,
|
|
5926
|
+
...WHITESPACE_CHARS2
|
|
5927
|
+
);
|
|
6037
5928
|
}
|
|
6038
5929
|
function split(str, sep = "") {
|
|
6039
5930
|
return str.split(sep);
|
|
6040
5931
|
}
|
|
6041
|
-
function
|
|
6042
|
-
|
|
6043
|
-
return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
|
|
5932
|
+
function stripAfter(content, find2) {
|
|
5933
|
+
return content.split(find2).shift();
|
|
6044
5934
|
}
|
|
6045
|
-
function
|
|
6046
|
-
|
|
6047
|
-
return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
|
|
5935
|
+
function stripBefore(content, find2) {
|
|
5936
|
+
return content.split(find2).slice(1).join(find2);
|
|
6048
5937
|
}
|
|
6049
|
-
function
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
}
|
|
6053
|
-
return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
|
|
5938
|
+
function stripChars(content, ...strip2) {
|
|
5939
|
+
const chars = asChars(content);
|
|
5940
|
+
return chars.filter((c) => !strip2.includes(c)).join("");
|
|
6054
5941
|
}
|
|
6055
|
-
function
|
|
6056
|
-
if (
|
|
6057
|
-
|
|
6058
|
-
const next = stripChars(val.trim().replace(first, "").trim(), "-");
|
|
6059
|
-
return first.length === 5 && next.length === 4 && isNumberLike(next);
|
|
5942
|
+
function stripLeading(content, ...strip2) {
|
|
5943
|
+
if (isUndefined(content)) {
|
|
5944
|
+
return void 0;
|
|
6060
5945
|
}
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
}
|
|
6066
|
-
|
|
6067
|
-
return (
|
|
6068
|
-
return !!(isConstant(value) && value.kind === kind);
|
|
6069
|
-
};
|
|
6070
|
-
}
|
|
6071
|
-
function hasDefaultValue(value) {
|
|
6072
|
-
const noDefault = isSpecificConstant("no-default-value");
|
|
6073
|
-
return !noDefault(value);
|
|
6074
|
-
}
|
|
6075
|
-
function hasIndexOf(value, idx) {
|
|
6076
|
-
const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
|
|
6077
|
-
return isErrorCondition(result2, "invalid-index") ? false : result2;
|
|
5946
|
+
let output = String(content);
|
|
5947
|
+
for (const s of strip2) {
|
|
5948
|
+
if (output.startsWith(String(s))) {
|
|
5949
|
+
output = output.slice(String(s).length);
|
|
5950
|
+
}
|
|
5951
|
+
}
|
|
5952
|
+
return isNumber(content) ? Number(output) : output;
|
|
6078
5953
|
}
|
|
6079
|
-
function
|
|
6080
|
-
return (
|
|
6081
|
-
|
|
6082
|
-
|
|
5954
|
+
function stripSurround(...chars) {
|
|
5955
|
+
return (input) => {
|
|
5956
|
+
let output = String(input);
|
|
5957
|
+
for (const s of chars) {
|
|
5958
|
+
if (output.startsWith(String(s))) {
|
|
5959
|
+
output = output.slice(String(s).length);
|
|
5960
|
+
}
|
|
5961
|
+
if (output.endsWith(String(s))) {
|
|
5962
|
+
output = output.slice(0, -1 * String(s).length);
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
return isNumber(input) ? Number(output) : output;
|
|
6083
5966
|
};
|
|
6084
5967
|
}
|
|
6085
|
-
function asChars(str) {
|
|
6086
|
-
return str.split("");
|
|
6087
|
-
}
|
|
6088
|
-
function asRecord(obj) {
|
|
6089
|
-
return obj;
|
|
6090
|
-
}
|
|
6091
|
-
function asString(value) {
|
|
6092
|
-
return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
|
|
6093
|
-
}
|
|
6094
|
-
function csv(csv2, format = `string-numeric-tuple`) {
|
|
6095
|
-
const tuple3 = [];
|
|
6096
|
-
csv2.split(/,\s?/).forEach((v) => {
|
|
6097
|
-
tuple3.push(
|
|
6098
|
-
format === "string-numeric-tuple" ? isNumberLike(v) ? Number(v) : v : format === "json-tuple" ? isNumberLike(v) ? Number(v) : v === "true" ? true : v === "false" ? false : `"${v}"` : format === "string-tuple" ? `${v}` : Never2
|
|
6099
|
-
);
|
|
6100
|
-
});
|
|
6101
|
-
return tuple3;
|
|
6102
|
-
}
|
|
6103
|
-
function intersect(value, _intersectedWith) {
|
|
6104
|
-
return value;
|
|
6105
|
-
}
|
|
6106
5968
|
function stripTrailing(content, ...strip2) {
|
|
5969
|
+
if (isUndefined(content)) {
|
|
5970
|
+
return void 0;
|
|
5971
|
+
}
|
|
6107
5972
|
let output = String(content);
|
|
6108
5973
|
for (const s of strip2) {
|
|
6109
5974
|
if (output.endsWith(String(s))) {
|
|
@@ -6112,1812 +5977,2000 @@ function stripTrailing(content, ...strip2) {
|
|
|
6112
5977
|
}
|
|
6113
5978
|
return isNumber(content) ? Number(output) : output;
|
|
6114
5979
|
}
|
|
6115
|
-
function
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
function jsonValue(val) {
|
|
6119
|
-
return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
|
|
5980
|
+
function stripUntil(content, ...until) {
|
|
5981
|
+
const stopIdx = asChars(content).findIndex((c) => until.includes(c));
|
|
5982
|
+
return content.slice(stopIdx);
|
|
6120
5983
|
}
|
|
6121
|
-
function
|
|
6122
|
-
|
|
5984
|
+
function stripWhile(content, ...match) {
|
|
5985
|
+
const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
|
|
5986
|
+
return content.slice(stopIdx);
|
|
6123
5987
|
}
|
|
6124
|
-
function
|
|
6125
|
-
|
|
6126
|
-
return found ? found[prop] : void 0;
|
|
5988
|
+
function surround(prefix, postfix) {
|
|
5989
|
+
return (input) => `${prefix}${input}${postfix}`;
|
|
6127
5990
|
}
|
|
6128
|
-
function
|
|
6129
|
-
const
|
|
6130
|
-
return
|
|
5991
|
+
function takeNumericCharacters(content) {
|
|
5992
|
+
const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
|
|
5993
|
+
return content.slice(0, nonNumericIdx);
|
|
6131
5994
|
}
|
|
6132
|
-
function
|
|
6133
|
-
const
|
|
6134
|
-
|
|
5995
|
+
function toCamelCase(input, preserveWhitespace) {
|
|
5996
|
+
const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
|
|
5997
|
+
const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
|
|
5998
|
+
pascal
|
|
5999
|
+
);
|
|
6000
|
+
const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
|
|
6001
|
+
return camel;
|
|
6135
6002
|
}
|
|
6136
|
-
function
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
const
|
|
6144
|
-
return
|
|
6003
|
+
function toKebabCase(input, _preserveWhitespace = false) {
|
|
6004
|
+
const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
|
|
6005
|
+
const replaceWhitespace = (i) => i.replace(/\s/g, "-");
|
|
6006
|
+
const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
|
|
6007
|
+
const replaceLeadingDash = (i) => i.replace(/^-/, "");
|
|
6008
|
+
const replaceTrailingDash = (i) => i.replace(/-$/, "");
|
|
6009
|
+
const replaceUnderscore = (i) => i.replace(/_/g, "-");
|
|
6010
|
+
const removeDupDashes = (i) => i.replace(/-+/g, "-");
|
|
6011
|
+
return removeDupDashes(`${preWhite}${replaceUnderscore(
|
|
6012
|
+
replaceTrailingDash(
|
|
6013
|
+
replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
|
|
6014
|
+
)
|
|
6015
|
+
)}${postWhite}`);
|
|
6145
6016
|
}
|
|
6146
|
-
function
|
|
6147
|
-
|
|
6148
|
-
return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
|
|
6017
|
+
function toNumericArray(arr) {
|
|
6018
|
+
return arr.map((i) => Number(i));
|
|
6149
6019
|
}
|
|
6150
|
-
function
|
|
6151
|
-
const
|
|
6152
|
-
|
|
6020
|
+
function toPascalCase(input, preserveWhitespace = void 0) {
|
|
6021
|
+
const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
|
|
6022
|
+
input
|
|
6023
|
+
);
|
|
6024
|
+
const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
|
|
6025
|
+
const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
|
|
6026
|
+
const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
|
|
6027
|
+
const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
|
|
6028
|
+
const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
|
|
6029
|
+
replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
|
|
6030
|
+
)}${preserveWhitespace ? postWhite : ""}`;
|
|
6031
|
+
return pascal;
|
|
6153
6032
|
}
|
|
6154
|
-
function
|
|
6155
|
-
const
|
|
6156
|
-
|
|
6033
|
+
function toSnakeCase(input, preserveWhitespace = false) {
|
|
6034
|
+
const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
|
|
6035
|
+
const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
|
|
6036
|
+
const convertDashes = (input2) => input2.replace(/-/g, "_");
|
|
6037
|
+
const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
|
|
6038
|
+
const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
|
|
6039
|
+
return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
|
|
6040
|
+
injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
|
|
6041
|
+
).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
|
|
6157
6042
|
}
|
|
6158
|
-
function
|
|
6159
|
-
|
|
6160
|
-
return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
|
|
6043
|
+
function toString(val) {
|
|
6044
|
+
return String(val);
|
|
6161
6045
|
}
|
|
6162
|
-
function
|
|
6163
|
-
|
|
6164
|
-
kind: "Mapper",
|
|
6165
|
-
map: (from) => {
|
|
6166
|
-
return from.map(fn2);
|
|
6167
|
-
}
|
|
6168
|
-
};
|
|
6169
|
-
return createFnWithPropsExplicit(fn2, props);
|
|
6046
|
+
function toUppercase(str) {
|
|
6047
|
+
return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
|
|
6170
6048
|
}
|
|
6171
|
-
function
|
|
6172
|
-
return (
|
|
6173
|
-
const fn2 = (input) => {
|
|
6174
|
-
return Object.keys(map2).reduce(
|
|
6175
|
-
(acc, key) => {
|
|
6176
|
-
const val = map2[key];
|
|
6177
|
-
return {
|
|
6178
|
-
...acc,
|
|
6179
|
-
[key]: isFunction(val) ? val(input) : val
|
|
6180
|
-
};
|
|
6181
|
-
},
|
|
6182
|
-
{}
|
|
6183
|
-
);
|
|
6184
|
-
};
|
|
6185
|
-
return fn2;
|
|
6186
|
-
};
|
|
6049
|
+
function trim(input) {
|
|
6050
|
+
return input.trim();
|
|
6187
6051
|
}
|
|
6188
|
-
function
|
|
6189
|
-
return (
|
|
6190
|
-
return asMapper(fn2);
|
|
6191
|
-
};
|
|
6052
|
+
function trimLeft(input) {
|
|
6053
|
+
return input.trimStart();
|
|
6192
6054
|
}
|
|
6193
|
-
function
|
|
6194
|
-
|
|
6195
|
-
const defUnique = withoutKeys(defVal, ...intersectingKeys);
|
|
6196
|
-
const overrideUnique = withoutKeys(defVal, ...intersectingKeys);
|
|
6197
|
-
const merged = {
|
|
6198
|
-
...intersectingKeys.reduce(
|
|
6199
|
-
(acc, key) => typeof override[key] === "undefined" ? { ...acc, [key]: defVal[key] } : { ...acc, [key]: override[key] },
|
|
6200
|
-
{}
|
|
6201
|
-
),
|
|
6202
|
-
...defUnique,
|
|
6203
|
-
...overrideUnique
|
|
6204
|
-
};
|
|
6205
|
-
return merged;
|
|
6055
|
+
function trimStart(input) {
|
|
6056
|
+
return input.trimStart();
|
|
6206
6057
|
}
|
|
6207
|
-
function
|
|
6208
|
-
return
|
|
6058
|
+
function trimRight(input) {
|
|
6059
|
+
return input.trimEnd();
|
|
6209
6060
|
}
|
|
6210
|
-
function
|
|
6211
|
-
return
|
|
6061
|
+
function trimEnd(input) {
|
|
6062
|
+
return input.trimEnd();
|
|
6212
6063
|
}
|
|
6213
|
-
function
|
|
6214
|
-
|
|
6064
|
+
function truncate(content, maxLength, ellipsis = false) {
|
|
6065
|
+
const overLimit = content.length > maxLength;
|
|
6066
|
+
return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
|
|
6215
6067
|
}
|
|
6216
|
-
function
|
|
6217
|
-
|
|
6068
|
+
function tuple(...values) {
|
|
6069
|
+
const arr = values.length === 1 ? values[0] : values;
|
|
6070
|
+
return asArray(arr);
|
|
6218
6071
|
}
|
|
6219
|
-
function
|
|
6220
|
-
return
|
|
6072
|
+
function uncapitalize(str) {
|
|
6073
|
+
return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
|
|
6221
6074
|
}
|
|
6222
|
-
|
|
6223
|
-
|
|
6075
|
+
var unset = "<<unset>>";
|
|
6076
|
+
function uppercase(str) {
|
|
6077
|
+
return str.toUpperCase();
|
|
6224
6078
|
}
|
|
6225
|
-
function
|
|
6079
|
+
function widen(value) {
|
|
6226
6080
|
return value;
|
|
6227
6081
|
}
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
}
|
|
6231
|
-
|
|
6232
|
-
switch (typeof val) {
|
|
6233
|
-
case "number":
|
|
6234
|
-
return val;
|
|
6235
|
-
case "string":
|
|
6236
|
-
return Number(val);
|
|
6237
|
-
case "boolean":
|
|
6238
|
-
return val ? 1 : 0;
|
|
6239
|
-
default:
|
|
6240
|
-
throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
|
|
6241
|
-
}
|
|
6242
|
-
}
|
|
6243
|
-
var convertList = (val) => val.map((i) => convertScalar(i));
|
|
6244
|
-
function toNumber(value) {
|
|
6245
|
-
return Array.isArray(value) ? convertList(value) : convertScalar(value);
|
|
6082
|
+
var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
|
|
6083
|
+
function getUrlProtocol(url) {
|
|
6084
|
+
const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
|
|
6085
|
+
return proto;
|
|
6246
6086
|
}
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
|
|
6087
|
+
function removeUrlProtocol(url) {
|
|
6088
|
+
return stripBefore(url, "://");
|
|
6250
6089
|
}
|
|
6251
|
-
function
|
|
6252
|
-
|
|
6090
|
+
function ensurePath(val) {
|
|
6091
|
+
const val2 = ensureLeading(val, "/");
|
|
6092
|
+
return val === "" ? "" : stripTrailing(val2, "/");
|
|
6253
6093
|
}
|
|
6254
|
-
function
|
|
6255
|
-
return (
|
|
6094
|
+
function getUrlPath(url) {
|
|
6095
|
+
return isUrl(url) ? ensurePath(
|
|
6096
|
+
stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
|
|
6097
|
+
) : Never2;
|
|
6256
6098
|
}
|
|
6257
|
-
function
|
|
6258
|
-
|
|
6099
|
+
function getUrlQueryParams(url, specific = void 0) {
|
|
6100
|
+
const qp = stripBefore(url, "?");
|
|
6101
|
+
if (specific) {
|
|
6102
|
+
return qp.includes(`${specific}=`) ? decodeURIComponent(
|
|
6103
|
+
stripAfter(
|
|
6104
|
+
stripBefore(qp, `${specific}=`),
|
|
6105
|
+
"&"
|
|
6106
|
+
).replace(/\+/g, "%20")
|
|
6107
|
+
) : void 0;
|
|
6108
|
+
}
|
|
6109
|
+
return qp === "" ? qp : `?${qp}`;
|
|
6259
6110
|
}
|
|
6260
|
-
function
|
|
6261
|
-
|
|
6111
|
+
function getUrlDefaultPort(url) {
|
|
6112
|
+
const proto = getUrlProtocol(url);
|
|
6113
|
+
return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
|
|
6262
6114
|
}
|
|
6263
|
-
function
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6115
|
+
function getUrlPort(url, resolve = false) {
|
|
6116
|
+
const re = /.*:(\d{2,3})/;
|
|
6117
|
+
const match = url.match(re);
|
|
6118
|
+
return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
|
|
6267
6119
|
}
|
|
6268
|
-
function
|
|
6269
|
-
|
|
6120
|
+
function getUrlSource(url) {
|
|
6121
|
+
const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
|
|
6122
|
+
return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
|
|
6270
6123
|
}
|
|
6271
|
-
function
|
|
6272
|
-
|
|
6124
|
+
function getUrlBase(url) {
|
|
6125
|
+
const path = getUrlPath(url);
|
|
6126
|
+
const remaining = stripAfter(url, path);
|
|
6127
|
+
return remaining;
|
|
6273
6128
|
}
|
|
6274
|
-
function
|
|
6275
|
-
|
|
6276
|
-
|
|
6129
|
+
function getUrlDynamics(url) {
|
|
6130
|
+
const path = getUrlPath(url);
|
|
6131
|
+
const qp = getUrlQueryParams(url);
|
|
6132
|
+
const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
|
|
6133
|
+
const segmentTypes = [
|
|
6134
|
+
"string",
|
|
6135
|
+
"number",
|
|
6136
|
+
"boolean",
|
|
6137
|
+
"Opt<string>",
|
|
6138
|
+
"Opt<number>",
|
|
6139
|
+
"Opt<boolean>"
|
|
6140
|
+
];
|
|
6141
|
+
const pathVars = {};
|
|
6142
|
+
const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
|
|
6143
|
+
const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
|
|
6144
|
+
const findPathNamed = infer(`<{{infer name}}>`);
|
|
6145
|
+
for (const part of pathParts) {
|
|
6146
|
+
const union4 = findPathUnion(part);
|
|
6147
|
+
const typed = findPathTyped(part);
|
|
6148
|
+
const named = findPathNamed(part);
|
|
6149
|
+
if (union4) {
|
|
6150
|
+
if (isVariable(union4.name) && isCsv(union4.union)) {
|
|
6151
|
+
pathVars[union4.name] = `string(${union4.union})`;
|
|
6152
|
+
}
|
|
6153
|
+
} else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
|
|
6154
|
+
pathVars[typed.name] = typed.type;
|
|
6155
|
+
} else if (named && isVariable(named.name)) {
|
|
6156
|
+
pathVars[named.name] = "string";
|
|
6157
|
+
}
|
|
6158
|
+
}
|
|
6159
|
+
const qpVars = {};
|
|
6160
|
+
const qpParts = stripLeading(qp, "?").split("&");
|
|
6161
|
+
for (const p of qpParts) {
|
|
6162
|
+
const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
|
|
6163
|
+
const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
|
|
6164
|
+
const fixed = infer(`{{infer var}}={{infer val}}`)(p);
|
|
6165
|
+
if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
|
|
6166
|
+
qpVars[union4.var] = `string(${union4.params})`;
|
|
6167
|
+
} else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
|
|
6168
|
+
qpVars[dynamic.var] = dynamic.val;
|
|
6169
|
+
} else if (fixed && isVariable(fixed.var)) {
|
|
6170
|
+
qpVars[fixed.var] = fixed.val;
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
return {
|
|
6174
|
+
pathVars,
|
|
6175
|
+
qpVars,
|
|
6176
|
+
allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
|
|
6177
|
+
...pathVars,
|
|
6178
|
+
...qpVars
|
|
6179
|
+
}
|
|
6277
6180
|
};
|
|
6278
6181
|
}
|
|
6279
|
-
function
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6182
|
+
function urlMeta(url) {
|
|
6183
|
+
return {
|
|
6184
|
+
url,
|
|
6185
|
+
isUrl: isUrl(url),
|
|
6186
|
+
protocol: getUrlProtocol(url),
|
|
6187
|
+
path: getUrlPath(url),
|
|
6188
|
+
queryParameters: getUrlQueryParams(url),
|
|
6189
|
+
params: getUrlDynamics,
|
|
6190
|
+
port: getUrlPort(url),
|
|
6191
|
+
source: getUrlSource(url),
|
|
6192
|
+
isIpAddress: isIpAddress(getUrlSource(url)),
|
|
6193
|
+
isIp4Address: isIp4Address(getUrlSource(url)),
|
|
6194
|
+
isIp6Address: isIp6Address(getUrlSource(url))
|
|
6283
6195
|
};
|
|
6284
6196
|
}
|
|
6285
|
-
function
|
|
6286
|
-
return (
|
|
6287
|
-
return typeof value === type;
|
|
6288
|
-
};
|
|
6197
|
+
function getYouTubePageType(url) {
|
|
6198
|
+
return isYouTubeUrl(url) ? isYouTubeVideoUrl(url) && (hasUrlQueryParameter(url, "v") || isYouTubeShareUrl(url)) ? hasUrlQueryParameter(url, "list") ? isYouTubeShareUrl(url) ? hasUrlQueryParameter(url, "t") ? `play::video::in-list::share-link::with-timestamp` : `play::video::in-list::share-link` : `play::video::in-list` : isYouTubeShareUrl(url) ? hasUrlQueryParameter(url, "t") ? `play::video::solo::share-link::with-timestamp` : `play::video::solo::share-link` : `play::video::solo` : isYouTubeCreatorUrl(url) ? getUrlPath(url).includes("/videos") ? "creator::videos" : getUrlPath(url).includes("/playlists") ? "creator::playlists" : last(getUrlPath(url).split("/")).startsWith("@") || getUrlPath(url).includes("/featured") ? "creator::featured" : "creator::other" : isYouTubeFeedUrl(url) ? isYouTubeFeedUrl(url, "history") ? "feed::history" : isYouTubeFeedUrl(url, "playlists") ? "feed::playlists" : isYouTubeFeedUrl(url, "liked") ? "feed::liked" : isYouTubeFeedUrl(url, "subscriptions") ? "feed::subscriptions" : isYouTubeFeedUrl(url, "trending") ? "feed::trending" : "feed::other" : isYouTubeVideosInPlaylist(url) ? "playlist::show" : "other" : Never2;
|
|
6289
6199
|
}
|
|
6290
|
-
function
|
|
6291
|
-
|
|
6292
|
-
|
|
6200
|
+
function youtubeEmbed(url) {
|
|
6201
|
+
if (hasUrlQueryParameter(url, "v")) {
|
|
6202
|
+
const id = getUrlQueryParams(url, "v");
|
|
6203
|
+
return `https://www.youtube.com/embed/${id}`;
|
|
6204
|
+
} else if (isYouTubeShareUrl(url)) {
|
|
6205
|
+
const id = url.split("/").pop();
|
|
6206
|
+
if (id) {
|
|
6207
|
+
return `https://www.youtube.com/embed/${id}`;
|
|
6208
|
+
} else {
|
|
6209
|
+
throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
|
|
6210
|
+
}
|
|
6211
|
+
} else {
|
|
6212
|
+
throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
|
|
6213
|
+
}
|
|
6214
|
+
}
|
|
6215
|
+
function youtubeMeta(url) {
|
|
6216
|
+
return isYouTubeUrl(url) ? {
|
|
6217
|
+
url,
|
|
6218
|
+
isYouTubeUrl: true,
|
|
6219
|
+
isShareUrl: isYouTubeShareUrl(url),
|
|
6220
|
+
pageType: getYouTubePageType(url)
|
|
6221
|
+
} : {
|
|
6222
|
+
url,
|
|
6223
|
+
isYouTubeUrl: false
|
|
6293
6224
|
};
|
|
6294
6225
|
}
|
|
6295
|
-
function
|
|
6296
|
-
return
|
|
6226
|
+
function queue(state) {
|
|
6227
|
+
return {
|
|
6228
|
+
queue: state,
|
|
6229
|
+
size: state.length,
|
|
6230
|
+
isEmpty() {
|
|
6231
|
+
return state.length === 0;
|
|
6232
|
+
},
|
|
6233
|
+
clear() {
|
|
6234
|
+
state.slice(0, 0);
|
|
6235
|
+
},
|
|
6236
|
+
drain() {
|
|
6237
|
+
const old_state = [...state];
|
|
6238
|
+
state.slice(0, 0);
|
|
6239
|
+
return old_state;
|
|
6240
|
+
},
|
|
6241
|
+
push(...add) {
|
|
6242
|
+
state.push(...add);
|
|
6243
|
+
},
|
|
6244
|
+
drop(quantity) {
|
|
6245
|
+
if (quantity && quantity > state.length) {
|
|
6246
|
+
throw new Error("Cannot drop more elements than present in the queue");
|
|
6247
|
+
}
|
|
6248
|
+
state.splice(0, quantity || 1);
|
|
6249
|
+
},
|
|
6250
|
+
take(quantity) {
|
|
6251
|
+
if (quantity && quantity > state.length) {
|
|
6252
|
+
throw new Error("Cannot take more elements than present in the queue");
|
|
6253
|
+
}
|
|
6254
|
+
const result2 = state.slice(0, quantity || 1);
|
|
6255
|
+
state.splice(0, quantity || 1);
|
|
6256
|
+
return result2;
|
|
6257
|
+
},
|
|
6258
|
+
*[Symbol.iterator]() {
|
|
6259
|
+
for (let i = 0; i < state.length; i++) {
|
|
6260
|
+
yield state[i];
|
|
6261
|
+
}
|
|
6262
|
+
}
|
|
6263
|
+
};
|
|
6297
6264
|
}
|
|
6298
|
-
function
|
|
6299
|
-
return
|
|
6265
|
+
function createFifoQueue(...list2) {
|
|
6266
|
+
return queue([...list2]);
|
|
6300
6267
|
}
|
|
6301
|
-
function
|
|
6302
|
-
return
|
|
6268
|
+
function queue2(state) {
|
|
6269
|
+
return {
|
|
6270
|
+
queue: state,
|
|
6271
|
+
size: state.length,
|
|
6272
|
+
isEmpty() {
|
|
6273
|
+
return state.length === 0;
|
|
6274
|
+
},
|
|
6275
|
+
push(...add) {
|
|
6276
|
+
state.push(...add);
|
|
6277
|
+
},
|
|
6278
|
+
drop(quantity) {
|
|
6279
|
+
state.splice(-quantity);
|
|
6280
|
+
},
|
|
6281
|
+
clear() {
|
|
6282
|
+
state.slice(0, 0);
|
|
6283
|
+
},
|
|
6284
|
+
drain() {
|
|
6285
|
+
const old_state = [...state];
|
|
6286
|
+
state.slice(0, 0);
|
|
6287
|
+
return old_state;
|
|
6288
|
+
},
|
|
6289
|
+
take(quantity) {
|
|
6290
|
+
const result2 = state.slice(-quantity);
|
|
6291
|
+
state.splice(-quantity);
|
|
6292
|
+
return result2;
|
|
6293
|
+
},
|
|
6294
|
+
*[Symbol.iterator]() {
|
|
6295
|
+
for (let i = state.length - 1; i >= 0; i--) {
|
|
6296
|
+
yield state[i];
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6299
|
+
};
|
|
6303
6300
|
}
|
|
6304
|
-
function
|
|
6305
|
-
return
|
|
6301
|
+
function createLifoQueue(...list2) {
|
|
6302
|
+
return queue2([...list2]);
|
|
6306
6303
|
}
|
|
6307
|
-
|
|
6308
|
-
|
|
6304
|
+
var scalarToToken = identity({
|
|
6305
|
+
string: "<<string>>",
|
|
6306
|
+
number: "<<number>>",
|
|
6307
|
+
boolean: "<<boolean>>",
|
|
6308
|
+
true: "<<true>>",
|
|
6309
|
+
false: "<<false>>",
|
|
6310
|
+
null: "<<null>>",
|
|
6311
|
+
undefined: "<<undefined>>",
|
|
6312
|
+
unknown: "<<unknown>>",
|
|
6313
|
+
any: "<<any>>",
|
|
6314
|
+
never: "<<never>>"
|
|
6315
|
+
});
|
|
6316
|
+
function stringLiteral(str) {
|
|
6317
|
+
return stripAfter(stripBefore(str, "string("), ")");
|
|
6309
6318
|
}
|
|
6310
|
-
function
|
|
6311
|
-
return
|
|
6319
|
+
function numericLiteral(str) {
|
|
6320
|
+
return stripAfter(stripBefore(str, "number("), ")");
|
|
6312
6321
|
}
|
|
6313
|
-
function
|
|
6314
|
-
|
|
6322
|
+
function handleOptional(token) {
|
|
6323
|
+
const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
|
|
6324
|
+
return bare.startsWith("string") ? `<<union::[ <<string>>, <<undefined>> ]>>` : bare.startsWith("number") ? `<<union::[ <<number>>, <<undefined>> ]>>` : bare.startsWith("boolean") ? `<<union::[ <<boolean>>, <<undefined>> ]>>` : bare.startsWith("unknown") ? `<<union::[ <<unknown>>, <<undefined>> ]>>` : `<<never>>`;
|
|
6315
6325
|
}
|
|
6316
|
-
|
|
6317
|
-
"
|
|
6318
|
-
"inherit",
|
|
6319
|
-
"initial",
|
|
6320
|
-
"revert",
|
|
6321
|
-
"revert-layer",
|
|
6322
|
-
"unset",
|
|
6323
|
-
"auto"
|
|
6324
|
-
];
|
|
6325
|
-
var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
|
|
6326
|
-
function isCssAspectRatio(val) {
|
|
6327
|
-
return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
|
|
6326
|
+
function simpleScalarTokenToTypeToken(val) {
|
|
6327
|
+
return val in scalarToToken ? scalarToToken[val] : val.startsWith("string(") ? stringLiteral(val).includes(",") ? `<<union::[ ${stringLiteral(val).split(/,\s?/).map((i) => `"${i}"`).join(", ")} ]>>` : `<<string::${stringLiteral(val)}>>` : val.startsWith("number(") ? numericLiteral(val).includes(",") ? `<<union::[ ${numericLiteral(val).split(/,\s?/).join(", ")} ]>>` : `<<number::${numericLiteral(val)}>>` : val.startsWith("Opt<") ? handleOptional(val) : `<<never>>`;
|
|
6328
6328
|
}
|
|
6329
|
-
function
|
|
6330
|
-
return
|
|
6329
|
+
function unionNode(node) {
|
|
6330
|
+
return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
|
|
6331
6331
|
}
|
|
6332
|
-
function
|
|
6333
|
-
return
|
|
6332
|
+
function union(nodes) {
|
|
6333
|
+
return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
|
|
6334
6334
|
}
|
|
6335
|
-
|
|
6336
|
-
|
|
6335
|
+
var stripUnion = stripSurround("Union(", ")");
|
|
6336
|
+
function simpleUnionTokenToTypeToken(val) {
|
|
6337
|
+
return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union(stripUnion(val))} ]>>` : Never2;
|
|
6337
6338
|
}
|
|
6338
|
-
function
|
|
6339
|
-
|
|
6340
|
-
|
|
6339
|
+
function simpleContainerTokenToTypeToken(_val) {
|
|
6340
|
+
}
|
|
6341
|
+
function asTypeToken(_val) {
|
|
6342
|
+
return "not ready";
|
|
6343
|
+
}
|
|
6344
|
+
function addToken(token, ...params) {
|
|
6345
|
+
return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
|
|
6346
|
+
}
|
|
6347
|
+
function boolean(literal2) {
|
|
6348
|
+
return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
|
|
6349
|
+
}
|
|
6350
|
+
var unknown = () => "<<unknown>>";
|
|
6351
|
+
var undefinedType = () => "<<undefined>>";
|
|
6352
|
+
var nullType = () => "<<null>>";
|
|
6353
|
+
function fn(..._args) {
|
|
6354
|
+
return {
|
|
6355
|
+
returns: (_rtn) => ({
|
|
6356
|
+
addProperties: (_kv) => {
|
|
6357
|
+
return null;
|
|
6358
|
+
},
|
|
6359
|
+
done: () => {
|
|
6360
|
+
return null;
|
|
6361
|
+
}
|
|
6362
|
+
}),
|
|
6363
|
+
done: () => {
|
|
6364
|
+
const result2 = null;
|
|
6365
|
+
return result2;
|
|
6366
|
+
}
|
|
6367
|
+
};
|
|
6368
|
+
}
|
|
6369
|
+
function dictionary(_obj) {
|
|
6370
|
+
return null;
|
|
6371
|
+
}
|
|
6372
|
+
function tuple2(..._elements) {
|
|
6373
|
+
return null;
|
|
6374
|
+
}
|
|
6375
|
+
function regexToken(re, ...rep) {
|
|
6376
|
+
let exp = "";
|
|
6377
|
+
if (isString(re)) {
|
|
6378
|
+
try {
|
|
6379
|
+
const test = new RegExp(re);
|
|
6380
|
+
if (!isRegExp(test)) {
|
|
6381
|
+
const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
|
|
6382
|
+
err.name = "InvalidRegEx";
|
|
6383
|
+
throw err;
|
|
6384
|
+
} else {
|
|
6385
|
+
exp = re;
|
|
6386
|
+
}
|
|
6387
|
+
} catch {
|
|
6388
|
+
const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
|
|
6389
|
+
err.name = "InvalidRegEx";
|
|
6390
|
+
throw err;
|
|
6391
|
+
}
|
|
6392
|
+
} else if (isRegExp(re)) {
|
|
6393
|
+
exp = re.toString();
|
|
6341
6394
|
}
|
|
6342
|
-
const
|
|
6343
|
-
|
|
6344
|
-
const tld = domain ? domain.pop() : "";
|
|
6345
|
-
const firstChar = val[0].toLowerCase();
|
|
6346
|
-
return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
|
|
6395
|
+
const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
|
|
6396
|
+
return token;
|
|
6347
6397
|
}
|
|
6348
|
-
function
|
|
6349
|
-
return
|
|
6398
|
+
function addSingleton(token, api2) {
|
|
6399
|
+
return (...literals) => {
|
|
6400
|
+
return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
|
|
6401
|
+
"union",
|
|
6402
|
+
literals.map((l) => addToken(token, `${l}`)).join(",")
|
|
6403
|
+
);
|
|
6404
|
+
};
|
|
6405
|
+
}
|
|
6406
|
+
var stringApi = {
|
|
6407
|
+
startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
|
|
6408
|
+
endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
|
|
6409
|
+
zip: () => addToken("string-set", "Zip5"),
|
|
6410
|
+
zipPlus4: () => addToken("string-set", "Zip5_4"),
|
|
6411
|
+
zipCode: () => addToken("string-set", "ZipCode"),
|
|
6412
|
+
militaryTime: (resolution) => {
|
|
6413
|
+
return addToken(
|
|
6414
|
+
"string-set",
|
|
6415
|
+
"militaryTime",
|
|
6416
|
+
resolution || "HH:MM"
|
|
6417
|
+
);
|
|
6418
|
+
},
|
|
6419
|
+
civilianTime: (resolution) => {
|
|
6420
|
+
return addToken(
|
|
6421
|
+
"string-set",
|
|
6422
|
+
"militaryTime",
|
|
6423
|
+
resolution || "HH:MM"
|
|
6424
|
+
);
|
|
6425
|
+
},
|
|
6426
|
+
numericString: () => addToken("string-set", "numeric"),
|
|
6427
|
+
ipv4Address: () => addToken("string-set", "ipv4Address"),
|
|
6428
|
+
ipv6Address: () => addToken("string-set", "ipv6Address"),
|
|
6429
|
+
regex: (exp, ...literalRepresentation) => {
|
|
6430
|
+
const token = regexToken(exp, ...literalRepresentation);
|
|
6431
|
+
return token;
|
|
6432
|
+
},
|
|
6433
|
+
done: () => addToken("string")
|
|
6434
|
+
};
|
|
6435
|
+
var string22 = addSingleton("string", stringApi);
|
|
6436
|
+
var number = addSingleton("number");
|
|
6437
|
+
function union2(...elements) {
|
|
6438
|
+
const result2 = elements.map((_el) => {
|
|
6439
|
+
});
|
|
6440
|
+
return result2;
|
|
6441
|
+
}
|
|
6442
|
+
function record(_key, _value) {
|
|
6443
|
+
return null;
|
|
6444
|
+
}
|
|
6445
|
+
function array(_type) {
|
|
6446
|
+
return null;
|
|
6447
|
+
}
|
|
6448
|
+
function set(_type) {
|
|
6449
|
+
return null;
|
|
6450
|
+
}
|
|
6451
|
+
function map(_key, _value) {
|
|
6452
|
+
return null;
|
|
6453
|
+
}
|
|
6454
|
+
function weakMap(_key, _value) {
|
|
6455
|
+
return null;
|
|
6456
|
+
}
|
|
6457
|
+
function isAddOrDone(val) {
|
|
6458
|
+
return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
|
|
6459
|
+
}
|
|
6460
|
+
var ShapeApiImplementation = {
|
|
6461
|
+
string: string22,
|
|
6462
|
+
number,
|
|
6463
|
+
boolean,
|
|
6464
|
+
unknown,
|
|
6465
|
+
undefined: undefinedType,
|
|
6466
|
+
null: nullType,
|
|
6467
|
+
union: union2,
|
|
6468
|
+
fn,
|
|
6469
|
+
record,
|
|
6470
|
+
array,
|
|
6471
|
+
set,
|
|
6472
|
+
map,
|
|
6473
|
+
weakMap,
|
|
6474
|
+
dictionary,
|
|
6475
|
+
tuple: tuple2
|
|
6476
|
+
};
|
|
6477
|
+
function shape(cb) {
|
|
6478
|
+
const rtn = cb(ShapeApiImplementation);
|
|
6479
|
+
return handleDoneFn(
|
|
6480
|
+
isAddOrDone(rtn) ? rtn.done() : rtn
|
|
6481
|
+
);
|
|
6482
|
+
}
|
|
6483
|
+
function isShape(v) {
|
|
6484
|
+
return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
|
|
6485
|
+
}
|
|
6486
|
+
function asDefineObject(defn) {
|
|
6487
|
+
const result2 = Object.keys(defn).reduce(
|
|
6488
|
+
(acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
|
|
6489
|
+
...acc,
|
|
6490
|
+
[i]: handleDoneFn(defn[i](ShapeApiImplementation))
|
|
6491
|
+
} : isFunction(defn[i]) ? {
|
|
6492
|
+
...acc,
|
|
6493
|
+
[i]: handleDoneFn(defn[i](ShapeApiImplementation))
|
|
6494
|
+
} : Never2,
|
|
6495
|
+
{}
|
|
6496
|
+
);
|
|
6497
|
+
return result2;
|
|
6498
|
+
}
|
|
6499
|
+
function asType(...token) {
|
|
6500
|
+
return isFunction(token) ? token(ShapeApiImplementation) : token.length === 1 ? isFunction(token[0]) ? handleDoneFn(token[0](ShapeApiImplementation)) : isDefineObject(token[0]) ? asDefineObject(token[0]) : token[0] : token.map((i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i);
|
|
6501
|
+
}
|
|
6502
|
+
function asStringLiteral(...values) {
|
|
6503
|
+
return values.map((i) => i);
|
|
6504
|
+
}
|
|
6505
|
+
var choices = "NOT READY";
|
|
6506
|
+
function doesExtend(type) {
|
|
6507
|
+
return (val) => {
|
|
6508
|
+
let response = false;
|
|
6509
|
+
if (isString(val)) {
|
|
6510
|
+
if (type === "string") {
|
|
6511
|
+
response = true;
|
|
6512
|
+
}
|
|
6513
|
+
if (type.startsWith("string(")) {
|
|
6514
|
+
const literals = stripAfter(
|
|
6515
|
+
stripBefore(type, "string("),
|
|
6516
|
+
")"
|
|
6517
|
+
).split(/,\s*/);
|
|
6518
|
+
if (literals.includes(val)) {
|
|
6519
|
+
response = true;
|
|
6520
|
+
}
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
if (isNumber(val)) {
|
|
6524
|
+
if (type === "number") {
|
|
6525
|
+
response = true;
|
|
6526
|
+
}
|
|
6527
|
+
if (type.startsWith("number(")) {
|
|
6528
|
+
const literals = stripAfter(
|
|
6529
|
+
stripBefore(type, "number("),
|
|
6530
|
+
")"
|
|
6531
|
+
).split(/,\s*/).map(Number);
|
|
6532
|
+
if (literals.includes(val)) {
|
|
6533
|
+
response = true;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
if (isNull(val) && (type === "null" || type === "Opt<null>")) {
|
|
6538
|
+
response = true;
|
|
6539
|
+
}
|
|
6540
|
+
if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
|
|
6541
|
+
response = true;
|
|
6542
|
+
}
|
|
6543
|
+
if (isBoolean(val)) {
|
|
6544
|
+
if (type === "boolean") {
|
|
6545
|
+
response = true;
|
|
6546
|
+
}
|
|
6547
|
+
if (type === "true" && val === true || type === "false" && val === false) {
|
|
6548
|
+
response = true;
|
|
6549
|
+
}
|
|
6550
|
+
}
|
|
6551
|
+
if (isNarrowableObject(val)) {
|
|
6552
|
+
if (type === "Dict" || type === "Dict<string, unknown>") {
|
|
6553
|
+
response = true;
|
|
6554
|
+
}
|
|
6555
|
+
if (startsWith("Dict<")(type)) {
|
|
6556
|
+
const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
|
|
6557
|
+
if (match) {
|
|
6558
|
+
const { value } = match;
|
|
6559
|
+
const isOpt = value.includes(`Opt<`);
|
|
6560
|
+
const values = objectValues(val);
|
|
6561
|
+
if (values.every((i) => isOpt ? isString(i) || isUndefined(i) : isString(i)) && type === "Dict<string, string>" || values.every((i) => isOpt ? isUndefined(i) || isNumber(i) : isNumber(i)) && type === "Dict<string, number>" || values.every((i) => isOpt ? isUndefined(i) || isBoolean(i) : isBoolean(i)) && type === "Dict<string, boolean>") {
|
|
6562
|
+
response = true;
|
|
6563
|
+
}
|
|
6564
|
+
}
|
|
6565
|
+
}
|
|
6566
|
+
}
|
|
6567
|
+
if (isArray(val)) {
|
|
6568
|
+
if (type === "Array" || type === "Array<unknown>") {
|
|
6569
|
+
return true;
|
|
6570
|
+
}
|
|
6571
|
+
if (type === "Array<Dict>" && val.every(isObject) || type === "Array<boolean>" && val.every(isBoolean) || type === "Array<string>" && val.every(isString) || type === "Array<number>" && val.every(isNumber) || type === "Array<Map>" && val.every(isMap) || type === "Array<Set>" && val.every(isSetContainer)) {
|
|
6572
|
+
response = true;
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
if (isMap(val)) {
|
|
6576
|
+
if (type === "Map" || type === "Map<Dict, Array>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isArray) || type === "Map<Dict, Dict>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isObject) || type === "Map<Dict, boolean>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isBoolean) || type === "Map<Dict, number>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isNumber) || type === "Map<Dict, string>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isString) || type === "Map<Dict, unknown>" && Array.from(val.keys()).every(isObject) || type === "Map<string, string>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isString) || type === "Map<string, number>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isNumber) || type === "Map<string, boolean>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isBoolean) || type === "Map<string, unknown>" && Array.from(val.keys()).every(isString) || type === "Map<number, string>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isString) || type === "Map<number, number>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isNumber) || type === "Map<number, boolean>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isBoolean) || type === "Map<number, unknown>" && Array.from(val.keys()).every(isNumber)) {
|
|
6577
|
+
response = true;
|
|
6578
|
+
}
|
|
6579
|
+
}
|
|
6580
|
+
if (isSetContainer(val)) {
|
|
6581
|
+
if (type === "Set" || type === "Set<unknown>" || type === "Set<boolean>" && Array.from(val).every(isBoolean) || type === "Set<string>" && Array.from(val).every(isString) || type === "Set<number>" && Array.from(val).every(isNumber) || type === "Set<Opt<boolean>>" && Array.from(val).every((i) => isBoolean(i) || isUndefined(i)) || type === "Set<Opt<string>>" && Array.from(val).every((i) => isString(i) || isUndefined(i)) || type === "Set<Opt<number>>" && Array.from(val).every((i) => isNumber(i) || isUndefined(i))) {
|
|
6582
|
+
response = true;
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6585
|
+
return response;
|
|
6586
|
+
};
|
|
6350
6587
|
}
|
|
6351
|
-
function
|
|
6352
|
-
|
|
6588
|
+
function ip6Prefix(...groups) {
|
|
6589
|
+
const empty = addToken("string");
|
|
6590
|
+
const count = 4 - groups.length;
|
|
6591
|
+
const fillIn = [];
|
|
6592
|
+
for (let index = 0; index < count; index++) {
|
|
6593
|
+
fillIn.push(empty);
|
|
6594
|
+
}
|
|
6595
|
+
return [
|
|
6596
|
+
"<<string::",
|
|
6597
|
+
[
|
|
6598
|
+
groups.join(":"),
|
|
6599
|
+
fillIn.join(":")
|
|
6600
|
+
].join(":"),
|
|
6601
|
+
">>"
|
|
6602
|
+
].join("");
|
|
6353
6603
|
}
|
|
6354
|
-
function
|
|
6355
|
-
|
|
6604
|
+
function createProxy(...initialize) {
|
|
6605
|
+
const state = initialize;
|
|
6606
|
+
state.id = null;
|
|
6607
|
+
const proxy = new Proxy(state, {});
|
|
6608
|
+
Object.defineProperty(proxy, "id", {
|
|
6609
|
+
enumerable: false
|
|
6610
|
+
});
|
|
6611
|
+
return proxy;
|
|
6356
6612
|
}
|
|
6357
|
-
function
|
|
6358
|
-
return
|
|
6613
|
+
function list(...init) {
|
|
6614
|
+
return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
|
|
6359
6615
|
}
|
|
6360
|
-
function
|
|
6361
|
-
return
|
|
6616
|
+
function singletonApi(kind) {
|
|
6617
|
+
return {
|
|
6618
|
+
wide: () => `<<${kind}>>`,
|
|
6619
|
+
literal: (val) => `<<${kind}::${val}>>`
|
|
6620
|
+
};
|
|
6362
6621
|
}
|
|
6363
|
-
function
|
|
6364
|
-
return
|
|
6622
|
+
function setApi(_variant) {
|
|
6623
|
+
return null;
|
|
6365
6624
|
}
|
|
6366
|
-
function
|
|
6367
|
-
return
|
|
6625
|
+
function fnReturnsApi(variant, _params, returns) {
|
|
6626
|
+
return isSet(returns) ? null : (_rtn) => {
|
|
6627
|
+
return isSet(returns) ? `<<${variant}::>>` : null;
|
|
6628
|
+
};
|
|
6368
6629
|
}
|
|
6369
|
-
function
|
|
6370
|
-
return
|
|
6630
|
+
function fnParamsApi(variant, params, _returns) {
|
|
6631
|
+
return isSet(params) ? null : (params2) => {
|
|
6632
|
+
return isSet(params2) ? `<<${variant}::>>` : null;
|
|
6633
|
+
};
|
|
6371
6634
|
}
|
|
6372
|
-
function
|
|
6373
|
-
return
|
|
6635
|
+
function fnDoneApi(variant, params, returns) {
|
|
6636
|
+
return isUnset(params) && isUnset(returns) ? `<<` : ``;
|
|
6374
6637
|
}
|
|
6375
|
-
function
|
|
6376
|
-
return
|
|
6638
|
+
function fnTokenClosure(kind, params, returns) {
|
|
6639
|
+
return {
|
|
6640
|
+
done: fnDoneApi(kind, params, returns),
|
|
6641
|
+
params: fnParamsApi(kind, params, returns),
|
|
6642
|
+
returns: fnReturnsApi(kind, params, returns)
|
|
6643
|
+
};
|
|
6377
6644
|
}
|
|
6378
|
-
function
|
|
6379
|
-
return
|
|
6645
|
+
function createTypeToken(kind) {
|
|
6646
|
+
return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
|
|
6380
6647
|
}
|
|
6381
|
-
function
|
|
6382
|
-
return
|
|
6648
|
+
function fromDefineObject(defn) {
|
|
6649
|
+
return defn;
|
|
6383
6650
|
}
|
|
6384
|
-
function
|
|
6385
|
-
const
|
|
6386
|
-
const
|
|
6387
|
-
const
|
|
6388
|
-
|
|
6389
|
-
const nothing = stripChars(svelte, ...[
|
|
6390
|
-
...NUMERIC_CHAR2,
|
|
6391
|
-
...WHITESPACE_CHARS2,
|
|
6392
|
-
"(",
|
|
6393
|
-
")",
|
|
6394
|
-
"+",
|
|
6395
|
-
".",
|
|
6396
|
-
"-"
|
|
6397
|
-
]);
|
|
6398
|
-
return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
|
|
6651
|
+
function getTokenKind(token) {
|
|
6652
|
+
const bare = stripSurround("<<", ">>")(token);
|
|
6653
|
+
const parts = bare.split("::");
|
|
6654
|
+
const kind = parts.pop();
|
|
6655
|
+
return kind;
|
|
6399
6656
|
}
|
|
6400
|
-
|
|
6401
|
-
|
|
6657
|
+
var simpleToken = (token) => token;
|
|
6658
|
+
var simpleScalarToken = (token) => token;
|
|
6659
|
+
var simpleContainerToken = (token) => token;
|
|
6660
|
+
function simpleScalarType(token) {
|
|
6661
|
+
const value = simpleScalarToken(token);
|
|
6662
|
+
return value;
|
|
6402
6663
|
}
|
|
6403
|
-
function
|
|
6404
|
-
|
|
6664
|
+
function simpleContainerType(token) {
|
|
6665
|
+
const value = simpleContainerToken(token);
|
|
6666
|
+
return value;
|
|
6405
6667
|
}
|
|
6406
|
-
function
|
|
6407
|
-
|
|
6668
|
+
function simpleType(token) {
|
|
6669
|
+
const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
|
|
6670
|
+
return value;
|
|
6408
6671
|
}
|
|
6409
|
-
function
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
if (isString(val)) {
|
|
6414
|
-
try {
|
|
6415
|
-
const _re = new RegExp(val);
|
|
6672
|
+
function hasOverlappingKeys(a, b) {
|
|
6673
|
+
const keys = Object.keys(a);
|
|
6674
|
+
for (const k of keys) {
|
|
6675
|
+
if (k in b) {
|
|
6416
6676
|
return true;
|
|
6417
|
-
} catch {
|
|
6418
|
-
return false;
|
|
6419
6677
|
}
|
|
6420
6678
|
}
|
|
6421
6679
|
return false;
|
|
6422
6680
|
}
|
|
6423
|
-
function
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
}
|
|
6441
|
-
function isTruthy(val) {
|
|
6442
|
-
return !FALSY_VALUES2.includes(val);
|
|
6443
|
-
}
|
|
6444
|
-
function isTypeSubtype(val) {
|
|
6445
|
-
return isString(val) && val.split("/").length === 2;
|
|
6446
|
-
}
|
|
6447
|
-
function isTypeTuple(value) {
|
|
6448
|
-
return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
|
|
6449
|
-
}
|
|
6450
|
-
function isUnset(val) {
|
|
6451
|
-
return isObject(val) && val.kind === "Unset";
|
|
6452
|
-
}
|
|
6453
|
-
function isUri(val, ...protocols) {
|
|
6454
|
-
const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
|
|
6455
|
-
return isString(val) && p.some((i) => val.startsWith(`${i}://`));
|
|
6681
|
+
function uniqueKeys(left, right) {
|
|
6682
|
+
const isNumeric = !!(isArray(left) && isArray(right));
|
|
6683
|
+
if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
|
|
6684
|
+
throw new Error("uniqueKeys(l,r) given invalid comparison; both left and right values should be an object or an array but not one of each!");
|
|
6685
|
+
}
|
|
6686
|
+
const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
|
|
6687
|
+
const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
|
|
6688
|
+
if (isNumeric) {
|
|
6689
|
+
throw new Error("uniqueKeys does not yet work with tuples");
|
|
6690
|
+
}
|
|
6691
|
+
const leftKeys = l.filter((i) => !r.includes(i));
|
|
6692
|
+
const rightKeys = r.filter((i) => !l.includes(i));
|
|
6693
|
+
return [
|
|
6694
|
+
"LeftRight",
|
|
6695
|
+
leftKeys,
|
|
6696
|
+
rightKeys
|
|
6697
|
+
];
|
|
6456
6698
|
}
|
|
6457
|
-
function
|
|
6458
|
-
|
|
6459
|
-
return isString(val) && p.some((i) => val.startsWith(`${i}://`));
|
|
6699
|
+
function asChars(str) {
|
|
6700
|
+
return str.split("");
|
|
6460
6701
|
}
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
...NUMERIC_CHAR2,
|
|
6464
|
-
"_",
|
|
6465
|
-
"."
|
|
6466
|
-
];
|
|
6467
|
-
var alpha = null;
|
|
6468
|
-
function valid(chars) {
|
|
6469
|
-
return chars.every((i) => VALID.includes(i));
|
|
6702
|
+
function asRecord(obj) {
|
|
6703
|
+
return obj;
|
|
6470
6704
|
}
|
|
6471
|
-
function
|
|
6472
|
-
return isString(
|
|
6705
|
+
function asString(value) {
|
|
6706
|
+
return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
|
|
6473
6707
|
}
|
|
6474
|
-
function
|
|
6475
|
-
return
|
|
6708
|
+
function isFunction(value) {
|
|
6709
|
+
return typeof value === "function";
|
|
6476
6710
|
}
|
|
6477
|
-
function
|
|
6478
|
-
return
|
|
6711
|
+
function isObject(value) {
|
|
6712
|
+
return typeof value === "object" && value !== null && Array.isArray(value) === false;
|
|
6479
6713
|
}
|
|
6480
|
-
function
|
|
6481
|
-
return
|
|
6714
|
+
function isNarrowableObject(value) {
|
|
6715
|
+
return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
|
|
6482
6716
|
}
|
|
6483
|
-
function
|
|
6484
|
-
return
|
|
6717
|
+
function isEscapeFunction(val) {
|
|
6718
|
+
return isFunction(val) && "escape" in val && val.escape === true;
|
|
6485
6719
|
}
|
|
6486
|
-
function
|
|
6487
|
-
return
|
|
6720
|
+
function isOptionalParamFunction(val) {
|
|
6721
|
+
return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
|
|
6488
6722
|
}
|
|
6489
|
-
function
|
|
6490
|
-
return
|
|
6723
|
+
function isApi(api2) {
|
|
6724
|
+
return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
|
|
6491
6725
|
}
|
|
6492
|
-
function
|
|
6493
|
-
return
|
|
6726
|
+
function isApiSurface(val) {
|
|
6727
|
+
return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
|
|
6494
6728
|
}
|
|
6495
|
-
function
|
|
6496
|
-
return
|
|
6729
|
+
function isDate(val) {
|
|
6730
|
+
return val instanceof Date;
|
|
6497
6731
|
}
|
|
6498
|
-
function
|
|
6499
|
-
|
|
6732
|
+
function isIsoDateTime(val) {
|
|
6733
|
+
if (!isString(val)) {
|
|
6734
|
+
return false;
|
|
6735
|
+
}
|
|
6736
|
+
const ISO_DATETIME_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})?$/;
|
|
6737
|
+
if (!ISO_DATETIME_REGEX.test(val)) {
|
|
6738
|
+
return false;
|
|
6739
|
+
}
|
|
6740
|
+
const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
|
|
6741
|
+
const [year, month, day, hours, minutes, seconds] = matches.map(Number);
|
|
6742
|
+
if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
|
|
6743
|
+
return false;
|
|
6744
|
+
}
|
|
6745
|
+
if (month < 1 || month > 12) {
|
|
6746
|
+
return false;
|
|
6747
|
+
}
|
|
6748
|
+
;
|
|
6749
|
+
const daysInMonth = new Date(year, month, 0).getDate();
|
|
6750
|
+
if (day < 1 || day > daysInMonth) {
|
|
6751
|
+
return false;
|
|
6752
|
+
}
|
|
6753
|
+
;
|
|
6754
|
+
const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
|
|
6755
|
+
if (tzMatch) {
|
|
6756
|
+
const [_2, _sign, tzHours, tzMinutes] = tzMatch;
|
|
6757
|
+
const numHours = Number.parseInt(tzHours, 10);
|
|
6758
|
+
const numMinutes = Number.parseInt(tzMinutes, 10);
|
|
6759
|
+
if (numHours > 14 || numMinutes > 59) {
|
|
6760
|
+
return false;
|
|
6761
|
+
}
|
|
6762
|
+
if (numHours === 14 && numMinutes > 0) {
|
|
6763
|
+
return false;
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
return true;
|
|
6500
6767
|
}
|
|
6501
|
-
function
|
|
6502
|
-
|
|
6768
|
+
function isIsoExplicitDate(val) {
|
|
6769
|
+
if (isString(val)) {
|
|
6770
|
+
const parts = val.split("-").map((i) => Number(i));
|
|
6771
|
+
return val.includes("-") ? val.split("-").every((i) => isNumberLike(i)) ? parts[0] >= 0 && parts[0] <= 9999 && parts[1] >= 1 && parts[1] <= 12 && parts[2] >= 1 && parts[2] <= 31 : false : false;
|
|
6772
|
+
} else {
|
|
6773
|
+
return false;
|
|
6774
|
+
}
|
|
6503
6775
|
}
|
|
6504
|
-
function
|
|
6505
|
-
|
|
6776
|
+
function isIsoImplicitDate(val) {
|
|
6777
|
+
if (isString(val) && val.length === 8 && isNumberLike(val)) {
|
|
6778
|
+
const year = Number(val.slice(0, 4));
|
|
6779
|
+
const month = Number(val.slice(4, 6));
|
|
6780
|
+
const date = Number(val.slice(6, 8));
|
|
6781
|
+
return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
|
|
6782
|
+
} else {
|
|
6783
|
+
return false;
|
|
6784
|
+
}
|
|
6506
6785
|
}
|
|
6507
|
-
function
|
|
6508
|
-
|
|
6786
|
+
function isIsoDate(val) {
|
|
6787
|
+
if (isString(val)) {
|
|
6788
|
+
return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
|
|
6789
|
+
} else {
|
|
6790
|
+
return false;
|
|
6791
|
+
}
|
|
6509
6792
|
}
|
|
6510
|
-
function
|
|
6511
|
-
|
|
6793
|
+
function isIsoExplicitTime(val) {
|
|
6794
|
+
if (isString(val)) {
|
|
6795
|
+
const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
|
|
6796
|
+
return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
|
|
6797
|
+
} else {
|
|
6798
|
+
return false;
|
|
6799
|
+
}
|
|
6512
6800
|
}
|
|
6513
|
-
function
|
|
6514
|
-
|
|
6801
|
+
function isIsoImplicitTime(val) {
|
|
6802
|
+
if (isString(val)) {
|
|
6803
|
+
const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
|
|
6804
|
+
return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
|
|
6805
|
+
} else {
|
|
6806
|
+
return false;
|
|
6807
|
+
}
|
|
6515
6808
|
}
|
|
6516
|
-
function
|
|
6517
|
-
|
|
6518
|
-
return isString(val) && speed.includes(separate(val));
|
|
6809
|
+
function isIsoTime(val) {
|
|
6810
|
+
return isIsoExplicitTime(val) || isIsoImplicitTime(val);
|
|
6519
6811
|
}
|
|
6520
|
-
function
|
|
6521
|
-
return isString(val) &&
|
|
6812
|
+
function isIsoYear(val) {
|
|
6813
|
+
return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
|
|
6522
6814
|
}
|
|
6523
|
-
function
|
|
6524
|
-
return
|
|
6815
|
+
function isLuxonDateTime(val) {
|
|
6816
|
+
return isObject(val) && typeof val === "object" && val !== null && "isValid" in val && "invalidReason" in val && "invalidExplanation" in val && "toISO" in val && "toFormat" in val && "toMillis" in val && "year" in val && "month" in val && "day" in val && "hour" in val && "minute" in val && "second" in val && "millisecond" in val && typeof val.isValid === "boolean" && typeof val.toISO === "function";
|
|
6525
6817
|
}
|
|
6526
|
-
function
|
|
6527
|
-
|
|
6818
|
+
function isMoment(val) {
|
|
6819
|
+
if (val instanceof Date) {
|
|
6820
|
+
return false;
|
|
6821
|
+
}
|
|
6822
|
+
return isObject(val) && typeof val.format === "function" && typeof val.year === "function" && typeof val.month === "function" && typeof val.date === "function" && "_isAMomentObject" in val && "_isValid" in val && typeof val.add === "function" && typeof val.subtract === "function" && typeof val.toISOString === "function" && typeof val.isValid === "function";
|
|
6528
6823
|
}
|
|
6529
|
-
function
|
|
6530
|
-
|
|
6824
|
+
function isThisMonth(val) {
|
|
6825
|
+
const now = /* @__PURE__ */ new Date();
|
|
6826
|
+
const currentYear = now.getFullYear();
|
|
6827
|
+
const currentMonth = now.getMonth() + 1;
|
|
6828
|
+
if (val instanceof Date) {
|
|
6829
|
+
return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
|
|
6830
|
+
}
|
|
6831
|
+
if (isMoment(val)) {
|
|
6832
|
+
const monthValue = val.month();
|
|
6833
|
+
return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
|
|
6834
|
+
}
|
|
6835
|
+
if (isLuxonDateTime(val)) {
|
|
6836
|
+
return val.year === currentYear && val.month === currentMonth;
|
|
6837
|
+
}
|
|
6838
|
+
if (typeof val === "string") {
|
|
6839
|
+
const isoDateRegex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][01]\d:[0-5]\d))?$/;
|
|
6840
|
+
if (!isoDateRegex.test(val)) {
|
|
6841
|
+
return false;
|
|
6842
|
+
}
|
|
6843
|
+
const dateMatch = val.match(/^(\d{4})-(\d{2})/);
|
|
6844
|
+
if (dateMatch) {
|
|
6845
|
+
const year = Number.parseInt(dateMatch[1], 10);
|
|
6846
|
+
const month = Number.parseInt(dateMatch[2], 10);
|
|
6847
|
+
return year === currentYear && month === currentMonth;
|
|
6848
|
+
}
|
|
6849
|
+
}
|
|
6850
|
+
return false;
|
|
6531
6851
|
}
|
|
6532
|
-
function
|
|
6533
|
-
|
|
6852
|
+
function isThisWeek(date) {
|
|
6853
|
+
const targetDate = asDate(date);
|
|
6854
|
+
if (!targetDate) {
|
|
6855
|
+
return false;
|
|
6856
|
+
}
|
|
6857
|
+
const currentWeek = getWeekNumber();
|
|
6858
|
+
const targetWeek = getWeekNumber(targetDate);
|
|
6859
|
+
return currentWeek === targetWeek;
|
|
6534
6860
|
}
|
|
6535
|
-
function
|
|
6536
|
-
|
|
6861
|
+
function isThisYear(val) {
|
|
6862
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
6863
|
+
if (isObject(val) || isNumber(val) || isString(val)) {
|
|
6864
|
+
const date = asDate(val);
|
|
6865
|
+
if (date) {
|
|
6866
|
+
return date.getFullYear() === currentYear;
|
|
6867
|
+
} else {
|
|
6868
|
+
return false;
|
|
6869
|
+
}
|
|
6870
|
+
}
|
|
6871
|
+
return false;
|
|
6537
6872
|
}
|
|
6538
|
-
function
|
|
6539
|
-
|
|
6873
|
+
function isToday(test) {
|
|
6874
|
+
if (isString(test)) {
|
|
6875
|
+
const justDate = stripAfter(test, "T");
|
|
6876
|
+
return isIsoExplicitDate(justDate) && justDate === getToday();
|
|
6877
|
+
} else if (isMoment(test) || isDate(test)) {
|
|
6878
|
+
return stripAfter(test.toISOString(), "T") === getToday();
|
|
6879
|
+
} else if (isLuxonDateTime(test)) {
|
|
6880
|
+
return stripAfter(test.toISO(), "T") === getToday();
|
|
6881
|
+
}
|
|
6882
|
+
return false;
|
|
6540
6883
|
}
|
|
6541
|
-
function
|
|
6542
|
-
|
|
6884
|
+
function isTomorrow(test) {
|
|
6885
|
+
if (isString(test)) {
|
|
6886
|
+
const justDate = stripAfter(test, "T");
|
|
6887
|
+
return isIsoExplicitDate(justDate) && justDate === getTomorrow();
|
|
6888
|
+
} else if (isMoment(test) || isDate(test)) {
|
|
6889
|
+
return stripAfter(test.toISOString(), "T") === getTomorrow();
|
|
6890
|
+
} else if (isLuxonDateTime(test)) {
|
|
6891
|
+
return stripAfter(test.toISO(), "T") === getTomorrow();
|
|
6892
|
+
}
|
|
6893
|
+
return false;
|
|
6543
6894
|
}
|
|
6544
|
-
function
|
|
6545
|
-
|
|
6895
|
+
function isYesterday(test) {
|
|
6896
|
+
if (isString(test)) {
|
|
6897
|
+
const justDate = stripAfter(test, "T");
|
|
6898
|
+
return isIsoExplicitDate(justDate) && justDate === getYesterday();
|
|
6899
|
+
} else if (isMoment(test) || isDate(test)) {
|
|
6900
|
+
return stripAfter(test.toISOString(), "T") === getYesterday();
|
|
6901
|
+
} else if (isLuxonDateTime(test)) {
|
|
6902
|
+
return stripAfter(test.toISO(), "T") === getYesterday();
|
|
6903
|
+
}
|
|
6904
|
+
return false;
|
|
6546
6905
|
}
|
|
6547
|
-
function
|
|
6548
|
-
return
|
|
6906
|
+
function isString(value) {
|
|
6907
|
+
return typeof value === "string";
|
|
6549
6908
|
}
|
|
6550
|
-
function
|
|
6551
|
-
|
|
6909
|
+
function isIso3166Alpha2(val) {
|
|
6910
|
+
const codes = ISO3166_12.map((i) => i.alpha2);
|
|
6911
|
+
return isString(val) && codes.includes(val);
|
|
6552
6912
|
}
|
|
6553
|
-
function
|
|
6554
|
-
|
|
6913
|
+
function isCountryCode2(val) {
|
|
6914
|
+
const codes = ISO3166_12.map((i) => i.alpha2);
|
|
6915
|
+
return isString(val) && codes.includes(val);
|
|
6555
6916
|
}
|
|
6556
|
-
function
|
|
6557
|
-
|
|
6917
|
+
function isIso3166Alpha3(val) {
|
|
6918
|
+
const codes = ISO3166_12.map((i) => i.alpha3);
|
|
6919
|
+
return isString(val) && codes.includes(val);
|
|
6558
6920
|
}
|
|
6559
|
-
function
|
|
6560
|
-
|
|
6921
|
+
function isCountryCode3(val) {
|
|
6922
|
+
const codes = ISO3166_12.map((i) => i.alpha3);
|
|
6923
|
+
return isString(val) && codes.includes(val);
|
|
6561
6924
|
}
|
|
6562
|
-
function
|
|
6563
|
-
|
|
6925
|
+
function isIso3166CountryCode(val) {
|
|
6926
|
+
const codes = ISO3166_12.map((i) => i.countryCode);
|
|
6927
|
+
return isString(val) && codes.includes(val);
|
|
6564
6928
|
}
|
|
6565
|
-
function
|
|
6566
|
-
return
|
|
6929
|
+
function isCountryAbbrev(val) {
|
|
6930
|
+
return isCountryCode2(val) || isCountryCode3(val);
|
|
6567
6931
|
}
|
|
6568
|
-
function
|
|
6569
|
-
|
|
6932
|
+
function isIso3166CountryName(val) {
|
|
6933
|
+
const codes = ISO3166_12.map((i) => i.name);
|
|
6934
|
+
return isString(val) && codes.includes(val);
|
|
6570
6935
|
}
|
|
6571
|
-
function
|
|
6572
|
-
|
|
6936
|
+
function isCountryName(val) {
|
|
6937
|
+
const codes = ISO3166_12.map((i) => i.name);
|
|
6938
|
+
return isString(val) && codes.includes(val);
|
|
6573
6939
|
}
|
|
6574
|
-
|
|
6575
|
-
|
|
6940
|
+
var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
|
|
6941
|
+
var NAME = US_STATE_LOOKUP2.map((i) => i.name);
|
|
6942
|
+
function isUsStateAbbreviation(val) {
|
|
6943
|
+
return isString(val) && ABBREV.includes(val);
|
|
6576
6944
|
}
|
|
6577
|
-
function
|
|
6578
|
-
return
|
|
6945
|
+
function isUsStateName(val) {
|
|
6946
|
+
return isString(val) && NAME.includes(val);
|
|
6579
6947
|
}
|
|
6580
|
-
function
|
|
6581
|
-
|
|
6948
|
+
function isNumericString(value) {
|
|
6949
|
+
const numericChars = [...NUMERIC_CHAR2];
|
|
6950
|
+
return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
|
|
6582
6951
|
}
|
|
6583
|
-
function
|
|
6584
|
-
const
|
|
6585
|
-
return
|
|
6952
|
+
function isNumberLike(value) {
|
|
6953
|
+
const numericChars = [...NUMERIC_CHAR2];
|
|
6954
|
+
return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
|
|
6586
6955
|
}
|
|
6587
|
-
function
|
|
6588
|
-
return
|
|
6956
|
+
function isNumber(value) {
|
|
6957
|
+
return typeof value === "number";
|
|
6589
6958
|
}
|
|
6590
|
-
function
|
|
6591
|
-
|
|
6959
|
+
function isZipCode5(val) {
|
|
6960
|
+
if (isNumber(val)) {
|
|
6961
|
+
return isZipCode5(`${val}`);
|
|
6962
|
+
}
|
|
6963
|
+
return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
|
|
6592
6964
|
}
|
|
6593
|
-
function
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6965
|
+
function isZipPlus4(val) {
|
|
6966
|
+
if (isString(val)) {
|
|
6967
|
+
const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
|
|
6968
|
+
const next = stripChars(val.trim().replace(first, "").trim(), "-");
|
|
6969
|
+
return first.length === 5 && next.length === 4 && isNumberLike(next);
|
|
6970
|
+
}
|
|
6971
|
+
return false;
|
|
6597
6972
|
}
|
|
6598
|
-
function
|
|
6599
|
-
return
|
|
6600
|
-
(i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
|
|
6601
|
-
);
|
|
6973
|
+
function isZipCode(val) {
|
|
6974
|
+
return isZipCode5(val) || isZipPlus4(val);
|
|
6602
6975
|
}
|
|
6603
|
-
function
|
|
6604
|
-
return
|
|
6976
|
+
function isSpecificConstant(kind) {
|
|
6977
|
+
return (value) => {
|
|
6978
|
+
return !!(isConstant(value) && value.kind === kind);
|
|
6979
|
+
};
|
|
6605
6980
|
}
|
|
6606
|
-
function
|
|
6607
|
-
|
|
6981
|
+
function hasDefaultValue(value) {
|
|
6982
|
+
const noDefault = isSpecificConstant("no-default-value");
|
|
6983
|
+
return !noDefault(value);
|
|
6608
6984
|
}
|
|
6609
|
-
function
|
|
6610
|
-
|
|
6985
|
+
function hasIndexOf(value, idx) {
|
|
6986
|
+
const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
|
|
6987
|
+
return isErrorCondition(result2, "invalid-index") ? false : result2;
|
|
6611
6988
|
}
|
|
6612
|
-
function
|
|
6613
|
-
return
|
|
6989
|
+
function hasKeys(...props) {
|
|
6990
|
+
return (val) => {
|
|
6991
|
+
const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
|
|
6992
|
+
return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
|
|
6993
|
+
};
|
|
6614
6994
|
}
|
|
6615
|
-
function
|
|
6616
|
-
return isString(val) &&
|
|
6995
|
+
function hasWhiteSpace(val) {
|
|
6996
|
+
return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
|
|
6617
6997
|
}
|
|
6618
|
-
function
|
|
6619
|
-
return
|
|
6998
|
+
function endsWith(endingIn2) {
|
|
6999
|
+
return (val) => {
|
|
7000
|
+
return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
|
|
7001
|
+
};
|
|
6620
7002
|
}
|
|
6621
|
-
function
|
|
6622
|
-
return
|
|
7003
|
+
function isEqual(base) {
|
|
7004
|
+
return (value) => isSameTypeOf(base)(value) ? value === base : false;
|
|
6623
7005
|
}
|
|
6624
|
-
function
|
|
6625
|
-
|
|
6626
|
-
const stripped = stripSurround("<<", ">>")(val);
|
|
6627
|
-
if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
|
|
6628
|
-
if (kind) {
|
|
6629
|
-
if (isAtomicKind(kind)) {
|
|
6630
|
-
return val === `<<${kind}>>`;
|
|
6631
|
-
} else if (isSetBasedKind(kind)) {
|
|
6632
|
-
return val.startsWith(`<<${kind}::`);
|
|
6633
|
-
} else {
|
|
6634
|
-
return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
|
|
6635
|
-
}
|
|
6636
|
-
} else {
|
|
6637
|
-
return true;
|
|
6638
|
-
}
|
|
6639
|
-
}
|
|
6640
|
-
return false;
|
|
6641
|
-
}
|
|
6642
|
-
return false;
|
|
7006
|
+
function isLength(value, len) {
|
|
7007
|
+
return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
|
|
6643
7008
|
}
|
|
6644
|
-
function
|
|
6645
|
-
return
|
|
7009
|
+
function isSameTypeOf(base) {
|
|
7010
|
+
return (compare) => {
|
|
7011
|
+
return typeof base === typeof compare;
|
|
7012
|
+
};
|
|
6646
7013
|
}
|
|
6647
|
-
function
|
|
6648
|
-
|
|
7014
|
+
function isTuple(...tuple3) {
|
|
7015
|
+
const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
|
|
7016
|
+
return (v) => {
|
|
7017
|
+
return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
|
|
7018
|
+
};
|
|
6649
7019
|
}
|
|
6650
|
-
function
|
|
6651
|
-
return
|
|
7020
|
+
function isTypeOf(type) {
|
|
7021
|
+
return (value) => {
|
|
7022
|
+
return typeof value === type;
|
|
7023
|
+
};
|
|
6652
7024
|
}
|
|
6653
|
-
function
|
|
6654
|
-
return
|
|
7025
|
+
function startsWith(startingWith) {
|
|
7026
|
+
return (val) => {
|
|
7027
|
+
return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
|
|
7028
|
+
};
|
|
6655
7029
|
}
|
|
6656
|
-
function
|
|
6657
|
-
return
|
|
7030
|
+
function isHtmlElement(val) {
|
|
7031
|
+
return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
|
|
6658
7032
|
}
|
|
6659
|
-
function
|
|
6660
|
-
return
|
|
7033
|
+
function isAlpha(value) {
|
|
7034
|
+
return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
|
|
6661
7035
|
}
|
|
6662
|
-
function
|
|
6663
|
-
return
|
|
7036
|
+
function isArray(value) {
|
|
7037
|
+
return Array.isArray(value) === true;
|
|
6664
7038
|
}
|
|
6665
|
-
function
|
|
6666
|
-
return
|
|
7039
|
+
function isBoolean(value) {
|
|
7040
|
+
return typeof value === "boolean";
|
|
6667
7041
|
}
|
|
6668
|
-
function
|
|
6669
|
-
return
|
|
7042
|
+
function isBooleanLike(val) {
|
|
7043
|
+
return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
|
|
6670
7044
|
}
|
|
6671
|
-
function
|
|
6672
|
-
return
|
|
7045
|
+
function isConstant(value) {
|
|
7046
|
+
return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
|
|
6673
7047
|
}
|
|
6674
|
-
function
|
|
6675
|
-
return
|
|
7048
|
+
function isContainer(value) {
|
|
7049
|
+
return !!(Array.isArray(value) || isObject(value));
|
|
6676
7050
|
}
|
|
6677
|
-
var
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
7051
|
+
var tokens = [
|
|
7052
|
+
"1",
|
|
7053
|
+
"inherit",
|
|
7054
|
+
"initial",
|
|
7055
|
+
"revert",
|
|
7056
|
+
"revert-layer",
|
|
7057
|
+
"unset",
|
|
7058
|
+
"auto"
|
|
6683
7059
|
];
|
|
6684
|
-
|
|
6685
|
-
|
|
7060
|
+
var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
|
|
7061
|
+
function isCssAspectRatio(val) {
|
|
7062
|
+
return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
|
|
6686
7063
|
}
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
function isSimpleToken(val) {
|
|
6690
|
-
return isString(val) && split_tokens.some(
|
|
6691
|
-
(i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
|
|
6692
|
-
);
|
|
7064
|
+
function isCsv(val) {
|
|
7065
|
+
return isString(val) && val.includes(",") && !val.startsWith(",");
|
|
6693
7066
|
}
|
|
6694
|
-
function
|
|
6695
|
-
return
|
|
6696
|
-
(i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
|
|
6697
|
-
);
|
|
7067
|
+
function isDefined(value) {
|
|
7068
|
+
return typeof value !== "undefined";
|
|
6698
7069
|
}
|
|
6699
|
-
function
|
|
6700
|
-
return
|
|
6701
|
-
(i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
|
|
6702
|
-
);
|
|
7070
|
+
function isDoneFn(val) {
|
|
7071
|
+
return hasKeys("done")(val) && typeof val.done === "function";
|
|
6703
7072
|
}
|
|
6704
|
-
function
|
|
6705
|
-
|
|
7073
|
+
function isEmail(val) {
|
|
7074
|
+
if (!isString(val)) {
|
|
7075
|
+
return false;
|
|
7076
|
+
}
|
|
7077
|
+
const parts = val?.split("@");
|
|
7078
|
+
const domain = parts[1]?.split(".");
|
|
7079
|
+
const tld = domain ? domain.pop() : "";
|
|
7080
|
+
const firstChar = val[0].toLowerCase();
|
|
7081
|
+
return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
|
|
6706
7082
|
}
|
|
6707
|
-
function
|
|
6708
|
-
return
|
|
7083
|
+
function isEmpty(val) {
|
|
7084
|
+
return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
|
|
6709
7085
|
}
|
|
6710
|
-
function
|
|
6711
|
-
return
|
|
7086
|
+
function isErrorCondition(value, kind = null) {
|
|
7087
|
+
return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
|
|
6712
7088
|
}
|
|
6713
|
-
function
|
|
6714
|
-
return
|
|
6715
|
-
(key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
|
|
6716
|
-
);
|
|
7089
|
+
function isFalse(i) {
|
|
7090
|
+
return typeof i === "boolean" && !i;
|
|
6717
7091
|
}
|
|
6718
|
-
function
|
|
6719
|
-
|
|
6720
|
-
const stripped = stripSurround(TT_START2, TT_STOP2)(val);
|
|
6721
|
-
return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
|
|
6722
|
-
}
|
|
7092
|
+
function isFalsy(val) {
|
|
7093
|
+
return FALSY_VALUES2.includes(val);
|
|
6723
7094
|
}
|
|
6724
|
-
function
|
|
6725
|
-
|
|
6726
|
-
const stripped = stripSurround(TT_START2, TT_STOP2)(val);
|
|
6727
|
-
return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
|
|
6728
|
-
}
|
|
6729
|
-
return false;
|
|
7095
|
+
function isFnWithParams(input, ...params) {
|
|
7096
|
+
return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
|
|
6730
7097
|
}
|
|
6731
|
-
function
|
|
6732
|
-
|
|
6733
|
-
const kind = getTokenKind(val);
|
|
6734
|
-
return kind.endsWith(`-set`);
|
|
6735
|
-
}
|
|
6736
|
-
return false;
|
|
7098
|
+
function isHexadecimal(val) {
|
|
7099
|
+
return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
|
|
6737
7100
|
}
|
|
6738
|
-
function
|
|
6739
|
-
return
|
|
7101
|
+
function isIndexable(value) {
|
|
7102
|
+
return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
|
|
6740
7103
|
}
|
|
6741
|
-
function
|
|
6742
|
-
return isString(
|
|
7104
|
+
function isInlineSvg(v) {
|
|
7105
|
+
return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
|
|
6743
7106
|
}
|
|
6744
|
-
function
|
|
6745
|
-
return
|
|
7107
|
+
function isMap(val) {
|
|
7108
|
+
return val instanceof Map;
|
|
6746
7109
|
}
|
|
6747
|
-
function
|
|
6748
|
-
return
|
|
7110
|
+
function isNever(val) {
|
|
7111
|
+
return isConstant(val) && val.kind === "never";
|
|
6749
7112
|
}
|
|
6750
|
-
function
|
|
6751
|
-
return
|
|
7113
|
+
function isNothing(val) {
|
|
7114
|
+
return !!(val === null || val === void 0);
|
|
6752
7115
|
}
|
|
6753
|
-
function
|
|
6754
|
-
return
|
|
7116
|
+
function isNotNull(value) {
|
|
7117
|
+
return value === null;
|
|
6755
7118
|
}
|
|
6756
|
-
function
|
|
6757
|
-
return
|
|
7119
|
+
function isNull(value) {
|
|
7120
|
+
return value === null;
|
|
6758
7121
|
}
|
|
6759
|
-
function
|
|
6760
|
-
|
|
7122
|
+
function isPhoneNumber(val) {
|
|
7123
|
+
const svelte = String(val).trim();
|
|
7124
|
+
const chars = svelte.split("");
|
|
7125
|
+
const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
|
|
7126
|
+
const valid2 = ["+", "(", ...NUMERIC_CHAR2];
|
|
7127
|
+
const nothing = stripChars(svelte, ...[
|
|
7128
|
+
...NUMERIC_CHAR2,
|
|
7129
|
+
...WHITESPACE_CHARS2,
|
|
7130
|
+
"(",
|
|
7131
|
+
")",
|
|
7132
|
+
"+",
|
|
7133
|
+
".",
|
|
7134
|
+
"-"
|
|
7135
|
+
]);
|
|
7136
|
+
return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
|
|
6761
7137
|
}
|
|
6762
|
-
function
|
|
6763
|
-
return
|
|
7138
|
+
function isReadonlyArray(value) {
|
|
7139
|
+
return Array.isArray(value) === true;
|
|
6764
7140
|
}
|
|
6765
|
-
function
|
|
7141
|
+
function isRef(value) {
|
|
7142
|
+
return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
|
|
7143
|
+
}
|
|
7144
|
+
function isRegExp(val) {
|
|
7145
|
+
return val instanceof RegExp;
|
|
7146
|
+
}
|
|
7147
|
+
function isLikeRegExp(val) {
|
|
7148
|
+
if (isRegExp(val)) {
|
|
7149
|
+
return true;
|
|
7150
|
+
}
|
|
6766
7151
|
if (isString(val)) {
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
7152
|
+
try {
|
|
7153
|
+
const _re = new RegExp(val);
|
|
7154
|
+
return true;
|
|
7155
|
+
} catch {
|
|
7156
|
+
return false;
|
|
7157
|
+
}
|
|
6772
7158
|
}
|
|
6773
7159
|
return false;
|
|
6774
7160
|
}
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
|
|
7161
|
+
function isSymbol(value) {
|
|
7162
|
+
return typeof value === "symbol";
|
|
6778
7163
|
}
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
|
|
7164
|
+
function isScalar(value) {
|
|
7165
|
+
return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
|
|
6782
7166
|
}
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
|
|
7167
|
+
function isSet(val) {
|
|
7168
|
+
return isObject(val) ? val.kind !== "Unset" : true;
|
|
6786
7169
|
}
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
|
|
7170
|
+
function isSetContainer(val) {
|
|
7171
|
+
return val instanceof Set;
|
|
6790
7172
|
}
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
|
|
7173
|
+
function isStringArray(val) {
|
|
7174
|
+
return Array.isArray(val) && val.every((i) => isString(i));
|
|
6794
7175
|
}
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
|
|
7176
|
+
function isThenable(val) {
|
|
7177
|
+
return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
|
|
6798
7178
|
}
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
|
|
7179
|
+
function isTrimable(val) {
|
|
7180
|
+
return isString(val) && val !== val.trim();
|
|
6802
7181
|
}
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
|
|
7182
|
+
function isTrue(value) {
|
|
7183
|
+
return value === true;
|
|
6806
7184
|
}
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
|
|
7185
|
+
function isTruthy(val) {
|
|
7186
|
+
return !FALSY_VALUES2.includes(val);
|
|
6810
7187
|
}
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
|
|
7188
|
+
function isTypeSubtype(val) {
|
|
7189
|
+
return isString(val) && val.split("/").length === 2;
|
|
6814
7190
|
}
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
|
|
7191
|
+
function isTypeTuple(value) {
|
|
7192
|
+
return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
|
|
6818
7193
|
}
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
|
|
7194
|
+
function isUndefined(value) {
|
|
7195
|
+
return typeof value === "undefined";
|
|
6822
7196
|
}
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
|
|
7197
|
+
function isUnset(val) {
|
|
7198
|
+
return isObject(val) && val.kind === "Unset";
|
|
6826
7199
|
}
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
return isString(val) &&
|
|
7200
|
+
function isUri(val, ...protocols) {
|
|
7201
|
+
const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
|
|
7202
|
+
return isString(val) && p.some((i) => val.startsWith(`${i}://`));
|
|
6830
7203
|
}
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
return isString(val) &&
|
|
7204
|
+
function isUrl(val, ...protocols) {
|
|
7205
|
+
const p = protocols.length === 0 ? ["http", "https"] : protocols;
|
|
7206
|
+
return isString(val) && p.some((i) => val.startsWith(`${i}://`));
|
|
6834
7207
|
}
|
|
6835
|
-
var
|
|
6836
|
-
|
|
6837
|
-
|
|
7208
|
+
var VALID = [
|
|
7209
|
+
...ALPHA_CHARS2,
|
|
7210
|
+
...NUMERIC_CHAR2,
|
|
7211
|
+
"_",
|
|
7212
|
+
"."
|
|
7213
|
+
];
|
|
7214
|
+
var alpha = null;
|
|
7215
|
+
function valid(chars) {
|
|
7216
|
+
return chars.every((i) => VALID.includes(i));
|
|
6838
7217
|
}
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
|
|
7218
|
+
function isVariable(val) {
|
|
7219
|
+
return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
|
|
6842
7220
|
}
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
|
|
7221
|
+
function separate(s) {
|
|
7222
|
+
return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
|
|
6846
7223
|
}
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
|
|
7224
|
+
function isAreaMetric(val) {
|
|
7225
|
+
return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6850
7226
|
}
|
|
6851
|
-
function
|
|
6852
|
-
return
|
|
7227
|
+
function isLuminosityMetric(val) {
|
|
7228
|
+
return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6853
7229
|
}
|
|
6854
|
-
function
|
|
6855
|
-
|
|
6856
|
-
return isString(val) && valid2.some(
|
|
6857
|
-
(i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
|
|
6858
|
-
);
|
|
7230
|
+
function isResistance(val) {
|
|
7231
|
+
return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6859
7232
|
}
|
|
6860
|
-
function
|
|
6861
|
-
|
|
6862
|
-
return isString(val) && valid2.some(
|
|
6863
|
-
(i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
|
|
6864
|
-
);
|
|
7233
|
+
function isCurrentMetric(val) {
|
|
7234
|
+
return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6865
7235
|
}
|
|
6866
|
-
function
|
|
6867
|
-
|
|
6868
|
-
"https://github.com",
|
|
6869
|
-
"https://www.github.com",
|
|
6870
|
-
"https://github.io"
|
|
6871
|
-
];
|
|
6872
|
-
return isString(val) && valid2.some(
|
|
6873
|
-
(i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
|
|
6874
|
-
);
|
|
7236
|
+
function isVoltageMetric(val) {
|
|
7237
|
+
return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6875
7238
|
}
|
|
6876
|
-
function
|
|
6877
|
-
return isString(val) &&
|
|
7239
|
+
function isFrequencyMetric(val) {
|
|
7240
|
+
return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6878
7241
|
}
|
|
6879
|
-
function
|
|
6880
|
-
return
|
|
6881
|
-
stripLeading(s, "https://github.com/"),
|
|
6882
|
-
"/"
|
|
6883
|
-
);
|
|
7242
|
+
function isPowerMetric(val) {
|
|
7243
|
+
return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6884
7244
|
}
|
|
6885
|
-
function
|
|
6886
|
-
return
|
|
7245
|
+
function isTimeMetric(val) {
|
|
7246
|
+
return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6887
7247
|
}
|
|
6888
|
-
function
|
|
6889
|
-
return isString(val) &&
|
|
7248
|
+
function isEnergyMetric(val) {
|
|
7249
|
+
return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6890
7250
|
}
|
|
6891
|
-
function
|
|
6892
|
-
return isString(val) &&
|
|
7251
|
+
function isPressureMetric(val) {
|
|
7252
|
+
return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6893
7253
|
}
|
|
6894
|
-
function
|
|
6895
|
-
return isString(val) &&
|
|
7254
|
+
function isTemperatureMetric(val) {
|
|
7255
|
+
return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6896
7256
|
}
|
|
6897
|
-
function
|
|
6898
|
-
return isString(val) &&
|
|
7257
|
+
function isVolumeMetric(val) {
|
|
7258
|
+
return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6899
7259
|
}
|
|
6900
|
-
function
|
|
6901
|
-
return isString(val) &&
|
|
7260
|
+
function isAccelerationMetric(val) {
|
|
7261
|
+
return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6902
7262
|
}
|
|
6903
|
-
function
|
|
6904
|
-
|
|
7263
|
+
function isSpeedMetric(val) {
|
|
7264
|
+
const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
|
|
7265
|
+
return isString(val) && speed.includes(separate(val));
|
|
6905
7266
|
}
|
|
6906
|
-
function
|
|
6907
|
-
return isString(val) &&
|
|
7267
|
+
function isMassMetric(val) {
|
|
7268
|
+
return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6908
7269
|
}
|
|
6909
|
-
function
|
|
6910
|
-
return isString(val) &&
|
|
7270
|
+
function isDistanceMetric(val) {
|
|
7271
|
+
return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
|
|
6911
7272
|
}
|
|
6912
|
-
function
|
|
6913
|
-
return
|
|
7273
|
+
function isMetric(val) {
|
|
7274
|
+
return isDistanceMetric(val) || isMassMetric(val) || isSpeedMetric(val) || isAccelerationMetric(val) || isVoltageMetric(val) || isTemperatureMetric(val) || isPressureMetric(val) || isEnergyMetric(val) || isTimeMetric(val) || isPowerMetric(val) || isFrequencyMetric(val) || isVoltageMetric(val) || isCurrentMetric(val) || isLuminosityMetric(val) || isAreaMetric(val);
|
|
6914
7275
|
}
|
|
6915
|
-
function
|
|
6916
|
-
return isString(
|
|
7276
|
+
function isAreaUom(val) {
|
|
7277
|
+
return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6917
7278
|
}
|
|
6918
|
-
function
|
|
6919
|
-
return
|
|
7279
|
+
function isLuminosityUom(val) {
|
|
7280
|
+
return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6920
7281
|
}
|
|
6921
|
-
function
|
|
6922
|
-
return isString(val) &&
|
|
7282
|
+
function isResistanceUom(val) {
|
|
7283
|
+
return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6923
7284
|
}
|
|
6924
|
-
function
|
|
6925
|
-
return isString(val) &&
|
|
7285
|
+
function isCurrentUom(val) {
|
|
7286
|
+
return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6926
7287
|
}
|
|
6927
|
-
function
|
|
6928
|
-
return isString(val) &&
|
|
7288
|
+
function isVoltageUom(val) {
|
|
7289
|
+
return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6929
7290
|
}
|
|
6930
|
-
function
|
|
6931
|
-
return isString(val) &&
|
|
7291
|
+
function isFrequencyUom(val) {
|
|
7292
|
+
return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6932
7293
|
}
|
|
6933
|
-
function
|
|
6934
|
-
return isString(val) &&
|
|
7294
|
+
function isPowerUom(val) {
|
|
7295
|
+
return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6935
7296
|
}
|
|
6936
|
-
function
|
|
6937
|
-
return isString(val) &&
|
|
7297
|
+
function isTimeUom(val) {
|
|
7298
|
+
return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6938
7299
|
}
|
|
6939
|
-
function
|
|
6940
|
-
return isString(val) &&
|
|
7300
|
+
function isEnergyUom(val) {
|
|
7301
|
+
return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6941
7302
|
}
|
|
6942
|
-
function
|
|
6943
|
-
return isString(val) &&
|
|
7303
|
+
function isPressureUom(val) {
|
|
7304
|
+
return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6944
7305
|
}
|
|
6945
|
-
function
|
|
6946
|
-
return isString(val) &&
|
|
7306
|
+
function isTemperatureUom(val) {
|
|
7307
|
+
return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6947
7308
|
}
|
|
6948
|
-
function
|
|
6949
|
-
return isString(val) &&
|
|
7309
|
+
function isVolumeUom(val) {
|
|
7310
|
+
return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
7311
|
+
}
|
|
7312
|
+
function isAccelerationUom(val) {
|
|
7313
|
+
return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
7314
|
+
}
|
|
7315
|
+
function isSpeedUom(val) {
|
|
7316
|
+
return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
7317
|
+
}
|
|
7318
|
+
function isMassUom(val) {
|
|
7319
|
+
return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6950
7320
|
}
|
|
6951
|
-
function
|
|
6952
|
-
return isString(val) &&
|
|
7321
|
+
function isDistanceUom(val) {
|
|
7322
|
+
return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
|
|
6953
7323
|
}
|
|
6954
|
-
function
|
|
6955
|
-
return
|
|
7324
|
+
function isUom(val) {
|
|
7325
|
+
return isDistanceUom(val) || isMassUom(val) || isSpeedUom(val) || isAccelerationUom(val) || isVoltageUom(val) || isTemperatureUom(val) || isPressureUom(val) || isEnergyUom(val) || isTimeUom(val) || isPowerUom(val) || isFrequencyUom(val) || isVoltageUom(val) || isCurrentUom(val) || isLuminosityUom(val) || isAreaUom(val);
|
|
6956
7326
|
}
|
|
6957
|
-
function
|
|
6958
|
-
return isString(val) &&
|
|
7327
|
+
function isIp4Address(val) {
|
|
7328
|
+
return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
|
|
6959
7329
|
}
|
|
6960
|
-
function
|
|
6961
|
-
|
|
7330
|
+
function isIp6Address(val) {
|
|
7331
|
+
const expanded = isString(val) ? ip6GroupExpansion(val) : "";
|
|
7332
|
+
return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
|
|
6962
7333
|
}
|
|
6963
|
-
function
|
|
6964
|
-
return
|
|
7334
|
+
function isIpAddress(val) {
|
|
7335
|
+
return isIp4Address(val) || isIp6Address(val);
|
|
6965
7336
|
}
|
|
6966
|
-
function
|
|
6967
|
-
return isString(val) &&
|
|
7337
|
+
function hasUrlPort(val) {
|
|
7338
|
+
return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
|
|
6968
7339
|
}
|
|
6969
|
-
function
|
|
6970
|
-
return isString(val) &&
|
|
7340
|
+
function isUrlPath(val) {
|
|
7341
|
+
return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
|
|
7342
|
+
(c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
|
|
7343
|
+
);
|
|
6971
7344
|
}
|
|
6972
|
-
function
|
|
6973
|
-
return isString(val) &&
|
|
7345
|
+
function isDomainName(val) {
|
|
7346
|
+
return isString(val) && val.split(".").filter((i) => i).length > 1 && isString(val.split(".").filter((i) => i).pop()) && asChars(val.split(".").filter((i) => i).pop()).length > 1 && val.split(".").filter((i) => i).every(
|
|
7347
|
+
(i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
|
|
7348
|
+
);
|
|
6974
7349
|
}
|
|
6975
|
-
function
|
|
6976
|
-
return
|
|
7350
|
+
function isUrlSource(val) {
|
|
7351
|
+
return isDomainName(val) || isIpAddress(val);
|
|
6977
7352
|
}
|
|
6978
|
-
function
|
|
6979
|
-
return isString(val
|
|
7353
|
+
function hasUrlQueryParameter(val, prop) {
|
|
7354
|
+
return isString(getUrlQueryParams(val, prop));
|
|
6980
7355
|
}
|
|
6981
|
-
function
|
|
6982
|
-
return
|
|
7356
|
+
function isNumericArray(val) {
|
|
7357
|
+
return Array.isArray(val) && val.every((i) => isNumber(i));
|
|
6983
7358
|
}
|
|
6984
|
-
function
|
|
6985
|
-
return
|
|
7359
|
+
function hasProtocol(val, ...protocols) {
|
|
7360
|
+
return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
|
|
6986
7361
|
}
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
function isSocialMediaUrl(val) {
|
|
6990
|
-
return isString(val) && URL20.some((i) => val.startsWith(i));
|
|
7362
|
+
function isProtocol(val, ...protocols) {
|
|
7363
|
+
return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
|
|
6991
7364
|
}
|
|
6992
|
-
function
|
|
6993
|
-
return isString(val) &&
|
|
7365
|
+
function hasProtocolPrefix(val, ...protocols) {
|
|
7366
|
+
return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).some((i) => val.startsWith(i)) : protocols.map((i) => `${i}://`).some((i) => val.startsWith(i));
|
|
6994
7367
|
}
|
|
6995
|
-
function
|
|
6996
|
-
return isString(val) && (
|
|
7368
|
+
function isProtocolPrefix(val, ...protocols) {
|
|
7369
|
+
return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
|
|
6997
7370
|
}
|
|
6998
|
-
function
|
|
6999
|
-
|
|
7371
|
+
function isTypeToken(val, kind) {
|
|
7372
|
+
if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
|
|
7373
|
+
const stripped = stripSurround("<<", ">>")(val);
|
|
7374
|
+
if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
|
|
7375
|
+
if (kind) {
|
|
7376
|
+
if (isAtomicKind(kind)) {
|
|
7377
|
+
return val === `<<${kind}>>`;
|
|
7378
|
+
} else if (isSetBasedKind(kind)) {
|
|
7379
|
+
return val.startsWith(`<<${kind}::`);
|
|
7380
|
+
} else {
|
|
7381
|
+
return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
|
|
7382
|
+
}
|
|
7383
|
+
} else {
|
|
7384
|
+
return true;
|
|
7385
|
+
}
|
|
7386
|
+
}
|
|
7387
|
+
return false;
|
|
7388
|
+
}
|
|
7389
|
+
return false;
|
|
7000
7390
|
}
|
|
7001
|
-
function
|
|
7002
|
-
return isString(val) &&
|
|
7391
|
+
function isTypeTokenKind(val) {
|
|
7392
|
+
return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
|
|
7003
7393
|
}
|
|
7004
|
-
function
|
|
7005
|
-
return isString(val) &&
|
|
7394
|
+
function isAtomicToken(val) {
|
|
7395
|
+
return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
|
|
7006
7396
|
}
|
|
7007
|
-
function
|
|
7008
|
-
return
|
|
7397
|
+
function isAtomicKind(val) {
|
|
7398
|
+
return isString(val) && TT_ATOMICS2.includes(val);
|
|
7009
7399
|
}
|
|
7010
|
-
function
|
|
7011
|
-
return
|
|
7400
|
+
function isObjectToken(val) {
|
|
7401
|
+
return isTypeToken(val, "obj");
|
|
7012
7402
|
}
|
|
7013
|
-
function
|
|
7014
|
-
return
|
|
7403
|
+
function isRecordToken(val) {
|
|
7404
|
+
return isTypeToken(val, "rec");
|
|
7015
7405
|
}
|
|
7016
|
-
function
|
|
7017
|
-
return
|
|
7406
|
+
function isTupleToken(val) {
|
|
7407
|
+
return isTypeToken(val, "tuple");
|
|
7018
7408
|
}
|
|
7019
|
-
function
|
|
7020
|
-
return
|
|
7409
|
+
function isArrayToken(val) {
|
|
7410
|
+
return isTypeToken(val, "arr");
|
|
7021
7411
|
}
|
|
7022
|
-
function
|
|
7023
|
-
return
|
|
7412
|
+
function isMapToken(val) {
|
|
7413
|
+
return isTypeToken(val, "map");
|
|
7024
7414
|
}
|
|
7025
|
-
function
|
|
7026
|
-
return
|
|
7415
|
+
function isSetToken(val) {
|
|
7416
|
+
return isTypeToken(val, "set");
|
|
7027
7417
|
}
|
|
7028
|
-
function
|
|
7029
|
-
return
|
|
7418
|
+
function isContainerToken(val) {
|
|
7419
|
+
return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
|
|
7030
7420
|
}
|
|
7031
|
-
function
|
|
7032
|
-
|
|
7033
|
-
const [t, st] = str.split("/");
|
|
7034
|
-
return [t, st];
|
|
7035
|
-
} else {
|
|
7036
|
-
const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
|
|
7037
|
-
err.name = "InvalidTypeSubtype";
|
|
7038
|
-
throw err;
|
|
7039
|
-
}
|
|
7421
|
+
function isShapeCallback(val) {
|
|
7422
|
+
return isFunction(val) && val.kind === "shape";
|
|
7040
7423
|
}
|
|
7041
|
-
|
|
7042
|
-
|
|
7424
|
+
var token_types = [
|
|
7425
|
+
...TT_ATOMICS2,
|
|
7426
|
+
...TT_CONTAINERS2,
|
|
7427
|
+
...TT_FUNCTIONS2,
|
|
7428
|
+
...TT_SETS2,
|
|
7429
|
+
...TT_SINGLETONS2
|
|
7430
|
+
];
|
|
7431
|
+
function isShapeToken(val) {
|
|
7432
|
+
return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
|
|
7043
7433
|
}
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7434
|
+
var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
|
|
7435
|
+
var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
|
|
7436
|
+
function isSimpleToken(val) {
|
|
7437
|
+
return isString(val) && split_tokens.some(
|
|
7438
|
+
(i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
|
|
7439
|
+
);
|
|
7049
7440
|
}
|
|
7050
|
-
function
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
|
|
7441
|
+
function isSimpleScalarToken(val) {
|
|
7442
|
+
return isString(val) && scalar_split_tokens.some(
|
|
7443
|
+
(i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
|
|
7444
|
+
);
|
|
7055
7445
|
}
|
|
7056
|
-
function
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
const segments = [];
|
|
7061
|
-
while (match = pattern.exec(template)) {
|
|
7062
|
-
const [fullMatch, varName, asType2] = match;
|
|
7063
|
-
const staticPart = template.slice(lastIndex, match.index);
|
|
7064
|
-
if (staticPart) {
|
|
7065
|
-
segments.push({ dynamic: false, text: staticPart });
|
|
7066
|
-
}
|
|
7067
|
-
segments.push({
|
|
7068
|
-
dynamic: true,
|
|
7069
|
-
varName,
|
|
7070
|
-
type: asType2 ? asType2 : "string"
|
|
7071
|
-
});
|
|
7072
|
-
lastIndex = match.index + fullMatch.length;
|
|
7073
|
-
}
|
|
7074
|
-
const remainder = template.slice(lastIndex);
|
|
7075
|
-
if (remainder) {
|
|
7076
|
-
segments.push({ dynamic: false, text: remainder });
|
|
7077
|
-
}
|
|
7078
|
-
return segments;
|
|
7446
|
+
function isSimpleContainerToken(val) {
|
|
7447
|
+
return isString(val) && scalar_split_tokens.some(
|
|
7448
|
+
(i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
|
|
7449
|
+
);
|
|
7079
7450
|
}
|
|
7080
|
-
function
|
|
7081
|
-
return
|
|
7451
|
+
function isSimpleTokenTuple(val) {
|
|
7452
|
+
return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
|
|
7082
7453
|
}
|
|
7083
|
-
function
|
|
7084
|
-
|
|
7085
|
-
for (const seg of segments) {
|
|
7086
|
-
if (!seg.dynamic) {
|
|
7087
|
-
regexStr += escapeRegex(seg.text);
|
|
7088
|
-
} else {
|
|
7089
|
-
switch (seg.type) {
|
|
7090
|
-
case "string":
|
|
7091
|
-
regexStr += "(.*?)";
|
|
7092
|
-
break;
|
|
7093
|
-
case "number":
|
|
7094
|
-
regexStr += "(\\d+)";
|
|
7095
|
-
break;
|
|
7096
|
-
case "boolean":
|
|
7097
|
-
regexStr += "(true|false)";
|
|
7098
|
-
break;
|
|
7099
|
-
}
|
|
7100
|
-
}
|
|
7101
|
-
}
|
|
7102
|
-
regexStr += "$";
|
|
7103
|
-
return new RegExp(regexStr);
|
|
7454
|
+
function isSimpleScalarTokenTuple(val) {
|
|
7455
|
+
return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
|
|
7104
7456
|
}
|
|
7105
|
-
function
|
|
7106
|
-
|
|
7107
|
-
case "string":
|
|
7108
|
-
return value;
|
|
7109
|
-
case "number":
|
|
7110
|
-
return Number(value);
|
|
7111
|
-
case "boolean":
|
|
7112
|
-
return value === "true";
|
|
7113
|
-
}
|
|
7457
|
+
function isSimpleContainerTokenTuple(val) {
|
|
7458
|
+
return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
|
|
7114
7459
|
}
|
|
7115
|
-
function
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
if (seg.dynamic) {
|
|
7125
|
-
const rawVal = match[captureIndex++];
|
|
7126
|
-
if (rawVal === void 0)
|
|
7127
|
-
return false;
|
|
7128
|
-
result2[seg.varName] = convertValue(seg.type, rawVal);
|
|
7129
|
-
}
|
|
7460
|
+
function isDefineObject(val) {
|
|
7461
|
+
return isObject(val) && Object.keys(val).some(
|
|
7462
|
+
(key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
|
|
7463
|
+
);
|
|
7464
|
+
}
|
|
7465
|
+
function isFnBasedToken(val) {
|
|
7466
|
+
if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
|
|
7467
|
+
const stripped = stripSurround(TT_START2, TT_STOP2)(val);
|
|
7468
|
+
return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
|
|
7130
7469
|
}
|
|
7131
|
-
return result2;
|
|
7132
7470
|
}
|
|
7133
|
-
function
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7471
|
+
function isFnBasedKind(val) {
|
|
7472
|
+
if (isString(val) && isTypeTokenKind(val)) {
|
|
7473
|
+
const stripped = stripSurround(TT_START2, TT_STOP2)(val);
|
|
7474
|
+
return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
|
|
7475
|
+
}
|
|
7476
|
+
return false;
|
|
7137
7477
|
}
|
|
7138
|
-
function
|
|
7139
|
-
|
|
7478
|
+
function isSetBasedToken(val) {
|
|
7479
|
+
if (isTypeToken(val)) {
|
|
7480
|
+
const kind = getTokenKind(val);
|
|
7481
|
+
return kind.endsWith(`-set`);
|
|
7482
|
+
}
|
|
7483
|
+
return false;
|
|
7140
7484
|
}
|
|
7141
|
-
function
|
|
7142
|
-
return
|
|
7485
|
+
function isSetBasedKind(val) {
|
|
7486
|
+
return isString(val) && val.endsWith(`-set`);
|
|
7143
7487
|
}
|
|
7144
|
-
function
|
|
7145
|
-
return
|
|
7488
|
+
function isSingletonKind(val) {
|
|
7489
|
+
return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
|
|
7146
7490
|
}
|
|
7147
|
-
function
|
|
7148
|
-
return
|
|
7491
|
+
function isSingletonToken(val) {
|
|
7492
|
+
return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
|
|
7149
7493
|
}
|
|
7150
|
-
function
|
|
7151
|
-
return
|
|
7494
|
+
function isTailwindColorName(val) {
|
|
7495
|
+
return isString(val) && Object.keys(TW_HUE2).includes(val);
|
|
7152
7496
|
}
|
|
7153
|
-
function
|
|
7154
|
-
return
|
|
7497
|
+
function isTailwindColorWithLuminosity(val) {
|
|
7498
|
+
return isString(val) && isTailwindColorName(val.split("-")[0]) && (!["white", "black"].includes(val.split("-")[0]) || val.split("-").length === 1) && (!val.includes("-") || Object.keys(TW_LUMINOSITY2).includes(retainAfter(val, "-")));
|
|
7155
7499
|
}
|
|
7156
|
-
function
|
|
7157
|
-
return
|
|
7500
|
+
function isTailwindColorWithLuminosityAndOpacity(val) {
|
|
7501
|
+
return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
|
|
7158
7502
|
}
|
|
7159
|
-
function
|
|
7160
|
-
|
|
7161
|
-
const original_path = segments.join("/");
|
|
7162
|
-
const pre = original_path.startsWith("/") ? "/" : "";
|
|
7163
|
-
const post = original_path.endsWith("/") ? "/" : "";
|
|
7164
|
-
return `${pre}${clean_path}${post}`;
|
|
7503
|
+
function isTailwindColor(val) {
|
|
7504
|
+
return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
|
|
7165
7505
|
}
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
|
|
7169
|
-
stripLeading(stripLeading(phone.trim(), "+"), "00"),
|
|
7170
|
-
...NUMERIC_CHAR2
|
|
7171
|
-
) : "";
|
|
7506
|
+
function isTailwindModifier(val) {
|
|
7507
|
+
return isString(val) && TW_MODIFIERS2.includes(val);
|
|
7172
7508
|
}
|
|
7173
|
-
function
|
|
7174
|
-
|
|
7175
|
-
return countryCode !== "" ? stripLeading(stripLeading(
|
|
7176
|
-
phone.trim(),
|
|
7177
|
-
"+",
|
|
7178
|
-
"00"
|
|
7179
|
-
), countryCode).trim() : phone.trim();
|
|
7509
|
+
function isTailwindColorTarget(val) {
|
|
7510
|
+
return isString(val) && TW_COLOR_TARGETS2.includes(val);
|
|
7180
7511
|
}
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
case "f":
|
|
7189
|
-
return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
|
|
7190
|
-
case "y":
|
|
7191
|
-
return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
|
|
7192
|
-
default:
|
|
7193
|
-
throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
|
|
7512
|
+
function isTailwindColorClass(val, ...allowedModifiers) {
|
|
7513
|
+
if (isString(val)) {
|
|
7514
|
+
const mods = getTailwindModifiers(val);
|
|
7515
|
+
const targetted = removeTailwindModifiers(val);
|
|
7516
|
+
const target = targetted.split("-")[0];
|
|
7517
|
+
const color = targetted.split("-").slice(1).join("-");
|
|
7518
|
+
return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
|
|
7194
7519
|
}
|
|
7520
|
+
return false;
|
|
7195
7521
|
}
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
|
|
7200
|
-
return `${result2}${right}`;
|
|
7522
|
+
var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7523
|
+
function isAustralianNewsUrl(val) {
|
|
7524
|
+
return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
|
|
7201
7525
|
}
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
);
|
|
7206
|
-
const min = Math.min(...find2.map((i) => i.length));
|
|
7207
|
-
let len = Math.max(...find2.map((i) => i.length));
|
|
7208
|
-
if (min !== len) {
|
|
7209
|
-
if (!find2.includes(content.slice(idx, len))) {
|
|
7210
|
-
len = min;
|
|
7211
|
-
}
|
|
7212
|
-
}
|
|
7213
|
-
return idx && idx > 0 ? content.slice(idx + len) : "";
|
|
7526
|
+
var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
|
|
7527
|
+
function isBelgiumNewsUrl(val) {
|
|
7528
|
+
return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
|
|
7214
7529
|
}
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
);
|
|
7219
|
-
return minFound > 0 ? content.slice(minFound) : "";
|
|
7530
|
+
var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7531
|
+
function isCanadianNewsUrl(val) {
|
|
7532
|
+
return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
|
|
7220
7533
|
}
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
return
|
|
7534
|
+
var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
|
|
7535
|
+
function isDanishNewsUrl(val) {
|
|
7536
|
+
return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
|
|
7224
7537
|
}
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
while (!find2.includes(chars[idx]) && idx <= chars.length) {
|
|
7229
|
-
idx = idx + 1;
|
|
7230
|
-
}
|
|
7231
|
-
return idx === 0 ? "" : content.slice(0, idx);
|
|
7538
|
+
var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
|
|
7539
|
+
function isDutchNewsUrl(val) {
|
|
7540
|
+
return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
|
|
7232
7541
|
}
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
while (!find2.includes(chars[idx]) && idx <= chars.length) {
|
|
7237
|
-
idx = idx + 1;
|
|
7238
|
-
}
|
|
7239
|
-
return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
|
|
7542
|
+
var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
|
|
7543
|
+
function isFrenchNewsUrl(val) {
|
|
7544
|
+
return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
|
|
7240
7545
|
}
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
return
|
|
7546
|
+
var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7547
|
+
function isGermanNewsUrl(val) {
|
|
7548
|
+
return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
|
|
7244
7549
|
}
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
return
|
|
7248
|
-
trimmed,
|
|
7249
|
-
...WHITESPACE_CHARS2
|
|
7250
|
-
);
|
|
7550
|
+
var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7551
|
+
function isIndianNewsUrl(val) {
|
|
7552
|
+
return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
|
|
7251
7553
|
}
|
|
7252
|
-
|
|
7253
|
-
|
|
7554
|
+
var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7555
|
+
function isItalianNewsUrl(val) {
|
|
7556
|
+
return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
|
|
7254
7557
|
}
|
|
7255
|
-
|
|
7256
|
-
|
|
7558
|
+
var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
|
|
7559
|
+
function isJapaneseNewsUrl(val) {
|
|
7560
|
+
return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
|
|
7257
7561
|
}
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
return
|
|
7562
|
+
var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7563
|
+
function isMexicanNewsUrl(val) {
|
|
7564
|
+
return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
|
|
7261
7565
|
}
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
if (output.startsWith(String(s))) {
|
|
7266
|
-
output = output.slice(String(s).length);
|
|
7267
|
-
}
|
|
7268
|
-
}
|
|
7269
|
-
return isNumber(content) ? Number(output) : output;
|
|
7566
|
+
var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7567
|
+
function isNorwegianNewsUrl(val) {
|
|
7568
|
+
return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
|
|
7270
7569
|
}
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
for (const s of chars) {
|
|
7275
|
-
if (output.startsWith(String(s))) {
|
|
7276
|
-
output = output.slice(String(s).length);
|
|
7277
|
-
}
|
|
7278
|
-
if (output.endsWith(String(s))) {
|
|
7279
|
-
output = output.slice(0, -1 * String(s).length);
|
|
7280
|
-
}
|
|
7281
|
-
}
|
|
7282
|
-
return isNumber(input) ? Number(output) : output;
|
|
7283
|
-
};
|
|
7570
|
+
var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
|
|
7571
|
+
function isSouthKoreanNewsUrl(val) {
|
|
7572
|
+
return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
|
|
7284
7573
|
}
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
return
|
|
7574
|
+
var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
|
|
7575
|
+
function isSpanishNewsUrl(val) {
|
|
7576
|
+
return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
|
|
7288
7577
|
}
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
return
|
|
7578
|
+
var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
|
|
7579
|
+
function isSwissNewsUrl(val) {
|
|
7580
|
+
return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
|
|
7292
7581
|
}
|
|
7293
|
-
|
|
7294
|
-
|
|
7582
|
+
var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
|
|
7583
|
+
function isTurkishNewsUrl(val) {
|
|
7584
|
+
return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
|
|
7295
7585
|
}
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
return
|
|
7586
|
+
var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
|
|
7587
|
+
function isUkNewsUrl(val) {
|
|
7588
|
+
return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
|
|
7299
7589
|
}
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
pascal
|
|
7304
|
-
);
|
|
7305
|
-
const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
|
|
7306
|
-
return camel;
|
|
7590
|
+
var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
|
|
7591
|
+
function isUsNewsUrl(val) {
|
|
7592
|
+
return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
|
|
7307
7593
|
}
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
|
|
7312
|
-
const replaceLeadingDash = (i) => i.replace(/^-/, "");
|
|
7313
|
-
const replaceTrailingDash = (i) => i.replace(/-$/, "");
|
|
7314
|
-
const replaceUnderscore = (i) => i.replace(/_/g, "-");
|
|
7315
|
-
const removeDupDashes = (i) => i.replace(/-+/g, "-");
|
|
7316
|
-
return removeDupDashes(`${preWhite}${replaceUnderscore(
|
|
7317
|
-
replaceTrailingDash(
|
|
7318
|
-
replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
|
|
7319
|
-
)
|
|
7320
|
-
)}${postWhite}`);
|
|
7594
|
+
var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
|
|
7595
|
+
function isChineseNewsUrl(val) {
|
|
7596
|
+
return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
|
|
7321
7597
|
}
|
|
7322
|
-
function
|
|
7323
|
-
return
|
|
7598
|
+
function isNewsUrl(val) {
|
|
7599
|
+
return isAustralianNewsUrl(val) || isBelgiumNewsUrl(val) || isCanadianNewsUrl(val) || isDanishNewsUrl(val) || isDutchNewsUrl(val) || isFrenchNewsUrl(val) || isGermanNewsUrl(val) || isIndianNewsUrl(val) || isItalianNewsUrl(val) || isJapaneseNewsUrl(val) || isMexicanNewsUrl(val) || isNorwegianNewsUrl(val) || isSouthKoreanNewsUrl(val) || isSpanishNewsUrl(val) || isSwissNewsUrl(val) || isTurkishNewsUrl(val) || isUkNewsUrl(val) || isUsNewsUrl(val);
|
|
7324
7600
|
}
|
|
7325
|
-
function
|
|
7326
|
-
const
|
|
7327
|
-
|
|
7601
|
+
function isBitbucketUrl(val) {
|
|
7602
|
+
const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
|
|
7603
|
+
return isString(val) && valid2.some(
|
|
7604
|
+
(i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
|
|
7328
7605
|
);
|
|
7329
|
-
const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
|
|
7330
|
-
const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
|
|
7331
|
-
const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
|
|
7332
|
-
const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
|
|
7333
|
-
const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
|
|
7334
|
-
replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
|
|
7335
|
-
)}${preserveWhitespace ? postWhite : ""}`;
|
|
7336
|
-
return pascal;
|
|
7337
7606
|
}
|
|
7338
|
-
function
|
|
7339
|
-
const
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
|
|
7344
|
-
return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
|
|
7345
|
-
injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
|
|
7346
|
-
).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
|
|
7607
|
+
function isCodeCommitUrl(val) {
|
|
7608
|
+
const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
|
|
7609
|
+
return isString(val) && valid2.some(
|
|
7610
|
+
(i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
|
|
7611
|
+
);
|
|
7347
7612
|
}
|
|
7348
|
-
function
|
|
7349
|
-
|
|
7613
|
+
function isGithubUrl(val) {
|
|
7614
|
+
const valid2 = [
|
|
7615
|
+
"https://github.com",
|
|
7616
|
+
"https://www.github.com",
|
|
7617
|
+
"https://github.io"
|
|
7618
|
+
];
|
|
7619
|
+
return isString(val) && valid2.some(
|
|
7620
|
+
(i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
|
|
7621
|
+
);
|
|
7350
7622
|
}
|
|
7351
|
-
function
|
|
7352
|
-
return
|
|
7623
|
+
function isGithubOrgUrl(val) {
|
|
7624
|
+
return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
|
|
7353
7625
|
}
|
|
7354
|
-
function
|
|
7355
|
-
return
|
|
7626
|
+
function stripper(s) {
|
|
7627
|
+
return stripTrailing(
|
|
7628
|
+
stripLeading(s, "https://github.com/"),
|
|
7629
|
+
"/"
|
|
7630
|
+
);
|
|
7356
7631
|
}
|
|
7357
|
-
function
|
|
7358
|
-
return
|
|
7632
|
+
function isGithubRepoUrl(val) {
|
|
7633
|
+
return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
|
|
7359
7634
|
}
|
|
7360
|
-
function
|
|
7361
|
-
return
|
|
7635
|
+
function isGithubRepoReleasesUrl(val) {
|
|
7636
|
+
return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
|
|
7362
7637
|
}
|
|
7363
|
-
function
|
|
7364
|
-
return
|
|
7638
|
+
function isGithubRepoReleaseTagUrl(val) {
|
|
7639
|
+
return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
|
|
7365
7640
|
}
|
|
7366
|
-
function
|
|
7367
|
-
return
|
|
7641
|
+
function isGithubIssuesListUrl(val) {
|
|
7642
|
+
return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
|
|
7368
7643
|
}
|
|
7369
|
-
function
|
|
7370
|
-
|
|
7371
|
-
return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
|
|
7644
|
+
function isGithubIssueUrl(val) {
|
|
7645
|
+
return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
|
|
7372
7646
|
}
|
|
7373
|
-
function
|
|
7374
|
-
|
|
7375
|
-
return asArray(arr);
|
|
7647
|
+
function isGithubProjectsListUrl(val) {
|
|
7648
|
+
return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
|
|
7376
7649
|
}
|
|
7377
|
-
function
|
|
7378
|
-
return
|
|
7650
|
+
function isGithubProjectUrl(val) {
|
|
7651
|
+
return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
|
|
7379
7652
|
}
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
return str.toUpperCase();
|
|
7653
|
+
function isGithubReleasesListUrl(val) {
|
|
7654
|
+
return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
|
|
7383
7655
|
}
|
|
7384
|
-
function
|
|
7385
|
-
return
|
|
7656
|
+
function isGithubReleaseTagUrl(val) {
|
|
7657
|
+
return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
|
|
7386
7658
|
}
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
|
|
7390
|
-
return proto;
|
|
7659
|
+
function isRepoSource(v) {
|
|
7660
|
+
return isString(v) && REPO_SOURCES2.includes(v);
|
|
7391
7661
|
}
|
|
7392
|
-
function
|
|
7393
|
-
return
|
|
7662
|
+
function isSemanticVersion(v, allowPrefix = false) {
|
|
7663
|
+
return isString(v) && v.split(".").length === 3 && !Number.isNaN(Number(v.split(".")[1])) && !Number.isNaN(Number(v.split(".")[2])) && (!Number.isNaN(Number(v.split(".")[0])) || allowPrefix && !Number.isNaN(Number(stripLeading(v.split(".")[0], "v").trim())));
|
|
7394
7664
|
}
|
|
7395
|
-
function
|
|
7396
|
-
|
|
7397
|
-
return val === "" ? "" : stripTrailing(val2, "/");
|
|
7665
|
+
function isRepoUrl(val) {
|
|
7666
|
+
return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
|
|
7398
7667
|
}
|
|
7399
|
-
function
|
|
7400
|
-
return
|
|
7401
|
-
stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
|
|
7402
|
-
) : Never2;
|
|
7668
|
+
function isWholeFoodsUrl(val) {
|
|
7669
|
+
return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7403
7670
|
}
|
|
7404
|
-
function
|
|
7405
|
-
|
|
7406
|
-
if (specific) {
|
|
7407
|
-
return qp.includes(`${specific}=`) ? decodeURIComponent(
|
|
7408
|
-
stripAfter(
|
|
7409
|
-
stripBefore(qp, `${specific}=`),
|
|
7410
|
-
"&"
|
|
7411
|
-
).replace(/\+/g, "%20")
|
|
7412
|
-
) : void 0;
|
|
7413
|
-
}
|
|
7414
|
-
return qp === "" ? qp : `?${qp}`;
|
|
7671
|
+
function isCvsUrl(val) {
|
|
7672
|
+
return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7415
7673
|
}
|
|
7416
|
-
function
|
|
7417
|
-
|
|
7418
|
-
return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
|
|
7674
|
+
function isWalgreensUrl(val) {
|
|
7675
|
+
return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7419
7676
|
}
|
|
7420
|
-
function
|
|
7421
|
-
|
|
7422
|
-
const match = url.match(re);
|
|
7423
|
-
return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
|
|
7677
|
+
function isKrogersUrl(val) {
|
|
7678
|
+
return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7424
7679
|
}
|
|
7425
|
-
function
|
|
7426
|
-
|
|
7427
|
-
return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
|
|
7680
|
+
function isZaraUrl(val) {
|
|
7681
|
+
return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7428
7682
|
}
|
|
7429
|
-
function
|
|
7430
|
-
|
|
7431
|
-
const remaining = stripAfter(url, path);
|
|
7432
|
-
return remaining;
|
|
7683
|
+
function isHmUrl(val) {
|
|
7684
|
+
return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7433
7685
|
}
|
|
7434
|
-
function
|
|
7435
|
-
|
|
7436
|
-
const qp = getUrlQueryParams(url);
|
|
7437
|
-
const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
|
|
7438
|
-
const segmentTypes = [
|
|
7439
|
-
"string",
|
|
7440
|
-
"number",
|
|
7441
|
-
"boolean",
|
|
7442
|
-
"Opt<string>",
|
|
7443
|
-
"Opt<number>",
|
|
7444
|
-
"Opt<boolean>"
|
|
7445
|
-
];
|
|
7446
|
-
const pathVars = {};
|
|
7447
|
-
const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
|
|
7448
|
-
const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
|
|
7449
|
-
const findPathNamed = infer(`<{{infer name}}>`);
|
|
7450
|
-
for (const part of pathParts) {
|
|
7451
|
-
const union4 = findPathUnion(part);
|
|
7452
|
-
const typed = findPathTyped(part);
|
|
7453
|
-
const named = findPathNamed(part);
|
|
7454
|
-
if (union4) {
|
|
7455
|
-
if (isVariable(union4.name) && isCsv(union4.union)) {
|
|
7456
|
-
pathVars[union4.name] = `string(${union4.union})`;
|
|
7457
|
-
}
|
|
7458
|
-
} else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
|
|
7459
|
-
pathVars[typed.name] = typed.type;
|
|
7460
|
-
} else if (named && isVariable(named.name)) {
|
|
7461
|
-
pathVars[named.name] = "string";
|
|
7462
|
-
}
|
|
7463
|
-
}
|
|
7464
|
-
const qpVars = {};
|
|
7465
|
-
const qpParts = stripLeading(qp, "?").split("&");
|
|
7466
|
-
for (const p of qpParts) {
|
|
7467
|
-
const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
|
|
7468
|
-
const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
|
|
7469
|
-
const fixed = infer(`{{infer var}}={{infer val}}`)(p);
|
|
7470
|
-
if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
|
|
7471
|
-
qpVars[union4.var] = `string(${union4.params})`;
|
|
7472
|
-
} else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
|
|
7473
|
-
qpVars[dynamic.var] = dynamic.val;
|
|
7474
|
-
} else if (fixed && isVariable(fixed.var)) {
|
|
7475
|
-
qpVars[fixed.var] = fixed.val;
|
|
7476
|
-
}
|
|
7477
|
-
}
|
|
7478
|
-
return {
|
|
7479
|
-
pathVars,
|
|
7480
|
-
qpVars,
|
|
7481
|
-
allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
|
|
7482
|
-
...pathVars,
|
|
7483
|
-
...qpVars
|
|
7484
|
-
}
|
|
7485
|
-
};
|
|
7686
|
+
function isDellUrl(val) {
|
|
7687
|
+
return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7486
7688
|
}
|
|
7487
|
-
function
|
|
7488
|
-
return {
|
|
7489
|
-
url,
|
|
7490
|
-
isUrl: isUrl(url),
|
|
7491
|
-
protocol: getUrlProtocol(url),
|
|
7492
|
-
path: getUrlPath(url),
|
|
7493
|
-
queryParameters: getUrlQueryParams(url),
|
|
7494
|
-
params: getUrlDynamics,
|
|
7495
|
-
port: getUrlPort(url),
|
|
7496
|
-
source: getUrlSource(url),
|
|
7497
|
-
isIpAddress: isIpAddress(getUrlSource(url)),
|
|
7498
|
-
isIp4Address: isIp4Address(getUrlSource(url)),
|
|
7499
|
-
isIp6Address: isIp6Address(getUrlSource(url))
|
|
7500
|
-
};
|
|
7689
|
+
function isIkeaUrl(val) {
|
|
7690
|
+
return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7501
7691
|
}
|
|
7502
|
-
function
|
|
7503
|
-
return
|
|
7692
|
+
function isLowesUrl(val) {
|
|
7693
|
+
return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7504
7694
|
}
|
|
7505
|
-
function
|
|
7506
|
-
|
|
7507
|
-
const id = getUrlQueryParams(url, "v");
|
|
7508
|
-
return `https://www.youtube.com/embed/${id}`;
|
|
7509
|
-
} else if (isYouTubeShareUrl(url)) {
|
|
7510
|
-
const id = url.split("/").pop();
|
|
7511
|
-
if (id) {
|
|
7512
|
-
return `https://www.youtube.com/embed/${id}`;
|
|
7513
|
-
} else {
|
|
7514
|
-
throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
|
|
7515
|
-
}
|
|
7516
|
-
} else {
|
|
7517
|
-
throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
|
|
7518
|
-
}
|
|
7695
|
+
function isNikeUrl(val) {
|
|
7696
|
+
return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7519
7697
|
}
|
|
7520
|
-
function
|
|
7521
|
-
return
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
isYouTubeUrl: false
|
|
7529
|
-
};
|
|
7698
|
+
function isWayfairUrl(val) {
|
|
7699
|
+
return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7700
|
+
}
|
|
7701
|
+
function isBestBuyUrl(val) {
|
|
7702
|
+
return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7703
|
+
}
|
|
7704
|
+
function isCostCoUrl(val) {
|
|
7705
|
+
return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7530
7706
|
}
|
|
7531
|
-
function
|
|
7532
|
-
return {
|
|
7533
|
-
queue: state,
|
|
7534
|
-
size: state.length,
|
|
7535
|
-
isEmpty() {
|
|
7536
|
-
return state.length === 0;
|
|
7537
|
-
},
|
|
7538
|
-
clear() {
|
|
7539
|
-
state.slice(0, 0);
|
|
7540
|
-
},
|
|
7541
|
-
drain() {
|
|
7542
|
-
const old_state = [...state];
|
|
7543
|
-
state.slice(0, 0);
|
|
7544
|
-
return old_state;
|
|
7545
|
-
},
|
|
7546
|
-
push(...add) {
|
|
7547
|
-
state.push(...add);
|
|
7548
|
-
},
|
|
7549
|
-
drop(quantity) {
|
|
7550
|
-
if (quantity && quantity > state.length) {
|
|
7551
|
-
throw new Error("Cannot drop more elements than present in the queue");
|
|
7552
|
-
}
|
|
7553
|
-
state.splice(0, quantity || 1);
|
|
7554
|
-
},
|
|
7555
|
-
take(quantity) {
|
|
7556
|
-
if (quantity && quantity > state.length) {
|
|
7557
|
-
throw new Error("Cannot take more elements than present in the queue");
|
|
7558
|
-
}
|
|
7559
|
-
const result2 = state.slice(0, quantity || 1);
|
|
7560
|
-
state.splice(0, quantity || 1);
|
|
7561
|
-
return result2;
|
|
7562
|
-
},
|
|
7563
|
-
*[Symbol.iterator]() {
|
|
7564
|
-
for (let i = 0; i < state.length; i++) {
|
|
7565
|
-
yield state[i];
|
|
7566
|
-
}
|
|
7567
|
-
}
|
|
7568
|
-
};
|
|
7707
|
+
function isEtsyUrl(val) {
|
|
7708
|
+
return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7569
7709
|
}
|
|
7570
|
-
function
|
|
7571
|
-
return
|
|
7710
|
+
function isTargetUrl(val) {
|
|
7711
|
+
return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7572
7712
|
}
|
|
7573
|
-
function
|
|
7574
|
-
return {
|
|
7575
|
-
queue: state,
|
|
7576
|
-
size: state.length,
|
|
7577
|
-
isEmpty() {
|
|
7578
|
-
return state.length === 0;
|
|
7579
|
-
},
|
|
7580
|
-
push(...add) {
|
|
7581
|
-
state.push(...add);
|
|
7582
|
-
},
|
|
7583
|
-
drop(quantity) {
|
|
7584
|
-
state.splice(-quantity);
|
|
7585
|
-
},
|
|
7586
|
-
clear() {
|
|
7587
|
-
state.slice(0, 0);
|
|
7588
|
-
},
|
|
7589
|
-
drain() {
|
|
7590
|
-
const old_state = [...state];
|
|
7591
|
-
state.slice(0, 0);
|
|
7592
|
-
return old_state;
|
|
7593
|
-
},
|
|
7594
|
-
take(quantity) {
|
|
7595
|
-
const result2 = state.slice(-quantity);
|
|
7596
|
-
state.splice(-quantity);
|
|
7597
|
-
return result2;
|
|
7598
|
-
},
|
|
7599
|
-
*[Symbol.iterator]() {
|
|
7600
|
-
for (let i = state.length - 1; i >= 0; i--) {
|
|
7601
|
-
yield state[i];
|
|
7602
|
-
}
|
|
7603
|
-
}
|
|
7604
|
-
};
|
|
7713
|
+
function isEbayUrl(val) {
|
|
7714
|
+
return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7605
7715
|
}
|
|
7606
|
-
function
|
|
7607
|
-
return
|
|
7716
|
+
function isHomeDepotUrl(val) {
|
|
7717
|
+
return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7608
7718
|
}
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
number: "<<number>>",
|
|
7612
|
-
boolean: "<<boolean>>",
|
|
7613
|
-
true: "<<true>>",
|
|
7614
|
-
false: "<<false>>",
|
|
7615
|
-
null: "<<null>>",
|
|
7616
|
-
undefined: "<<undefined>>",
|
|
7617
|
-
unknown: "<<unknown>>",
|
|
7618
|
-
any: "<<any>>",
|
|
7619
|
-
never: "<<never>>"
|
|
7620
|
-
});
|
|
7621
|
-
function stringLiteral(str) {
|
|
7622
|
-
return stripAfter(stripBefore(str, "string("), ")");
|
|
7719
|
+
function isMacysUrl(val) {
|
|
7720
|
+
return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7623
7721
|
}
|
|
7624
|
-
function
|
|
7625
|
-
return
|
|
7722
|
+
function isAppleUrl(val) {
|
|
7723
|
+
return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7626
7724
|
}
|
|
7627
|
-
function
|
|
7628
|
-
|
|
7629
|
-
return bare.startsWith("string") ? `<<union::[ <<string>>, <<undefined>> ]>>` : bare.startsWith("number") ? `<<union::[ <<number>>, <<undefined>> ]>>` : bare.startsWith("boolean") ? `<<union::[ <<boolean>>, <<undefined>> ]>>` : bare.startsWith("unknown") ? `<<union::[ <<unknown>>, <<undefined>> ]>>` : `<<never>>`;
|
|
7725
|
+
function isWalmartUrl(val) {
|
|
7726
|
+
return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7630
7727
|
}
|
|
7631
|
-
function
|
|
7632
|
-
return
|
|
7728
|
+
function isAmazonUrl(val) {
|
|
7729
|
+
return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
|
|
7633
7730
|
}
|
|
7634
|
-
function
|
|
7635
|
-
return
|
|
7731
|
+
function isRetailUrl(val) {
|
|
7732
|
+
return isAmazonUrl(val) || isWalgreensUrl(val) || isAppleUrl(val) || isMacysUrl(val) || isEbayUrl(val) || isHomeDepotUrl(val) || isTargetUrl(val) || isEtsyUrl(val) || isCostCoUrl(val) || isBestBuyUrl(val) || isWayfairUrl(val) || isNikeUrl(val) || isLowesUrl(val) || isIkeaUrl(val) || isDellUrl(val) || isHmUrl(val) || isZaraUrl(val) || isKrogersUrl(val) || isWalgreensUrl(val) || isCvsUrl(val) || isWholeFoodsUrl(val);
|
|
7636
7733
|
}
|
|
7637
|
-
|
|
7638
|
-
|
|
7734
|
+
var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
|
|
7735
|
+
var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
|
|
7736
|
+
function isSocialMediaUrl(val) {
|
|
7737
|
+
return isString(val) && URL20.some((i) => val.startsWith(i));
|
|
7639
7738
|
}
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union2(stripUnion(val))} ]>>` : Never2;
|
|
7739
|
+
function isSocialMediaProfileUrl(val) {
|
|
7740
|
+
return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
|
|
7643
7741
|
}
|
|
7644
|
-
function
|
|
7742
|
+
function isYouTubeUrl(val) {
|
|
7743
|
+
return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
|
|
7645
7744
|
}
|
|
7646
|
-
function
|
|
7647
|
-
return
|
|
7745
|
+
function isYouTubeShareUrl(val) {
|
|
7746
|
+
return isString(val) && val.startsWith(`https://youtu.be`);
|
|
7648
7747
|
}
|
|
7649
|
-
function
|
|
7650
|
-
return
|
|
7748
|
+
function isYouTubeVideoUrl(val) {
|
|
7749
|
+
return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
|
|
7651
7750
|
}
|
|
7652
|
-
function
|
|
7653
|
-
return
|
|
7751
|
+
function isYouTubePlaylistUrl(val) {
|
|
7752
|
+
return isString(val) && (val === `https://www.youtube.com/feed/playlists` || val === `https://youtube.com/feed/playlists` || val === `https://www.youtube.com/channel/playlists` || val === `https://youtube.com/channel/playlists` || val.startsWith(`https://www.youtube.com/@`) && val.endsWith(`/playlists`) || val.startsWith(`https://youtube.com/@`) && val.endsWith(`/playlists`));
|
|
7654
7753
|
}
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
var nullType = () => "<<null>>";
|
|
7658
|
-
function fn(..._args) {
|
|
7659
|
-
return {
|
|
7660
|
-
returns: (_rtn) => ({
|
|
7661
|
-
addProperties: (_kv) => {
|
|
7662
|
-
return null;
|
|
7663
|
-
},
|
|
7664
|
-
done: () => {
|
|
7665
|
-
return null;
|
|
7666
|
-
}
|
|
7667
|
-
}),
|
|
7668
|
-
done: () => {
|
|
7669
|
-
const result2 = null;
|
|
7670
|
-
return result2;
|
|
7671
|
-
}
|
|
7672
|
-
};
|
|
7754
|
+
function feed_map(type) {
|
|
7755
|
+
return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
|
|
7673
7756
|
}
|
|
7674
|
-
function
|
|
7675
|
-
return
|
|
7757
|
+
function isYouTubeFeedUrl(val, type) {
|
|
7758
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
|
|
7676
7759
|
}
|
|
7677
|
-
function
|
|
7678
|
-
return
|
|
7760
|
+
function isYouTubeFeedHistoryUrl(val) {
|
|
7761
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
|
|
7679
7762
|
}
|
|
7680
|
-
function
|
|
7681
|
-
|
|
7682
|
-
if (isString(re)) {
|
|
7683
|
-
try {
|
|
7684
|
-
const test = new RegExp(re);
|
|
7685
|
-
if (!isRegExp(test)) {
|
|
7686
|
-
const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
|
|
7687
|
-
err.name = "InvalidRegEx";
|
|
7688
|
-
throw err;
|
|
7689
|
-
} else {
|
|
7690
|
-
exp = re;
|
|
7691
|
-
}
|
|
7692
|
-
} catch {
|
|
7693
|
-
const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
|
|
7694
|
-
err.name = "InvalidRegEx";
|
|
7695
|
-
throw err;
|
|
7696
|
-
}
|
|
7697
|
-
} else if (isRegExp(re)) {
|
|
7698
|
-
exp = re.toString();
|
|
7699
|
-
}
|
|
7700
|
-
const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
|
|
7701
|
-
return token;
|
|
7763
|
+
function isYouTubePlaylistsUrl(val) {
|
|
7764
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
|
|
7702
7765
|
}
|
|
7703
|
-
function
|
|
7704
|
-
return (
|
|
7705
|
-
return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
|
|
7706
|
-
"union",
|
|
7707
|
-
literals.map((l) => addToken(token, `${l}`)).join(",")
|
|
7708
|
-
);
|
|
7709
|
-
};
|
|
7766
|
+
function isYouTubeTrendingUrl(val) {
|
|
7767
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
|
|
7710
7768
|
}
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
|
|
7714
|
-
zip: () => addToken("string-set", "Zip5"),
|
|
7715
|
-
zipPlus4: () => addToken("string-set", "Zip5_4"),
|
|
7716
|
-
zipCode: () => addToken("string-set", "ZipCode"),
|
|
7717
|
-
militaryTime: (resolution) => {
|
|
7718
|
-
return addToken(
|
|
7719
|
-
"string-set",
|
|
7720
|
-
"militaryTime",
|
|
7721
|
-
resolution || "HH:MM"
|
|
7722
|
-
);
|
|
7723
|
-
},
|
|
7724
|
-
civilianTime: (resolution) => {
|
|
7725
|
-
return addToken(
|
|
7726
|
-
"string-set",
|
|
7727
|
-
"militaryTime",
|
|
7728
|
-
resolution || "HH:MM"
|
|
7729
|
-
);
|
|
7730
|
-
},
|
|
7731
|
-
numericString: () => addToken("string-set", "numeric"),
|
|
7732
|
-
ipv4Address: () => addToken("string-set", "ipv4Address"),
|
|
7733
|
-
ipv6Address: () => addToken("string-set", "ipv6Address"),
|
|
7734
|
-
regex: (exp, ...literalRepresentation) => {
|
|
7735
|
-
const token = regexToken(exp, ...literalRepresentation);
|
|
7736
|
-
return token;
|
|
7737
|
-
},
|
|
7738
|
-
done: () => addToken("string")
|
|
7739
|
-
};
|
|
7740
|
-
var string22 = addSingleton("string", stringApi);
|
|
7741
|
-
var number = addSingleton("number");
|
|
7742
|
-
function union3(...elements) {
|
|
7743
|
-
const result2 = elements.map((_el) => {
|
|
7744
|
-
});
|
|
7745
|
-
return result2;
|
|
7769
|
+
function isYouTubeSubscriptionsUrl(val) {
|
|
7770
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
|
|
7746
7771
|
}
|
|
7747
|
-
function
|
|
7748
|
-
return
|
|
7772
|
+
function isYouTubeCreatorUrl(url) {
|
|
7773
|
+
return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
|
|
7749
7774
|
}
|
|
7750
|
-
function
|
|
7751
|
-
return
|
|
7775
|
+
function isYouTubeVideosInPlaylist(val) {
|
|
7776
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
|
|
7752
7777
|
}
|
|
7753
|
-
function
|
|
7754
|
-
|
|
7778
|
+
function isVueRef(val) {
|
|
7779
|
+
if (isObject(val)) {
|
|
7780
|
+
const keys = Object.keys(val);
|
|
7781
|
+
return !!["dep", "__v_isRef"].every((i) => keys.includes(i));
|
|
7782
|
+
}
|
|
7783
|
+
return false;
|
|
7784
|
+
}
|
|
7785
|
+
function csv(csv2, format = `string-numeric-tuple`) {
|
|
7786
|
+
const tuple3 = [];
|
|
7787
|
+
csv2.split(/,\s?/).forEach((v) => {
|
|
7788
|
+
tuple3.push(
|
|
7789
|
+
format === "string-numeric-tuple" ? isNumberLike(v) ? Number(v) : v : format === "json-tuple" ? isNumberLike(v) ? Number(v) : v === "true" ? true : v === "false" ? false : `"${v}"` : format === "string-tuple" ? `${v}` : Never2
|
|
7790
|
+
);
|
|
7791
|
+
});
|
|
7792
|
+
return tuple3;
|
|
7755
7793
|
}
|
|
7756
|
-
function
|
|
7757
|
-
|
|
7794
|
+
function fromKeyValue(kvs) {
|
|
7795
|
+
const obj = {};
|
|
7796
|
+
for (const kv of kvs) {
|
|
7797
|
+
obj[kv.key] = kv.value;
|
|
7798
|
+
}
|
|
7799
|
+
return obj;
|
|
7758
7800
|
}
|
|
7759
|
-
function
|
|
7760
|
-
return
|
|
7801
|
+
function intersect(value, _intersectedWith) {
|
|
7802
|
+
return value;
|
|
7761
7803
|
}
|
|
7762
|
-
function
|
|
7763
|
-
return
|
|
7804
|
+
function ip6GroupExpansion(ip) {
|
|
7805
|
+
return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
|
|
7764
7806
|
}
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
number,
|
|
7768
|
-
boolean,
|
|
7769
|
-
unknown,
|
|
7770
|
-
undefined: undefinedType,
|
|
7771
|
-
null: nullType,
|
|
7772
|
-
union: union3,
|
|
7773
|
-
fn,
|
|
7774
|
-
record,
|
|
7775
|
-
array,
|
|
7776
|
-
set,
|
|
7777
|
-
map,
|
|
7778
|
-
weakMap,
|
|
7779
|
-
dictionary,
|
|
7780
|
-
tuple: tuple2
|
|
7781
|
-
};
|
|
7782
|
-
function shape(cb) {
|
|
7783
|
-
const rtn = cb(ShapeApiImplementation);
|
|
7784
|
-
return handleDoneFn(
|
|
7785
|
-
isAddOrDone(rtn) ? rtn.done() : rtn
|
|
7786
|
-
);
|
|
7807
|
+
function jsonValue(val) {
|
|
7808
|
+
return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
|
|
7787
7809
|
}
|
|
7788
|
-
function
|
|
7789
|
-
return
|
|
7810
|
+
function jsonValues(...val) {
|
|
7811
|
+
return val.map((i) => jsonValue(i));
|
|
7790
7812
|
}
|
|
7791
|
-
function
|
|
7792
|
-
const
|
|
7793
|
-
|
|
7794
|
-
...acc,
|
|
7795
|
-
[i]: handleDoneFn(defn[i](ShapeApiImplementation))
|
|
7796
|
-
} : isFunction(defn[i]) ? {
|
|
7797
|
-
...acc,
|
|
7798
|
-
[i]: handleDoneFn(defn[i](ShapeApiImplementation))
|
|
7799
|
-
} : Never2,
|
|
7800
|
-
{}
|
|
7801
|
-
);
|
|
7802
|
-
return result2;
|
|
7813
|
+
function lookupAlpha2Code(code, prop) {
|
|
7814
|
+
const found = ISO3166_12.find((i) => i.alpha2 === code);
|
|
7815
|
+
return found ? found[prop] : void 0;
|
|
7803
7816
|
}
|
|
7804
|
-
function
|
|
7805
|
-
|
|
7817
|
+
function lookupAlpha3Code(code, prop) {
|
|
7818
|
+
const found = ISO3166_12.find((i) => i.alpha3 === code);
|
|
7819
|
+
return found ? found[prop] : void 0;
|
|
7806
7820
|
}
|
|
7807
|
-
function
|
|
7808
|
-
|
|
7821
|
+
function lookupName(name, prop) {
|
|
7822
|
+
const found = ISO3166_12.find((i) => i.name === name);
|
|
7823
|
+
return found ? found[prop] : void 0;
|
|
7809
7824
|
}
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
fillIn.push(empty);
|
|
7825
|
+
function lookupNumericCode(code, prop) {
|
|
7826
|
+
let num = isNumber(code) ? `${code}` : code;
|
|
7827
|
+
if (num.length === 1) {
|
|
7828
|
+
num = `00${num}`;
|
|
7829
|
+
} else if (num.length === 2) {
|
|
7830
|
+
num = `0${num}`;
|
|
7817
7831
|
}
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
[
|
|
7821
|
-
groups.join(":"),
|
|
7822
|
-
fillIn.join(":")
|
|
7823
|
-
].join(":"),
|
|
7824
|
-
">>"
|
|
7825
|
-
].join("");
|
|
7832
|
+
const found = ISO3166_12.find((i) => i.countryCode === num);
|
|
7833
|
+
return found ? found[prop] : void 0;
|
|
7826
7834
|
}
|
|
7827
|
-
function
|
|
7828
|
-
const
|
|
7829
|
-
|
|
7830
|
-
const proxy = new Proxy(state, {});
|
|
7831
|
-
Object.defineProperty(proxy, "id", {
|
|
7832
|
-
enumerable: false
|
|
7833
|
-
});
|
|
7834
|
-
return proxy;
|
|
7835
|
+
function lookupCountryName(code) {
|
|
7836
|
+
const uc = uppercase(code);
|
|
7837
|
+
return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
|
|
7835
7838
|
}
|
|
7836
|
-
function
|
|
7837
|
-
|
|
7839
|
+
function lookupCountryAlpha2(code) {
|
|
7840
|
+
const uc = uppercase(code);
|
|
7841
|
+
return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
|
|
7838
7842
|
}
|
|
7839
|
-
function
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
literal: (val) => `<<${kind}::${val}>>`
|
|
7843
|
-
};
|
|
7843
|
+
function lookupCountryAlpha3(token) {
|
|
7844
|
+
const uc = uppercase(token);
|
|
7845
|
+
return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
|
|
7844
7846
|
}
|
|
7845
|
-
function
|
|
7846
|
-
|
|
7847
|
+
function lookupCountryCode(token) {
|
|
7848
|
+
const uc = uppercase(token);
|
|
7849
|
+
return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
|
|
7847
7850
|
}
|
|
7848
|
-
function
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
+
function asMapper(fn2) {
|
|
7852
|
+
const props = {
|
|
7853
|
+
kind: "Mapper",
|
|
7854
|
+
map: (from) => {
|
|
7855
|
+
return from.map(fn2);
|
|
7856
|
+
}
|
|
7851
7857
|
};
|
|
7858
|
+
return createFnWithPropsExplicit(fn2, props);
|
|
7852
7859
|
}
|
|
7853
|
-
function
|
|
7854
|
-
return
|
|
7855
|
-
|
|
7860
|
+
function createObjectMap() {
|
|
7861
|
+
return (map2) => {
|
|
7862
|
+
const fn2 = (input) => {
|
|
7863
|
+
return Object.keys(map2).reduce(
|
|
7864
|
+
(acc, key) => {
|
|
7865
|
+
const val = map2[key];
|
|
7866
|
+
return {
|
|
7867
|
+
...acc,
|
|
7868
|
+
[key]: isFunction(val) ? val(input) : val
|
|
7869
|
+
};
|
|
7870
|
+
},
|
|
7871
|
+
{}
|
|
7872
|
+
);
|
|
7873
|
+
};
|
|
7874
|
+
return fn2;
|
|
7856
7875
|
};
|
|
7857
7876
|
}
|
|
7858
|
-
function
|
|
7859
|
-
return
|
|
7877
|
+
function createMapper() {
|
|
7878
|
+
return (fn2) => {
|
|
7879
|
+
return asMapper(fn2);
|
|
7880
|
+
};
|
|
7860
7881
|
}
|
|
7861
|
-
function
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7882
|
+
function mergeObjects(defVal, override) {
|
|
7883
|
+
const intersectingKeys = sharedKeys(defVal, override);
|
|
7884
|
+
const defUnique = withoutKeys(defVal, ...intersectingKeys);
|
|
7885
|
+
const overrideUnique = withoutKeys(defVal, ...intersectingKeys);
|
|
7886
|
+
const merged = {
|
|
7887
|
+
...intersectingKeys.reduce(
|
|
7888
|
+
(acc, key) => typeof override[key] === "undefined" ? { ...acc, [key]: defVal[key] } : { ...acc, [key]: override[key] },
|
|
7889
|
+
{}
|
|
7890
|
+
),
|
|
7891
|
+
...defUnique,
|
|
7892
|
+
...overrideUnique
|
|
7866
7893
|
};
|
|
7894
|
+
return merged;
|
|
7867
7895
|
}
|
|
7868
|
-
function
|
|
7869
|
-
return
|
|
7896
|
+
function mergeScalars(a, b) {
|
|
7897
|
+
return isUndefined(b) ? a : b;
|
|
7870
7898
|
}
|
|
7871
|
-
function
|
|
7872
|
-
return
|
|
7899
|
+
function mergeTuples(a, b) {
|
|
7900
|
+
return b.length > a.length ? b.map((v, idx) => v !== void 0 ? v : a[idx]) : [...b, ...a.slice(b.length)].map((v, idx) => v !== void 0 ? v : a[idx]);
|
|
7873
7901
|
}
|
|
7874
|
-
function
|
|
7875
|
-
|
|
7876
|
-
const parts = bare.split("::");
|
|
7877
|
-
const kind = parts.pop();
|
|
7878
|
-
return kind;
|
|
7902
|
+
function never(val) {
|
|
7903
|
+
return val;
|
|
7879
7904
|
}
|
|
7880
|
-
|
|
7881
|
-
var simpleScalarToken = (token) => token;
|
|
7882
|
-
var simpleContainerToken = (token) => token;
|
|
7883
|
-
function simpleScalarType(token) {
|
|
7884
|
-
const value = simpleScalarToken(token);
|
|
7905
|
+
function optional(value) {
|
|
7885
7906
|
return value;
|
|
7886
7907
|
}
|
|
7887
|
-
function
|
|
7888
|
-
const value = simpleContainerToken(token);
|
|
7908
|
+
function orNull(value) {
|
|
7889
7909
|
return value;
|
|
7890
7910
|
}
|
|
7891
|
-
function
|
|
7892
|
-
const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
|
|
7911
|
+
function optionalOrNull(value) {
|
|
7893
7912
|
return value;
|
|
7894
7913
|
}
|
|
7895
|
-
function
|
|
7896
|
-
|
|
7914
|
+
function stripParenthesis(val) {
|
|
7915
|
+
return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
|
|
7916
|
+
}
|
|
7917
|
+
function sortKeyApi(order) {
|
|
7918
|
+
return {
|
|
7919
|
+
order,
|
|
7920
|
+
toTop: (...keys) => sortKeyApi(
|
|
7921
|
+
[
|
|
7922
|
+
...keys.toReversed(),
|
|
7923
|
+
...order.filter((i) => !keys.includes(i))
|
|
7924
|
+
]
|
|
7925
|
+
),
|
|
7926
|
+
toBottom: (...keys) => sortKeyApi(
|
|
7927
|
+
[
|
|
7928
|
+
...order.filter((i) => !keys.includes(i)),
|
|
7929
|
+
...keys
|
|
7930
|
+
]
|
|
7931
|
+
),
|
|
7932
|
+
done: () => order
|
|
7933
|
+
};
|
|
7934
|
+
}
|
|
7935
|
+
function toKeyValue(obj, sort) {
|
|
7936
|
+
let keys = keysOf(obj);
|
|
7937
|
+
const tuple3 = [];
|
|
7938
|
+
if (sort) {
|
|
7939
|
+
keys = handleDoneFn(sort(sortKeyApi(keys)));
|
|
7940
|
+
}
|
|
7897
7941
|
for (const k of keys) {
|
|
7898
|
-
|
|
7899
|
-
return true;
|
|
7900
|
-
}
|
|
7942
|
+
tuple3.push({ key: k, value: obj[k] });
|
|
7901
7943
|
}
|
|
7902
|
-
return
|
|
7944
|
+
return tuple3;
|
|
7903
7945
|
}
|
|
7904
|
-
function
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7946
|
+
function convertScalar(val) {
|
|
7947
|
+
switch (typeof val) {
|
|
7948
|
+
case "number":
|
|
7949
|
+
return val;
|
|
7950
|
+
case "string":
|
|
7951
|
+
return Number(val);
|
|
7952
|
+
case "boolean":
|
|
7953
|
+
return val ? 1 : 0;
|
|
7954
|
+
default:
|
|
7955
|
+
throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
|
|
7913
7956
|
}
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7957
|
+
}
|
|
7958
|
+
var convertList = (val) => val.map((i) => convertScalar(i));
|
|
7959
|
+
function toNumber(value) {
|
|
7960
|
+
return Array.isArray(value) ? convertList(value) : convertScalar(value);
|
|
7961
|
+
}
|
|
7962
|
+
var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
|
|
7963
|
+
function removeTailwindModifiers(val) {
|
|
7964
|
+
return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
|
|
7965
|
+
}
|
|
7966
|
+
function getTailwindModifiers(val) {
|
|
7967
|
+
return val.split(":").filter((i) => isTailwindModifier(i));
|
|
7968
|
+
}
|
|
7969
|
+
function union3(..._options) {
|
|
7970
|
+
return (value) => value;
|
|
7971
|
+
}
|
|
7972
|
+
function unionize(value, _inUnionWith) {
|
|
7973
|
+
return value;
|
|
7921
7974
|
}
|
|
7922
7975
|
function asVueRef(value) {
|
|
7923
7976
|
return {
|
|
@@ -8359,6 +8412,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
|
|
|
8359
8412
|
defineObject,
|
|
8360
8413
|
defineObjectApi,
|
|
8361
8414
|
defineTuple,
|
|
8415
|
+
doesExtend,
|
|
8362
8416
|
endsWith,
|
|
8363
8417
|
ensureLeading,
|
|
8364
8418
|
ensureSurround,
|
|
@@ -8369,6 +8423,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
|
|
|
8369
8423
|
find,
|
|
8370
8424
|
fnMeta,
|
|
8371
8425
|
fromDefineObject,
|
|
8426
|
+
fromKeyValue,
|
|
8372
8427
|
get,
|
|
8373
8428
|
getDaysBetween,
|
|
8374
8429
|
getEach,
|
|
@@ -8651,6 +8706,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
|
|
|
8651
8706
|
isVoltageUom,
|
|
8652
8707
|
isVolumeMetric,
|
|
8653
8708
|
isVolumeUom,
|
|
8709
|
+
isVueRef,
|
|
8654
8710
|
isWalgreensUrl,
|
|
8655
8711
|
isWalmartUrl,
|
|
8656
8712
|
isWayfairUrl,
|
|
@@ -8744,6 +8800,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
|
|
|
8744
8800
|
takeProp,
|
|
8745
8801
|
toCamelCase,
|
|
8746
8802
|
toKebabCase,
|
|
8803
|
+
toKeyValue,
|
|
8747
8804
|
toNumber,
|
|
8748
8805
|
toNumericArray,
|
|
8749
8806
|
toPascalCase,
|