inferred-types 0.55.12 → 0.55.14

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