inferred-types 0.55.13 → 0.55.15

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.
@@ -5133,2526 +5133,2534 @@ var filter = "NOT READY";
5133
5133
  function filterEmpty(...val) {
5134
5134
  return val.filter((i) => isNotEmpty(i));
5135
5135
  }
5136
- function find(list2, deref = null) {
5137
- return (comparator) => {
5138
- return list2.find((i) => {
5139
- const val = deref ? isObject(i) || isArray(i) ? deref in i ? i[deref] : void 0 : i : i;
5140
- return val === comparator;
5141
- });
5142
- };
5143
- }
5144
- function getEach(list2, dotPath) {
5145
- const result2 = list2.map(
5146
- (i) => isNull(dotPath) ? i : isContainer(i) ? get(i, dotPath) : Never2
5147
- ).filter((i) => !isErrorCondition(i));
5148
- return result2;
5149
- }
5150
- function indexOf(val, index) {
5151
- const isNegative = isNumber(index) && index < 0;
5152
- if (isNegative && !Array.isArray(val)) {
5153
- throw new Error(`The indexOf(val,idx) utility received a negative index value [${index}] but the value being de-references is not an array [${typeof val}]!`);
5154
- }
5155
- if (isNegative && Array.isArray(val) && val.length < Math.abs(index)) {
5156
- throw new Error(`The indexOf(val,idx) utility received a negative index of ${index} but the length of the array passed in is only ${val.length}! This is not allowed.`);
5157
- }
5158
- const idx = isNegative && Array.isArray(val) ? val.length + 1 - Math.abs(index) : index;
5159
- return index === null ? val : isNull(idx) ? val : isArray(val) ? Number(idx) in val ? val[Number(idx)] : errCondition("invalid-index", `attempt to index a numeric array with an invalid index: ${Number(idx)}`) : isObject(val) ? String(idx) in val ? val[String(idx)] : errCondition("invalid-index", `attempt to index a dictionary object with an invalid index: ${String(idx)}`) : errCondition("invalid-container-type", `Attempt to use indexOf() on an invalid container type: ${typeof val}`);
5136
+ function isFunction(value) {
5137
+ return typeof value === "function";
5160
5138
  }
5161
- function intersectWithOffset(a, b, deref) {
5162
- const aIndexable = a.every((i) => isIndexable(i));
5163
- const bIndexable = b.every((i) => isIndexable(i));
5164
- if (!aIndexable || !bIndexable) {
5165
- if (!aIndexable) {
5166
- throw new Error(`The "a" array passed into intersect(a,b) was not fully composed of indexable properties: ${a.map((i) => typeof i).join(", ")}`);
5167
- } else {
5168
- throw new Error(`The "b" array passed into intersect(a,b) was not fully composed of indexable properties: ${b.map((i) => typeof i).join(", ")}`);
5169
- }
5170
- }
5171
- const aMatches = getEach(a, deref);
5172
- const bMatches = getEach(b, deref);
5173
- const sharedKeys2 = ifNotNull(
5174
- deref,
5175
- (v) => [
5176
- a.filter((i) => Array.from(bMatches).includes(get(i, v))),
5177
- b.filter((i) => Array.from(aMatches).includes(get(i, v)))
5178
- ],
5179
- () => a.filter((k) => b.includes(k))
5180
- );
5181
- return sharedKeys2;
5139
+ function isObject(value) {
5140
+ return typeof value === "object" && value !== null && Array.isArray(value) === false;
5182
5141
  }
5183
- function intersectNoOffset(a, b) {
5184
- return a.length < b.length ? a.filter((val) => b.includes(val)) : b.filter((val) => a.includes(val));
5142
+ function isNarrowableObject(value) {
5143
+ return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
5185
5144
  }
5186
- function intersection(a, b, deref = null) {
5187
- return deref === null ? intersectNoOffset(a, b) : intersectWithOffset(a, b, deref);
5145
+ function isEscapeFunction(val) {
5146
+ return isFunction(val) && "escape" in val && val.escape === true;
5188
5147
  }
5189
- function joinWith(joinWith2) {
5190
- return (...tuple3) => {
5191
- const tup = tuple3;
5192
- return tup.join(joinWith2);
5193
- };
5148
+ function isOptionalParamFunction(val) {
5149
+ return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
5194
5150
  }
5195
- function last(list2) {
5196
- return [...list2].pop();
5151
+ function isApi(api2) {
5152
+ return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
5197
5153
  }
5198
- function logicalReturns(conditions) {
5199
- return conditions.map(
5200
- (c) => isBoolean(c) ? c : isFunction(c) ? c() : Never2
5201
- );
5154
+ function isApiSurface(val) {
5155
+ return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
5202
5156
  }
5203
- function reverse(list2) {
5204
- return [...list2].reverse();
5157
+ function isDate(val) {
5158
+ return val instanceof Date;
5205
5159
  }
5206
- function shift(list2) {
5207
- let rtn;
5208
- if (isDefined(list2)) {
5209
- rtn = list2.length === 0 ? void 0 : list2[0];
5210
- try {
5211
- list2 = list2.slice(1);
5212
- } catch {
5213
- }
5214
- } else {
5215
- rtn = void 0;
5160
+ function isIsoDateTime(val) {
5161
+ if (!isString(val)) {
5162
+ return false;
5216
5163
  }
5217
- return rtn;
5218
- }
5219
- function slice(list2, start2, end) {
5220
- return list2.slice(start2, end);
5221
- }
5222
- function unique(...values) {
5223
- const u = [];
5224
- for (const i of values.flat()) {
5225
- if (!u.includes(i)) {
5226
- u.push(i);
5227
- }
5164
+ 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})?$/;
5165
+ if (!ISO_DATETIME_REGEX.test(val)) {
5166
+ return false;
5228
5167
  }
5229
- return u;
5230
- }
5231
- function box(value) {
5232
- const rtn = {
5233
- __type: "box",
5234
- value,
5235
- unbox: (...p) => {
5236
- return typeof value === "function" ? value(...p) : value;
5168
+ const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
5169
+ const [year, month, day, hours, minutes, seconds] = matches.map(Number);
5170
+ if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
5171
+ return false;
5172
+ }
5173
+ if (month < 1 || month > 12) {
5174
+ return false;
5175
+ }
5176
+ ;
5177
+ const daysInMonth = new Date(year, month, 0).getDate();
5178
+ if (day < 1 || day > daysInMonth) {
5179
+ return false;
5180
+ }
5181
+ ;
5182
+ const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
5183
+ if (tzMatch) {
5184
+ const [_2, _sign, tzHours, tzMinutes] = tzMatch;
5185
+ const numHours = Number.parseInt(tzHours, 10);
5186
+ const numMinutes = Number.parseInt(tzMinutes, 10);
5187
+ if (numHours > 14 || numMinutes > 59) {
5188
+ return false;
5237
5189
  }
5238
- };
5239
- return rtn;
5240
- }
5241
- function isBox(thing) {
5242
- return typeof thing === "object" && "__type" in thing && thing.__type === "box";
5190
+ if (numHours === 14 && numMinutes > 0) {
5191
+ return false;
5192
+ }
5193
+ }
5194
+ return true;
5243
5195
  }
5244
- function boxDictionaryValues(dict) {
5245
- const keys = Object.keys(dict);
5246
- return keys.reduce(
5247
- (acc, key) => ({ ...acc, [key]: box(dict[key]) }),
5248
- {}
5249
- );
5196
+ function isIsoExplicitDate(val) {
5197
+ if (isString(val)) {
5198
+ const parts = val.split("-").map((i) => Number(i));
5199
+ 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;
5200
+ } else {
5201
+ return false;
5202
+ }
5250
5203
  }
5251
- function unbox(val) {
5252
- return isBox(val) ? val.value : val;
5204
+ function isIsoImplicitDate(val) {
5205
+ if (isString(val) && val.length === 8 && isNumberLike(val)) {
5206
+ const year = Number(val.slice(0, 4));
5207
+ const month = Number(val.slice(4, 6));
5208
+ const date = Number(val.slice(6, 8));
5209
+ return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
5210
+ } else {
5211
+ return false;
5212
+ }
5253
5213
  }
5254
- function capitalize(str) {
5255
- return `${str?.slice(0, 1).toUpperCase()}${str?.slice(1)}`;
5214
+ function isIsoDate(val) {
5215
+ if (isString(val)) {
5216
+ return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
5217
+ } else {
5218
+ return false;
5219
+ }
5256
5220
  }
5257
- function cssColor(color, v1, v2, v3, opacity) {
5258
- return `color(${color} ${v1} ${v2} ${v3}${opacity ? ` / ${opacity}` : ""}`;
5221
+ function isIsoExplicitTime(val) {
5222
+ if (isString(val)) {
5223
+ const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
5224
+ return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
5225
+ } else {
5226
+ return false;
5227
+ }
5259
5228
  }
5260
- function twColor(color, luminosity) {
5261
- const lum = luminosity in TW_LUMINOSITY2 ? TW_LUMINOSITY2[luminosity] : 0;
5262
- const chroma = luminosity in TW_CHROMA2 ? TW_CHROMA2[luminosity] : 0;
5263
- const hue = TW_HUE2[color];
5264
- return `oklch(${lum} ${chroma} ${hue})`;
5229
+ function isIsoImplicitTime(val) {
5230
+ if (isString(val)) {
5231
+ const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
5232
+ return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
5233
+ } else {
5234
+ return false;
5235
+ }
5265
5236
  }
5266
- function ensureLeading(content, ensure) {
5267
- const output = String(content);
5268
- return output.startsWith(String(ensure)) ? content : isString(content) ? `${ensure}${content}` : Number(`${ensure}${content}`);
5237
+ function isIsoTime(val) {
5238
+ return isIsoExplicitTime(val) || isIsoImplicitTime(val);
5269
5239
  }
5270
- function ensureSurround(prefix, postfix) {
5271
- const fn2 = (input) => {
5272
- let result2 = input;
5273
- result2 = ensureLeading(result2, prefix);
5274
- result2 = ensureTrailing(result2, postfix);
5275
- return result2;
5276
- };
5277
- return fn2;
5240
+ function isIsoYear(val) {
5241
+ return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
5278
5242
  }
5279
- function ensureTrailing(content, ensure) {
5280
- return (
5281
- //
5282
- content.endsWith(ensure) ? content : `${content}${ensure}`
5283
- );
5243
+ function isLuxonDateTime(val) {
5244
+ 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";
5284
5245
  }
5285
- function getTypeSubtype(str) {
5286
- if (isTypeSubtype(str)) {
5287
- const [t, st] = str.split("/");
5288
- return [t, st];
5289
- } else {
5290
- const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
5291
- err.name = "InvalidTypeSubtype";
5292
- throw err;
5246
+ function isMoment(val) {
5247
+ if (val instanceof Date) {
5248
+ return false;
5293
5249
  }
5250
+ 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";
5294
5251
  }
5295
- function identity(...values) {
5296
- return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
5297
- }
5298
- function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
5299
- if (ch.length !== 1) {
5300
- throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
5252
+ function isThisMonth(val) {
5253
+ const now = /* @__PURE__ */ new Date();
5254
+ const currentYear = now.getFullYear();
5255
+ const currentMonth = now.getMonth() + 1;
5256
+ if (val instanceof Date) {
5257
+ return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
5301
5258
  }
5302
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
5303
- }
5304
- function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
5305
- if (ch.length !== 1) {
5306
- throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
5259
+ if (isMoment(val)) {
5260
+ const monthValue = val.month();
5261
+ return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
5307
5262
  }
5308
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
5309
- }
5310
- function parseTemplate(template) {
5311
- const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
5312
- let lastIndex = 0;
5313
- let match;
5314
- const segments = [];
5315
- while (match = pattern.exec(template)) {
5316
- const [fullMatch, varName, asType2] = match;
5317
- const staticPart = template.slice(lastIndex, match.index);
5318
- if (staticPart) {
5319
- segments.push({ dynamic: false, text: staticPart });
5320
- }
5321
- segments.push({
5322
- dynamic: true,
5323
- varName,
5324
- type: asType2 ? asType2 : "string"
5325
- });
5326
- lastIndex = match.index + fullMatch.length;
5263
+ if (isLuxonDateTime(val)) {
5264
+ return val.year === currentYear && val.month === currentMonth;
5327
5265
  }
5328
- const remainder = template.slice(lastIndex);
5329
- if (remainder) {
5330
- segments.push({ dynamic: false, text: remainder });
5266
+ if (typeof val === "string") {
5267
+ 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))?$/;
5268
+ if (!isoDateRegex.test(val)) {
5269
+ return false;
5270
+ }
5271
+ const dateMatch = val.match(/^(\d{4})-(\d{2})/);
5272
+ if (dateMatch) {
5273
+ const year = Number.parseInt(dateMatch[1], 10);
5274
+ const month = Number.parseInt(dateMatch[2], 10);
5275
+ return year === currentYear && month === currentMonth;
5276
+ }
5331
5277
  }
5332
- return segments;
5278
+ return false;
5333
5279
  }
5334
- function escapeRegex(str) {
5335
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5280
+ function isThisWeek(date) {
5281
+ const targetDate = asDate(date);
5282
+ if (!targetDate) {
5283
+ return false;
5284
+ }
5285
+ const currentWeek = getWeekNumber();
5286
+ const targetWeek = getWeekNumber(targetDate);
5287
+ return currentWeek === targetWeek;
5336
5288
  }
5337
- function buildRegexPattern(segments) {
5338
- let regexStr = "^";
5339
- for (const seg of segments) {
5340
- if (!seg.dynamic) {
5341
- regexStr += escapeRegex(seg.text);
5289
+ function isThisYear(val) {
5290
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
5291
+ if (isObject(val) || isNumber(val) || isString(val)) {
5292
+ const date = asDate(val);
5293
+ if (date) {
5294
+ return date.getFullYear() === currentYear;
5342
5295
  } else {
5343
- switch (seg.type) {
5344
- case "string":
5345
- regexStr += "(.*?)";
5346
- break;
5347
- case "number":
5348
- regexStr += "(\\d+)";
5349
- break;
5350
- case "boolean":
5351
- regexStr += "(true|false)";
5352
- break;
5353
- }
5296
+ return false;
5354
5297
  }
5355
5298
  }
5356
- regexStr += "$";
5357
- return new RegExp(regexStr);
5299
+ return false;
5358
5300
  }
5359
- function convertValue(type, value) {
5360
- switch (type) {
5361
- case "string":
5362
- return value;
5363
- case "number":
5364
- return Number(value);
5365
- case "boolean":
5366
- return value === "true";
5301
+ function isToday(test) {
5302
+ if (isString(test)) {
5303
+ const justDate = stripAfter(test, "T");
5304
+ return isIsoExplicitDate(justDate) && justDate === getToday();
5305
+ } else if (isMoment(test) || isDate(test)) {
5306
+ return stripAfter(test.toISOString(), "T") === getToday();
5307
+ } else if (isLuxonDateTime(test)) {
5308
+ return stripAfter(test.toISO(), "T") === getToday();
5367
5309
  }
5310
+ return false;
5368
5311
  }
5369
- function matchTemplate(template, test) {
5370
- const segments = parseTemplate(template);
5371
- const regex = buildRegexPattern(segments);
5372
- const match = regex.exec(test);
5373
- if (!match)
5374
- return false;
5375
- let captureIndex = 1;
5376
- const result2 = {};
5377
- for (const seg of segments) {
5378
- if (seg.dynamic) {
5379
- const rawVal = match[captureIndex++];
5380
- if (rawVal === void 0)
5381
- return false;
5382
- result2[seg.varName] = convertValue(seg.type, rawVal);
5383
- }
5312
+ function isTomorrow(test) {
5313
+ if (isString(test)) {
5314
+ const justDate = stripAfter(test, "T");
5315
+ return isIsoExplicitDate(justDate) && justDate === getTomorrow();
5316
+ } else if (isMoment(test) || isDate(test)) {
5317
+ return stripAfter(test.toISOString(), "T") === getTomorrow();
5318
+ } else if (isLuxonDateTime(test)) {
5319
+ return stripAfter(test.toISO(), "T") === getTomorrow();
5384
5320
  }
5385
- return result2;
5321
+ return false;
5386
5322
  }
5387
- function infer(inference) {
5388
- return (test) => {
5389
- return matchTemplate(inference, test);
5390
- };
5323
+ function isYesterday(test) {
5324
+ if (isString(test)) {
5325
+ const justDate = stripAfter(test, "T");
5326
+ return isIsoExplicitDate(justDate) && justDate === getYesterday();
5327
+ } else if (isMoment(test) || isDate(test)) {
5328
+ return stripAfter(test.toISOString(), "T") === getYesterday();
5329
+ } else if (isLuxonDateTime(test)) {
5330
+ return stripAfter(test.toISO(), "T") === getYesterday();
5331
+ }
5332
+ return false;
5391
5333
  }
5392
- function idLiteral(o) {
5393
- return { ...o, id: o.id };
5334
+ function isVisa(val) {
5335
+ if (isString(val) && val.startsWith("4")) {
5336
+ const parts = val.split(" ");
5337
+ return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4);
5338
+ }
5339
+ return false;
5394
5340
  }
5395
- function nameLiteral(o) {
5396
- return o;
5341
+ function isMastercard(val) {
5342
+ if (isString(val) && val.startsWith("4")) {
5343
+ const parts = val.split(" ");
5344
+ return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4) && ["51", "55", "22", "23", "24", "25", "26", "27"].some((i) => val.startsWith(i));
5345
+ }
5346
+ return false;
5397
5347
  }
5398
- function kindLiteral(o) {
5399
- return o;
5348
+ function isVisaMastercard(val) {
5349
+ return isVisa(val) || isMastercard(val);
5400
5350
  }
5401
- function idTypeGuard(_o) {
5402
- return true;
5351
+ function isAmericanExpress(val) {
5352
+ if (isString(val)) {
5353
+ const parts = val.split(" ");
5354
+ return parts.length === 3 && parts.every(
5355
+ (i) => isNumberLike(i) && parts[0].length === 4 && parts[1].length === 6
5356
+ );
5357
+ }
5358
+ return false;
5403
5359
  }
5404
- function literal(obj) {
5405
- return obj;
5360
+ function isCreditCard(val) {
5361
+ return isVisaMastercard(val) || isAmericanExpress(val);
5406
5362
  }
5407
- function lowercase(str) {
5408
- return str.toLowerCase();
5363
+ function cardType(cardNumber) {
5364
+ const cleanedNumber = String(cardNumber).replace(/\D/g, "");
5365
+ const length = cleanedNumber.length;
5366
+ if (!isValidLength(length)) {
5367
+ return "invalid";
5368
+ }
5369
+ if (!luhnCheck(cleanedNumber)) {
5370
+ return "invalid";
5371
+ }
5372
+ const cardTypes = [
5373
+ { name: "Visa", lengths: [16], prefixes: [/^4/] },
5374
+ { name: "Mastercard", lengths: [16], prefixes: [/^(51|52|53|54|55|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)/] },
5375
+ { name: "American Express", lengths: [15], prefixes: [/^3[47]/] },
5376
+ { name: "Discover", lengths: [16], prefixes: [/^(6011|622(12[6-9]|1[3-9]\d|2[0-4]\d|25\d|6[4-9]|7[0-4]|8[0-4]|9\d)|64[4-9]|65)/] },
5377
+ { name: "JCB", lengths: [16], prefixes: [/^(35|2131|1800)/] },
5378
+ { name: "Diners Club", lengths: [14, 16], prefixes: [/^(30[0-5]|36|38)/] },
5379
+ { name: "China UnionPay", lengths: [16, 17, 18, 19], prefixes: [/^(62|88)/] },
5380
+ { name: "Maestro", lengths: [12, 13, 14, 15, 16, 17, 18, 19], prefixes: [/^(5018|5020|5038|6304)/] },
5381
+ { name: "Solo", lengths: [16, 18, 19], prefixes: [/^(6334|6767)/] }
5382
+ ];
5383
+ for (const type of cardTypes) {
5384
+ if (type.lengths.includes(length)) {
5385
+ for (const prefix of type.prefixes) {
5386
+ if (prefix.test(cleanedNumber)) {
5387
+ return type.name;
5388
+ }
5389
+ }
5390
+ }
5391
+ }
5392
+ return "invalid";
5409
5393
  }
5410
- function narrow(...values) {
5411
- return values.length === 1 ? values[0] : values;
5394
+ function isValidLength(length) {
5395
+ const validLengths = [13, 14, 15, 16, 17, 18, 19];
5396
+ return validLengths.includes(length);
5412
5397
  }
5413
- function pathJoin(...segments) {
5414
- const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
5415
- const original_path = segments.join("/");
5416
- const pre = original_path.startsWith("/") ? "/" : "";
5417
- const post = original_path.endsWith("/") ? "/" : "";
5418
- return `${pre}${clean_path}${post}`;
5398
+ function luhnCheck(num) {
5399
+ let sum = 0;
5400
+ let double = false;
5401
+ for (let i = num.length - 1; i >= 0; i--) {
5402
+ let n = Number.parseInt(num.charAt(i), 10);
5403
+ if (double) {
5404
+ n *= 2;
5405
+ if (n > 9) {
5406
+ n -= 9;
5407
+ }
5408
+ }
5409
+ sum += n;
5410
+ double = !double;
5411
+ }
5412
+ return sum % 10 === 0;
5419
5413
  }
5420
- var asPhoneFormat = () => `NOT IMPLEMENTED`;
5421
- function getPhoneCountryCode(phone) {
5422
- return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
5423
- stripLeading(stripLeading(phone.trim(), "+"), "00"),
5424
- ...NUMERIC_CHAR2
5425
- ) : "";
5414
+ function isString(value) {
5415
+ return typeof value === "string";
5426
5416
  }
5427
- function removePhoneCountryCode(phone) {
5428
- const countryCode = getPhoneCountryCode(phone);
5429
- return countryCode !== "" ? stripLeading(stripLeading(
5430
- phone.trim(),
5431
- "+",
5432
- "00"
5433
- ), countryCode).trim() : phone.trim();
5417
+ function isIso3166Alpha2(val) {
5418
+ const codes = ISO3166_12.map((i) => i.alpha2);
5419
+ return isString(val) && codes.includes(val);
5434
5420
  }
5435
- var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
5436
- function endingIn(word, postfix) {
5437
- switch (postfix) {
5438
- case "is":
5439
- return word.endsWith(postfix) ? `${word}es` : void 0;
5440
- case "singular-noun":
5441
- return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
5442
- case "f":
5443
- return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
5444
- case "y":
5445
- return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
5446
- default:
5447
- throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
5448
- }
5421
+ function isCountryCode2(val) {
5422
+ const codes = ISO3166_12.map((i) => i.alpha2);
5423
+ return isString(val) && codes.includes(val);
5449
5424
  }
5450
- function pluralize(word) {
5451
- const right = rightWhitespace(word);
5452
- const w = word.trimEnd();
5453
- const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
5454
- return `${result2}${right}`;
5455
- }
5456
- function retainAfter(content, ...find2) {
5457
- const idx = Math.min(
5458
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
5459
- );
5460
- const min = Math.min(...find2.map((i) => i.length));
5461
- let len = Math.max(...find2.map((i) => i.length));
5462
- if (min !== len) {
5463
- if (!find2.includes(content.slice(idx, len))) {
5464
- len = min;
5465
- }
5466
- }
5467
- return idx && idx > 0 ? content.slice(idx + len) : "";
5425
+ function isIso3166Alpha3(val) {
5426
+ const codes = ISO3166_12.map((i) => i.alpha3);
5427
+ return isString(val) && codes.includes(val);
5468
5428
  }
5469
- function retainAfterInclusive(content, ...find2) {
5470
- const minFound = Math.min(
5471
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
5472
- );
5473
- return minFound > 0 ? content.slice(minFound) : "";
5429
+ function isCountryCode3(val) {
5430
+ const codes = ISO3166_12.map((i) => i.alpha3);
5431
+ return isString(val) && codes.includes(val);
5474
5432
  }
5475
- function retainChars(content, ...retain2) {
5476
- const chars = asChars(content);
5477
- return chars.filter((c) => retain2.includes(c)).join("");
5433
+ function isIso3166CountryCode(val) {
5434
+ const codes = ISO3166_12.map((i) => i.countryCode);
5435
+ return isString(val) && codes.includes(val);
5478
5436
  }
5479
- function retainUntil(content, ...find2) {
5480
- const chars = asChars(content);
5481
- let idx = 0;
5482
- while (!find2.includes(chars[idx]) && idx <= chars.length) {
5483
- idx = idx + 1;
5484
- }
5485
- return idx === 0 ? "" : content.slice(0, idx);
5437
+ function isCountryAbbrev(val) {
5438
+ return isCountryCode2(val) || isCountryCode3(val);
5486
5439
  }
5487
- function retainUntilInclusive(content, ...find2) {
5488
- const chars = asChars(content);
5489
- let idx = 0;
5490
- while (!find2.includes(chars[idx]) && idx <= chars.length) {
5491
- idx = idx + 1;
5492
- }
5493
- return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
5440
+ function isIso3166CountryName(val) {
5441
+ const codes = ISO3166_12.map((i) => i.name);
5442
+ return isString(val) && codes.includes(val);
5494
5443
  }
5495
- function retainWhile(content, ...retain2) {
5496
- const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
5497
- return content.slice(0, stopIdx);
5444
+ function isCountryName(val) {
5445
+ const codes = ISO3166_12.map((i) => i.name);
5446
+ return isString(val) && codes.includes(val);
5498
5447
  }
5499
- function rightWhitespace(content) {
5500
- const trimmed = content.trimStart();
5501
- return retainAfterInclusive(
5502
- trimmed,
5503
- ...WHITESPACE_CHARS2
5504
- );
5448
+ var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
5449
+ var NAME = US_STATE_LOOKUP2.map((i) => i.name);
5450
+ function isUsStateAbbreviation(val) {
5451
+ return isString(val) && ABBREV.includes(val);
5505
5452
  }
5506
- function split(str, sep = "") {
5507
- return str.split(sep);
5453
+ function isUsStateName(val) {
5454
+ return isString(val) && NAME.includes(val);
5508
5455
  }
5509
- function stripAfter(content, find2) {
5510
- return content.split(find2).shift();
5456
+ function isNumericString(value) {
5457
+ const numericChars = [...NUMERIC_CHAR2];
5458
+ return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
5511
5459
  }
5512
- function stripBefore(content, find2) {
5513
- return content.split(find2).slice(1).join(find2);
5460
+ function isNumberLike(value) {
5461
+ const numericChars = [...NUMERIC_CHAR2];
5462
+ return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
5514
5463
  }
5515
- function stripChars(content, ...strip2) {
5516
- const chars = asChars(content);
5517
- return chars.filter((c) => !strip2.includes(c)).join("");
5464
+ function isNumber(value) {
5465
+ return typeof value === "number";
5518
5466
  }
5519
- function stripLeading(content, ...strip2) {
5520
- if (isUndefined(content)) {
5521
- return void 0;
5522
- }
5523
- let output = String(content);
5524
- for (const s of strip2) {
5525
- if (output.startsWith(String(s))) {
5526
- output = output.slice(String(s).length);
5527
- }
5467
+ function isZipCode5(val) {
5468
+ if (isNumber(val)) {
5469
+ return isZipCode5(`${val}`);
5528
5470
  }
5529
- return isNumber(content) ? Number(output) : output;
5530
- }
5531
- function stripSurround(...chars) {
5532
- return (input) => {
5533
- let output = String(input);
5534
- for (const s of chars) {
5535
- if (output.startsWith(String(s))) {
5536
- output = output.slice(String(s).length);
5537
- }
5538
- if (output.endsWith(String(s))) {
5539
- output = output.slice(0, -1 * String(s).length);
5540
- }
5541
- }
5542
- return isNumber(input) ? Number(output) : output;
5543
- };
5471
+ return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
5544
5472
  }
5545
- function stripTrailing(content, ...strip2) {
5546
- if (isUndefined(content)) {
5547
- return void 0;
5548
- }
5549
- let output = String(content);
5550
- for (const s of strip2) {
5551
- if (output.endsWith(String(s))) {
5552
- output = output.slice(0, -1 * String(s).length);
5553
- }
5473
+ function isZipPlus4(val) {
5474
+ if (isString(val)) {
5475
+ const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
5476
+ const next = stripChars(val.trim().replace(first, "").trim(), "-");
5477
+ return first.length === 5 && next.length === 4 && isNumberLike(next);
5554
5478
  }
5555
- return isNumber(content) ? Number(output) : output;
5479
+ return false;
5556
5480
  }
5557
- function stripUntil(content, ...until) {
5558
- const stopIdx = asChars(content).findIndex((c) => until.includes(c));
5559
- return content.slice(stopIdx);
5481
+ function isZipCode(val) {
5482
+ return isZipCode5(val) || isZipPlus4(val);
5560
5483
  }
5561
- function stripWhile(content, ...match) {
5562
- const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
5563
- return content.slice(stopIdx);
5484
+ function isSpecificConstant(kind) {
5485
+ return (value) => {
5486
+ return !!(isConstant(value) && value.kind === kind);
5487
+ };
5564
5488
  }
5565
- function surround(prefix, postfix) {
5566
- return (input) => `${prefix}${input}${postfix}`;
5489
+ function hasDefaultValue(value) {
5490
+ const noDefault = isSpecificConstant("no-default-value");
5491
+ return !noDefault(value);
5567
5492
  }
5568
- function takeNumericCharacters(content) {
5569
- const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
5570
- return content.slice(0, nonNumericIdx);
5493
+ function hasIndexOf(value, idx) {
5494
+ const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
5495
+ return isErrorCondition(result2, "invalid-index") ? false : result2;
5571
5496
  }
5572
- function toCamelCase(input, preserveWhitespace) {
5573
- const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
5574
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
5575
- pascal
5576
- );
5577
- const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
5578
- return camel;
5497
+ function hasKeys(...props) {
5498
+ return (val) => {
5499
+ const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
5500
+ return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
5501
+ };
5579
5502
  }
5580
- function toKebabCase(input, _preserveWhitespace = false) {
5581
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
5582
- const replaceWhitespace = (i) => i.replace(/\s/g, "-");
5583
- const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
5584
- const replaceLeadingDash = (i) => i.replace(/^-/, "");
5585
- const replaceTrailingDash = (i) => i.replace(/-$/, "");
5586
- const replaceUnderscore = (i) => i.replace(/_/g, "-");
5587
- const removeDupDashes = (i) => i.replace(/-+/g, "-");
5588
- return removeDupDashes(`${preWhite}${replaceUnderscore(
5589
- replaceTrailingDash(
5590
- replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
5591
- )
5592
- )}${postWhite}`);
5503
+ function asChars(str) {
5504
+ return str.split("");
5593
5505
  }
5594
- function toNumericArray(arr) {
5595
- return arr.map((i) => Number(i));
5506
+ function asRecord(obj) {
5507
+ return obj;
5596
5508
  }
5597
- function toPascalCase(input, preserveWhitespace = void 0) {
5598
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
5599
- input
5600
- );
5601
- const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
5602
- const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
5603
- const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
5604
- const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
5605
- const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
5606
- replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
5607
- )}${preserveWhitespace ? postWhite : ""}`;
5608
- return pascal;
5509
+ function asString(value) {
5510
+ return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
5609
5511
  }
5610
- function toSnakeCase(input, preserveWhitespace = false) {
5611
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
5612
- const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
5613
- const convertDashes = (input2) => input2.replace(/-/g, "_");
5614
- const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
5615
- const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
5616
- return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
5617
- injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
5618
- ).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
5512
+ function csv(csv2, format = `string-numeric-tuple`) {
5513
+ const tuple3 = [];
5514
+ csv2.split(/,\s?/).forEach((v) => {
5515
+ tuple3.push(
5516
+ 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
5517
+ );
5518
+ });
5519
+ return tuple3;
5619
5520
  }
5620
- function toString(val) {
5621
- return String(val);
5521
+ function fromKeyValue(kvs) {
5522
+ const obj = {};
5523
+ for (const kv of kvs) {
5524
+ obj[kv.key] = kv.value;
5525
+ }
5526
+ return obj;
5622
5527
  }
5623
- function toUppercase(str) {
5624
- return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
5528
+ function intersect(value, _intersectedWith) {
5529
+ return value;
5625
5530
  }
5626
- function trim(input) {
5627
- return input.trim();
5531
+ function ip6GroupExpansion(ip) {
5532
+ return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
5628
5533
  }
5629
- function trimLeft(input) {
5630
- return input.trimStart();
5534
+ function jsonValue(val) {
5535
+ return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
5631
5536
  }
5632
- function trimStart(input) {
5633
- return input.trimStart();
5537
+ function jsonValues(...val) {
5538
+ return val.map((i) => jsonValue(i));
5634
5539
  }
5635
- function trimRight(input) {
5636
- return input.trimEnd();
5540
+ function lookupAlpha2Code(code, prop) {
5541
+ const found = ISO3166_12.find((i) => i.alpha2 === code);
5542
+ return found ? found[prop] : void 0;
5637
5543
  }
5638
- function trimEnd(input) {
5639
- return input.trimEnd();
5544
+ function lookupAlpha3Code(code, prop) {
5545
+ const found = ISO3166_12.find((i) => i.alpha3 === code);
5546
+ return found ? found[prop] : void 0;
5640
5547
  }
5641
- function truncate(content, maxLength, ellipsis = false) {
5642
- const overLimit = content.length > maxLength;
5643
- return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
5548
+ function lookupName(name, prop) {
5549
+ const found = ISO3166_12.find((i) => i.name === name);
5550
+ return found ? found[prop] : void 0;
5644
5551
  }
5645
- function tuple(...values) {
5646
- const arr = values.length === 1 ? values[0] : values;
5647
- return asArray(arr);
5552
+ function lookupNumericCode(code, prop) {
5553
+ let num = isNumber(code) ? `${code}` : code;
5554
+ if (num.length === 1) {
5555
+ num = `00${num}`;
5556
+ } else if (num.length === 2) {
5557
+ num = `0${num}`;
5558
+ }
5559
+ const found = ISO3166_12.find((i) => i.countryCode === num);
5560
+ return found ? found[prop] : void 0;
5648
5561
  }
5649
- function uncapitalize(str) {
5650
- return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
5562
+ function lookupCountryName(code) {
5563
+ const uc = uppercase(code);
5564
+ return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
5651
5565
  }
5652
- var unset = "<<unset>>";
5653
- function uppercase(str) {
5654
- return str.toUpperCase();
5566
+ function lookupCountryAlpha2(code) {
5567
+ const uc = uppercase(code);
5568
+ return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
5655
5569
  }
5656
- function widen(value) {
5657
- return value;
5570
+ function lookupCountryAlpha3(token) {
5571
+ const uc = uppercase(token);
5572
+ return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
5658
5573
  }
5659
- var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
5660
- function getUrlProtocol(url) {
5661
- const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
5662
- return proto;
5574
+ function lookupCountryCode(token) {
5575
+ const uc = uppercase(token);
5576
+ return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
5663
5577
  }
5664
- function removeUrlProtocol(url) {
5665
- return stripBefore(url, "://");
5578
+ function asMapper(fn2) {
5579
+ const props = {
5580
+ kind: "Mapper",
5581
+ map: (from) => {
5582
+ return from.map(fn2);
5583
+ }
5584
+ };
5585
+ return createFnWithPropsExplicit(fn2, props);
5666
5586
  }
5667
- function ensurePath(val) {
5668
- const val2 = ensureLeading(val, "/");
5669
- return val === "" ? "" : stripTrailing(val2, "/");
5587
+ function createObjectMap() {
5588
+ return (map2) => {
5589
+ const fn2 = (input) => {
5590
+ return Object.keys(map2).reduce(
5591
+ (acc, key) => {
5592
+ const val = map2[key];
5593
+ return {
5594
+ ...acc,
5595
+ [key]: isFunction(val) ? val(input) : val
5596
+ };
5597
+ },
5598
+ {}
5599
+ );
5600
+ };
5601
+ return fn2;
5602
+ };
5670
5603
  }
5671
- function getUrlPath(url) {
5672
- return isUrl(url) ? ensurePath(
5673
- stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
5674
- ) : Never2;
5604
+ function createMapper() {
5605
+ return (fn2) => {
5606
+ return asMapper(fn2);
5607
+ };
5675
5608
  }
5676
- function getUrlQueryParams(url, specific = void 0) {
5677
- const qp = stripBefore(url, "?");
5678
- if (specific) {
5679
- return qp.includes(`${specific}=`) ? decodeURIComponent(
5680
- stripAfter(
5681
- stripBefore(qp, `${specific}=`),
5682
- "&"
5683
- ).replace(/\+/g, "%20")
5684
- ) : void 0;
5685
- }
5686
- return qp === "" ? qp : `?${qp}`;
5609
+ function mergeObjects(defVal, override) {
5610
+ return {
5611
+ ...defVal,
5612
+ ...override
5613
+ };
5687
5614
  }
5688
- function getUrlDefaultPort(url) {
5689
- const proto = getUrlProtocol(url);
5690
- return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
5615
+ function isUndefined(value) {
5616
+ return typeof value === "undefined";
5691
5617
  }
5692
- function getUrlPort(url, resolve = false) {
5693
- const re = /.*:(\d{2,3})/;
5694
- const match = url.match(re);
5695
- return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
5618
+ function mergeScalars(a, b) {
5619
+ return isUndefined(b) ? a : b;
5696
5620
  }
5697
- function getUrlSource(url) {
5698
- const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
5699
- return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
5621
+ function mergeTuples(a, b) {
5622
+ 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]);
5700
5623
  }
5701
- function getUrlBase(url) {
5702
- const path = getUrlPath(url);
5703
- const remaining = stripAfter(url, path);
5704
- return remaining;
5624
+ function never(val) {
5625
+ return val;
5705
5626
  }
5706
- function getUrlDynamics(url) {
5707
- const path = getUrlPath(url);
5708
- const qp = getUrlQueryParams(url);
5709
- const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
5710
- const segmentTypes = [
5711
- "string",
5712
- "number",
5713
- "boolean",
5714
- "Opt<string>",
5715
- "Opt<number>",
5716
- "Opt<boolean>"
5717
- ];
5718
- const pathVars = {};
5719
- const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
5720
- const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
5721
- const findPathNamed = infer(`<{{infer name}}>`);
5722
- for (const part of pathParts) {
5723
- const union4 = findPathUnion(part);
5724
- const typed = findPathTyped(part);
5725
- const named = findPathNamed(part);
5726
- if (union4) {
5727
- if (isVariable(union4.name) && isCsv(union4.union)) {
5728
- pathVars[union4.name] = `string(${union4.union})`;
5729
- }
5730
- } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
5731
- pathVars[typed.name] = typed.type;
5732
- } else if (named && isVariable(named.name)) {
5733
- pathVars[named.name] = "string";
5734
- }
5735
- }
5736
- const qpVars = {};
5737
- const qpParts = stripLeading(qp, "?").split("&");
5738
- for (const p of qpParts) {
5739
- const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
5740
- const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
5741
- const fixed = infer(`{{infer var}}={{infer val}}`)(p);
5742
- if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
5743
- qpVars[union4.var] = `string(${union4.params})`;
5744
- } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
5745
- qpVars[dynamic.var] = dynamic.val;
5746
- } else if (fixed && isVariable(fixed.var)) {
5747
- qpVars[fixed.var] = fixed.val;
5748
- }
5749
- }
5750
- return {
5751
- pathVars,
5752
- qpVars,
5753
- allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
5754
- ...pathVars,
5755
- ...qpVars
5756
- }
5757
- };
5627
+ function optional(value) {
5628
+ return value;
5758
5629
  }
5759
- function urlMeta(url) {
5630
+ function orNull(value) {
5631
+ return value;
5632
+ }
5633
+ function optionalOrNull(value) {
5634
+ return value;
5635
+ }
5636
+ function stripParenthesis(val) {
5637
+ return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
5638
+ }
5639
+ function sortKeyApi(order) {
5760
5640
  return {
5761
- url,
5762
- isUrl: isUrl(url),
5763
- protocol: getUrlProtocol(url),
5764
- path: getUrlPath(url),
5765
- queryParameters: getUrlQueryParams(url),
5766
- params: getUrlDynamics,
5767
- port: getUrlPort(url),
5768
- source: getUrlSource(url),
5769
- isIpAddress: isIpAddress(getUrlSource(url)),
5770
- isIp4Address: isIp4Address(getUrlSource(url)),
5771
- isIp6Address: isIp6Address(getUrlSource(url))
5641
+ order,
5642
+ toTop: (...keys) => sortKeyApi(
5643
+ [
5644
+ ...keys,
5645
+ ...order.filter((i) => !keys.includes(i))
5646
+ ]
5647
+ ),
5648
+ toBottom: (...keys) => sortKeyApi(
5649
+ [
5650
+ ...order.filter((i) => !keys.includes(i)),
5651
+ ...keys
5652
+ ]
5653
+ ),
5654
+ done: () => order
5772
5655
  };
5773
5656
  }
5774
- function getYouTubePageType(url) {
5775
- 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;
5657
+ function toKeyValue(obj, sort) {
5658
+ let keys = keysOf(obj);
5659
+ const tuple3 = [];
5660
+ if (sort) {
5661
+ keys = handleDoneFn(sort(sortKeyApi(keys)));
5662
+ }
5663
+ for (const k of keys) {
5664
+ tuple3.push({ key: k, value: obj[k] });
5665
+ }
5666
+ return tuple3;
5776
5667
  }
5777
- function youtubeEmbed(url) {
5778
- if (hasUrlQueryParameter(url, "v")) {
5779
- const id = getUrlQueryParams(url, "v");
5780
- return `https://www.youtube.com/embed/${id}`;
5781
- } else if (isYouTubeShareUrl(url)) {
5782
- const id = url.split("/").pop();
5783
- if (id) {
5784
- return `https://www.youtube.com/embed/${id}`;
5785
- } else {
5786
- throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
5787
- }
5788
- } else {
5789
- throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
5668
+ function convertScalar(val) {
5669
+ switch (typeof val) {
5670
+ case "number":
5671
+ return val;
5672
+ case "string":
5673
+ return Number(val);
5674
+ case "boolean":
5675
+ return val ? 1 : 0;
5676
+ default:
5677
+ throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
5790
5678
  }
5791
5679
  }
5792
- function youtubeMeta(url) {
5793
- return isYouTubeUrl(url) ? {
5794
- url,
5795
- isYouTubeUrl: true,
5796
- isShareUrl: isYouTubeShareUrl(url),
5797
- pageType: getYouTubePageType(url)
5798
- } : {
5799
- url,
5800
- isYouTubeUrl: false
5801
- };
5680
+ var convertList = (val) => val.map((i) => convertScalar(i));
5681
+ function toNumber(value) {
5682
+ return Array.isArray(value) ? convertList(value) : convertScalar(value);
5802
5683
  }
5803
- function queue(state) {
5804
- return {
5805
- queue: state,
5806
- size: state.length,
5807
- isEmpty() {
5808
- return state.length === 0;
5809
- },
5810
- clear() {
5811
- state.slice(0, 0);
5812
- },
5813
- drain() {
5814
- const old_state = [...state];
5815
- state.slice(0, 0);
5816
- return old_state;
5817
- },
5818
- push(...add) {
5819
- state.push(...add);
5820
- },
5821
- drop(quantity) {
5822
- if (quantity && quantity > state.length) {
5823
- throw new Error("Cannot drop more elements than present in the queue");
5824
- }
5825
- state.splice(0, quantity || 1);
5826
- },
5827
- take(quantity) {
5828
- if (quantity && quantity > state.length) {
5829
- throw new Error("Cannot take more elements than present in the queue");
5830
- }
5831
- const result2 = state.slice(0, quantity || 1);
5832
- state.splice(0, quantity || 1);
5833
- return result2;
5834
- },
5835
- *[Symbol.iterator]() {
5836
- for (let i = 0; i < state.length; i++) {
5837
- yield state[i];
5838
- }
5839
- }
5840
- };
5841
- }
5842
- function createFifoQueue(...list2) {
5843
- return queue([...list2]);
5844
- }
5845
- function queue2(state) {
5846
- return {
5847
- queue: state,
5848
- size: state.length,
5849
- isEmpty() {
5850
- return state.length === 0;
5851
- },
5852
- push(...add) {
5853
- state.push(...add);
5854
- },
5855
- drop(quantity) {
5856
- state.splice(-quantity);
5857
- },
5858
- clear() {
5859
- state.slice(0, 0);
5860
- },
5861
- drain() {
5862
- const old_state = [...state];
5863
- state.slice(0, 0);
5864
- return old_state;
5865
- },
5866
- take(quantity) {
5867
- const result2 = state.slice(-quantity);
5868
- state.splice(-quantity);
5869
- return result2;
5870
- },
5871
- *[Symbol.iterator]() {
5872
- for (let i = state.length - 1; i >= 0; i--) {
5873
- yield state[i];
5874
- }
5875
- }
5876
- };
5877
- }
5878
- function createLifoQueue(...list2) {
5879
- return queue2([...list2]);
5684
+ var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
5685
+ function removeTailwindModifiers(val) {
5686
+ return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
5880
5687
  }
5881
- var scalarToToken = identity({
5882
- string: "<<string>>",
5883
- number: "<<number>>",
5884
- boolean: "<<boolean>>",
5885
- true: "<<true>>",
5886
- false: "<<false>>",
5887
- null: "<<null>>",
5888
- undefined: "<<undefined>>",
5889
- unknown: "<<unknown>>",
5890
- any: "<<any>>",
5891
- never: "<<never>>"
5892
- });
5893
- function stringLiteral(str) {
5894
- return stripAfter(stripBefore(str, "string("), ")");
5688
+ function getTailwindModifiers(val) {
5689
+ return val.split(":").filter((i) => isTailwindModifier(i));
5895
5690
  }
5896
- function numericLiteral(str) {
5897
- return stripAfter(stripBefore(str, "number("), ")");
5691
+ function union(..._options) {
5692
+ return (value) => value;
5898
5693
  }
5899
- function handleOptional(token) {
5900
- const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
5901
- 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>>`;
5694
+ function unionize(value, _inUnionWith) {
5695
+ return value;
5902
5696
  }
5903
- function simpleScalarTokenToTypeToken(val) {
5904
- 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>>`;
5697
+ function hasWhiteSpace(val) {
5698
+ return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
5905
5699
  }
5906
- function unionNode(node) {
5907
- return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
5700
+ function endsWith(endingIn2) {
5701
+ return (val) => {
5702
+ return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
5703
+ };
5908
5704
  }
5909
- function union(nodes) {
5910
- return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
5705
+ function compare(base) {
5706
+ return (value) => {
5707
+ return base.includes(value);
5708
+ };
5911
5709
  }
5912
- var stripUnion = stripSurround("Union(", ")");
5913
- function simpleUnionTokenToTypeToken(val) {
5914
- return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union(stripUnion(val))} ]>>` : Never2;
5710
+ function isEqual(...base) {
5711
+ return compare(base);
5915
5712
  }
5916
- function simpleContainerTokenToTypeToken(_val) {
5713
+ function isLength(value, len) {
5714
+ return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
5917
5715
  }
5918
- function asTypeToken(_val) {
5919
- return "not ready";
5716
+ function isSameTypeOf(base) {
5717
+ return (compare2) => {
5718
+ return typeof base === typeof compare2;
5719
+ };
5920
5720
  }
5921
- function addToken(token, ...params) {
5922
- return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
5721
+ function isTuple(...tuple3) {
5722
+ const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
5723
+ return (v) => {
5724
+ return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
5725
+ };
5923
5726
  }
5924
- function boolean(literal2) {
5925
- return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
5727
+ function isTypeOf(type) {
5728
+ return (value) => {
5729
+ return typeof value === type;
5730
+ };
5926
5731
  }
5927
- var unknown = () => "<<unknown>>";
5928
- var undefinedType = () => "<<undefined>>";
5929
- var nullType = () => "<<null>>";
5930
- function fn(..._args) {
5931
- return {
5932
- returns: (_rtn) => ({
5933
- addProperties: (_kv) => {
5934
- return null;
5935
- },
5936
- done: () => {
5937
- return null;
5938
- }
5939
- }),
5940
- done: () => {
5941
- const result2 = null;
5942
- return result2;
5943
- }
5732
+ function startsWith(startingWith) {
5733
+ return (val) => {
5734
+ return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
5944
5735
  };
5945
5736
  }
5946
- function dictionary(_obj) {
5947
- return null;
5737
+ function isHtmlElement(val) {
5738
+ return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
5948
5739
  }
5949
- function tuple2(..._elements) {
5950
- return null;
5740
+ function isAlpha(value) {
5741
+ return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
5951
5742
  }
5952
- function regexToken(re, ...rep) {
5953
- let exp = "";
5954
- if (isString(re)) {
5955
- try {
5956
- const test = new RegExp(re);
5957
- if (!isRegExp(test)) {
5958
- const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
5959
- err.name = "InvalidRegEx";
5960
- throw err;
5961
- } else {
5962
- exp = re;
5963
- }
5964
- } catch {
5965
- const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
5966
- err.name = "InvalidRegEx";
5967
- throw err;
5968
- }
5969
- } else if (isRegExp(re)) {
5970
- exp = re.toString();
5971
- }
5972
- const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
5973
- return token;
5743
+ function isArray(value) {
5744
+ return Array.isArray(value) === true;
5974
5745
  }
5975
- function addSingleton(token, api2) {
5976
- return (...literals) => {
5977
- return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
5978
- "union",
5979
- literals.map((l) => addToken(token, `${l}`)).join(",")
5980
- );
5981
- };
5746
+ function isBoolean(value) {
5747
+ return typeof value === "boolean";
5982
5748
  }
5983
- var stringApi = {
5984
- startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
5985
- endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
5986
- zip: () => addToken("string-set", "Zip5"),
5987
- zipPlus4: () => addToken("string-set", "Zip5_4"),
5988
- zipCode: () => addToken("string-set", "ZipCode"),
5989
- militaryTime: (resolution) => {
5990
- return addToken(
5991
- "string-set",
5992
- "militaryTime",
5993
- resolution || "HH:MM"
5994
- );
5995
- },
5996
- civilianTime: (resolution) => {
5997
- return addToken(
5998
- "string-set",
5999
- "militaryTime",
6000
- resolution || "HH:MM"
6001
- );
6002
- },
6003
- numericString: () => addToken("string-set", "numeric"),
6004
- ipv4Address: () => addToken("string-set", "ipv4Address"),
6005
- ipv6Address: () => addToken("string-set", "ipv6Address"),
6006
- regex: (exp, ...literalRepresentation) => {
6007
- const token = regexToken(exp, ...literalRepresentation);
6008
- return token;
6009
- },
6010
- done: () => addToken("string")
6011
- };
6012
- var string22 = addSingleton("string", stringApi);
6013
- var number = addSingleton("number");
6014
- function union2(...elements) {
6015
- const result2 = elements.map((_el) => {
6016
- });
6017
- return result2;
5749
+ function isBooleanLike(val) {
5750
+ return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
6018
5751
  }
6019
- function record(_key, _value) {
6020
- return null;
5752
+ function isConstant(value) {
5753
+ return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
6021
5754
  }
6022
- function array(_type) {
6023
- return null;
5755
+ function isContainer(value) {
5756
+ return !!(Array.isArray(value) || isObject(value));
6024
5757
  }
6025
- function set(_type) {
6026
- return null;
5758
+ var tokens = [
5759
+ "1",
5760
+ "inherit",
5761
+ "initial",
5762
+ "revert",
5763
+ "revert-layer",
5764
+ "unset",
5765
+ "auto"
5766
+ ];
5767
+ var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
5768
+ function isCssAspectRatio(val) {
5769
+ return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
6027
5770
  }
6028
- function map(_key, _value) {
6029
- return null;
5771
+ function isCsv(val) {
5772
+ return isString(val) && val.includes(",") && !val.startsWith(",");
6030
5773
  }
6031
- function weakMap(_key, _value) {
6032
- return null;
5774
+ function isDefined(value) {
5775
+ return value !== void 0;
6033
5776
  }
6034
- function isAddOrDone(val) {
6035
- return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
5777
+ function isDoneFn(val) {
5778
+ return hasKeys("done")(val) && typeof val.done === "function";
6036
5779
  }
6037
- var ShapeApiImplementation = {
6038
- string: string22,
6039
- number,
6040
- boolean,
6041
- unknown,
6042
- undefined: undefinedType,
6043
- null: nullType,
6044
- union: union2,
6045
- fn,
6046
- record,
6047
- array,
6048
- set,
6049
- map,
6050
- weakMap,
6051
- dictionary,
6052
- tuple: tuple2
6053
- };
6054
- function shape(cb) {
6055
- const rtn = cb(ShapeApiImplementation);
6056
- return handleDoneFn(
6057
- isAddOrDone(rtn) ? rtn.done() : rtn
6058
- );
5780
+ function isEmail(val) {
5781
+ if (!isString(val)) {
5782
+ return false;
5783
+ }
5784
+ const parts = val?.split("@");
5785
+ const domain = parts[1]?.split(".");
5786
+ const tld = domain ? domain.pop() : "";
5787
+ const firstChar = val[0].toLowerCase();
5788
+ return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
6059
5789
  }
6060
- function isShape(v) {
6061
- return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
5790
+ function isEmpty(val) {
5791
+ return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
6062
5792
  }
6063
- function asDefineObject(defn) {
6064
- const result2 = Object.keys(defn).reduce(
6065
- (acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
6066
- ...acc,
6067
- [i]: handleDoneFn(defn[i](ShapeApiImplementation))
6068
- } : isFunction(defn[i]) ? {
6069
- ...acc,
6070
- [i]: handleDoneFn(defn[i](ShapeApiImplementation))
6071
- } : Never2,
6072
- {}
6073
- );
6074
- return result2;
5793
+ function isNotEmpty(val) {
5794
+ return !(isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && (val?.length === 0 || val?.length === void 0));
6075
5795
  }
6076
- function asType(...token) {
6077
- 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);
5796
+ function isErrorCondition(value, kind = null) {
5797
+ return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
6078
5798
  }
6079
- function asStringLiteral(...values) {
6080
- return values.map((i) => i);
5799
+ function isFalse(i) {
5800
+ return typeof i === "boolean" && !i;
6081
5801
  }
6082
- var choices = "NOT READY";
6083
- function doesExtend(type) {
6084
- return (val) => {
6085
- let response = false;
6086
- if (isString(val)) {
6087
- if (type === "string") {
6088
- response = true;
6089
- }
6090
- if (type.startsWith("string(")) {
6091
- const literals = stripAfter(
6092
- stripBefore(type, "string("),
6093
- ")"
6094
- ).split(/,\s*/);
6095
- if (literals.includes(val)) {
6096
- response = true;
6097
- }
6098
- }
6099
- }
6100
- if (isNumber(val)) {
6101
- if (type === "number") {
6102
- response = true;
6103
- }
6104
- if (type.startsWith("number(")) {
6105
- const literals = stripAfter(
6106
- stripBefore(type, "number("),
6107
- ")"
6108
- ).split(/,\s*/).map(Number);
6109
- if (literals.includes(val)) {
6110
- response = true;
6111
- }
6112
- }
6113
- }
6114
- if (isNull(val) && (type === "null" || type === "Opt<null>")) {
6115
- response = true;
6116
- }
6117
- if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
6118
- response = true;
6119
- }
6120
- if (isBoolean(val)) {
6121
- if (type === "boolean") {
6122
- response = true;
6123
- }
6124
- if (type === "true" && val === true || type === "false" && val === false) {
6125
- response = true;
6126
- }
6127
- }
6128
- if (isNarrowableObject(val)) {
6129
- if (type === "Dict" || type === "Dict<string, unknown>") {
6130
- response = true;
6131
- }
6132
- if (startsWith("Dict<")(type)) {
6133
- const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
6134
- if (match) {
6135
- const { value } = match;
6136
- const isOpt = value.includes(`Opt<`);
6137
- const values = objectValues(val);
6138
- 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>") {
6139
- response = true;
6140
- }
6141
- }
6142
- }
6143
- }
6144
- if (isArray(val)) {
6145
- if (type === "Array" || type === "Array<unknown>") {
6146
- return true;
6147
- }
6148
- 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)) {
6149
- response = true;
6150
- }
6151
- }
6152
- if (isMap(val)) {
6153
- 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)) {
6154
- response = true;
6155
- }
5802
+ function isFalsy(val) {
5803
+ return FALSY_VALUES2.includes(val);
5804
+ }
5805
+ function isFnWithParams(input, ...params) {
5806
+ return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
5807
+ }
5808
+ function isHexadecimal(val) {
5809
+ return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
5810
+ }
5811
+ function isIndexable(value) {
5812
+ return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
5813
+ }
5814
+ function isInlineSvg(v) {
5815
+ return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
5816
+ }
5817
+ function isMap(val) {
5818
+ return val instanceof Map;
5819
+ }
5820
+ function isNever(val) {
5821
+ return isConstant(val) && val.kind === "never";
5822
+ }
5823
+ function isNothing(val) {
5824
+ return !!(val === null || val === void 0);
5825
+ }
5826
+ function isNotNull(value) {
5827
+ return value === null;
5828
+ }
5829
+ function isNull(value) {
5830
+ return value === null;
5831
+ }
5832
+ function maybePhoneNumber(val) {
5833
+ const svelte = String(val).trim();
5834
+ const chars = svelte.split("");
5835
+ const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
5836
+ const valid2 = ["+", "(", ...NUMERIC_CHAR2];
5837
+ const nothing = stripChars(svelte, ...[
5838
+ ...NUMERIC_CHAR2,
5839
+ ...WHITESPACE_CHARS2,
5840
+ "(",
5841
+ ")",
5842
+ "+",
5843
+ ".",
5844
+ "-"
5845
+ ]);
5846
+ return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
5847
+ }
5848
+ var start = PHONE_COUNTRY_CODES2.map((i) => `+${i[0]} `);
5849
+ function hasCountryCode(val) {
5850
+ if (isString(val)) {
5851
+ return start.some((i) => val.trimStart().startsWith(i));
5852
+ }
5853
+ return false;
5854
+ }
5855
+ function isUsPhoneNumber(val) {
5856
+ if (isString(val)) {
5857
+ return maybePhoneNumber(val) && val.trimStart().startsWith(`+1 `);
5858
+ }
5859
+ return false;
5860
+ }
5861
+ function isPhoneNumber(val) {
5862
+ if (isString(val) && maybePhoneNumber(val) && [" ", "-", "."].some((i) => val.includes(i))) {
5863
+ const cc = getPhoneCountryCode(val);
5864
+ const without = cc === "" ? retainChars(val, ...NUMERIC_CHAR2) : retainChars(val.trimStart().replace(`+${cc} `, ""), ...NUMERIC_CHAR2);
5865
+ switch (cc) {
5866
+ case "1":
5867
+ return without.length === 10;
5868
+ case "44":
5869
+ return !![10, 11].includes(without.length);
5870
+ case "":
5871
+ return without.length <= 10;
5872
+ default:
5873
+ return without.length <= 11;
6156
5874
  }
6157
- if (isSetContainer(val)) {
6158
- 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))) {
6159
- response = true;
6160
- }
5875
+ }
5876
+ return false;
5877
+ }
5878
+ function isReadonlyArray(value) {
5879
+ return Array.isArray(value) === true;
5880
+ }
5881
+ function isRef(value) {
5882
+ return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
5883
+ }
5884
+ function isRegExp(val) {
5885
+ return val instanceof RegExp;
5886
+ }
5887
+ function isLikeRegExp(val) {
5888
+ if (isRegExp(val)) {
5889
+ return true;
5890
+ }
5891
+ if (isString(val)) {
5892
+ try {
5893
+ const _re = new RegExp(val);
5894
+ return true;
5895
+ } catch {
5896
+ return false;
6161
5897
  }
6162
- return response;
6163
- };
5898
+ }
5899
+ return false;
5900
+ }
5901
+ function isSymbol(value) {
5902
+ return typeof value === "symbol";
5903
+ }
5904
+ function isScalar(value) {
5905
+ return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
5906
+ }
5907
+ function isSet(val) {
5908
+ return isObject(val) ? val.kind !== "Unset" : true;
5909
+ }
5910
+ function isSetContainer(val) {
5911
+ return val instanceof Set;
5912
+ }
5913
+ function isStringArray(val) {
5914
+ return Array.isArray(val) && val.every((i) => isString(i));
5915
+ }
5916
+ function isThenable(val) {
5917
+ return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
5918
+ }
5919
+ function isTrimable(val) {
5920
+ return isString(val) && val !== val.trim();
5921
+ }
5922
+ function isTrue(value) {
5923
+ return value === true;
5924
+ }
5925
+ function isTruthy(val) {
5926
+ return !FALSY_VALUES2.includes(val);
5927
+ }
5928
+ function isTypeSubtype(val) {
5929
+ return isString(val) && val.split("/").length === 2;
5930
+ }
5931
+ function isTypeTuple(value) {
5932
+ return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
5933
+ }
5934
+ function isUnset(val) {
5935
+ return isObject(val) && val.kind === "Unset";
5936
+ }
5937
+ function isUri(val, ...protocols) {
5938
+ const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
5939
+ return isString(val) && p.some((i) => val.startsWith(`${i}://`));
5940
+ }
5941
+ function isUrl(val, ...protocols) {
5942
+ const p = protocols.length === 0 ? ["http", "https"] : protocols;
5943
+ return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6164
5944
  }
6165
- function ip6Prefix(...groups) {
6166
- const empty = addToken("string");
6167
- const count = 4 - groups.length;
6168
- const fillIn = [];
6169
- for (let index = 0; index < count; index++) {
6170
- fillIn.push(empty);
6171
- }
6172
- return [
6173
- "<<string::",
6174
- [
6175
- groups.join(":"),
6176
- fillIn.join(":")
6177
- ].join(":"),
6178
- ">>"
6179
- ].join("");
5945
+ var VALID = [
5946
+ ...ALPHA_CHARS2,
5947
+ ...NUMERIC_CHAR2,
5948
+ "_",
5949
+ "."
5950
+ ];
5951
+ var alpha = null;
5952
+ function valid(chars) {
5953
+ return chars.every((i) => VALID.includes(i));
6180
5954
  }
6181
- function createProxy(...initialize) {
6182
- const state = initialize;
6183
- state.id = null;
6184
- const proxy = new Proxy(state, {});
6185
- Object.defineProperty(proxy, "id", {
6186
- enumerable: false
6187
- });
6188
- return proxy;
5955
+ function isVariable(val) {
5956
+ return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
6189
5957
  }
6190
- function list(...init) {
6191
- return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
5958
+ function separate(s) {
5959
+ return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
6192
5960
  }
6193
- function singletonApi(kind) {
6194
- return {
6195
- wide: () => `<<${kind}>>`,
6196
- literal: (val) => `<<${kind}::${val}>>`
6197
- };
5961
+ function isAreaMetric(val) {
5962
+ return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6198
5963
  }
6199
- function setApi(_variant) {
6200
- return null;
5964
+ function isLuminosityMetric(val) {
5965
+ return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6201
5966
  }
6202
- function fnReturnsApi(variant, _params, returns) {
6203
- return isSet(returns) ? null : (_rtn) => {
6204
- return isSet(returns) ? `<<${variant}::>>` : null;
6205
- };
5967
+ function isResistance(val) {
5968
+ return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6206
5969
  }
6207
- function fnParamsApi(variant, params, _returns) {
6208
- return isSet(params) ? null : (params2) => {
6209
- return isSet(params2) ? `<<${variant}::>>` : null;
6210
- };
5970
+ function isCurrentMetric(val) {
5971
+ return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6211
5972
  }
6212
- function fnDoneApi(variant, params, returns) {
6213
- return isUnset(params) && isUnset(returns) ? `<<` : ``;
5973
+ function isVoltageMetric(val) {
5974
+ return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6214
5975
  }
6215
- function fnTokenClosure(kind, params, returns) {
6216
- return {
6217
- done: fnDoneApi(kind, params, returns),
6218
- params: fnParamsApi(kind, params, returns),
6219
- returns: fnReturnsApi(kind, params, returns)
6220
- };
5976
+ function isFrequencyMetric(val) {
5977
+ return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6221
5978
  }
6222
- function createTypeToken(kind) {
6223
- return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
5979
+ function isPowerMetric(val) {
5980
+ return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6224
5981
  }
6225
- function fromDefineObject(defn) {
6226
- return defn;
5982
+ function isTimeMetric(val) {
5983
+ return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6227
5984
  }
6228
- function getTokenKind(token) {
6229
- const bare = stripSurround("<<", ">>")(token);
6230
- const parts = bare.split("::");
6231
- const kind = parts.pop();
6232
- return kind;
5985
+ function isEnergyMetric(val) {
5986
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6233
5987
  }
6234
- var simpleToken = (token) => token;
6235
- var simpleScalarToken = (token) => token;
6236
- var simpleContainerToken = (token) => token;
6237
- function simpleScalarType(token) {
6238
- const value = simpleScalarToken(token);
6239
- return value;
5988
+ function isPressureMetric(val) {
5989
+ return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6240
5990
  }
6241
- function simpleContainerType(token) {
6242
- const value = simpleContainerToken(token);
6243
- return value;
5991
+ function isTemperatureMetric(val) {
5992
+ return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6244
5993
  }
6245
- function simpleType(token) {
6246
- const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
6247
- return value;
5994
+ function isVolumeMetric(val) {
5995
+ return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6248
5996
  }
6249
- function hasOverlappingKeys(a, b) {
6250
- const keys = Object.keys(a);
6251
- for (const k of keys) {
6252
- if (k in b) {
6253
- return true;
6254
- }
6255
- }
6256
- return false;
5997
+ function isAccelerationMetric(val) {
5998
+ return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6257
5999
  }
6258
- function uniqueKeys(left, right) {
6259
- const isNumeric = !!(isArray(left) && isArray(right));
6260
- if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
6261
- 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!");
6262
- }
6263
- const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
6264
- const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
6265
- if (isNumeric) {
6266
- throw new Error("uniqueKeys does not yet work with tuples");
6267
- }
6268
- const leftKeys = l.filter((i) => !r.includes(i));
6269
- const rightKeys = r.filter((i) => !l.includes(i));
6270
- return [
6271
- "LeftRight",
6272
- leftKeys,
6273
- rightKeys
6274
- ];
6000
+ function isSpeedMetric(val) {
6001
+ const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
6002
+ return isString(val) && speed.includes(separate(val));
6275
6003
  }
6276
- function asChars(str) {
6277
- return str.split("");
6004
+ function isMassMetric(val) {
6005
+ return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6278
6006
  }
6279
- function asRecord(obj) {
6280
- return obj;
6007
+ function isDistanceMetric(val) {
6008
+ return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6281
6009
  }
6282
- function asString(value) {
6283
- return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
6010
+ function isMetric(val) {
6011
+ 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);
6284
6012
  }
6285
- function isFunction(value) {
6286
- return typeof value === "function";
6013
+ function isAreaUom(val) {
6014
+ return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6287
6015
  }
6288
- function isObject(value) {
6289
- return typeof value === "object" && value !== null && Array.isArray(value) === false;
6016
+ function isLuminosityUom(val) {
6017
+ return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6290
6018
  }
6291
- function isNarrowableObject(value) {
6292
- return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
6019
+ function isResistanceUom(val) {
6020
+ return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6293
6021
  }
6294
- function isEscapeFunction(val) {
6295
- return isFunction(val) && "escape" in val && val.escape === true;
6022
+ function isCurrentUom(val) {
6023
+ return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6296
6024
  }
6297
- function isOptionalParamFunction(val) {
6298
- return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
6025
+ function isVoltageUom(val) {
6026
+ return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6299
6027
  }
6300
- function isApi(api2) {
6301
- return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
6028
+ function isFrequencyUom(val) {
6029
+ return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6302
6030
  }
6303
- function isApiSurface(val) {
6304
- return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
6031
+ function isPowerUom(val) {
6032
+ return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6305
6033
  }
6306
- function isDate(val) {
6307
- return val instanceof Date;
6034
+ function isTimeUom(val) {
6035
+ return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6308
6036
  }
6309
- function isIsoDateTime(val) {
6310
- if (!isString(val)) {
6311
- return false;
6312
- }
6313
- 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})?$/;
6314
- if (!ISO_DATETIME_REGEX.test(val)) {
6315
- return false;
6316
- }
6317
- const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
6318
- const [year, month, day, hours, minutes, seconds] = matches.map(Number);
6319
- if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
6320
- return false;
6321
- }
6322
- if (month < 1 || month > 12) {
6323
- return false;
6324
- }
6325
- ;
6326
- const daysInMonth = new Date(year, month, 0).getDate();
6327
- if (day < 1 || day > daysInMonth) {
6328
- return false;
6329
- }
6330
- ;
6331
- const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
6332
- if (tzMatch) {
6333
- const [_2, _sign, tzHours, tzMinutes] = tzMatch;
6334
- const numHours = Number.parseInt(tzHours, 10);
6335
- const numMinutes = Number.parseInt(tzMinutes, 10);
6336
- if (numHours > 14 || numMinutes > 59) {
6337
- return false;
6338
- }
6339
- if (numHours === 14 && numMinutes > 0) {
6340
- return false;
6341
- }
6342
- }
6343
- return true;
6037
+ function isEnergyUom(val) {
6038
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6344
6039
  }
6345
- function isIsoExplicitDate(val) {
6346
- if (isString(val)) {
6347
- const parts = val.split("-").map((i) => Number(i));
6348
- 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;
6349
- } else {
6350
- return false;
6351
- }
6040
+ function isPressureUom(val) {
6041
+ return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6352
6042
  }
6353
- function isIsoImplicitDate(val) {
6354
- if (isString(val) && val.length === 8 && isNumberLike(val)) {
6355
- const year = Number(val.slice(0, 4));
6356
- const month = Number(val.slice(4, 6));
6357
- const date = Number(val.slice(6, 8));
6358
- return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
6359
- } else {
6360
- return false;
6361
- }
6043
+ function isTemperatureUom(val) {
6044
+ return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6362
6045
  }
6363
- function isIsoDate(val) {
6364
- if (isString(val)) {
6365
- return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
6366
- } else {
6367
- return false;
6368
- }
6046
+ function isVolumeUom(val) {
6047
+ return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6369
6048
  }
6370
- function isIsoExplicitTime(val) {
6371
- if (isString(val)) {
6372
- const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
6373
- return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
6374
- } else {
6375
- return false;
6376
- }
6049
+ function isAccelerationUom(val) {
6050
+ return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6051
+ }
6052
+ function isSpeedUom(val) {
6053
+ return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6377
6054
  }
6378
- function isIsoImplicitTime(val) {
6379
- if (isString(val)) {
6380
- const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
6381
- return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
6382
- } else {
6383
- return false;
6384
- }
6055
+ function isMassUom(val) {
6056
+ return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6385
6057
  }
6386
- function isIsoTime(val) {
6387
- return isIsoExplicitTime(val) || isIsoImplicitTime(val);
6058
+ function isDistanceUom(val) {
6059
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6388
6060
  }
6389
- function isIsoYear(val) {
6390
- return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
6061
+ function isUom(val) {
6062
+ 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);
6391
6063
  }
6392
- function isLuxonDateTime(val) {
6393
- 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";
6064
+ function isIp4Address(val) {
6065
+ return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
6394
6066
  }
6395
- function isMoment(val) {
6396
- if (val instanceof Date) {
6397
- return false;
6398
- }
6399
- 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";
6067
+ function isIp6Address(val) {
6068
+ const expanded = isString(val) ? ip6GroupExpansion(val) : "";
6069
+ return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
6400
6070
  }
6401
- function isThisMonth(val) {
6402
- const now = /* @__PURE__ */ new Date();
6403
- const currentYear = now.getFullYear();
6404
- const currentMonth = now.getMonth() + 1;
6405
- if (val instanceof Date) {
6406
- return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
6407
- }
6408
- if (isMoment(val)) {
6409
- const monthValue = val.month();
6410
- return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
6411
- }
6412
- if (isLuxonDateTime(val)) {
6413
- return val.year === currentYear && val.month === currentMonth;
6414
- }
6415
- if (typeof val === "string") {
6416
- 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))?$/;
6417
- if (!isoDateRegex.test(val)) {
6418
- return false;
6419
- }
6420
- const dateMatch = val.match(/^(\d{4})-(\d{2})/);
6421
- if (dateMatch) {
6422
- const year = Number.parseInt(dateMatch[1], 10);
6423
- const month = Number.parseInt(dateMatch[2], 10);
6424
- return year === currentYear && month === currentMonth;
6425
- }
6426
- }
6427
- return false;
6071
+ function isIpAddress(val) {
6072
+ return isIp4Address(val) || isIp6Address(val);
6428
6073
  }
6429
- function isThisWeek(date) {
6430
- const targetDate = asDate(date);
6431
- if (!targetDate) {
6432
- return false;
6433
- }
6434
- const currentWeek = getWeekNumber();
6435
- const targetWeek = getWeekNumber(targetDate);
6436
- return currentWeek === targetWeek;
6074
+ function hasUrlPort(val) {
6075
+ return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
6437
6076
  }
6438
- function isThisYear(val) {
6439
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
6440
- if (isObject(val) || isNumber(val) || isString(val)) {
6441
- const date = asDate(val);
6442
- if (date) {
6443
- return date.getFullYear() === currentYear;
6444
- } else {
6445
- return false;
6446
- }
6447
- }
6448
- return false;
6077
+ function isUrlPath(val) {
6078
+ return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
6079
+ (c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
6080
+ );
6449
6081
  }
6450
- function isToday(test) {
6451
- if (isString(test)) {
6452
- const justDate = stripAfter(test, "T");
6453
- return isIsoExplicitDate(justDate) && justDate === getToday();
6454
- } else if (isMoment(test) || isDate(test)) {
6455
- return stripAfter(test.toISOString(), "T") === getToday();
6456
- } else if (isLuxonDateTime(test)) {
6457
- return stripAfter(test.toISO(), "T") === getToday();
6458
- }
6459
- return false;
6082
+ function isDomainName(val) {
6083
+ 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(
6084
+ (i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
6085
+ );
6460
6086
  }
6461
- function isTomorrow(test) {
6462
- if (isString(test)) {
6463
- const justDate = stripAfter(test, "T");
6464
- return isIsoExplicitDate(justDate) && justDate === getTomorrow();
6465
- } else if (isMoment(test) || isDate(test)) {
6466
- return stripAfter(test.toISOString(), "T") === getTomorrow();
6467
- } else if (isLuxonDateTime(test)) {
6468
- return stripAfter(test.toISO(), "T") === getTomorrow();
6469
- }
6470
- return false;
6087
+ function isUrlSource(val) {
6088
+ return isDomainName(val) || isIpAddress(val);
6471
6089
  }
6472
- function isYesterday(test) {
6473
- if (isString(test)) {
6474
- const justDate = stripAfter(test, "T");
6475
- return isIsoExplicitDate(justDate) && justDate === getYesterday();
6476
- } else if (isMoment(test) || isDate(test)) {
6477
- return stripAfter(test.toISOString(), "T") === getYesterday();
6478
- } else if (isLuxonDateTime(test)) {
6479
- return stripAfter(test.toISO(), "T") === getYesterday();
6480
- }
6481
- return false;
6090
+ function hasUrlQueryParameter(val, prop) {
6091
+ return isString(getUrlQueryParams(val, prop));
6482
6092
  }
6483
- function isVisa(val) {
6484
- if (isString(val) && val.startsWith("4")) {
6485
- const parts = val.split(" ");
6486
- return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4);
6487
- }
6488
- return false;
6093
+ function isNumericArray(val) {
6094
+ return Array.isArray(val) && val.every((i) => isNumber(i));
6489
6095
  }
6490
- function isMastercard(val) {
6491
- if (isString(val) && val.startsWith("4")) {
6492
- const parts = val.split(" ");
6493
- return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4) && ["51", "55", "22", "23", "24", "25", "26", "27"].some((i) => val.startsWith(i));
6494
- }
6495
- return false;
6096
+ function hasProtocol(val, ...protocols) {
6097
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
6496
6098
  }
6497
- function isVisaMastercard(val) {
6498
- return isVisa(val) || isMastercard(val);
6099
+ function isProtocol(val, ...protocols) {
6100
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
6499
6101
  }
6500
- function isAmericanExpress(val) {
6501
- if (isString(val)) {
6502
- const parts = val.split(" ");
6503
- return parts.length === 3 && parts.every(
6504
- (i) => isNumberLike(i) && parts[0].length === 4 && parts[1].length === 6
6505
- );
6506
- }
6507
- return false;
6102
+ function hasProtocolPrefix(val, ...protocols) {
6103
+ 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));
6508
6104
  }
6509
- function isCreditCard(val) {
6510
- return isVisaMastercard(val) || isAmericanExpress(val);
6105
+ function isProtocolPrefix(val, ...protocols) {
6106
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
6511
6107
  }
6512
- function cardType(cardNumber) {
6513
- const cleanedNumber = String(cardNumber).replace(/\D/g, "");
6514
- const length = cleanedNumber.length;
6515
- if (!isValidLength(length)) {
6516
- return "invalid";
6517
- }
6518
- if (!luhnCheck(cleanedNumber)) {
6519
- return "invalid";
6520
- }
6521
- const cardTypes = [
6522
- { name: "Visa", lengths: [16], prefixes: [/^4/] },
6523
- { name: "Mastercard", lengths: [16], prefixes: [/^(51|52|53|54|55|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)/] },
6524
- { name: "American Express", lengths: [15], prefixes: [/^3[47]/] },
6525
- { name: "Discover", lengths: [16], prefixes: [/^(6011|622(12[6-9]|1[3-9]\d|2[0-4]\d|25\d|6[4-9]|7[0-4]|8[0-4]|9\d)|64[4-9]|65)/] },
6526
- { name: "JCB", lengths: [16], prefixes: [/^(35|2131|1800)/] },
6527
- { name: "Diners Club", lengths: [14, 16], prefixes: [/^(30[0-5]|36|38)/] },
6528
- { name: "China UnionPay", lengths: [16, 17, 18, 19], prefixes: [/^(62|88)/] },
6529
- { name: "Maestro", lengths: [12, 13, 14, 15, 16, 17, 18, 19], prefixes: [/^(5018|5020|5038|6304)/] },
6530
- { name: "Solo", lengths: [16, 18, 19], prefixes: [/^(6334|6767)/] }
6531
- ];
6532
- for (const type of cardTypes) {
6533
- if (type.lengths.includes(length)) {
6534
- for (const prefix of type.prefixes) {
6535
- if (prefix.test(cleanedNumber)) {
6536
- return type.name;
6108
+ function isTypeToken(val, kind) {
6109
+ if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
6110
+ const stripped = stripSurround("<<", ">>")(val);
6111
+ if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
6112
+ if (kind) {
6113
+ if (isAtomicKind(kind)) {
6114
+ return val === `<<${kind}>>`;
6115
+ } else if (isSetBasedKind(kind)) {
6116
+ return val.startsWith(`<<${kind}::`);
6117
+ } else {
6118
+ return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
6537
6119
  }
6120
+ } else {
6121
+ return true;
6538
6122
  }
6539
6123
  }
6124
+ return false;
6540
6125
  }
6541
- return "invalid";
6126
+ return false;
6542
6127
  }
6543
- function isValidLength(length) {
6544
- const validLengths = [13, 14, 15, 16, 17, 18, 19];
6545
- return validLengths.includes(length);
6128
+ function isTypeTokenKind(val) {
6129
+ return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
6546
6130
  }
6547
- function luhnCheck(num) {
6548
- let sum = 0;
6549
- let double = false;
6550
- for (let i = num.length - 1; i >= 0; i--) {
6551
- let n = Number.parseInt(num.charAt(i), 10);
6552
- if (double) {
6553
- n *= 2;
6554
- if (n > 9) {
6555
- n -= 9;
6556
- }
6557
- }
6558
- sum += n;
6559
- double = !double;
6560
- }
6561
- return sum % 10 === 0;
6131
+ function isAtomicToken(val) {
6132
+ return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
6562
6133
  }
6563
- function isString(value) {
6564
- return typeof value === "string";
6134
+ function isAtomicKind(val) {
6135
+ return isString(val) && TT_ATOMICS2.includes(val);
6565
6136
  }
6566
- function isIso3166Alpha2(val) {
6567
- const codes = ISO3166_12.map((i) => i.alpha2);
6568
- return isString(val) && codes.includes(val);
6137
+ function isObjectToken(val) {
6138
+ return isTypeToken(val, "obj");
6569
6139
  }
6570
- function isCountryCode2(val) {
6571
- const codes = ISO3166_12.map((i) => i.alpha2);
6572
- return isString(val) && codes.includes(val);
6140
+ function isRecordToken(val) {
6141
+ return isTypeToken(val, "rec");
6573
6142
  }
6574
- function isIso3166Alpha3(val) {
6575
- const codes = ISO3166_12.map((i) => i.alpha3);
6576
- return isString(val) && codes.includes(val);
6143
+ function isTupleToken(val) {
6144
+ return isTypeToken(val, "tuple");
6577
6145
  }
6578
- function isCountryCode3(val) {
6579
- const codes = ISO3166_12.map((i) => i.alpha3);
6580
- return isString(val) && codes.includes(val);
6146
+ function isArrayToken(val) {
6147
+ return isTypeToken(val, "arr");
6581
6148
  }
6582
- function isIso3166CountryCode(val) {
6583
- const codes = ISO3166_12.map((i) => i.countryCode);
6584
- return isString(val) && codes.includes(val);
6149
+ function isMapToken(val) {
6150
+ return isTypeToken(val, "map");
6151
+ }
6152
+ function isSetToken(val) {
6153
+ return isTypeToken(val, "set");
6154
+ }
6155
+ function isContainerToken(val) {
6156
+ return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
6157
+ }
6158
+ function isShapeCallback(val) {
6159
+ return isFunction(val) && val.kind === "shape";
6585
6160
  }
6586
- function isCountryAbbrev(val) {
6587
- return isCountryCode2(val) || isCountryCode3(val);
6161
+ var token_types = [
6162
+ ...TT_ATOMICS2,
6163
+ ...TT_CONTAINERS2,
6164
+ ...TT_FUNCTIONS2,
6165
+ ...TT_SETS2,
6166
+ ...TT_SINGLETONS2
6167
+ ];
6168
+ function isShapeToken(val) {
6169
+ return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
6588
6170
  }
6589
- function isIso3166CountryName(val) {
6590
- const codes = ISO3166_12.map((i) => i.name);
6591
- return isString(val) && codes.includes(val);
6171
+ var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
6172
+ var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
6173
+ function isSimpleToken(val) {
6174
+ return isString(val) && split_tokens.some(
6175
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6176
+ );
6592
6177
  }
6593
- function isCountryName(val) {
6594
- const codes = ISO3166_12.map((i) => i.name);
6595
- return isString(val) && codes.includes(val);
6178
+ function isSimpleScalarToken(val) {
6179
+ return isString(val) && scalar_split_tokens.some(
6180
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6181
+ );
6596
6182
  }
6597
- var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
6598
- var NAME = US_STATE_LOOKUP2.map((i) => i.name);
6599
- function isUsStateAbbreviation(val) {
6600
- return isString(val) && ABBREV.includes(val);
6183
+ function isSimpleContainerToken(val) {
6184
+ return isString(val) && scalar_split_tokens.some(
6185
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6186
+ );
6601
6187
  }
6602
- function isUsStateName(val) {
6603
- return isString(val) && NAME.includes(val);
6188
+ function isSimpleTokenTuple(val) {
6189
+ return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
6604
6190
  }
6605
- function isNumericString(value) {
6606
- const numericChars = [...NUMERIC_CHAR2];
6607
- return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
6191
+ function isSimpleScalarTokenTuple(val) {
6192
+ return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
6608
6193
  }
6609
- function isNumberLike(value) {
6610
- const numericChars = [...NUMERIC_CHAR2];
6611
- return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
6194
+ function isSimpleContainerTokenTuple(val) {
6195
+ return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
6612
6196
  }
6613
- function isNumber(value) {
6614
- return typeof value === "number";
6197
+ function isDefineObject(val) {
6198
+ return isObject(val) && Object.keys(val).some(
6199
+ (key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
6200
+ );
6615
6201
  }
6616
- function isZipCode5(val) {
6617
- if (isNumber(val)) {
6618
- return isZipCode5(`${val}`);
6202
+ function isFnBasedToken(val) {
6203
+ if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
6204
+ const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6205
+ return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6619
6206
  }
6620
- return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
6621
6207
  }
6622
- function isZipPlus4(val) {
6623
- if (isString(val)) {
6624
- const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
6625
- const next = stripChars(val.trim().replace(first, "").trim(), "-");
6626
- return first.length === 5 && next.length === 4 && isNumberLike(next);
6208
+ function isFnBasedKind(val) {
6209
+ if (isString(val) && isTypeTokenKind(val)) {
6210
+ const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6211
+ return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6627
6212
  }
6628
6213
  return false;
6629
6214
  }
6630
- function isZipCode(val) {
6631
- return isZipCode5(val) || isZipPlus4(val);
6215
+ function isSetBasedToken(val) {
6216
+ if (isTypeToken(val)) {
6217
+ const kind = getTokenKind(val);
6218
+ return kind.endsWith(`-set`);
6219
+ }
6220
+ return false;
6632
6221
  }
6633
- function isSpecificConstant(kind) {
6634
- return (value) => {
6635
- return !!(isConstant(value) && value.kind === kind);
6636
- };
6222
+ function isSetBasedKind(val) {
6223
+ return isString(val) && val.endsWith(`-set`);
6637
6224
  }
6638
- function hasDefaultValue(value) {
6639
- const noDefault = isSpecificConstant("no-default-value");
6640
- return !noDefault(value);
6225
+ function isSingletonKind(val) {
6226
+ return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
6641
6227
  }
6642
- function hasIndexOf(value, idx) {
6643
- const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
6644
- return isErrorCondition(result2, "invalid-index") ? false : result2;
6228
+ function isSingletonToken(val) {
6229
+ return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
6645
6230
  }
6646
- function hasKeys(...props) {
6647
- return (val) => {
6648
- const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
6649
- return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
6650
- };
6231
+ function isTailwindColorName(val) {
6232
+ return isString(val) && Object.keys(TW_HUE2).includes(val);
6651
6233
  }
6652
- function hasWhiteSpace(val) {
6653
- return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
6234
+ function isTailwindColorWithLuminosity(val) {
6235
+ 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, "-")));
6654
6236
  }
6655
- function endsWith(endingIn2) {
6656
- return (val) => {
6657
- return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
6658
- };
6237
+ function isTailwindColorWithLuminosityAndOpacity(val) {
6238
+ return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
6659
6239
  }
6660
- function isEqual(base) {
6661
- return (value) => isSameTypeOf(base)(value) ? value === base : false;
6240
+ function isTailwindColor(val) {
6241
+ return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
6662
6242
  }
6663
- function isLength(value, len) {
6664
- return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
6243
+ function isTailwindModifier(val) {
6244
+ return isString(val) && TW_MODIFIERS2.includes(val);
6665
6245
  }
6666
- function isSameTypeOf(base) {
6667
- return (compare) => {
6668
- return typeof base === typeof compare;
6669
- };
6246
+ function isTailwindColorTarget(val) {
6247
+ return isString(val) && TW_COLOR_TARGETS2.includes(val);
6670
6248
  }
6671
- function isTuple(...tuple3) {
6672
- const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
6673
- return (v) => {
6674
- return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
6675
- };
6249
+ function isTailwindColorClass(val, ...allowedModifiers) {
6250
+ if (isString(val)) {
6251
+ const mods = getTailwindModifiers(val);
6252
+ const targetted = removeTailwindModifiers(val);
6253
+ const target = targetted.split("-")[0];
6254
+ const color = targetted.split("-").slice(1).join("-");
6255
+ return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
6256
+ }
6257
+ return false;
6676
6258
  }
6677
- function isTypeOf(type) {
6678
- return (value) => {
6679
- return typeof value === type;
6680
- };
6259
+ var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
6260
+ function isAustralianNewsUrl(val) {
6261
+ return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
6681
6262
  }
6682
- function startsWith(startingWith) {
6683
- return (val) => {
6684
- return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
6685
- };
6263
+ var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
6264
+ function isBelgiumNewsUrl(val) {
6265
+ return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
6686
6266
  }
6687
- function isHtmlElement(val) {
6688
- return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
6267
+ var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
6268
+ function isCanadianNewsUrl(val) {
6269
+ return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
6689
6270
  }
6690
- function isAlpha(value) {
6691
- return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
6271
+ var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
6272
+ function isDanishNewsUrl(val) {
6273
+ return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
6692
6274
  }
6693
- function isArray(value) {
6694
- return Array.isArray(value) === true;
6275
+ var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
6276
+ function isDutchNewsUrl(val) {
6277
+ return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
6695
6278
  }
6696
- function isBoolean(value) {
6697
- return typeof value === "boolean";
6279
+ var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
6280
+ function isFrenchNewsUrl(val) {
6281
+ return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
6698
6282
  }
6699
- function isBooleanLike(val) {
6700
- return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
6283
+ var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
6284
+ function isGermanNewsUrl(val) {
6285
+ return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
6701
6286
  }
6702
- function isConstant(value) {
6703
- return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
6287
+ var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
6288
+ function isIndianNewsUrl(val) {
6289
+ return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
6704
6290
  }
6705
- function isContainer(value) {
6706
- return !!(Array.isArray(value) || isObject(value));
6291
+ var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
6292
+ function isItalianNewsUrl(val) {
6293
+ return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
6707
6294
  }
6708
- var tokens = [
6709
- "1",
6710
- "inherit",
6711
- "initial",
6712
- "revert",
6713
- "revert-layer",
6714
- "unset",
6715
- "auto"
6716
- ];
6717
- var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
6718
- function isCssAspectRatio(val) {
6719
- return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
6295
+ var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
6296
+ function isJapaneseNewsUrl(val) {
6297
+ return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
6720
6298
  }
6721
- function isCsv(val) {
6722
- return isString(val) && val.includes(",") && !val.startsWith(",");
6299
+ var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
6300
+ function isMexicanNewsUrl(val) {
6301
+ return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
6723
6302
  }
6724
- function isDefined(value) {
6725
- return typeof value !== "undefined";
6303
+ var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
6304
+ function isNorwegianNewsUrl(val) {
6305
+ return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
6726
6306
  }
6727
- function isDoneFn(val) {
6728
- return hasKeys("done")(val) && typeof val.done === "function";
6307
+ var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
6308
+ function isSouthKoreanNewsUrl(val) {
6309
+ return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
6729
6310
  }
6730
- function isEmail(val) {
6731
- if (!isString(val)) {
6732
- return false;
6733
- }
6734
- const parts = val?.split("@");
6735
- const domain = parts[1]?.split(".");
6736
- const tld = domain ? domain.pop() : "";
6737
- const firstChar = val[0].toLowerCase();
6738
- return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
6311
+ var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
6312
+ function isSpanishNewsUrl(val) {
6313
+ return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
6739
6314
  }
6740
- function isEmpty(val) {
6741
- return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
6315
+ var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
6316
+ function isSwissNewsUrl(val) {
6317
+ return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
6742
6318
  }
6743
- function isNotEmpty(val) {
6744
- return !(isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && (val?.length === 0 || val?.length === void 0));
6319
+ var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
6320
+ function isTurkishNewsUrl(val) {
6321
+ return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
6745
6322
  }
6746
- function isErrorCondition(value, kind = null) {
6747
- return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
6323
+ var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
6324
+ function isUkNewsUrl(val) {
6325
+ return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
6326
+ }
6327
+ var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
6328
+ function isUsNewsUrl(val) {
6329
+ return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
6330
+ }
6331
+ var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
6332
+ function isChineseNewsUrl(val) {
6333
+ return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
6334
+ }
6335
+ function isNewsUrl(val) {
6336
+ 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);
6337
+ }
6338
+ function isBitbucketUrl(val) {
6339
+ const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
6340
+ return isString(val) && valid2.some(
6341
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6342
+ );
6748
6343
  }
6749
- function isFalse(i) {
6750
- return typeof i === "boolean" && !i;
6344
+ function isCodeCommitUrl(val) {
6345
+ const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
6346
+ return isString(val) && valid2.some(
6347
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6348
+ );
6751
6349
  }
6752
- function isFalsy(val) {
6753
- return FALSY_VALUES2.includes(val);
6350
+ function isGithubUrl(val) {
6351
+ const valid2 = [
6352
+ "https://github.com",
6353
+ "https://www.github.com",
6354
+ "https://github.io"
6355
+ ];
6356
+ return isString(val) && valid2.some(
6357
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6358
+ );
6754
6359
  }
6755
- function isFnWithParams(input, ...params) {
6756
- return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
6360
+ function isGithubOrgUrl(val) {
6361
+ return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
6757
6362
  }
6758
- function isHexadecimal(val) {
6759
- return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
6363
+ function stripper(s) {
6364
+ return stripTrailing(
6365
+ stripLeading(s, "https://github.com/"),
6366
+ "/"
6367
+ );
6760
6368
  }
6761
- function isIndexable(value) {
6762
- return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
6369
+ function isGithubRepoUrl(val) {
6370
+ return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
6763
6371
  }
6764
- function isInlineSvg(v) {
6765
- return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
6372
+ function isGithubRepoReleasesUrl(val) {
6373
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
6766
6374
  }
6767
- function isMap(val) {
6768
- return val instanceof Map;
6375
+ function isGithubRepoReleaseTagUrl(val) {
6376
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
6769
6377
  }
6770
- function isNever(val) {
6771
- return isConstant(val) && val.kind === "never";
6378
+ function isGithubIssuesListUrl(val) {
6379
+ return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
6772
6380
  }
6773
- function isNothing(val) {
6774
- return !!(val === null || val === void 0);
6381
+ function isGithubIssueUrl(val) {
6382
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
6775
6383
  }
6776
- function isNotNull(value) {
6777
- return value === null;
6384
+ function isGithubProjectsListUrl(val) {
6385
+ return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
6778
6386
  }
6779
- function isNull(value) {
6780
- return value === null;
6387
+ function isGithubProjectUrl(val) {
6388
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
6781
6389
  }
6782
- function maybePhoneNumber(val) {
6783
- const svelte = String(val).trim();
6784
- const chars = svelte.split("");
6785
- const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
6786
- const valid2 = ["+", "(", ...NUMERIC_CHAR2];
6787
- const nothing = stripChars(svelte, ...[
6788
- ...NUMERIC_CHAR2,
6789
- ...WHITESPACE_CHARS2,
6790
- "(",
6791
- ")",
6792
- "+",
6793
- ".",
6794
- "-"
6795
- ]);
6796
- return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
6390
+ function isGithubReleasesListUrl(val) {
6391
+ return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
6797
6392
  }
6798
- var start = PHONE_COUNTRY_CODES2.map((i) => `+${i[0]} `);
6799
- function hasCountryCode(val) {
6800
- if (isString(val)) {
6801
- return start.some((i) => val.trimStart().startsWith(i));
6802
- }
6803
- return false;
6393
+ function isGithubReleaseTagUrl(val) {
6394
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
6804
6395
  }
6805
- function isUsPhoneNumber(val) {
6806
- if (isString(val)) {
6807
- return maybePhoneNumber(val) && val.trimStart().startsWith(`+1 `);
6808
- }
6809
- return false;
6396
+ function isRepoSource(v) {
6397
+ return isString(v) && REPO_SOURCES2.includes(v);
6810
6398
  }
6811
- function isPhoneNumber(val) {
6812
- if (isString(val) && maybePhoneNumber(val) && [" ", "-", "."].some((i) => val.includes(i))) {
6813
- const cc = getPhoneCountryCode(val);
6814
- const without = cc === "" ? retainChars(val, ...NUMERIC_CHAR2) : retainChars(val.trimStart().replace(`+${cc} `, ""), ...NUMERIC_CHAR2);
6815
- switch (cc) {
6816
- case "1":
6817
- return without.length === 10;
6818
- case "44":
6819
- return !![10, 11].includes(without.length);
6820
- case "":
6821
- return without.length <= 10;
6822
- default:
6823
- return without.length <= 11;
6824
- }
6825
- }
6826
- return false;
6399
+ function isSemanticVersion(v, allowPrefix = false) {
6400
+ 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())));
6827
6401
  }
6828
- function isReadonlyArray(value) {
6829
- return Array.isArray(value) === true;
6402
+ function isRepoUrl(val) {
6403
+ return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
6830
6404
  }
6831
- function isRef(value) {
6832
- return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
6405
+ function isWholeFoodsUrl(val) {
6406
+ return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
6833
6407
  }
6834
- function isRegExp(val) {
6835
- return val instanceof RegExp;
6408
+ function isCvsUrl(val) {
6409
+ return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
6836
6410
  }
6837
- function isLikeRegExp(val) {
6838
- if (isRegExp(val)) {
6839
- return true;
6840
- }
6841
- if (isString(val)) {
6842
- try {
6843
- const _re = new RegExp(val);
6844
- return true;
6845
- } catch {
6846
- return false;
6847
- }
6848
- }
6849
- return false;
6411
+ function isWalgreensUrl(val) {
6412
+ return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
6850
6413
  }
6851
- function isSymbol(value) {
6852
- return typeof value === "symbol";
6414
+ function isKrogersUrl(val) {
6415
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6853
6416
  }
6854
- function isScalar(value) {
6855
- return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
6417
+ function isZaraUrl(val) {
6418
+ return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
6856
6419
  }
6857
- function isSet(val) {
6858
- return isObject(val) ? val.kind !== "Unset" : true;
6420
+ function isHmUrl(val) {
6421
+ return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
6859
6422
  }
6860
- function isSetContainer(val) {
6861
- return val instanceof Set;
6423
+ function isDellUrl(val) {
6424
+ return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
6862
6425
  }
6863
- function isStringArray(val) {
6864
- return Array.isArray(val) && val.every((i) => isString(i));
6426
+ function isIkeaUrl(val) {
6427
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6865
6428
  }
6866
- function isThenable(val) {
6867
- return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
6429
+ function isLowesUrl(val) {
6430
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6868
6431
  }
6869
- function isTrimable(val) {
6870
- return isString(val) && val !== val.trim();
6432
+ function isNikeUrl(val) {
6433
+ return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
6871
6434
  }
6872
- function isTrue(value) {
6873
- return value === true;
6435
+ function isWayfairUrl(val) {
6436
+ return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
6874
6437
  }
6875
- function isTruthy(val) {
6876
- return !FALSY_VALUES2.includes(val);
6438
+ function isBestBuyUrl(val) {
6439
+ return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
6877
6440
  }
6878
- function isTypeSubtype(val) {
6879
- return isString(val) && val.split("/").length === 2;
6441
+ function isCostCoUrl(val) {
6442
+ return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
6880
6443
  }
6881
- function isTypeTuple(value) {
6882
- return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
6444
+ function isEtsyUrl(val) {
6445
+ return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
6883
6446
  }
6884
- function isUndefined(value) {
6885
- return typeof value === "undefined";
6447
+ function isTargetUrl(val) {
6448
+ return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
6886
6449
  }
6887
- function isUnset(val) {
6888
- return isObject(val) && val.kind === "Unset";
6450
+ function isEbayUrl(val) {
6451
+ return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
6889
6452
  }
6890
- function isUri(val, ...protocols) {
6891
- const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
6892
- return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6453
+ function isHomeDepotUrl(val) {
6454
+ return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
6893
6455
  }
6894
- function isUrl(val, ...protocols) {
6895
- const p = protocols.length === 0 ? ["http", "https"] : protocols;
6896
- return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6456
+ function isMacysUrl(val) {
6457
+ return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
6897
6458
  }
6898
- var VALID = [
6899
- ...ALPHA_CHARS2,
6900
- ...NUMERIC_CHAR2,
6901
- "_",
6902
- "."
6903
- ];
6904
- var alpha = null;
6905
- function valid(chars) {
6906
- return chars.every((i) => VALID.includes(i));
6459
+ function isAppleUrl(val) {
6460
+ return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
6907
6461
  }
6908
- function isVariable(val) {
6909
- return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
6462
+ function isWalmartUrl(val) {
6463
+ return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
6910
6464
  }
6911
- function separate(s) {
6912
- return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
6465
+ function isAmazonUrl(val) {
6466
+ return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
6913
6467
  }
6914
- function isAreaMetric(val) {
6915
- return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6468
+ function isRetailUrl(val) {
6469
+ 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);
6916
6470
  }
6917
- function isLuminosityMetric(val) {
6918
- return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6471
+ var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
6472
+ var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
6473
+ function isSocialMediaUrl(val) {
6474
+ return isString(val) && URL20.some((i) => val.startsWith(i));
6919
6475
  }
6920
- function isResistance(val) {
6921
- return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6476
+ function isSocialMediaProfileUrl(val) {
6477
+ return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
6922
6478
  }
6923
- function isCurrentMetric(val) {
6924
- return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6479
+ function isYouTubeUrl(val) {
6480
+ return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
6925
6481
  }
6926
- function isVoltageMetric(val) {
6927
- return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6482
+ function isYouTubeShareUrl(val) {
6483
+ return isString(val) && val.startsWith(`https://youtu.be`);
6928
6484
  }
6929
- function isFrequencyMetric(val) {
6930
- return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6485
+ function isYouTubeVideoUrl(val) {
6486
+ return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
6931
6487
  }
6932
- function isPowerMetric(val) {
6933
- return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6488
+ function isYouTubePlaylistUrl(val) {
6489
+ 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`));
6934
6490
  }
6935
- function isTimeMetric(val) {
6936
- return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6491
+ function feed_map(type) {
6492
+ return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
6937
6493
  }
6938
- function isEnergyMetric(val) {
6939
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6494
+ function isYouTubeFeedUrl(val, type) {
6495
+ return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
6940
6496
  }
6941
- function isPressureMetric(val) {
6942
- return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6497
+ function isYouTubeFeedHistoryUrl(val) {
6498
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
6943
6499
  }
6944
- function isTemperatureMetric(val) {
6945
- return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6500
+ function isYouTubePlaylistsUrl(val) {
6501
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
6946
6502
  }
6947
- function isVolumeMetric(val) {
6948
- return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6503
+ function isYouTubeTrendingUrl(val) {
6504
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
6949
6505
  }
6950
- function isAccelerationMetric(val) {
6951
- return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6506
+ function isYouTubeSubscriptionsUrl(val) {
6507
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
6952
6508
  }
6953
- function isSpeedMetric(val) {
6954
- const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
6955
- return isString(val) && speed.includes(separate(val));
6509
+ function isYouTubeCreatorUrl(url) {
6510
+ return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
6956
6511
  }
6957
- function isMassMetric(val) {
6958
- return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6512
+ function isYouTubeVideosInPlaylist(val) {
6513
+ return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
6959
6514
  }
6960
- function isDistanceMetric(val) {
6961
- return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6515
+ function isVueRef(val) {
6516
+ if (isObject(val)) {
6517
+ const keys = Object.keys(val);
6518
+ return !!["dep", "__v_isRef"].every((i) => keys.includes(i));
6519
+ }
6520
+ return false;
6962
6521
  }
6963
- function isMetric(val) {
6964
- 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);
6522
+ function filterUndefined(...val) {
6523
+ return val.filter((i) => isDefined(i));
6965
6524
  }
6966
- function isAreaUom(val) {
6967
- return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6525
+ function find(list2, deref = null) {
6526
+ return (comparator) => {
6527
+ return list2.find((i) => {
6528
+ const val = deref ? isObject(i) || isArray(i) ? deref in i ? i[deref] : void 0 : i : i;
6529
+ return val === comparator;
6530
+ });
6531
+ };
6968
6532
  }
6969
- function isLuminosityUom(val) {
6970
- return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6533
+ function getEach(list2, dotPath) {
6534
+ const result2 = list2.map(
6535
+ (i) => isNull(dotPath) ? i : isContainer(i) ? get(i, dotPath) : Never2
6536
+ ).filter((i) => !isErrorCondition(i));
6537
+ return result2;
6971
6538
  }
6972
- function isResistanceUom(val) {
6973
- return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6539
+ function indexOf(val, index) {
6540
+ const isNegative = isNumber(index) && index < 0;
6541
+ if (isNegative && !Array.isArray(val)) {
6542
+ throw new Error(`The indexOf(val,idx) utility received a negative index value [${index}] but the value being de-references is not an array [${typeof val}]!`);
6543
+ }
6544
+ if (isNegative && Array.isArray(val) && val.length < Math.abs(index)) {
6545
+ throw new Error(`The indexOf(val,idx) utility received a negative index of ${index} but the length of the array passed in is only ${val.length}! This is not allowed.`);
6546
+ }
6547
+ const idx = isNegative && Array.isArray(val) ? val.length + 1 - Math.abs(index) : index;
6548
+ return index === null ? val : isNull(idx) ? val : isArray(val) ? Number(idx) in val ? val[Number(idx)] : errCondition("invalid-index", `attempt to index a numeric array with an invalid index: ${Number(idx)}`) : isObject(val) ? String(idx) in val ? val[String(idx)] : errCondition("invalid-index", `attempt to index a dictionary object with an invalid index: ${String(idx)}`) : errCondition("invalid-container-type", `Attempt to use indexOf() on an invalid container type: ${typeof val}`);
6974
6549
  }
6975
- function isCurrentUom(val) {
6976
- return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6550
+ function intersectWithOffset(a, b, deref) {
6551
+ const aIndexable = a.every((i) => isIndexable(i));
6552
+ const bIndexable = b.every((i) => isIndexable(i));
6553
+ if (!aIndexable || !bIndexable) {
6554
+ if (!aIndexable) {
6555
+ throw new Error(`The "a" array passed into intersect(a,b) was not fully composed of indexable properties: ${a.map((i) => typeof i).join(", ")}`);
6556
+ } else {
6557
+ throw new Error(`The "b" array passed into intersect(a,b) was not fully composed of indexable properties: ${b.map((i) => typeof i).join(", ")}`);
6558
+ }
6559
+ }
6560
+ const aMatches = getEach(a, deref);
6561
+ const bMatches = getEach(b, deref);
6562
+ const sharedKeys2 = ifNotNull(
6563
+ deref,
6564
+ (v) => [
6565
+ a.filter((i) => Array.from(bMatches).includes(get(i, v))),
6566
+ b.filter((i) => Array.from(aMatches).includes(get(i, v)))
6567
+ ],
6568
+ () => a.filter((k) => b.includes(k))
6569
+ );
6570
+ return sharedKeys2;
6977
6571
  }
6978
- function isVoltageUom(val) {
6979
- return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6572
+ function intersectNoOffset(a, b) {
6573
+ return a.length < b.length ? a.filter((val) => b.includes(val)) : b.filter((val) => a.includes(val));
6980
6574
  }
6981
- function isFrequencyUom(val) {
6982
- return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6575
+ function intersection(a, b, deref = null) {
6576
+ return deref === null ? intersectNoOffset(a, b) : intersectWithOffset(a, b, deref);
6983
6577
  }
6984
- function isPowerUom(val) {
6985
- return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6578
+ function joinWith(joinWith2) {
6579
+ return (...tuple3) => {
6580
+ const tup = tuple3;
6581
+ return tup.join(joinWith2);
6582
+ };
6986
6583
  }
6987
- function isTimeUom(val) {
6988
- return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6584
+ function last(list2) {
6585
+ return [...list2].pop();
6989
6586
  }
6990
- function isEnergyUom(val) {
6991
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6587
+ function logicalReturns(conditions) {
6588
+ return conditions.map(
6589
+ (c) => isBoolean(c) ? c : isFunction(c) ? c() : Never2
6590
+ );
6992
6591
  }
6993
- function isPressureUom(val) {
6994
- return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6592
+ function reverse(list2) {
6593
+ return [...list2].reverse();
6995
6594
  }
6996
- function isTemperatureUom(val) {
6997
- return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6595
+ function shift(list2) {
6596
+ let rtn;
6597
+ if (isDefined(list2)) {
6598
+ rtn = list2.length === 0 ? void 0 : list2[0];
6599
+ try {
6600
+ list2 = list2.slice(1);
6601
+ } catch {
6602
+ }
6603
+ } else {
6604
+ rtn = void 0;
6605
+ }
6606
+ return rtn;
6998
6607
  }
6999
- function isVolumeUom(val) {
7000
- return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6608
+ function slice(list2, start2, end) {
6609
+ return list2.slice(start2, end);
7001
6610
  }
7002
- function isAccelerationUom(val) {
7003
- return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6611
+ function unique(...values) {
6612
+ const u = [];
6613
+ for (const i of values.flat()) {
6614
+ if (!u.includes(i)) {
6615
+ u.push(i);
6616
+ }
6617
+ }
6618
+ return u;
7004
6619
  }
7005
- function isSpeedUom(val) {
7006
- return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6620
+ function box(value) {
6621
+ const rtn = {
6622
+ __type: "box",
6623
+ value,
6624
+ unbox: (...p) => {
6625
+ return typeof value === "function" ? value(...p) : value;
6626
+ }
6627
+ };
6628
+ return rtn;
7007
6629
  }
7008
- function isMassUom(val) {
7009
- return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6630
+ function isBox(thing) {
6631
+ return typeof thing === "object" && "__type" in thing && thing.__type === "box";
7010
6632
  }
7011
- function isDistanceUom(val) {
7012
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6633
+ function boxDictionaryValues(dict) {
6634
+ const keys = Object.keys(dict);
6635
+ return keys.reduce(
6636
+ (acc, key) => ({ ...acc, [key]: box(dict[key]) }),
6637
+ {}
6638
+ );
7013
6639
  }
7014
- function isUom(val) {
7015
- 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);
6640
+ function unbox(val) {
6641
+ return isBox(val) ? val.value : val;
7016
6642
  }
7017
- function isIp4Address(val) {
7018
- return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
6643
+ function capitalize(str) {
6644
+ return `${str?.slice(0, 1).toUpperCase()}${str?.slice(1)}`;
7019
6645
  }
7020
- function isIp6Address(val) {
7021
- const expanded = isString(val) ? ip6GroupExpansion(val) : "";
7022
- return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
6646
+ function cssColor(color, v1, v2, v3, opacity) {
6647
+ return `color(${color} ${v1} ${v2} ${v3}${opacity ? ` / ${opacity}` : ""}`;
7023
6648
  }
7024
- function isIpAddress(val) {
7025
- return isIp4Address(val) || isIp6Address(val);
6649
+ function twColor(color, luminosity) {
6650
+ const lum = luminosity in TW_LUMINOSITY2 ? TW_LUMINOSITY2[luminosity] : 0;
6651
+ const chroma = luminosity in TW_CHROMA2 ? TW_CHROMA2[luminosity] : 0;
6652
+ const hue = TW_HUE2[color];
6653
+ return `oklch(${lum} ${chroma} ${hue})`;
7026
6654
  }
7027
- function hasUrlPort(val) {
7028
- return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
6655
+ function ensureLeading(content, ensure) {
6656
+ const output = String(content);
6657
+ return output.startsWith(String(ensure)) ? content : isString(content) ? `${ensure}${content}` : Number(`${ensure}${content}`);
7029
6658
  }
7030
- function isUrlPath(val) {
7031
- return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
7032
- (c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
7033
- );
6659
+ function ensureSurround(prefix, postfix) {
6660
+ const fn2 = (input) => {
6661
+ let result2 = input;
6662
+ result2 = ensureLeading(result2, prefix);
6663
+ result2 = ensureTrailing(result2, postfix);
6664
+ return result2;
6665
+ };
6666
+ return fn2;
7034
6667
  }
7035
- function isDomainName(val) {
7036
- 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(
7037
- (i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
6668
+ function ensureTrailing(content, ensure) {
6669
+ return (
6670
+ //
6671
+ content.endsWith(ensure) ? content : `${content}${ensure}`
7038
6672
  );
7039
6673
  }
7040
- function isUrlSource(val) {
7041
- return isDomainName(val) || isIpAddress(val);
7042
- }
7043
- function hasUrlQueryParameter(val, prop) {
7044
- return isString(getUrlQueryParams(val, prop));
6674
+ function getTypeSubtype(str) {
6675
+ if (isTypeSubtype(str)) {
6676
+ const [t, st] = str.split("/");
6677
+ return [t, st];
6678
+ } else {
6679
+ const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
6680
+ err.name = "InvalidTypeSubtype";
6681
+ throw err;
6682
+ }
7045
6683
  }
7046
- function isNumericArray(val) {
7047
- return Array.isArray(val) && val.every((i) => isNumber(i));
6684
+ function identity(...values) {
6685
+ return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
7048
6686
  }
7049
- function hasProtocol(val, ...protocols) {
7050
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
6687
+ function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6688
+ if (ch.length !== 1) {
6689
+ throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
6690
+ }
6691
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
7051
6692
  }
7052
- function isProtocol(val, ...protocols) {
7053
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
6693
+ function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6694
+ if (ch.length !== 1) {
6695
+ throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
6696
+ }
6697
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
7054
6698
  }
7055
- function hasProtocolPrefix(val, ...protocols) {
7056
- 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));
6699
+ function parseTemplate(template) {
6700
+ const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
6701
+ let lastIndex = 0;
6702
+ let match;
6703
+ const segments = [];
6704
+ while (match = pattern.exec(template)) {
6705
+ const [fullMatch, varName, asType2] = match;
6706
+ const staticPart = template.slice(lastIndex, match.index);
6707
+ if (staticPart) {
6708
+ segments.push({ dynamic: false, text: staticPart });
6709
+ }
6710
+ segments.push({
6711
+ dynamic: true,
6712
+ varName,
6713
+ type: asType2 ? asType2 : "string"
6714
+ });
6715
+ lastIndex = match.index + fullMatch.length;
6716
+ }
6717
+ const remainder = template.slice(lastIndex);
6718
+ if (remainder) {
6719
+ segments.push({ dynamic: false, text: remainder });
6720
+ }
6721
+ return segments;
7057
6722
  }
7058
- function isProtocolPrefix(val, ...protocols) {
7059
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
6723
+ function escapeRegex(str) {
6724
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7060
6725
  }
7061
- function isTypeToken(val, kind) {
7062
- if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
7063
- const stripped = stripSurround("<<", ">>")(val);
7064
- if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
7065
- if (kind) {
7066
- if (isAtomicKind(kind)) {
7067
- return val === `<<${kind}>>`;
7068
- } else if (isSetBasedKind(kind)) {
7069
- return val.startsWith(`<<${kind}::`);
7070
- } else {
7071
- return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
7072
- }
7073
- } else {
7074
- return true;
6726
+ function buildRegexPattern(segments) {
6727
+ let regexStr = "^";
6728
+ for (const seg of segments) {
6729
+ if (!seg.dynamic) {
6730
+ regexStr += escapeRegex(seg.text);
6731
+ } else {
6732
+ switch (seg.type) {
6733
+ case "string":
6734
+ regexStr += "(.*?)";
6735
+ break;
6736
+ case "number":
6737
+ regexStr += "(\\d+)";
6738
+ break;
6739
+ case "boolean":
6740
+ regexStr += "(true|false)";
6741
+ break;
7075
6742
  }
7076
6743
  }
7077
- return false;
7078
6744
  }
7079
- return false;
7080
- }
7081
- function isTypeTokenKind(val) {
7082
- return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
7083
- }
7084
- function isAtomicToken(val) {
7085
- return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
6745
+ regexStr += "$";
6746
+ return new RegExp(regexStr);
7086
6747
  }
7087
- function isAtomicKind(val) {
7088
- return isString(val) && TT_ATOMICS2.includes(val);
6748
+ function convertValue(type, value) {
6749
+ switch (type) {
6750
+ case "string":
6751
+ return value;
6752
+ case "number":
6753
+ return Number(value);
6754
+ case "boolean":
6755
+ return value === "true";
6756
+ }
7089
6757
  }
7090
- function isObjectToken(val) {
7091
- return isTypeToken(val, "obj");
6758
+ function matchTemplate(template, test) {
6759
+ const segments = parseTemplate(template);
6760
+ const regex = buildRegexPattern(segments);
6761
+ const match = regex.exec(test);
6762
+ if (!match)
6763
+ return false;
6764
+ let captureIndex = 1;
6765
+ const result2 = {};
6766
+ for (const seg of segments) {
6767
+ if (seg.dynamic) {
6768
+ const rawVal = match[captureIndex++];
6769
+ if (rawVal === void 0)
6770
+ return false;
6771
+ result2[seg.varName] = convertValue(seg.type, rawVal);
6772
+ }
6773
+ }
6774
+ return result2;
7092
6775
  }
7093
- function isRecordToken(val) {
7094
- return isTypeToken(val, "rec");
6776
+ function infer(inference) {
6777
+ return (test) => {
6778
+ return matchTemplate(inference, test);
6779
+ };
7095
6780
  }
7096
- function isTupleToken(val) {
7097
- return isTypeToken(val, "tuple");
6781
+ function idLiteral(o) {
6782
+ return { ...o, id: o.id };
7098
6783
  }
7099
- function isArrayToken(val) {
7100
- return isTypeToken(val, "arr");
6784
+ function nameLiteral(o) {
6785
+ return o;
7101
6786
  }
7102
- function isMapToken(val) {
7103
- return isTypeToken(val, "map");
6787
+ function kindLiteral(o) {
6788
+ return o;
7104
6789
  }
7105
- function isSetToken(val) {
7106
- return isTypeToken(val, "set");
6790
+ function idTypeGuard(_o) {
6791
+ return true;
7107
6792
  }
7108
- function isContainerToken(val) {
7109
- return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
6793
+ function literal(obj) {
6794
+ return obj;
7110
6795
  }
7111
- function isShapeCallback(val) {
7112
- return isFunction(val) && val.kind === "shape";
6796
+ function lowercase(str) {
6797
+ return str.toLowerCase();
7113
6798
  }
7114
- var token_types = [
7115
- ...TT_ATOMICS2,
7116
- ...TT_CONTAINERS2,
7117
- ...TT_FUNCTIONS2,
7118
- ...TT_SETS2,
7119
- ...TT_SINGLETONS2
7120
- ];
7121
- function isShapeToken(val) {
7122
- return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
6799
+ function narrow(...values) {
6800
+ return values.length === 1 ? values[0] : values;
7123
6801
  }
7124
- var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
7125
- var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
7126
- function isSimpleToken(val) {
7127
- return isString(val) && split_tokens.some(
7128
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
7129
- );
6802
+ function pathJoin(...segments) {
6803
+ const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
6804
+ const original_path = segments.join("/");
6805
+ const pre = original_path.startsWith("/") ? "/" : "";
6806
+ const post = original_path.endsWith("/") ? "/" : "";
6807
+ return `${pre}${clean_path}${post}`;
7130
6808
  }
7131
- function isSimpleScalarToken(val) {
7132
- return isString(val) && scalar_split_tokens.some(
7133
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
7134
- );
6809
+ var asPhoneFormat = () => `NOT IMPLEMENTED`;
6810
+ function getPhoneCountryCode(phone) {
6811
+ return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
6812
+ stripLeading(stripLeading(phone.trim(), "+"), "00"),
6813
+ ...NUMERIC_CHAR2
6814
+ ) : "";
7135
6815
  }
7136
- function isSimpleContainerToken(val) {
7137
- return isString(val) && scalar_split_tokens.some(
7138
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
7139
- );
6816
+ function removePhoneCountryCode(phone) {
6817
+ const countryCode = getPhoneCountryCode(phone);
6818
+ return countryCode !== "" ? stripLeading(stripLeading(
6819
+ phone.trim(),
6820
+ "+",
6821
+ "00"
6822
+ ), countryCode).trim() : phone.trim();
7140
6823
  }
7141
- function isSimpleTokenTuple(val) {
7142
- return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
6824
+ var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
6825
+ function endingIn(word, postfix) {
6826
+ switch (postfix) {
6827
+ case "is":
6828
+ return word.endsWith(postfix) ? `${word}es` : void 0;
6829
+ case "singular-noun":
6830
+ return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
6831
+ case "f":
6832
+ return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
6833
+ case "y":
6834
+ return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
6835
+ default:
6836
+ throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
6837
+ }
7143
6838
  }
7144
- function isSimpleScalarTokenTuple(val) {
7145
- return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
6839
+ function pluralize(word) {
6840
+ const right = rightWhitespace(word);
6841
+ const w = word.trimEnd();
6842
+ const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
6843
+ return `${result2}${right}`;
7146
6844
  }
7147
- function isSimpleContainerTokenTuple(val) {
7148
- return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
6845
+ function retainAfter(content, ...find2) {
6846
+ const idx = Math.min(
6847
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6848
+ );
6849
+ const min = Math.min(...find2.map((i) => i.length));
6850
+ let len = Math.max(...find2.map((i) => i.length));
6851
+ if (min !== len) {
6852
+ if (!find2.includes(content.slice(idx, len))) {
6853
+ len = min;
6854
+ }
6855
+ }
6856
+ return idx && idx > 0 ? content.slice(idx + len) : "";
7149
6857
  }
7150
- function isDefineObject(val) {
7151
- return isObject(val) && Object.keys(val).some(
7152
- (key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
6858
+ function retainAfterInclusive(content, ...find2) {
6859
+ const minFound = Math.min(
6860
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
7153
6861
  );
6862
+ return minFound > 0 ? content.slice(minFound) : "";
7154
6863
  }
7155
- function isFnBasedToken(val) {
7156
- if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
7157
- const stripped = stripSurround(TT_START2, TT_STOP2)(val);
7158
- return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
7159
- }
6864
+ function retainChars(content, ...retain2) {
6865
+ const chars = asChars(content);
6866
+ return chars.filter((c) => retain2.includes(c)).join("");
7160
6867
  }
7161
- function isFnBasedKind(val) {
7162
- if (isString(val) && isTypeTokenKind(val)) {
7163
- const stripped = stripSurround(TT_START2, TT_STOP2)(val);
7164
- return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6868
+ function retainUntil(content, ...find2) {
6869
+ const chars = asChars(content);
6870
+ let idx = 0;
6871
+ while (!find2.includes(chars[idx]) && idx <= chars.length) {
6872
+ idx = idx + 1;
7165
6873
  }
7166
- return false;
6874
+ return idx === 0 ? "" : content.slice(0, idx);
7167
6875
  }
7168
- function isSetBasedToken(val) {
7169
- if (isTypeToken(val)) {
7170
- const kind = getTokenKind(val);
7171
- return kind.endsWith(`-set`);
6876
+ function retainUntilInclusive(content, ...find2) {
6877
+ const chars = asChars(content);
6878
+ let idx = 0;
6879
+ while (!find2.includes(chars[idx]) && idx <= chars.length) {
6880
+ idx = idx + 1;
7172
6881
  }
7173
- return false;
7174
- }
7175
- function isSetBasedKind(val) {
7176
- return isString(val) && val.endsWith(`-set`);
7177
- }
7178
- function isSingletonKind(val) {
7179
- return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
7180
- }
7181
- function isSingletonToken(val) {
7182
- return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
7183
- }
7184
- function isTailwindColorName(val) {
7185
- return isString(val) && Object.keys(TW_HUE2).includes(val);
7186
- }
7187
- function isTailwindColorWithLuminosity(val) {
7188
- 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, "-")));
7189
- }
7190
- function isTailwindColorWithLuminosityAndOpacity(val) {
7191
- return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
6882
+ return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
7192
6883
  }
7193
- function isTailwindColor(val) {
7194
- return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
6884
+ function retainWhile(content, ...retain2) {
6885
+ const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
6886
+ return content.slice(0, stopIdx);
7195
6887
  }
7196
- function isTailwindModifier(val) {
7197
- return isString(val) && TW_MODIFIERS2.includes(val);
6888
+ function rightWhitespace(content) {
6889
+ const trimmed = content.trimStart();
6890
+ return retainAfterInclusive(
6891
+ trimmed,
6892
+ ...WHITESPACE_CHARS2
6893
+ );
7198
6894
  }
7199
- function isTailwindColorTarget(val) {
7200
- return isString(val) && TW_COLOR_TARGETS2.includes(val);
6895
+ function split(str, sep = "") {
6896
+ return str.split(sep);
7201
6897
  }
7202
- function isTailwindColorClass(val, ...allowedModifiers) {
7203
- if (isString(val)) {
7204
- const mods = getTailwindModifiers(val);
7205
- const targetted = removeTailwindModifiers(val);
7206
- const target = targetted.split("-")[0];
7207
- const color = targetted.split("-").slice(1).join("-");
7208
- return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
7209
- }
7210
- return false;
6898
+ function stripAfter(content, find2) {
6899
+ return content.split(find2).shift();
7211
6900
  }
7212
- var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
7213
- function isAustralianNewsUrl(val) {
7214
- return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
6901
+ function stripBefore(content, find2) {
6902
+ return content.split(find2).slice(1).join(find2);
7215
6903
  }
7216
- var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
7217
- function isBelgiumNewsUrl(val) {
7218
- return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
6904
+ function stripChars(content, ...strip2) {
6905
+ const chars = asChars(content);
6906
+ return chars.filter((c) => !strip2.includes(c)).join("");
7219
6907
  }
7220
- var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
7221
- function isCanadianNewsUrl(val) {
7222
- return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
6908
+ function stripLeading(content, ...strip2) {
6909
+ if (isUndefined(content)) {
6910
+ return void 0;
6911
+ }
6912
+ let output = String(content);
6913
+ for (const s of strip2) {
6914
+ if (output.startsWith(String(s))) {
6915
+ output = output.slice(String(s).length);
6916
+ }
6917
+ }
6918
+ return isNumber(content) ? Number(output) : output;
7223
6919
  }
7224
- var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
7225
- function isDanishNewsUrl(val) {
7226
- return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
6920
+ function stripSurround(...chars) {
6921
+ return (input) => {
6922
+ let output = String(input);
6923
+ for (const s of chars) {
6924
+ if (output.startsWith(String(s))) {
6925
+ output = output.slice(String(s).length);
6926
+ }
6927
+ if (output.endsWith(String(s))) {
6928
+ output = output.slice(0, -1 * String(s).length);
6929
+ }
6930
+ }
6931
+ return isNumber(input) ? Number(output) : output;
6932
+ };
7227
6933
  }
7228
- var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
7229
- function isDutchNewsUrl(val) {
7230
- return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
6934
+ function stripTrailing(content, ...strip2) {
6935
+ if (isUndefined(content)) {
6936
+ return void 0;
6937
+ }
6938
+ let output = String(content);
6939
+ for (const s of strip2) {
6940
+ if (output.endsWith(String(s))) {
6941
+ output = output.slice(0, -1 * String(s).length);
6942
+ }
6943
+ }
6944
+ return isNumber(content) ? Number(output) : output;
7231
6945
  }
7232
- var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
7233
- function isFrenchNewsUrl(val) {
7234
- return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
6946
+ function stripUntil(content, ...until) {
6947
+ const stopIdx = asChars(content).findIndex((c) => until.includes(c));
6948
+ return content.slice(stopIdx);
7235
6949
  }
7236
- var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
7237
- function isGermanNewsUrl(val) {
7238
- return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
6950
+ function stripWhile(content, ...match) {
6951
+ const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
6952
+ return content.slice(stopIdx);
7239
6953
  }
7240
- var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
7241
- function isIndianNewsUrl(val) {
7242
- return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
6954
+ function surround(prefix, postfix) {
6955
+ return (input) => `${prefix}${input}${postfix}`;
7243
6956
  }
7244
- var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
7245
- function isItalianNewsUrl(val) {
7246
- return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
6957
+ function takeNumericCharacters(content) {
6958
+ const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
6959
+ return content.slice(0, nonNumericIdx);
7247
6960
  }
7248
- var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
7249
- function isJapaneseNewsUrl(val) {
7250
- return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
6961
+ function toCamelCase(input, preserveWhitespace) {
6962
+ const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
6963
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
6964
+ pascal
6965
+ );
6966
+ const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
6967
+ return camel;
7251
6968
  }
7252
- var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
7253
- function isMexicanNewsUrl(val) {
7254
- return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
6969
+ function toKebabCase(input, _preserveWhitespace = false) {
6970
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
6971
+ const replaceWhitespace = (i) => i.replace(/\s/g, "-");
6972
+ const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
6973
+ const replaceLeadingDash = (i) => i.replace(/^-/, "");
6974
+ const replaceTrailingDash = (i) => i.replace(/-$/, "");
6975
+ const replaceUnderscore = (i) => i.replace(/_/g, "-");
6976
+ const removeDupDashes = (i) => i.replace(/-+/g, "-");
6977
+ return removeDupDashes(`${preWhite}${replaceUnderscore(
6978
+ replaceTrailingDash(
6979
+ replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
6980
+ )
6981
+ )}${postWhite}`);
7255
6982
  }
7256
- var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
7257
- function isNorwegianNewsUrl(val) {
7258
- return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
6983
+ function toNumericArray(arr) {
6984
+ return arr.map((i) => Number(i));
7259
6985
  }
7260
- var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
7261
- function isSouthKoreanNewsUrl(val) {
7262
- return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
6986
+ function toPascalCase(input, preserveWhitespace = void 0) {
6987
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
6988
+ input
6989
+ );
6990
+ const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
6991
+ const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
6992
+ const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
6993
+ const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
6994
+ const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
6995
+ replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
6996
+ )}${preserveWhitespace ? postWhite : ""}`;
6997
+ return pascal;
7263
6998
  }
7264
- var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
7265
- function isSpanishNewsUrl(val) {
7266
- return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
6999
+ function toSnakeCase(input, preserveWhitespace = false) {
7000
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
7001
+ const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
7002
+ const convertDashes = (input2) => input2.replace(/-/g, "_");
7003
+ const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
7004
+ const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
7005
+ return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
7006
+ injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
7007
+ ).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
7267
7008
  }
7268
- var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
7269
- function isSwissNewsUrl(val) {
7270
- return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
7009
+ function toString(val) {
7010
+ return String(val);
7271
7011
  }
7272
- var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
7273
- function isTurkishNewsUrl(val) {
7274
- return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
7012
+ function toUppercase(str) {
7013
+ return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
7275
7014
  }
7276
- var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
7277
- function isUkNewsUrl(val) {
7278
- return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
7015
+ function trim(input) {
7016
+ return input.trim();
7279
7017
  }
7280
- var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
7281
- function isUsNewsUrl(val) {
7282
- return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
7018
+ function trimLeft(input) {
7019
+ return input.trimStart();
7283
7020
  }
7284
- var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
7285
- function isChineseNewsUrl(val) {
7286
- return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
7021
+ function trimStart(input) {
7022
+ return input.trimStart();
7287
7023
  }
7288
- function isNewsUrl(val) {
7289
- 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);
7024
+ function trimRight(input) {
7025
+ return input.trimEnd();
7290
7026
  }
7291
- function isBitbucketUrl(val) {
7292
- const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
7293
- return isString(val) && valid2.some(
7294
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7295
- );
7027
+ function trimEnd(input) {
7028
+ return input.trimEnd();
7296
7029
  }
7297
- function isCodeCommitUrl(val) {
7298
- const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
7299
- return isString(val) && valid2.some(
7300
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7301
- );
7030
+ function truncate(content, maxLength, ellipsis = false) {
7031
+ const overLimit = content.length > maxLength;
7032
+ return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
7302
7033
  }
7303
- function isGithubUrl(val) {
7304
- const valid2 = [
7305
- "https://github.com",
7306
- "https://www.github.com",
7307
- "https://github.io"
7308
- ];
7309
- return isString(val) && valid2.some(
7310
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7311
- );
7034
+ function tuple(...values) {
7035
+ const arr = values.length === 1 ? values[0] : values;
7036
+ return asArray(arr);
7312
7037
  }
7313
- function isGithubOrgUrl(val) {
7314
- return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
7038
+ function uncapitalize(str) {
7039
+ return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
7315
7040
  }
7316
- function stripper(s) {
7317
- return stripTrailing(
7318
- stripLeading(s, "https://github.com/"),
7319
- "/"
7320
- );
7041
+ var unset = "<<unset>>";
7042
+ function uppercase(str) {
7043
+ return str.toUpperCase();
7321
7044
  }
7322
- function isGithubRepoUrl(val) {
7323
- return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
7045
+ function widen(value) {
7046
+ return value;
7324
7047
  }
7325
- function isGithubRepoReleasesUrl(val) {
7326
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
7048
+ var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
7049
+ function getUrlProtocol(url) {
7050
+ const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
7051
+ return proto;
7327
7052
  }
7328
- function isGithubRepoReleaseTagUrl(val) {
7329
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
7053
+ function removeUrlProtocol(url) {
7054
+ return stripBefore(url, "://");
7330
7055
  }
7331
- function isGithubIssuesListUrl(val) {
7332
- return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
7056
+ function ensurePath(val) {
7057
+ const val2 = ensureLeading(val, "/");
7058
+ return val === "" ? "" : stripTrailing(val2, "/");
7333
7059
  }
7334
- function isGithubIssueUrl(val) {
7335
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
7060
+ function getUrlPath(url) {
7061
+ return isUrl(url) ? ensurePath(
7062
+ stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
7063
+ ) : Never2;
7336
7064
  }
7337
- function isGithubProjectsListUrl(val) {
7338
- return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
7065
+ function getUrlQueryParams(url, specific = void 0) {
7066
+ const qp = stripBefore(url, "?");
7067
+ if (specific) {
7068
+ return qp.includes(`${specific}=`) ? decodeURIComponent(
7069
+ stripAfter(
7070
+ stripBefore(qp, `${specific}=`),
7071
+ "&"
7072
+ ).replace(/\+/g, "%20")
7073
+ ) : void 0;
7074
+ }
7075
+ return qp === "" ? qp : `?${qp}`;
7339
7076
  }
7340
- function isGithubProjectUrl(val) {
7341
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
7077
+ function getUrlDefaultPort(url) {
7078
+ const proto = getUrlProtocol(url);
7079
+ return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
7342
7080
  }
7343
- function isGithubReleasesListUrl(val) {
7344
- return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
7081
+ function getUrlPort(url, resolve = false) {
7082
+ const re = /.*:(\d{2,3})/;
7083
+ const match = url.match(re);
7084
+ return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
7345
7085
  }
7346
- function isGithubReleaseTagUrl(val) {
7347
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
7086
+ function getUrlSource(url) {
7087
+ const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
7088
+ return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
7348
7089
  }
7349
- function isRepoSource(v) {
7350
- return isString(v) && REPO_SOURCES2.includes(v);
7090
+ function getUrlBase(url) {
7091
+ const path = getUrlPath(url);
7092
+ const remaining = stripAfter(url, path);
7093
+ return remaining;
7351
7094
  }
7352
- function isSemanticVersion(v, allowPrefix = false) {
7353
- 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())));
7095
+ function getUrlDynamics(url) {
7096
+ const path = getUrlPath(url);
7097
+ const qp = getUrlQueryParams(url);
7098
+ const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
7099
+ const segmentTypes = [
7100
+ "string",
7101
+ "number",
7102
+ "boolean",
7103
+ "Opt<string>",
7104
+ "Opt<number>",
7105
+ "Opt<boolean>"
7106
+ ];
7107
+ const pathVars = {};
7108
+ const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
7109
+ const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
7110
+ const findPathNamed = infer(`<{{infer name}}>`);
7111
+ for (const part of pathParts) {
7112
+ const union4 = findPathUnion(part);
7113
+ const typed = findPathTyped(part);
7114
+ const named = findPathNamed(part);
7115
+ if (union4) {
7116
+ if (isVariable(union4.name) && isCsv(union4.union)) {
7117
+ pathVars[union4.name] = `string(${union4.union})`;
7118
+ }
7119
+ } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
7120
+ pathVars[typed.name] = typed.type;
7121
+ } else if (named && isVariable(named.name)) {
7122
+ pathVars[named.name] = "string";
7123
+ }
7124
+ }
7125
+ const qpVars = {};
7126
+ const qpParts = stripLeading(qp, "?").split("&");
7127
+ for (const p of qpParts) {
7128
+ const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
7129
+ const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
7130
+ const fixed = infer(`{{infer var}}={{infer val}}`)(p);
7131
+ if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
7132
+ qpVars[union4.var] = `string(${union4.params})`;
7133
+ } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
7134
+ qpVars[dynamic.var] = dynamic.val;
7135
+ } else if (fixed && isVariable(fixed.var)) {
7136
+ qpVars[fixed.var] = fixed.val;
7137
+ }
7138
+ }
7139
+ return {
7140
+ pathVars,
7141
+ qpVars,
7142
+ allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
7143
+ ...pathVars,
7144
+ ...qpVars
7145
+ }
7146
+ };
7354
7147
  }
7355
- function isRepoUrl(val) {
7356
- return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
7148
+ function urlMeta(url) {
7149
+ return {
7150
+ url,
7151
+ isUrl: isUrl(url),
7152
+ protocol: getUrlProtocol(url),
7153
+ path: getUrlPath(url),
7154
+ queryParameters: getUrlQueryParams(url),
7155
+ params: getUrlDynamics,
7156
+ port: getUrlPort(url),
7157
+ source: getUrlSource(url),
7158
+ isIpAddress: isIpAddress(getUrlSource(url)),
7159
+ isIp4Address: isIp4Address(getUrlSource(url)),
7160
+ isIp6Address: isIp6Address(getUrlSource(url))
7161
+ };
7357
7162
  }
7358
- function isWholeFoodsUrl(val) {
7359
- return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
7163
+ function getYouTubePageType(url) {
7164
+ 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;
7360
7165
  }
7361
- function isCvsUrl(val) {
7362
- return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
7166
+ function youtubeEmbed(url) {
7167
+ if (hasUrlQueryParameter(url, "v")) {
7168
+ const id = getUrlQueryParams(url, "v");
7169
+ return `https://www.youtube.com/embed/${id}`;
7170
+ } else if (isYouTubeShareUrl(url)) {
7171
+ const id = url.split("/").pop();
7172
+ if (id) {
7173
+ return `https://www.youtube.com/embed/${id}`;
7174
+ } else {
7175
+ throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
7176
+ }
7177
+ } else {
7178
+ throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
7179
+ }
7363
7180
  }
7364
- function isWalgreensUrl(val) {
7365
- return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
7181
+ function youtubeMeta(url) {
7182
+ return isYouTubeUrl(url) ? {
7183
+ url,
7184
+ isYouTubeUrl: true,
7185
+ isShareUrl: isYouTubeShareUrl(url),
7186
+ pageType: getYouTubePageType(url)
7187
+ } : {
7188
+ url,
7189
+ isYouTubeUrl: false
7190
+ };
7366
7191
  }
7367
- function isKrogersUrl(val) {
7368
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7192
+ function queue(state) {
7193
+ return {
7194
+ queue: state,
7195
+ size: state.length,
7196
+ isEmpty() {
7197
+ return state.length === 0;
7198
+ },
7199
+ clear() {
7200
+ state.slice(0, 0);
7201
+ },
7202
+ drain() {
7203
+ const old_state = [...state];
7204
+ state.slice(0, 0);
7205
+ return old_state;
7206
+ },
7207
+ push(...add) {
7208
+ state.push(...add);
7209
+ },
7210
+ drop(quantity) {
7211
+ if (quantity && quantity > state.length) {
7212
+ throw new Error("Cannot drop more elements than present in the queue");
7213
+ }
7214
+ state.splice(0, quantity || 1);
7215
+ },
7216
+ take(quantity) {
7217
+ if (quantity && quantity > state.length) {
7218
+ throw new Error("Cannot take more elements than present in the queue");
7219
+ }
7220
+ const result2 = state.slice(0, quantity || 1);
7221
+ state.splice(0, quantity || 1);
7222
+ return result2;
7223
+ },
7224
+ *[Symbol.iterator]() {
7225
+ for (let i = 0; i < state.length; i++) {
7226
+ yield state[i];
7227
+ }
7228
+ }
7229
+ };
7369
7230
  }
7370
- function isZaraUrl(val) {
7371
- return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
7231
+ function createFifoQueue(...list2) {
7232
+ return queue([...list2]);
7372
7233
  }
7373
- function isHmUrl(val) {
7374
- return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
7234
+ function queue2(state) {
7235
+ return {
7236
+ queue: state,
7237
+ size: state.length,
7238
+ isEmpty() {
7239
+ return state.length === 0;
7240
+ },
7241
+ push(...add) {
7242
+ state.push(...add);
7243
+ },
7244
+ drop(quantity) {
7245
+ state.splice(-quantity);
7246
+ },
7247
+ clear() {
7248
+ state.slice(0, 0);
7249
+ },
7250
+ drain() {
7251
+ const old_state = [...state];
7252
+ state.slice(0, 0);
7253
+ return old_state;
7254
+ },
7255
+ take(quantity) {
7256
+ const result2 = state.slice(-quantity);
7257
+ state.splice(-quantity);
7258
+ return result2;
7259
+ },
7260
+ *[Symbol.iterator]() {
7261
+ for (let i = state.length - 1; i >= 0; i--) {
7262
+ yield state[i];
7263
+ }
7264
+ }
7265
+ };
7375
7266
  }
7376
- function isDellUrl(val) {
7377
- return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
7267
+ function createLifoQueue(...list2) {
7268
+ return queue2([...list2]);
7378
7269
  }
7379
- function isIkeaUrl(val) {
7380
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7270
+ var scalarToToken = identity({
7271
+ string: "<<string>>",
7272
+ number: "<<number>>",
7273
+ boolean: "<<boolean>>",
7274
+ true: "<<true>>",
7275
+ false: "<<false>>",
7276
+ null: "<<null>>",
7277
+ undefined: "<<undefined>>",
7278
+ unknown: "<<unknown>>",
7279
+ any: "<<any>>",
7280
+ never: "<<never>>"
7281
+ });
7282
+ function stringLiteral(str) {
7283
+ return stripAfter(stripBefore(str, "string("), ")");
7381
7284
  }
7382
- function isLowesUrl(val) {
7383
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7285
+ function numericLiteral(str) {
7286
+ return stripAfter(stripBefore(str, "number("), ")");
7384
7287
  }
7385
- function isNikeUrl(val) {
7386
- return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
7288
+ function handleOptional(token) {
7289
+ const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
7290
+ 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>>`;
7387
7291
  }
7388
- function isWayfairUrl(val) {
7389
- return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
7292
+ function simpleScalarTokenToTypeToken(val) {
7293
+ 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>>`;
7390
7294
  }
7391
- function isBestBuyUrl(val) {
7392
- return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
7295
+ function unionNode(node) {
7296
+ return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
7393
7297
  }
7394
- function isCostCoUrl(val) {
7395
- return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
7298
+ function union2(nodes) {
7299
+ return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
7396
7300
  }
7397
- function isEtsyUrl(val) {
7398
- return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
7301
+ var stripUnion = stripSurround("Union(", ")");
7302
+ function simpleUnionTokenToTypeToken(val) {
7303
+ return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union2(stripUnion(val))} ]>>` : Never2;
7399
7304
  }
7400
- function isTargetUrl(val) {
7401
- return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
7305
+ function simpleContainerTokenToTypeToken(_val) {
7402
7306
  }
7403
- function isEbayUrl(val) {
7404
- return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
7307
+ function asTypeToken(_val) {
7308
+ return "not ready";
7405
7309
  }
7406
- function isHomeDepotUrl(val) {
7407
- return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
7310
+ function addToken(token, ...params) {
7311
+ return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
7408
7312
  }
7409
- function isMacysUrl(val) {
7410
- return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
7313
+ function boolean(literal2) {
7314
+ return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
7411
7315
  }
7412
- function isAppleUrl(val) {
7413
- return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
7316
+ var unknown = () => "<<unknown>>";
7317
+ var undefinedType = () => "<<undefined>>";
7318
+ var nullType = () => "<<null>>";
7319
+ function fn(..._args) {
7320
+ return {
7321
+ returns: (_rtn) => ({
7322
+ addProperties: (_kv) => {
7323
+ return null;
7324
+ },
7325
+ done: () => {
7326
+ return null;
7327
+ }
7328
+ }),
7329
+ done: () => {
7330
+ const result2 = null;
7331
+ return result2;
7332
+ }
7333
+ };
7414
7334
  }
7415
- function isWalmartUrl(val) {
7416
- return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
7335
+ function dictionary(_obj) {
7336
+ return null;
7417
7337
  }
7418
- function isAmazonUrl(val) {
7419
- return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
7338
+ function tuple2(..._elements) {
7339
+ return null;
7420
7340
  }
7421
- function isRetailUrl(val) {
7422
- 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);
7341
+ function regexToken(re, ...rep) {
7342
+ let exp = "";
7343
+ if (isString(re)) {
7344
+ try {
7345
+ const test = new RegExp(re);
7346
+ if (!isRegExp(test)) {
7347
+ const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
7348
+ err.name = "InvalidRegEx";
7349
+ throw err;
7350
+ } else {
7351
+ exp = re;
7352
+ }
7353
+ } catch {
7354
+ const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
7355
+ err.name = "InvalidRegEx";
7356
+ throw err;
7357
+ }
7358
+ } else if (isRegExp(re)) {
7359
+ exp = re.toString();
7360
+ }
7361
+ const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
7362
+ return token;
7423
7363
  }
7424
- var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
7425
- var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
7426
- function isSocialMediaUrl(val) {
7427
- return isString(val) && URL20.some((i) => val.startsWith(i));
7364
+ function addSingleton(token, api2) {
7365
+ return (...literals) => {
7366
+ return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
7367
+ "union",
7368
+ literals.map((l) => addToken(token, `${l}`)).join(",")
7369
+ );
7370
+ };
7428
7371
  }
7429
- function isSocialMediaProfileUrl(val) {
7430
- return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
7372
+ var stringApi = {
7373
+ startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
7374
+ endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
7375
+ zip: () => addToken("string-set", "Zip5"),
7376
+ zipPlus4: () => addToken("string-set", "Zip5_4"),
7377
+ zipCode: () => addToken("string-set", "ZipCode"),
7378
+ militaryTime: (resolution) => {
7379
+ return addToken(
7380
+ "string-set",
7381
+ "militaryTime",
7382
+ resolution || "HH:MM"
7383
+ );
7384
+ },
7385
+ civilianTime: (resolution) => {
7386
+ return addToken(
7387
+ "string-set",
7388
+ "militaryTime",
7389
+ resolution || "HH:MM"
7390
+ );
7391
+ },
7392
+ numericString: () => addToken("string-set", "numeric"),
7393
+ ipv4Address: () => addToken("string-set", "ipv4Address"),
7394
+ ipv6Address: () => addToken("string-set", "ipv6Address"),
7395
+ regex: (exp, ...literalRepresentation) => {
7396
+ const token = regexToken(exp, ...literalRepresentation);
7397
+ return token;
7398
+ },
7399
+ done: () => addToken("string")
7400
+ };
7401
+ var string22 = addSingleton("string", stringApi);
7402
+ var number = addSingleton("number");
7403
+ function union3(...elements) {
7404
+ const result2 = elements.map((_el) => {
7405
+ });
7406
+ return result2;
7431
7407
  }
7432
- function isYouTubeUrl(val) {
7433
- return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
7408
+ function record(_key, _value) {
7409
+ return null;
7434
7410
  }
7435
- function isYouTubeShareUrl(val) {
7436
- return isString(val) && val.startsWith(`https://youtu.be`);
7411
+ function array(_type) {
7412
+ return null;
7437
7413
  }
7438
- function isYouTubeVideoUrl(val) {
7439
- return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
7414
+ function set(_type) {
7415
+ return null;
7440
7416
  }
7441
- function isYouTubePlaylistUrl(val) {
7442
- 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`));
7417
+ function map(_key, _value) {
7418
+ return null;
7443
7419
  }
7444
- function feed_map(type) {
7445
- return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
7420
+ function weakMap(_key, _value) {
7421
+ return null;
7446
7422
  }
7447
- function isYouTubeFeedUrl(val, type) {
7448
- return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
7423
+ function isAddOrDone(val) {
7424
+ return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
7449
7425
  }
7450
- function isYouTubeFeedHistoryUrl(val) {
7451
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
7426
+ var ShapeApiImplementation = {
7427
+ string: string22,
7428
+ number,
7429
+ boolean,
7430
+ unknown,
7431
+ undefined: undefinedType,
7432
+ null: nullType,
7433
+ union: union3,
7434
+ fn,
7435
+ record,
7436
+ array,
7437
+ set,
7438
+ map,
7439
+ weakMap,
7440
+ dictionary,
7441
+ tuple: tuple2
7442
+ };
7443
+ function shape(cb) {
7444
+ const rtn = cb(ShapeApiImplementation);
7445
+ return handleDoneFn(
7446
+ isAddOrDone(rtn) ? rtn.done() : rtn
7447
+ );
7452
7448
  }
7453
- function isYouTubePlaylistsUrl(val) {
7454
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
7449
+ function isShape(v) {
7450
+ return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
7455
7451
  }
7456
- function isYouTubeTrendingUrl(val) {
7457
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
7452
+ function asDefineObject(defn) {
7453
+ const result2 = Object.keys(defn).reduce(
7454
+ (acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
7455
+ ...acc,
7456
+ [i]: handleDoneFn(defn[i](ShapeApiImplementation))
7457
+ } : isFunction(defn[i]) ? {
7458
+ ...acc,
7459
+ [i]: handleDoneFn(defn[i](ShapeApiImplementation))
7460
+ } : Never2,
7461
+ {}
7462
+ );
7463
+ return result2;
7458
7464
  }
7459
- function isYouTubeSubscriptionsUrl(val) {
7460
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
7465
+ function asType(...token) {
7466
+ 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);
7461
7467
  }
7462
- function isYouTubeCreatorUrl(url) {
7463
- return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
7468
+ function asStringLiteral(...values) {
7469
+ return values.map((i) => i);
7464
7470
  }
7465
- function isYouTubeVideosInPlaylist(val) {
7466
- return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
7471
+ var choices = "NOT READY";
7472
+ function doesExtend(type) {
7473
+ return (val) => {
7474
+ let response = false;
7475
+ if (isString(val)) {
7476
+ if (type === "string") {
7477
+ response = true;
7478
+ }
7479
+ if (type.startsWith("string(")) {
7480
+ const literals = stripAfter(
7481
+ stripBefore(type, "string("),
7482
+ ")"
7483
+ ).split(/,\s*/);
7484
+ if (literals.includes(val)) {
7485
+ response = true;
7486
+ }
7487
+ }
7488
+ }
7489
+ if (isNumber(val)) {
7490
+ if (type === "number") {
7491
+ response = true;
7492
+ }
7493
+ if (type.startsWith("number(")) {
7494
+ const literals = stripAfter(
7495
+ stripBefore(type, "number("),
7496
+ ")"
7497
+ ).split(/,\s*/).map(Number);
7498
+ if (literals.includes(val)) {
7499
+ response = true;
7500
+ }
7501
+ }
7502
+ }
7503
+ if (isNull(val) && (type === "null" || type === "Opt<null>")) {
7504
+ response = true;
7505
+ }
7506
+ if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
7507
+ response = true;
7508
+ }
7509
+ if (isBoolean(val)) {
7510
+ if (type === "boolean") {
7511
+ response = true;
7512
+ }
7513
+ if (type === "true" && val === true || type === "false" && val === false) {
7514
+ response = true;
7515
+ }
7516
+ }
7517
+ if (isNarrowableObject(val)) {
7518
+ if (type === "Dict" || type === "Dict<string, unknown>") {
7519
+ response = true;
7520
+ }
7521
+ if (startsWith("Dict<")(type)) {
7522
+ const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
7523
+ if (match) {
7524
+ const { value } = match;
7525
+ const isOpt = value.includes(`Opt<`);
7526
+ const values = objectValues(val);
7527
+ 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>") {
7528
+ response = true;
7529
+ }
7530
+ }
7531
+ }
7532
+ }
7533
+ if (isArray(val)) {
7534
+ if (type === "Array" || type === "Array<unknown>") {
7535
+ return true;
7536
+ }
7537
+ 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)) {
7538
+ response = true;
7539
+ }
7540
+ }
7541
+ if (isMap(val)) {
7542
+ 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)) {
7543
+ response = true;
7544
+ }
7545
+ }
7546
+ if (isSetContainer(val)) {
7547
+ 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))) {
7548
+ response = true;
7549
+ }
7550
+ }
7551
+ return response;
7552
+ };
7467
7553
  }
7468
- function isVueRef(val) {
7469
- if (isObject(val)) {
7470
- const keys = Object.keys(val);
7471
- return !!["dep", "__v_isRef"].every((i) => keys.includes(i));
7554
+ function ip6Prefix(...groups) {
7555
+ const empty = addToken("string");
7556
+ const count = 4 - groups.length;
7557
+ const fillIn = [];
7558
+ for (let index = 0; index < count; index++) {
7559
+ fillIn.push(empty);
7472
7560
  }
7473
- return false;
7561
+ return [
7562
+ "<<string::",
7563
+ [
7564
+ groups.join(":"),
7565
+ fillIn.join(":")
7566
+ ].join(":"),
7567
+ ">>"
7568
+ ].join("");
7474
7569
  }
7475
- function csv(csv2, format = `string-numeric-tuple`) {
7476
- const tuple3 = [];
7477
- csv2.split(/,\s?/).forEach((v) => {
7478
- tuple3.push(
7479
- 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
7480
- );
7570
+ function createProxy(...initialize) {
7571
+ const state = initialize;
7572
+ state.id = null;
7573
+ const proxy = new Proxy(state, {});
7574
+ Object.defineProperty(proxy, "id", {
7575
+ enumerable: false
7481
7576
  });
7482
- return tuple3;
7483
- }
7484
- function fromKeyValue(kvs) {
7485
- const obj = {};
7486
- for (const kv of kvs) {
7487
- obj[kv.key] = kv.value;
7488
- }
7489
- return obj;
7490
- }
7491
- function intersect(value, _intersectedWith) {
7492
- return value;
7493
- }
7494
- function ip6GroupExpansion(ip) {
7495
- return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
7496
- }
7497
- function jsonValue(val) {
7498
- return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
7499
- }
7500
- function jsonValues(...val) {
7501
- return val.map((i) => jsonValue(i));
7502
- }
7503
- function lookupAlpha2Code(code, prop) {
7504
- const found = ISO3166_12.find((i) => i.alpha2 === code);
7505
- return found ? found[prop] : void 0;
7506
- }
7507
- function lookupAlpha3Code(code, prop) {
7508
- const found = ISO3166_12.find((i) => i.alpha3 === code);
7509
- return found ? found[prop] : void 0;
7510
- }
7511
- function lookupName(name, prop) {
7512
- const found = ISO3166_12.find((i) => i.name === name);
7513
- return found ? found[prop] : void 0;
7514
- }
7515
- function lookupNumericCode(code, prop) {
7516
- let num = isNumber(code) ? `${code}` : code;
7517
- if (num.length === 1) {
7518
- num = `00${num}`;
7519
- } else if (num.length === 2) {
7520
- num = `0${num}`;
7521
- }
7522
- const found = ISO3166_12.find((i) => i.countryCode === num);
7523
- return found ? found[prop] : void 0;
7524
- }
7525
- function lookupCountryName(code) {
7526
- const uc = uppercase(code);
7527
- return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
7577
+ return proxy;
7528
7578
  }
7529
- function lookupCountryAlpha2(code) {
7530
- const uc = uppercase(code);
7531
- return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
7579
+ function list(...init) {
7580
+ return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
7532
7581
  }
7533
- function lookupCountryAlpha3(token) {
7534
- const uc = uppercase(token);
7535
- return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
7582
+ function singletonApi(kind) {
7583
+ return {
7584
+ wide: () => `<<${kind}>>`,
7585
+ literal: (val) => `<<${kind}::${val}>>`
7586
+ };
7536
7587
  }
7537
- function lookupCountryCode(token) {
7538
- const uc = uppercase(token);
7539
- return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
7588
+ function setApi(_variant) {
7589
+ return null;
7540
7590
  }
7541
- function asMapper(fn2) {
7542
- const props = {
7543
- kind: "Mapper",
7544
- map: (from) => {
7545
- return from.map(fn2);
7546
- }
7591
+ function fnReturnsApi(variant, _params, returns) {
7592
+ return isSet(returns) ? null : (_rtn) => {
7593
+ return isSet(returns) ? `<<${variant}::>>` : null;
7547
7594
  };
7548
- return createFnWithPropsExplicit(fn2, props);
7549
7595
  }
7550
- function createObjectMap() {
7551
- return (map2) => {
7552
- const fn2 = (input) => {
7553
- return Object.keys(map2).reduce(
7554
- (acc, key) => {
7555
- const val = map2[key];
7556
- return {
7557
- ...acc,
7558
- [key]: isFunction(val) ? val(input) : val
7559
- };
7560
- },
7561
- {}
7562
- );
7563
- };
7564
- return fn2;
7596
+ function fnParamsApi(variant, params, _returns) {
7597
+ return isSet(params) ? null : (params2) => {
7598
+ return isSet(params2) ? `<<${variant}::>>` : null;
7565
7599
  };
7566
7600
  }
7567
- function createMapper() {
7568
- return (fn2) => {
7569
- return asMapper(fn2);
7570
- };
7601
+ function fnDoneApi(variant, params, returns) {
7602
+ return isUnset(params) && isUnset(returns) ? `<<` : ``;
7571
7603
  }
7572
- function mergeObjects(defVal, override) {
7604
+ function fnTokenClosure(kind, params, returns) {
7573
7605
  return {
7574
- ...defVal,
7575
- ...override
7606
+ done: fnDoneApi(kind, params, returns),
7607
+ params: fnParamsApi(kind, params, returns),
7608
+ returns: fnReturnsApi(kind, params, returns)
7576
7609
  };
7577
7610
  }
7578
- function mergeScalars(a, b) {
7579
- return isUndefined(b) ? a : b;
7611
+ function createTypeToken(kind) {
7612
+ return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
7580
7613
  }
7581
- function mergeTuples(a, b) {
7582
- 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]);
7614
+ function fromDefineObject(defn) {
7615
+ return defn;
7583
7616
  }
7584
- function never(val) {
7585
- return val;
7617
+ function getTokenKind(token) {
7618
+ const bare = stripSurround("<<", ">>")(token);
7619
+ const parts = bare.split("::");
7620
+ const kind = parts.pop();
7621
+ return kind;
7586
7622
  }
7587
- function optional(value) {
7623
+ var simpleToken = (token) => token;
7624
+ var simpleScalarToken = (token) => token;
7625
+ var simpleContainerToken = (token) => token;
7626
+ function simpleScalarType(token) {
7627
+ const value = simpleScalarToken(token);
7588
7628
  return value;
7589
7629
  }
7590
- function orNull(value) {
7630
+ function simpleContainerType(token) {
7631
+ const value = simpleContainerToken(token);
7591
7632
  return value;
7592
7633
  }
7593
- function optionalOrNull(value) {
7634
+ function simpleType(token) {
7635
+ const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
7594
7636
  return value;
7595
7637
  }
7596
- function stripParenthesis(val) {
7597
- return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
7598
- }
7599
- function sortKeyApi(order) {
7600
- return {
7601
- order,
7602
- toTop: (...keys) => sortKeyApi(
7603
- [
7604
- ...keys,
7605
- ...order.filter((i) => !keys.includes(i))
7606
- ]
7607
- ),
7608
- toBottom: (...keys) => sortKeyApi(
7609
- [
7610
- ...order.filter((i) => !keys.includes(i)),
7611
- ...keys
7612
- ]
7613
- ),
7614
- done: () => order
7615
- };
7616
- }
7617
- function toKeyValue(obj, sort) {
7618
- let keys = keysOf(obj);
7619
- const tuple3 = [];
7620
- if (sort) {
7621
- keys = handleDoneFn(sort(sortKeyApi(keys)));
7622
- }
7638
+ function hasOverlappingKeys(a, b) {
7639
+ const keys = Object.keys(a);
7623
7640
  for (const k of keys) {
7624
- tuple3.push({ key: k, value: obj[k] });
7641
+ if (k in b) {
7642
+ return true;
7643
+ }
7625
7644
  }
7626
- return tuple3;
7645
+ return false;
7627
7646
  }
7628
- function convertScalar(val) {
7629
- switch (typeof val) {
7630
- case "number":
7631
- return val;
7632
- case "string":
7633
- return Number(val);
7634
- case "boolean":
7635
- return val ? 1 : 0;
7636
- default:
7637
- throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
7647
+ function uniqueKeys(left, right) {
7648
+ const isNumeric = !!(isArray(left) && isArray(right));
7649
+ if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
7650
+ 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!");
7638
7651
  }
7639
- }
7640
- var convertList = (val) => val.map((i) => convertScalar(i));
7641
- function toNumber(value) {
7642
- return Array.isArray(value) ? convertList(value) : convertScalar(value);
7643
- }
7644
- var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
7645
- function removeTailwindModifiers(val) {
7646
- return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
7647
- }
7648
- function getTailwindModifiers(val) {
7649
- return val.split(":").filter((i) => isTailwindModifier(i));
7650
- }
7651
- function union3(..._options) {
7652
- return (value) => value;
7653
- }
7654
- function unionize(value, _inUnionWith) {
7655
- return value;
7652
+ const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
7653
+ const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
7654
+ if (isNumeric) {
7655
+ throw new Error("uniqueKeys does not yet work with tuples");
7656
+ }
7657
+ const leftKeys = l.filter((i) => !r.includes(i));
7658
+ const rightKeys = r.filter((i) => !l.includes(i));
7659
+ return [
7660
+ "LeftRight",
7661
+ leftKeys,
7662
+ rightKeys
7663
+ ];
7656
7664
  }
7657
7665
  function asVueRef(value) {
7658
7666
  return {
@@ -8104,6 +8112,7 @@ export {
8104
8112
  errCondition,
8105
8113
  filter,
8106
8114
  filterEmpty,
8115
+ filterUndefined,
8107
8116
  find,
8108
8117
  fnMeta,
8109
8118
  fromDefineObject,
@@ -8510,7 +8519,7 @@ export {
8510
8519
  twColor,
8511
8520
  unbox,
8512
8521
  uncapitalize,
8513
- union3 as union,
8522
+ union,
8514
8523
  unionize,
8515
8524
  unique,
8516
8525
  uniqueKeys,