inferred-types 0.55.2 → 0.55.4

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.
@@ -2611,54 +2611,6 @@ function asApi(api2) {
2611
2611
  function handleDoneFn(val, call_bare_fn = false) {
2612
2612
  return isObject(val) || isFunction(val) ? isDoneFn(val) ? val.done() : isFunction(val) ? call_bare_fn ? val() : val : val : isFunction(val) ? call_bare_fn ? val() : val : val;
2613
2613
  }
2614
- function addPropsToFn(fn2, clone_fn) {
2615
- const localFn = clone_fn ? (...args) => fn2(args) : fn2;
2616
- return (obj) => {
2617
- for (const k in obj) {
2618
- localFn[k] = obj[k];
2619
- }
2620
- return localFn;
2621
- };
2622
- }
2623
- function addFnToProps(props, _clone_fn) {
2624
- return (fn2) => {
2625
- const localFn = (...args) => fn2(args);
2626
- for (const k in props) {
2627
- localFn[k] = props[k];
2628
- }
2629
- return localFn;
2630
- };
2631
- }
2632
- function createCssSelector(_opt) {
2633
- return (...selectors) => {
2634
- return selectors.join(" ");
2635
- };
2636
- }
2637
- function createFnWithProps(fn2, props, narrowing = false) {
2638
- const fnWithProps = fn2;
2639
- for (const prop of Object.keys(props)) {
2640
- fnWithProps[prop] = props[prop];
2641
- }
2642
- return isTrue(narrowing) ? fnWithProps : fnWithProps;
2643
- }
2644
- function createFnWithPropsExplicit(fn2, props) {
2645
- const fnWithProps = fn2;
2646
- for (const prop of Object.keys(props)) {
2647
- fnWithProps[prop] = props[prop];
2648
- }
2649
- return fnWithProps;
2650
- }
2651
- function defineObj(literal2 = {}) {
2652
- return (wide22 = {}) => {
2653
- const obj = literal2 ? { ...literal2, ...wide22 } : wide22;
2654
- return obj;
2655
- };
2656
- }
2657
- function defineTuple(...values) {
2658
- return values.map(
2659
- (i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i
2660
- );
2661
- }
2662
2614
  function objectToApi(obj, def = null) {
2663
2615
  const transformed = Object.keys(obj).reduce(
2664
2616
  (acc, key) => {
@@ -4471,21 +4423,6 @@ function ifSameType(value, comparator, same, notSame) {
4471
4423
  typeof value === typeof comparator ? same(value) : notSame(value)
4472
4424
  );
4473
4425
  }
4474
- function isNull(value) {
4475
- return value === null;
4476
- }
4477
- function isString(value) {
4478
- return typeof value === "string";
4479
- }
4480
- function isSymbol(value) {
4481
- return typeof value === "symbol";
4482
- }
4483
- function isNumber(value) {
4484
- return typeof value === "number";
4485
- }
4486
- function isScalar(value) {
4487
- return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
4488
- }
4489
4426
  function ifScalar(value, ifCallback, notCallback) {
4490
4427
  const result2 = isScalar(value) ? ifCallback(
4491
4428
  value
@@ -4708,7 +4645,7 @@ function get(value, dotPath, options = {
4708
4645
  return outcome;
4709
4646
  }
4710
4647
  function keysOf(container) {
4711
- const keys = Array.isArray(container) ? Object.keys(container).map((i) => Number(i)) : isObject(container) ? isRef(container) ? ["value"] : Object.keys(container) : [];
4648
+ const keys = isVueRef(container) ? ["value"] : Array.isArray(container) ? Object.keys(container).map((i) => Number(i)) : isObject(container) ? Object.keys(container) : [];
4712
4649
  return keys;
4713
4650
  }
4714
4651
  function callback() {
@@ -4796,88 +4733,6 @@ function withKeys(dict, ...keys) {
4796
4733
  function withoutKeys(dict, ...exclude) {
4797
4734
  return omit(dict, ...exclude);
4798
4735
  }
4799
- function doesExtend(type) {
4800
- return (val) => {
4801
- let response = false;
4802
- if (isString(val)) {
4803
- if (type === "string") {
4804
- response = true;
4805
- }
4806
- if (type.startsWith("string(")) {
4807
- const literals = stripAfter(
4808
- stripBefore(type, "string("),
4809
- ")"
4810
- ).split(/,\s*/);
4811
- if (literals.includes(val)) {
4812
- response = true;
4813
- }
4814
- }
4815
- }
4816
- if (isNumber(val)) {
4817
- if (type === "number") {
4818
- response = true;
4819
- }
4820
- if (type.startsWith("number(")) {
4821
- const literals = stripAfter(
4822
- stripBefore(type, "number("),
4823
- ")"
4824
- ).split(/,\s*/).map(Number);
4825
- if (literals.includes(val)) {
4826
- response = true;
4827
- }
4828
- }
4829
- }
4830
- if (isNull(val) && (type === "null" || type === "Opt<null>")) {
4831
- response = true;
4832
- }
4833
- if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
4834
- response = true;
4835
- }
4836
- if (isBoolean(val)) {
4837
- if (type === "boolean") {
4838
- response = true;
4839
- }
4840
- if (type === "true" && val === true || type === "false" && val === false) {
4841
- response = true;
4842
- }
4843
- }
4844
- if (isNarrowableObject(val)) {
4845
- if (type === "Dict" || type === "Dict<string, unknown>") {
4846
- response = true;
4847
- }
4848
- if (startsWith("Dict<")(type)) {
4849
- const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
4850
- if (match) {
4851
- const { value } = match;
4852
- const isOpt = value.includes(`Opt<`);
4853
- const values = objectValues(val);
4854
- 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>") {
4855
- response = true;
4856
- }
4857
- }
4858
- }
4859
- }
4860
- if (isArray(val)) {
4861
- if (type === "Array" || type === "Array<unknown>") {
4862
- return true;
4863
- }
4864
- 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)) {
4865
- response = true;
4866
- }
4867
- }
4868
- if (isMap(val)) {
4869
- 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)) {
4870
- response = true;
4871
- }
4872
- }
4873
- if (isSetContainer(val)) {
4874
- 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))) {
4875
- response = true;
4876
- }
4877
- }
4878
- return response;
4879
- };
4880
- }
4881
4736
  function withoutValue(wo) {
4882
4737
  return (obj) => {
4883
4738
  const output = {};
@@ -4930,6 +4785,54 @@ function fnMeta(func) {
4930
4785
  };
4931
4786
  }
4932
4787
  var wrapFn = "NOT IMPLEMENTED";
4788
+ function addPropsToFn(fn2, clone_fn) {
4789
+ const localFn = clone_fn ? (...args) => fn2(args) : fn2;
4790
+ return (obj) => {
4791
+ for (const k in obj) {
4792
+ localFn[k] = obj[k];
4793
+ }
4794
+ return localFn;
4795
+ };
4796
+ }
4797
+ function addFnToProps(props, _clone_fn) {
4798
+ return (fn2) => {
4799
+ const localFn = (...args) => fn2(args);
4800
+ for (const k in props) {
4801
+ localFn[k] = props[k];
4802
+ }
4803
+ return localFn;
4804
+ };
4805
+ }
4806
+ function createCssSelector(_opt) {
4807
+ return (...selectors) => {
4808
+ return selectors.join(" ");
4809
+ };
4810
+ }
4811
+ function createFnWithProps(fn2, props, narrowing = false) {
4812
+ const fnWithProps = fn2;
4813
+ for (const prop of Object.keys(props)) {
4814
+ fnWithProps[prop] = props[prop];
4815
+ }
4816
+ return isTrue(narrowing) ? fnWithProps : fnWithProps;
4817
+ }
4818
+ function createFnWithPropsExplicit(fn2, props) {
4819
+ const fnWithProps = fn2;
4820
+ for (const prop of Object.keys(props)) {
4821
+ fnWithProps[prop] = props[prop];
4822
+ }
4823
+ return fnWithProps;
4824
+ }
4825
+ function defineObj(literal2 = {}) {
4826
+ return (wide22 = {}) => {
4827
+ const obj = literal2 ? { ...literal2, ...wide22 } : wide22;
4828
+ return obj;
4829
+ };
4830
+ }
4831
+ function defineTuple(...values) {
4832
+ return values.map(
4833
+ (i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i
4834
+ );
4835
+ }
4933
4836
  function asArray(thing) {
4934
4837
  return Array.isArray(thing) === true ? thing : typeof thing === "undefined" ? [] : [thing];
4935
4838
  }
@@ -5112,311 +5015,266 @@ function ensureTrailing(content, ensure) {
5112
5015
  content.endsWith(ensure) ? content : `${content}${ensure}`
5113
5016
  );
5114
5017
  }
5115
- function isFunction(value) {
5116
- return typeof value === "function";
5117
- }
5118
- function isObject(value) {
5119
- return typeof value === "object" && value !== null && Array.isArray(value) === false;
5018
+ function getTypeSubtype(str) {
5019
+ if (isTypeSubtype(str)) {
5020
+ const [t, st] = str.split("/");
5021
+ return [t, st];
5022
+ } else {
5023
+ const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
5024
+ err.name = "InvalidTypeSubtype";
5025
+ throw err;
5026
+ }
5120
5027
  }
5121
- function isNarrowableObject(value) {
5122
- return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
5028
+ function identity(...values) {
5029
+ return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
5123
5030
  }
5124
- function isEscapeFunction(val) {
5125
- return isFunction(val) && "escape" in val && val.escape === true;
5031
+ function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
5032
+ if (ch.length !== 1) {
5033
+ throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
5034
+ }
5035
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
5126
5036
  }
5127
- function isOptionalParamFunction(val) {
5128
- return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
5037
+ function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
5038
+ if (ch.length !== 1) {
5039
+ throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
5040
+ }
5041
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
5129
5042
  }
5130
- function isApi(api2) {
5131
- return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
5043
+ function parseTemplate(template) {
5044
+ const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
5045
+ let lastIndex = 0;
5046
+ let match;
5047
+ const segments = [];
5048
+ while (match = pattern.exec(template)) {
5049
+ const [fullMatch, varName, asType2] = match;
5050
+ const staticPart = template.slice(lastIndex, match.index);
5051
+ if (staticPart) {
5052
+ segments.push({ dynamic: false, text: staticPart });
5053
+ }
5054
+ segments.push({
5055
+ dynamic: true,
5056
+ varName,
5057
+ type: asType2 ? asType2 : "string"
5058
+ });
5059
+ lastIndex = match.index + fullMatch.length;
5060
+ }
5061
+ const remainder = template.slice(lastIndex);
5062
+ if (remainder) {
5063
+ segments.push({ dynamic: false, text: remainder });
5064
+ }
5065
+ return segments;
5132
5066
  }
5133
- function isApiSurface(val) {
5134
- return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
5067
+ function escapeRegex(str) {
5068
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5135
5069
  }
5136
- function isDate(val) {
5137
- return val instanceof Date;
5138
- }
5139
- function isIsoDateTime(val) {
5140
- if (!isString(val)) {
5141
- return false;
5142
- }
5143
- 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})?$/;
5144
- if (!ISO_DATETIME_REGEX.test(val)) {
5145
- return false;
5146
- }
5147
- const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
5148
- const [year, month, day, hours, minutes, seconds] = matches.map(Number);
5149
- if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
5150
- return false;
5151
- }
5152
- if (month < 1 || month > 12) {
5153
- return false;
5154
- }
5155
- ;
5156
- const daysInMonth = new Date(year, month, 0).getDate();
5157
- if (day < 1 || day > daysInMonth) {
5158
- return false;
5159
- }
5160
- ;
5161
- const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
5162
- if (tzMatch) {
5163
- const [_2, _sign, tzHours, tzMinutes] = tzMatch;
5164
- const numHours = Number.parseInt(tzHours, 10);
5165
- const numMinutes = Number.parseInt(tzMinutes, 10);
5166
- if (numHours > 14 || numMinutes > 59) {
5167
- return false;
5168
- }
5169
- if (numHours === 14 && numMinutes > 0) {
5170
- return false;
5070
+ function buildRegexPattern(segments) {
5071
+ let regexStr = "^";
5072
+ for (const seg of segments) {
5073
+ if (!seg.dynamic) {
5074
+ regexStr += escapeRegex(seg.text);
5075
+ } else {
5076
+ switch (seg.type) {
5077
+ case "string":
5078
+ regexStr += "(.*?)";
5079
+ break;
5080
+ case "number":
5081
+ regexStr += "(\\d+)";
5082
+ break;
5083
+ case "boolean":
5084
+ regexStr += "(true|false)";
5085
+ break;
5086
+ }
5171
5087
  }
5172
5088
  }
5173
- return true;
5089
+ regexStr += "$";
5090
+ return new RegExp(regexStr);
5174
5091
  }
5175
- function isIsoExplicitDate(val) {
5176
- if (isString(val)) {
5177
- const parts = val.split("-").map((i) => Number(i));
5178
- 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;
5179
- } else {
5180
- return false;
5092
+ function convertValue(type, value) {
5093
+ switch (type) {
5094
+ case "string":
5095
+ return value;
5096
+ case "number":
5097
+ return Number(value);
5098
+ case "boolean":
5099
+ return value === "true";
5181
5100
  }
5182
5101
  }
5183
- function isIsoImplicitDate(val) {
5184
- if (isString(val) && val.length === 8 && isNumberLike(val)) {
5185
- const year = Number(val.slice(0, 4));
5186
- const month = Number(val.slice(4, 6));
5187
- const date = Number(val.slice(6, 8));
5188
- return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
5189
- } else {
5102
+ function matchTemplate(template, test) {
5103
+ const segments = parseTemplate(template);
5104
+ const regex = buildRegexPattern(segments);
5105
+ const match = regex.exec(test);
5106
+ if (!match)
5190
5107
  return false;
5108
+ let captureIndex = 1;
5109
+ const result2 = {};
5110
+ for (const seg of segments) {
5111
+ if (seg.dynamic) {
5112
+ const rawVal = match[captureIndex++];
5113
+ if (rawVal === void 0)
5114
+ return false;
5115
+ result2[seg.varName] = convertValue(seg.type, rawVal);
5116
+ }
5191
5117
  }
5118
+ return result2;
5192
5119
  }
5193
- function isIsoDate(val) {
5194
- if (isString(val)) {
5195
- return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
5196
- } else {
5197
- return false;
5198
- }
5120
+ function infer(inference) {
5121
+ return (test) => {
5122
+ return matchTemplate(inference, test);
5123
+ };
5199
5124
  }
5200
- function isIsoExplicitTime(val) {
5201
- if (isString(val)) {
5202
- const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
5203
- return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
5204
- } else {
5205
- return false;
5206
- }
5125
+ function idLiteral(o) {
5126
+ return { ...o, id: o.id };
5207
5127
  }
5208
- function isIsoImplicitTime(val) {
5209
- if (isString(val)) {
5210
- const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
5211
- return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
5212
- } else {
5213
- return false;
5214
- }
5128
+ function nameLiteral(o) {
5129
+ return o;
5215
5130
  }
5216
- function isIsoTime(val) {
5217
- return isIsoExplicitTime(val) || isIsoImplicitTime(val);
5131
+ function kindLiteral(o) {
5132
+ return o;
5218
5133
  }
5219
- function isIsoYear(val) {
5220
- return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
5134
+ function idTypeGuard(_o) {
5135
+ return true;
5221
5136
  }
5222
- function isLuxonDateTime(val) {
5223
- 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";
5137
+ function literal(obj) {
5138
+ return obj;
5224
5139
  }
5225
- function isMoment(val) {
5226
- if (val instanceof Date) {
5227
- return false;
5228
- }
5229
- 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";
5140
+ function lowercase(str) {
5141
+ return str.toLowerCase();
5230
5142
  }
5231
- function isThisMonth(val) {
5232
- const now = /* @__PURE__ */ new Date();
5233
- const currentYear = now.getFullYear();
5234
- const currentMonth = now.getMonth() + 1;
5235
- if (val instanceof Date) {
5236
- return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
5237
- }
5238
- if (isMoment(val)) {
5239
- const monthValue = val.month();
5240
- return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
5241
- }
5242
- if (isLuxonDateTime(val)) {
5243
- return val.year === currentYear && val.month === currentMonth;
5143
+ function narrow(...values) {
5144
+ return values.length === 1 ? values[0] : values;
5145
+ }
5146
+ function pathJoin(...segments) {
5147
+ const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
5148
+ const original_path = segments.join("/");
5149
+ const pre = original_path.startsWith("/") ? "/" : "";
5150
+ const post = original_path.endsWith("/") ? "/" : "";
5151
+ return `${pre}${clean_path}${post}`;
5152
+ }
5153
+ var asPhoneFormat = () => `NOT IMPLEMENTED`;
5154
+ function getPhoneCountryCode(phone) {
5155
+ return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
5156
+ stripLeading(stripLeading(phone.trim(), "+"), "00"),
5157
+ ...NUMERIC_CHAR2
5158
+ ) : "";
5159
+ }
5160
+ function removePhoneCountryCode(phone) {
5161
+ const countryCode = getPhoneCountryCode(phone);
5162
+ return countryCode !== "" ? stripLeading(stripLeading(
5163
+ phone.trim(),
5164
+ "+",
5165
+ "00"
5166
+ ), countryCode).trim() : phone.trim();
5167
+ }
5168
+ var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
5169
+ function endingIn(word, postfix) {
5170
+ switch (postfix) {
5171
+ case "is":
5172
+ return word.endsWith(postfix) ? `${word}es` : void 0;
5173
+ case "singular-noun":
5174
+ return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
5175
+ case "f":
5176
+ return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
5177
+ case "y":
5178
+ return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
5179
+ default:
5180
+ throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
5244
5181
  }
5245
- if (typeof val === "string") {
5246
- 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))?$/;
5247
- if (!isoDateRegex.test(val)) {
5248
- return false;
5249
- }
5250
- const dateMatch = val.match(/^(\d{4})-(\d{2})/);
5251
- if (dateMatch) {
5252
- const year = Number.parseInt(dateMatch[1], 10);
5253
- const month = Number.parseInt(dateMatch[2], 10);
5254
- return year === currentYear && month === currentMonth;
5182
+ }
5183
+ function pluralize(word) {
5184
+ const right = rightWhitespace(word);
5185
+ const w = word.trimEnd();
5186
+ const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
5187
+ return `${result2}${right}`;
5188
+ }
5189
+ function retainAfter(content, ...find2) {
5190
+ const idx = Math.min(
5191
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
5192
+ );
5193
+ const min = Math.min(...find2.map((i) => i.length));
5194
+ let len = Math.max(...find2.map((i) => i.length));
5195
+ if (min !== len) {
5196
+ if (!find2.includes(content.slice(idx, len))) {
5197
+ len = min;
5255
5198
  }
5256
5199
  }
5257
- return false;
5200
+ return idx && idx > 0 ? content.slice(idx + len) : "";
5258
5201
  }
5259
- function isThisWeek(date) {
5260
- const targetDate = asDate(date);
5261
- if (!targetDate) {
5262
- return false;
5202
+ function retainAfterInclusive(content, ...find2) {
5203
+ const minFound = Math.min(
5204
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
5205
+ );
5206
+ return minFound > 0 ? content.slice(minFound) : "";
5207
+ }
5208
+ function retainChars(content, ...retain2) {
5209
+ const chars = asChars(content);
5210
+ return chars.filter((c) => retain2.includes(c)).join("");
5211
+ }
5212
+ function retainUntil(content, ...find2) {
5213
+ const chars = asChars(content);
5214
+ let idx = 0;
5215
+ while (!find2.includes(chars[idx]) && idx <= chars.length) {
5216
+ idx = idx + 1;
5263
5217
  }
5264
- const currentWeek = getWeekNumber();
5265
- const targetWeek = getWeekNumber(targetDate);
5266
- return currentWeek === targetWeek;
5218
+ return idx === 0 ? "" : content.slice(0, idx);
5267
5219
  }
5268
- function isThisYear(val) {
5269
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
5270
- if (isObject(val) || isNumber(val) || isString(val)) {
5271
- const date = asDate(val);
5272
- if (date) {
5273
- return date.getFullYear() === currentYear;
5274
- } else {
5275
- return false;
5276
- }
5220
+ function retainUntilInclusive(content, ...find2) {
5221
+ const chars = asChars(content);
5222
+ let idx = 0;
5223
+ while (!find2.includes(chars[idx]) && idx <= chars.length) {
5224
+ idx = idx + 1;
5277
5225
  }
5278
- return false;
5226
+ return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
5279
5227
  }
5280
- function isToday(test) {
5281
- if (isString(test)) {
5282
- const justDate = stripAfter(test, "T");
5283
- return isIsoExplicitDate(justDate) && justDate === getToday();
5284
- } else if (isMoment(test) || isDate(test)) {
5285
- return stripAfter(test.toISOString(), "T") === getToday();
5286
- } else if (isLuxonDateTime(test)) {
5287
- return stripAfter(test.toISO(), "T") === getToday();
5288
- }
5289
- return false;
5290
- }
5291
- function isTomorrow(test) {
5292
- if (isString(test)) {
5293
- const justDate = stripAfter(test, "T");
5294
- return isIsoExplicitDate(justDate) && justDate === getTomorrow();
5295
- } else if (isMoment(test) || isDate(test)) {
5296
- return stripAfter(test.toISOString(), "T") === getTomorrow();
5297
- } else if (isLuxonDateTime(test)) {
5298
- return stripAfter(test.toISO(), "T") === getTomorrow();
5299
- }
5300
- return false;
5301
- }
5302
- function isYesterday(test) {
5303
- if (isString(test)) {
5304
- const justDate = stripAfter(test, "T");
5305
- return isIsoExplicitDate(justDate) && justDate === getYesterday();
5306
- } else if (isMoment(test) || isDate(test)) {
5307
- return stripAfter(test.toISOString(), "T") === getYesterday();
5308
- } else if (isLuxonDateTime(test)) {
5309
- return stripAfter(test.toISO(), "T") === getYesterday();
5310
- }
5311
- return false;
5312
- }
5313
- function isIso3166Alpha2(val) {
5314
- const codes = ISO3166_12.map((i) => i.alpha2);
5315
- return isString(val) && codes.includes(val);
5316
- }
5317
- function isCountryCode2(val) {
5318
- const codes = ISO3166_12.map((i) => i.alpha2);
5319
- return isString(val) && codes.includes(val);
5320
- }
5321
- function isIso3166Alpha3(val) {
5322
- const codes = ISO3166_12.map((i) => i.alpha3);
5323
- return isString(val) && codes.includes(val);
5324
- }
5325
- function isCountryCode3(val) {
5326
- const codes = ISO3166_12.map((i) => i.alpha3);
5327
- return isString(val) && codes.includes(val);
5328
- }
5329
- function isIso3166CountryCode(val) {
5330
- const codes = ISO3166_12.map((i) => i.countryCode);
5331
- return isString(val) && codes.includes(val);
5332
- }
5333
- function isCountryAbbrev(val) {
5334
- return isCountryCode2(val) || isCountryCode3(val);
5335
- }
5336
- function isIso3166CountryName(val) {
5337
- const codes = ISO3166_12.map((i) => i.name);
5338
- return isString(val) && codes.includes(val);
5339
- }
5340
- function isCountryName(val) {
5341
- const codes = ISO3166_12.map((i) => i.name);
5342
- return isString(val) && codes.includes(val);
5343
- }
5344
- var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
5345
- var NAME = US_STATE_LOOKUP2.map((i) => i.name);
5346
- function isUsStateAbbreviation(val) {
5347
- return isString(val) && ABBREV.includes(val);
5228
+ function retainWhile(content, ...retain2) {
5229
+ const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
5230
+ return content.slice(0, stopIdx);
5348
5231
  }
5349
- function isUsStateName(val) {
5350
- return isString(val) && NAME.includes(val);
5232
+ function rightWhitespace(content) {
5233
+ const trimmed = content.trimStart();
5234
+ return retainAfterInclusive(
5235
+ trimmed,
5236
+ ...WHITESPACE_CHARS2
5237
+ );
5351
5238
  }
5352
5239
  function split(str, sep = "") {
5353
5240
  return str.split(sep);
5354
5241
  }
5355
- function isNumericString(value) {
5356
- const numericChars = [...NUMERIC_CHAR2];
5357
- return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
5242
+ function stripAfter(content, find2) {
5243
+ return content.split(find2).shift();
5358
5244
  }
5359
- function isNumberLike(value) {
5360
- const numericChars = [...NUMERIC_CHAR2];
5361
- return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
5245
+ function stripBefore(content, find2) {
5246
+ return content.split(find2).slice(1).join(find2);
5362
5247
  }
5363
- function isZipCode5(val) {
5364
- if (isNumber(val)) {
5365
- return isZipCode5(`${val}`);
5366
- }
5367
- return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
5248
+ function stripChars(content, ...strip2) {
5249
+ const chars = asChars(content);
5250
+ return chars.filter((c) => !strip2.includes(c)).join("");
5368
5251
  }
5369
- function isZipPlus4(val) {
5370
- if (isString(val)) {
5371
- const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
5372
- const next = stripChars(val.trim().replace(first, "").trim(), "-");
5373
- return first.length === 5 && next.length === 4 && isNumberLike(next);
5252
+ function stripLeading(content, ...strip2) {
5253
+ if (isUndefined(content)) {
5254
+ return void 0;
5374
5255
  }
5375
- return false;
5376
- }
5377
- function isZipCode(val) {
5378
- return isZipCode5(val) || isZipPlus4(val);
5379
- }
5380
- function isSpecificConstant(kind) {
5381
- return (value) => {
5382
- return !!(isConstant(value) && value.kind === kind);
5383
- };
5384
- }
5385
- function hasDefaultValue(value) {
5386
- const noDefault = isSpecificConstant("no-default-value");
5387
- return !noDefault(value);
5388
- }
5389
- function hasIndexOf(value, idx) {
5390
- const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
5391
- return isErrorCondition(result2, "invalid-index") ? false : result2;
5256
+ let output = String(content);
5257
+ for (const s of strip2) {
5258
+ if (output.startsWith(String(s))) {
5259
+ output = output.slice(String(s).length);
5260
+ }
5261
+ }
5262
+ return isNumber(content) ? Number(output) : output;
5392
5263
  }
5393
- function hasKeys(...props) {
5394
- return (val) => {
5395
- const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
5396
- return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
5264
+ function stripSurround(...chars) {
5265
+ return (input) => {
5266
+ let output = String(input);
5267
+ for (const s of chars) {
5268
+ if (output.startsWith(String(s))) {
5269
+ output = output.slice(String(s).length);
5270
+ }
5271
+ if (output.endsWith(String(s))) {
5272
+ output = output.slice(0, -1 * String(s).length);
5273
+ }
5274
+ }
5275
+ return isNumber(input) ? Number(output) : output;
5397
5276
  };
5398
5277
  }
5399
- function asChars(str) {
5400
- return str.split("");
5401
- }
5402
- function asRecord(obj) {
5403
- return obj;
5404
- }
5405
- function asString(value) {
5406
- return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
5407
- }
5408
- function csv(csv2, format = `string-numeric-tuple`) {
5409
- const tuple3 = [];
5410
- csv2.split(/,\s?/).forEach((v) => {
5411
- tuple3.push(
5412
- 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
5413
- );
5414
- });
5415
- return tuple3;
5416
- }
5417
- function intersect(value, _intersectedWith) {
5418
- return value;
5419
- }
5420
5278
  function stripTrailing(content, ...strip2) {
5421
5279
  if (isUndefined(content)) {
5422
5280
  return void 0;
@@ -5429,1815 +5287,2000 @@ function stripTrailing(content, ...strip2) {
5429
5287
  }
5430
5288
  return isNumber(content) ? Number(output) : output;
5431
5289
  }
5432
- function ip6GroupExpansion(ip) {
5433
- return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
5290
+ function stripUntil(content, ...until) {
5291
+ const stopIdx = asChars(content).findIndex((c) => until.includes(c));
5292
+ return content.slice(stopIdx);
5434
5293
  }
5435
- function jsonValue(val) {
5436
- return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
5294
+ function stripWhile(content, ...match) {
5295
+ const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
5296
+ return content.slice(stopIdx);
5437
5297
  }
5438
- function jsonValues(...val) {
5439
- return val.map((i) => jsonValue(i));
5298
+ function surround(prefix, postfix) {
5299
+ return (input) => `${prefix}${input}${postfix}`;
5440
5300
  }
5441
- function lookupAlpha2Code(code, prop) {
5442
- const found = ISO3166_12.find((i) => i.alpha2 === code);
5443
- return found ? found[prop] : void 0;
5301
+ function takeNumericCharacters(content) {
5302
+ const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
5303
+ return content.slice(0, nonNumericIdx);
5444
5304
  }
5445
- function lookupAlpha3Code(code, prop) {
5446
- const found = ISO3166_12.find((i) => i.alpha3 === code);
5447
- return found ? found[prop] : void 0;
5305
+ function toCamelCase(input, preserveWhitespace) {
5306
+ const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
5307
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
5308
+ pascal
5309
+ );
5310
+ const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
5311
+ return camel;
5448
5312
  }
5449
- function lookupName(name, prop) {
5450
- const found = ISO3166_12.find((i) => i.name === name);
5451
- return found ? found[prop] : void 0;
5313
+ function toKebabCase(input, _preserveWhitespace = false) {
5314
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
5315
+ const replaceWhitespace = (i) => i.replace(/\s/g, "-");
5316
+ const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
5317
+ const replaceLeadingDash = (i) => i.replace(/^-/, "");
5318
+ const replaceTrailingDash = (i) => i.replace(/-$/, "");
5319
+ const replaceUnderscore = (i) => i.replace(/_/g, "-");
5320
+ const removeDupDashes = (i) => i.replace(/-+/g, "-");
5321
+ return removeDupDashes(`${preWhite}${replaceUnderscore(
5322
+ replaceTrailingDash(
5323
+ replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
5324
+ )
5325
+ )}${postWhite}`);
5452
5326
  }
5453
- function lookupNumericCode(code, prop) {
5454
- let num = isNumber(code) ? `${code}` : code;
5455
- if (num.length === 1) {
5456
- num = `00${num}`;
5457
- } else if (num.length === 2) {
5458
- num = `0${num}`;
5459
- }
5460
- const found = ISO3166_12.find((i) => i.countryCode === num);
5461
- return found ? found[prop] : void 0;
5327
+ function toNumericArray(arr) {
5328
+ return arr.map((i) => Number(i));
5462
5329
  }
5463
- function lookupCountryName(code) {
5464
- const uc = uppercase(code);
5465
- return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
5330
+ function toPascalCase(input, preserveWhitespace = void 0) {
5331
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
5332
+ input
5333
+ );
5334
+ const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
5335
+ const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
5336
+ const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
5337
+ const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
5338
+ const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
5339
+ replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
5340
+ )}${preserveWhitespace ? postWhite : ""}`;
5341
+ return pascal;
5466
5342
  }
5467
- function lookupCountryAlpha2(code) {
5468
- const uc = uppercase(code);
5469
- return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
5343
+ function toSnakeCase(input, preserveWhitespace = false) {
5344
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
5345
+ const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
5346
+ const convertDashes = (input2) => input2.replace(/-/g, "_");
5347
+ const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
5348
+ const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
5349
+ return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
5350
+ injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
5351
+ ).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
5470
5352
  }
5471
- function lookupCountryAlpha3(token) {
5472
- const uc = uppercase(token);
5473
- return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
5353
+ function toString(val) {
5354
+ return String(val);
5474
5355
  }
5475
- function lookupCountryCode(token) {
5476
- const uc = uppercase(token);
5477
- return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
5356
+ function toUppercase(str) {
5357
+ return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
5478
5358
  }
5479
- function asMapper(fn2) {
5480
- const props = {
5481
- kind: "Mapper",
5482
- map: (from) => {
5483
- return from.map(fn2);
5484
- }
5485
- };
5486
- return createFnWithPropsExplicit(fn2, props);
5359
+ function trim(input) {
5360
+ return input.trim();
5487
5361
  }
5488
- function createObjectMap() {
5489
- return (map2) => {
5490
- const fn2 = (input) => {
5491
- return Object.keys(map2).reduce(
5492
- (acc, key) => {
5493
- const val = map2[key];
5494
- return {
5495
- ...acc,
5496
- [key]: isFunction(val) ? val(input) : val
5497
- };
5498
- },
5499
- {}
5500
- );
5501
- };
5502
- return fn2;
5503
- };
5362
+ function trimLeft(input) {
5363
+ return input.trimStart();
5504
5364
  }
5505
- function createMapper() {
5506
- return (fn2) => {
5507
- return asMapper(fn2);
5508
- };
5365
+ function trimStart(input) {
5366
+ return input.trimStart();
5509
5367
  }
5510
- function mergeObjects(defVal, override) {
5511
- const intersectingKeys = sharedKeys(defVal, override);
5512
- const defUnique = withoutKeys(defVal, ...intersectingKeys);
5513
- const overrideUnique = withoutKeys(defVal, ...intersectingKeys);
5514
- const merged = {
5515
- ...intersectingKeys.reduce(
5516
- (acc, key) => typeof override[key] === "undefined" ? { ...acc, [key]: defVal[key] } : { ...acc, [key]: override[key] },
5517
- {}
5518
- ),
5519
- ...defUnique,
5520
- ...overrideUnique
5521
- };
5522
- return merged;
5368
+ function trimRight(input) {
5369
+ return input.trimEnd();
5523
5370
  }
5524
- function isUndefined(value) {
5525
- return typeof value === "undefined";
5371
+ function trimEnd(input) {
5372
+ return input.trimEnd();
5526
5373
  }
5527
- function mergeScalars(a, b) {
5528
- return isUndefined(b) ? a : b;
5374
+ function truncate(content, maxLength, ellipsis = false) {
5375
+ const overLimit = content.length > maxLength;
5376
+ return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
5529
5377
  }
5530
- function mergeTuples(a, b) {
5531
- 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]);
5378
+ function tuple(...values) {
5379
+ const arr = values.length === 1 ? values[0] : values;
5380
+ return asArray(arr);
5532
5381
  }
5533
- function never(val) {
5534
- return val;
5382
+ function uncapitalize(str) {
5383
+ return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
5535
5384
  }
5536
- function optional(value) {
5537
- return value;
5385
+ var unset = "<<unset>>";
5386
+ function uppercase(str) {
5387
+ return str.toUpperCase();
5538
5388
  }
5539
- function orNull(value) {
5389
+ function widen(value) {
5540
5390
  return value;
5541
5391
  }
5542
- function optionalOrNull(value) {
5543
- return value;
5392
+ var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
5393
+ function getUrlProtocol(url) {
5394
+ const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
5395
+ return proto;
5544
5396
  }
5545
- function stripParenthesis(val) {
5546
- return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
5397
+ function removeUrlProtocol(url) {
5398
+ return stripBefore(url, "://");
5547
5399
  }
5548
- function convertScalar(val) {
5549
- switch (typeof val) {
5550
- case "number":
5551
- return val;
5552
- case "string":
5553
- return Number(val);
5554
- case "boolean":
5555
- return val ? 1 : 0;
5556
- default:
5557
- throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
5558
- }
5400
+ function ensurePath(val) {
5401
+ const val2 = ensureLeading(val, "/");
5402
+ return val === "" ? "" : stripTrailing(val2, "/");
5559
5403
  }
5560
- var convertList = (val) => val.map((i) => convertScalar(i));
5561
- function toNumber(value) {
5562
- return Array.isArray(value) ? convertList(value) : convertScalar(value);
5404
+ function getUrlPath(url) {
5405
+ return isUrl(url) ? ensurePath(
5406
+ stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
5407
+ ) : Never2;
5563
5408
  }
5564
- var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
5565
- function removeTailwindModifiers(val) {
5566
- return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
5409
+ function getUrlQueryParams(url, specific = void 0) {
5410
+ const qp = stripBefore(url, "?");
5411
+ if (specific) {
5412
+ return qp.includes(`${specific}=`) ? decodeURIComponent(
5413
+ stripAfter(
5414
+ stripBefore(qp, `${specific}=`),
5415
+ "&"
5416
+ ).replace(/\+/g, "%20")
5417
+ ) : void 0;
5418
+ }
5419
+ return qp === "" ? qp : `?${qp}`;
5567
5420
  }
5568
- function getTailwindModifiers(val) {
5569
- return val.split(":").filter((i) => isTailwindModifier(i));
5421
+ function getUrlDefaultPort(url) {
5422
+ const proto = getUrlProtocol(url);
5423
+ return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
5570
5424
  }
5571
- function union(..._options) {
5572
- return (value) => value;
5425
+ function getUrlPort(url, resolve = false) {
5426
+ const re = /.*:(\d{2,3})/;
5427
+ const match = url.match(re);
5428
+ return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
5573
5429
  }
5574
- function unionize(value, _inUnionWith) {
5575
- return value;
5430
+ function getUrlSource(url) {
5431
+ const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
5432
+ return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
5576
5433
  }
5577
- function hasWhiteSpace(val) {
5578
- return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
5434
+ function getUrlBase(url) {
5435
+ const path = getUrlPath(url);
5436
+ const remaining = stripAfter(url, path);
5437
+ return remaining;
5579
5438
  }
5580
- function endsWith(endingIn2) {
5581
- return (val) => {
5582
- return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
5439
+ function getUrlDynamics(url) {
5440
+ const path = getUrlPath(url);
5441
+ const qp = getUrlQueryParams(url);
5442
+ const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
5443
+ const segmentTypes = [
5444
+ "string",
5445
+ "number",
5446
+ "boolean",
5447
+ "Opt<string>",
5448
+ "Opt<number>",
5449
+ "Opt<boolean>"
5450
+ ];
5451
+ const pathVars = {};
5452
+ const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
5453
+ const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
5454
+ const findPathNamed = infer(`<{{infer name}}>`);
5455
+ for (const part of pathParts) {
5456
+ const union4 = findPathUnion(part);
5457
+ const typed = findPathTyped(part);
5458
+ const named = findPathNamed(part);
5459
+ if (union4) {
5460
+ if (isVariable(union4.name) && isCsv(union4.union)) {
5461
+ pathVars[union4.name] = `string(${union4.union})`;
5462
+ }
5463
+ } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
5464
+ pathVars[typed.name] = typed.type;
5465
+ } else if (named && isVariable(named.name)) {
5466
+ pathVars[named.name] = "string";
5467
+ }
5468
+ }
5469
+ const qpVars = {};
5470
+ const qpParts = stripLeading(qp, "?").split("&");
5471
+ for (const p of qpParts) {
5472
+ const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
5473
+ const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
5474
+ const fixed = infer(`{{infer var}}={{infer val}}`)(p);
5475
+ if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
5476
+ qpVars[union4.var] = `string(${union4.params})`;
5477
+ } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
5478
+ qpVars[dynamic.var] = dynamic.val;
5479
+ } else if (fixed && isVariable(fixed.var)) {
5480
+ qpVars[fixed.var] = fixed.val;
5481
+ }
5482
+ }
5483
+ return {
5484
+ pathVars,
5485
+ qpVars,
5486
+ allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
5487
+ ...pathVars,
5488
+ ...qpVars
5489
+ }
5583
5490
  };
5584
5491
  }
5585
- function isEqual(base) {
5586
- return (value) => isSameTypeOf(base)(value) ? value === base : false;
5587
- }
5588
- function isLength(value, len) {
5589
- return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
5590
- }
5591
- function isSameTypeOf(base) {
5592
- return (compare) => {
5593
- return typeof base === typeof compare;
5492
+ function urlMeta(url) {
5493
+ return {
5494
+ url,
5495
+ isUrl: isUrl(url),
5496
+ protocol: getUrlProtocol(url),
5497
+ path: getUrlPath(url),
5498
+ queryParameters: getUrlQueryParams(url),
5499
+ params: getUrlDynamics,
5500
+ port: getUrlPort(url),
5501
+ source: getUrlSource(url),
5502
+ isIpAddress: isIpAddress(getUrlSource(url)),
5503
+ isIp4Address: isIp4Address(getUrlSource(url)),
5504
+ isIp6Address: isIp6Address(getUrlSource(url))
5594
5505
  };
5595
5506
  }
5596
- function isTuple(...tuple3) {
5597
- const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
5598
- return (v) => {
5599
- return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
5600
- };
5507
+ function getYouTubePageType(url) {
5508
+ 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;
5601
5509
  }
5602
- function isTypeOf(type) {
5603
- return (value) => {
5604
- return typeof value === type;
5605
- };
5510
+ function youtubeEmbed(url) {
5511
+ if (hasUrlQueryParameter(url, "v")) {
5512
+ const id = getUrlQueryParams(url, "v");
5513
+ return `https://www.youtube.com/embed/${id}`;
5514
+ } else if (isYouTubeShareUrl(url)) {
5515
+ const id = url.split("/").pop();
5516
+ if (id) {
5517
+ return `https://www.youtube.com/embed/${id}`;
5518
+ } else {
5519
+ throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
5520
+ }
5521
+ } else {
5522
+ throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
5523
+ }
5606
5524
  }
5607
- function startsWith(startingWith) {
5608
- return (val) => {
5609
- return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
5525
+ function youtubeMeta(url) {
5526
+ return isYouTubeUrl(url) ? {
5527
+ url,
5528
+ isYouTubeUrl: true,
5529
+ isShareUrl: isYouTubeShareUrl(url),
5530
+ pageType: getYouTubePageType(url)
5531
+ } : {
5532
+ url,
5533
+ isYouTubeUrl: false
5610
5534
  };
5611
5535
  }
5612
- function isHtmlElement(val) {
5613
- return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
5536
+ function queue(state) {
5537
+ return {
5538
+ queue: state,
5539
+ size: state.length,
5540
+ isEmpty() {
5541
+ return state.length === 0;
5542
+ },
5543
+ clear() {
5544
+ state.slice(0, 0);
5545
+ },
5546
+ drain() {
5547
+ const old_state = [...state];
5548
+ state.slice(0, 0);
5549
+ return old_state;
5550
+ },
5551
+ push(...add) {
5552
+ state.push(...add);
5553
+ },
5554
+ drop(quantity) {
5555
+ if (quantity && quantity > state.length) {
5556
+ throw new Error("Cannot drop more elements than present in the queue");
5557
+ }
5558
+ state.splice(0, quantity || 1);
5559
+ },
5560
+ take(quantity) {
5561
+ if (quantity && quantity > state.length) {
5562
+ throw new Error("Cannot take more elements than present in the queue");
5563
+ }
5564
+ const result2 = state.slice(0, quantity || 1);
5565
+ state.splice(0, quantity || 1);
5566
+ return result2;
5567
+ },
5568
+ *[Symbol.iterator]() {
5569
+ for (let i = 0; i < state.length; i++) {
5570
+ yield state[i];
5571
+ }
5572
+ }
5573
+ };
5614
5574
  }
5615
- function isAlpha(value) {
5616
- return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
5575
+ function createFifoQueue(...list2) {
5576
+ return queue([...list2]);
5617
5577
  }
5618
- function isArray(value) {
5619
- return Array.isArray(value) === true;
5578
+ function queue2(state) {
5579
+ return {
5580
+ queue: state,
5581
+ size: state.length,
5582
+ isEmpty() {
5583
+ return state.length === 0;
5584
+ },
5585
+ push(...add) {
5586
+ state.push(...add);
5587
+ },
5588
+ drop(quantity) {
5589
+ state.splice(-quantity);
5590
+ },
5591
+ clear() {
5592
+ state.slice(0, 0);
5593
+ },
5594
+ drain() {
5595
+ const old_state = [...state];
5596
+ state.slice(0, 0);
5597
+ return old_state;
5598
+ },
5599
+ take(quantity) {
5600
+ const result2 = state.slice(-quantity);
5601
+ state.splice(-quantity);
5602
+ return result2;
5603
+ },
5604
+ *[Symbol.iterator]() {
5605
+ for (let i = state.length - 1; i >= 0; i--) {
5606
+ yield state[i];
5607
+ }
5608
+ }
5609
+ };
5620
5610
  }
5621
- function isBoolean(value) {
5622
- return typeof value === "boolean";
5611
+ function createLifoQueue(...list2) {
5612
+ return queue2([...list2]);
5623
5613
  }
5624
- function isBooleanLike(val) {
5625
- return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
5614
+ var scalarToToken = identity({
5615
+ string: "<<string>>",
5616
+ number: "<<number>>",
5617
+ boolean: "<<boolean>>",
5618
+ true: "<<true>>",
5619
+ false: "<<false>>",
5620
+ null: "<<null>>",
5621
+ undefined: "<<undefined>>",
5622
+ unknown: "<<unknown>>",
5623
+ any: "<<any>>",
5624
+ never: "<<never>>"
5625
+ });
5626
+ function stringLiteral(str) {
5627
+ return stripAfter(stripBefore(str, "string("), ")");
5628
+ }
5629
+ function numericLiteral(str) {
5630
+ return stripAfter(stripBefore(str, "number("), ")");
5631
+ }
5632
+ function handleOptional(token) {
5633
+ const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
5634
+ 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>>`;
5635
+ }
5636
+ function simpleScalarTokenToTypeToken(val) {
5637
+ 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>>`;
5638
+ }
5639
+ function unionNode(node) {
5640
+ return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
5641
+ }
5642
+ function union(nodes) {
5643
+ return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
5644
+ }
5645
+ var stripUnion = stripSurround("Union(", ")");
5646
+ function simpleUnionTokenToTypeToken(val) {
5647
+ return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union(stripUnion(val))} ]>>` : Never2;
5648
+ }
5649
+ function simpleContainerTokenToTypeToken(_val) {
5650
+ }
5651
+ function asTypeToken(_val) {
5652
+ return "not ready";
5653
+ }
5654
+ function addToken(token, ...params) {
5655
+ return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
5656
+ }
5657
+ function boolean(literal2) {
5658
+ return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
5659
+ }
5660
+ var unknown = () => "<<unknown>>";
5661
+ var undefinedType = () => "<<undefined>>";
5662
+ var nullType = () => "<<null>>";
5663
+ function fn(..._args) {
5664
+ return {
5665
+ returns: (_rtn) => ({
5666
+ addProperties: (_kv) => {
5667
+ return null;
5668
+ },
5669
+ done: () => {
5670
+ return null;
5671
+ }
5672
+ }),
5673
+ done: () => {
5674
+ const result2 = null;
5675
+ return result2;
5676
+ }
5677
+ };
5678
+ }
5679
+ function dictionary(_obj) {
5680
+ return null;
5681
+ }
5682
+ function tuple2(..._elements) {
5683
+ return null;
5684
+ }
5685
+ function regexToken(re, ...rep) {
5686
+ let exp = "";
5687
+ if (isString(re)) {
5688
+ try {
5689
+ const test = new RegExp(re);
5690
+ if (!isRegExp(test)) {
5691
+ const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
5692
+ err.name = "InvalidRegEx";
5693
+ throw err;
5694
+ } else {
5695
+ exp = re;
5696
+ }
5697
+ } catch {
5698
+ const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
5699
+ err.name = "InvalidRegEx";
5700
+ throw err;
5701
+ }
5702
+ } else if (isRegExp(re)) {
5703
+ exp = re.toString();
5704
+ }
5705
+ const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
5706
+ return token;
5707
+ }
5708
+ function addSingleton(token, api2) {
5709
+ return (...literals) => {
5710
+ return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
5711
+ "union",
5712
+ literals.map((l) => addToken(token, `${l}`)).join(",")
5713
+ );
5714
+ };
5715
+ }
5716
+ var stringApi = {
5717
+ startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
5718
+ endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
5719
+ zip: () => addToken("string-set", "Zip5"),
5720
+ zipPlus4: () => addToken("string-set", "Zip5_4"),
5721
+ zipCode: () => addToken("string-set", "ZipCode"),
5722
+ militaryTime: (resolution) => {
5723
+ return addToken(
5724
+ "string-set",
5725
+ "militaryTime",
5726
+ resolution || "HH:MM"
5727
+ );
5728
+ },
5729
+ civilianTime: (resolution) => {
5730
+ return addToken(
5731
+ "string-set",
5732
+ "militaryTime",
5733
+ resolution || "HH:MM"
5734
+ );
5735
+ },
5736
+ numericString: () => addToken("string-set", "numeric"),
5737
+ ipv4Address: () => addToken("string-set", "ipv4Address"),
5738
+ ipv6Address: () => addToken("string-set", "ipv6Address"),
5739
+ regex: (exp, ...literalRepresentation) => {
5740
+ const token = regexToken(exp, ...literalRepresentation);
5741
+ return token;
5742
+ },
5743
+ done: () => addToken("string")
5744
+ };
5745
+ var string22 = addSingleton("string", stringApi);
5746
+ var number = addSingleton("number");
5747
+ function union2(...elements) {
5748
+ const result2 = elements.map((_el) => {
5749
+ });
5750
+ return result2;
5751
+ }
5752
+ function record(_key, _value) {
5753
+ return null;
5754
+ }
5755
+ function array(_type) {
5756
+ return null;
5757
+ }
5758
+ function set(_type) {
5759
+ return null;
5760
+ }
5761
+ function map(_key, _value) {
5762
+ return null;
5763
+ }
5764
+ function weakMap(_key, _value) {
5765
+ return null;
5766
+ }
5767
+ function isAddOrDone(val) {
5768
+ return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
5769
+ }
5770
+ var ShapeApiImplementation = {
5771
+ string: string22,
5772
+ number,
5773
+ boolean,
5774
+ unknown,
5775
+ undefined: undefinedType,
5776
+ null: nullType,
5777
+ union: union2,
5778
+ fn,
5779
+ record,
5780
+ array,
5781
+ set,
5782
+ map,
5783
+ weakMap,
5784
+ dictionary,
5785
+ tuple: tuple2
5786
+ };
5787
+ function shape(cb) {
5788
+ const rtn = cb(ShapeApiImplementation);
5789
+ return handleDoneFn(
5790
+ isAddOrDone(rtn) ? rtn.done() : rtn
5791
+ );
5792
+ }
5793
+ function isShape(v) {
5794
+ return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
5795
+ }
5796
+ function asDefineObject(defn) {
5797
+ const result2 = Object.keys(defn).reduce(
5798
+ (acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
5799
+ ...acc,
5800
+ [i]: handleDoneFn(defn[i](ShapeApiImplementation))
5801
+ } : isFunction(defn[i]) ? {
5802
+ ...acc,
5803
+ [i]: handleDoneFn(defn[i](ShapeApiImplementation))
5804
+ } : Never2,
5805
+ {}
5806
+ );
5807
+ return result2;
5808
+ }
5809
+ function asType(...token) {
5810
+ 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);
5811
+ }
5812
+ function asStringLiteral(...values) {
5813
+ return values.map((i) => i);
5814
+ }
5815
+ var choices = "NOT READY";
5816
+ function doesExtend(type) {
5817
+ return (val) => {
5818
+ let response = false;
5819
+ if (isString(val)) {
5820
+ if (type === "string") {
5821
+ response = true;
5822
+ }
5823
+ if (type.startsWith("string(")) {
5824
+ const literals = stripAfter(
5825
+ stripBefore(type, "string("),
5826
+ ")"
5827
+ ).split(/,\s*/);
5828
+ if (literals.includes(val)) {
5829
+ response = true;
5830
+ }
5831
+ }
5832
+ }
5833
+ if (isNumber(val)) {
5834
+ if (type === "number") {
5835
+ response = true;
5836
+ }
5837
+ if (type.startsWith("number(")) {
5838
+ const literals = stripAfter(
5839
+ stripBefore(type, "number("),
5840
+ ")"
5841
+ ).split(/,\s*/).map(Number);
5842
+ if (literals.includes(val)) {
5843
+ response = true;
5844
+ }
5845
+ }
5846
+ }
5847
+ if (isNull(val) && (type === "null" || type === "Opt<null>")) {
5848
+ response = true;
5849
+ }
5850
+ if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
5851
+ response = true;
5852
+ }
5853
+ if (isBoolean(val)) {
5854
+ if (type === "boolean") {
5855
+ response = true;
5856
+ }
5857
+ if (type === "true" && val === true || type === "false" && val === false) {
5858
+ response = true;
5859
+ }
5860
+ }
5861
+ if (isNarrowableObject(val)) {
5862
+ if (type === "Dict" || type === "Dict<string, unknown>") {
5863
+ response = true;
5864
+ }
5865
+ if (startsWith("Dict<")(type)) {
5866
+ const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
5867
+ if (match) {
5868
+ const { value } = match;
5869
+ const isOpt = value.includes(`Opt<`);
5870
+ const values = objectValues(val);
5871
+ 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>") {
5872
+ response = true;
5873
+ }
5874
+ }
5875
+ }
5876
+ }
5877
+ if (isArray(val)) {
5878
+ if (type === "Array" || type === "Array<unknown>") {
5879
+ return true;
5880
+ }
5881
+ 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)) {
5882
+ response = true;
5883
+ }
5884
+ }
5885
+ if (isMap(val)) {
5886
+ 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)) {
5887
+ response = true;
5888
+ }
5889
+ }
5890
+ if (isSetContainer(val)) {
5891
+ 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))) {
5892
+ response = true;
5893
+ }
5894
+ }
5895
+ return response;
5896
+ };
5897
+ }
5898
+ function ip6Prefix(...groups) {
5899
+ const empty = addToken("string");
5900
+ const count = 4 - groups.length;
5901
+ const fillIn = [];
5902
+ for (let index = 0; index < count; index++) {
5903
+ fillIn.push(empty);
5904
+ }
5905
+ return [
5906
+ "<<string::",
5907
+ [
5908
+ groups.join(":"),
5909
+ fillIn.join(":")
5910
+ ].join(":"),
5911
+ ">>"
5912
+ ].join("");
5913
+ }
5914
+ function createProxy(...initialize) {
5915
+ const state = initialize;
5916
+ state.id = null;
5917
+ const proxy = new Proxy(state, {});
5918
+ Object.defineProperty(proxy, "id", {
5919
+ enumerable: false
5920
+ });
5921
+ return proxy;
5922
+ }
5923
+ function list(...init) {
5924
+ return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
5925
+ }
5926
+ function singletonApi(kind) {
5927
+ return {
5928
+ wide: () => `<<${kind}>>`,
5929
+ literal: (val) => `<<${kind}::${val}>>`
5930
+ };
5931
+ }
5932
+ function setApi(_variant) {
5933
+ return null;
5626
5934
  }
5627
- function isConstant(value) {
5628
- return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
5935
+ function fnReturnsApi(variant, _params, returns) {
5936
+ return isSet(returns) ? null : (_rtn) => {
5937
+ return isSet(returns) ? `<<${variant}::>>` : null;
5938
+ };
5629
5939
  }
5630
- function isContainer(value) {
5631
- return !!(Array.isArray(value) || isObject(value));
5940
+ function fnParamsApi(variant, params, _returns) {
5941
+ return isSet(params) ? null : (params2) => {
5942
+ return isSet(params2) ? `<<${variant}::>>` : null;
5943
+ };
5632
5944
  }
5633
- var tokens = [
5634
- "1",
5635
- "inherit",
5636
- "initial",
5637
- "revert",
5638
- "revert-layer",
5639
- "unset",
5640
- "auto"
5641
- ];
5642
- var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
5643
- function isCssAspectRatio(val) {
5644
- return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
5945
+ function fnDoneApi(variant, params, returns) {
5946
+ return isUnset(params) && isUnset(returns) ? `<<` : ``;
5645
5947
  }
5646
- function isCsv(val) {
5647
- return isString(val) && val.includes(",") && !val.startsWith(",");
5948
+ function fnTokenClosure(kind, params, returns) {
5949
+ return {
5950
+ done: fnDoneApi(kind, params, returns),
5951
+ params: fnParamsApi(kind, params, returns),
5952
+ returns: fnReturnsApi(kind, params, returns)
5953
+ };
5648
5954
  }
5649
- function isDefined(value) {
5650
- return typeof value !== "undefined";
5955
+ function createTypeToken(kind) {
5956
+ return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
5651
5957
  }
5652
- function isDoneFn(val) {
5653
- return hasKeys("done")(val) && typeof val.done === "function";
5958
+ function fromDefineObject(defn) {
5959
+ return defn;
5654
5960
  }
5655
- function isEmail(val) {
5656
- if (!isString(val)) {
5657
- return false;
5658
- }
5659
- const parts = val?.split("@");
5660
- const domain = parts[1]?.split(".");
5661
- const tld = domain ? domain.pop() : "";
5662
- const firstChar = val[0].toLowerCase();
5663
- return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
5961
+ function getTokenKind(token) {
5962
+ const bare = stripSurround("<<", ">>")(token);
5963
+ const parts = bare.split("::");
5964
+ const kind = parts.pop();
5965
+ return kind;
5664
5966
  }
5665
- function isEmpty(val) {
5666
- return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
5967
+ var simpleToken = (token) => token;
5968
+ var simpleScalarToken = (token) => token;
5969
+ var simpleContainerToken = (token) => token;
5970
+ function simpleScalarType(token) {
5971
+ const value = simpleScalarToken(token);
5972
+ return value;
5667
5973
  }
5668
- function isErrorCondition(value, kind = null) {
5669
- return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
5974
+ function simpleContainerType(token) {
5975
+ const value = simpleContainerToken(token);
5976
+ return value;
5670
5977
  }
5671
- function isFalse(i) {
5672
- return typeof i === "boolean" && !i;
5978
+ function simpleType(token) {
5979
+ const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
5980
+ return value;
5673
5981
  }
5674
- function isFalsy(val) {
5675
- return FALSY_VALUES2.includes(val);
5982
+ function hasOverlappingKeys(a, b) {
5983
+ const keys = Object.keys(a);
5984
+ for (const k of keys) {
5985
+ if (k in b) {
5986
+ return true;
5987
+ }
5988
+ }
5989
+ return false;
5676
5990
  }
5677
- function isFnWithParams(input, ...params) {
5678
- return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
5991
+ function uniqueKeys(left, right) {
5992
+ const isNumeric = !!(isArray(left) && isArray(right));
5993
+ if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
5994
+ 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!");
5995
+ }
5996
+ const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
5997
+ const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
5998
+ if (isNumeric) {
5999
+ throw new Error("uniqueKeys does not yet work with tuples");
6000
+ }
6001
+ const leftKeys = l.filter((i) => !r.includes(i));
6002
+ const rightKeys = r.filter((i) => !l.includes(i));
6003
+ return [
6004
+ "LeftRight",
6005
+ leftKeys,
6006
+ rightKeys
6007
+ ];
5679
6008
  }
5680
- function isHexadecimal(val) {
5681
- return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
6009
+ function asChars(str) {
6010
+ return str.split("");
5682
6011
  }
5683
- function isIndexable(value) {
5684
- return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
6012
+ function asRecord(obj) {
6013
+ return obj;
5685
6014
  }
5686
- function isInlineSvg(v) {
5687
- return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
6015
+ function asString(value) {
6016
+ return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
5688
6017
  }
5689
- function isMap(val) {
5690
- return val instanceof Map;
6018
+ function isFunction(value) {
6019
+ return typeof value === "function";
5691
6020
  }
5692
- function isNever(val) {
5693
- return isConstant(val) && val.kind === "never";
6021
+ function isObject(value) {
6022
+ return typeof value === "object" && value !== null && Array.isArray(value) === false;
5694
6023
  }
5695
- function isNothing(val) {
5696
- return !!(val === null || val === void 0);
6024
+ function isNarrowableObject(value) {
6025
+ return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
5697
6026
  }
5698
- function isNotNull(value) {
5699
- return value === null;
6027
+ function isEscapeFunction(val) {
6028
+ return isFunction(val) && "escape" in val && val.escape === true;
5700
6029
  }
5701
- function isPhoneNumber(val) {
5702
- const svelte = String(val).trim();
5703
- const chars = svelte.split("");
5704
- const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
5705
- const valid2 = ["+", "(", ...NUMERIC_CHAR2];
5706
- const nothing = stripChars(svelte, ...[
5707
- ...NUMERIC_CHAR2,
5708
- ...WHITESPACE_CHARS2,
5709
- "(",
5710
- ")",
5711
- "+",
5712
- ".",
5713
- "-"
5714
- ]);
5715
- return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
6030
+ function isOptionalParamFunction(val) {
6031
+ return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
5716
6032
  }
5717
- function isReadonlyArray(value) {
5718
- return Array.isArray(value) === true;
6033
+ function isApi(api2) {
6034
+ return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
5719
6035
  }
5720
- function isRef(value) {
5721
- return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
6036
+ function isApiSurface(val) {
6037
+ return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
5722
6038
  }
5723
- function isRegExp(val) {
5724
- return val instanceof RegExp;
6039
+ function isDate(val) {
6040
+ return val instanceof Date;
5725
6041
  }
5726
- function isLikeRegExp(val) {
5727
- if (isRegExp(val)) {
5728
- return true;
6042
+ function isIsoDateTime(val) {
6043
+ if (!isString(val)) {
6044
+ return false;
5729
6045
  }
5730
- if (isString(val)) {
5731
- try {
5732
- const _re = new RegExp(val);
5733
- return true;
5734
- } catch {
6046
+ 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})?$/;
6047
+ if (!ISO_DATETIME_REGEX.test(val)) {
6048
+ return false;
6049
+ }
6050
+ const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
6051
+ const [year, month, day, hours, minutes, seconds] = matches.map(Number);
6052
+ if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
6053
+ return false;
6054
+ }
6055
+ if (month < 1 || month > 12) {
6056
+ return false;
6057
+ }
6058
+ ;
6059
+ const daysInMonth = new Date(year, month, 0).getDate();
6060
+ if (day < 1 || day > daysInMonth) {
6061
+ return false;
6062
+ }
6063
+ ;
6064
+ const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
6065
+ if (tzMatch) {
6066
+ const [_2, _sign, tzHours, tzMinutes] = tzMatch;
6067
+ const numHours = Number.parseInt(tzHours, 10);
6068
+ const numMinutes = Number.parseInt(tzMinutes, 10);
6069
+ if (numHours > 14 || numMinutes > 59) {
6070
+ return false;
6071
+ }
6072
+ if (numHours === 14 && numMinutes > 0) {
5735
6073
  return false;
5736
6074
  }
5737
6075
  }
5738
- return false;
5739
- }
5740
- function isSet(val) {
5741
- return isObject(val) ? val.kind !== "Unset" : true;
5742
- }
5743
- function isSetContainer(val) {
5744
- return val instanceof Set;
5745
- }
5746
- function isStringArray(val) {
5747
- return Array.isArray(val) && val.every((i) => isString(i));
5748
- }
5749
- function isThenable(val) {
5750
- return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
5751
- }
5752
- function isTrimable(val) {
5753
- return isString(val) && val !== val.trim();
5754
- }
5755
- function isTrue(value) {
5756
- return value === true;
5757
- }
5758
- function isTruthy(val) {
5759
- return !FALSY_VALUES2.includes(val);
6076
+ return true;
5760
6077
  }
5761
- function isTypeSubtype(val) {
5762
- return isString(val) && val.split("/").length === 2;
6078
+ function isIsoExplicitDate(val) {
6079
+ if (isString(val)) {
6080
+ const parts = val.split("-").map((i) => Number(i));
6081
+ 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;
6082
+ } else {
6083
+ return false;
6084
+ }
5763
6085
  }
5764
- function isTypeTuple(value) {
5765
- return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
6086
+ function isIsoImplicitDate(val) {
6087
+ if (isString(val) && val.length === 8 && isNumberLike(val)) {
6088
+ const year = Number(val.slice(0, 4));
6089
+ const month = Number(val.slice(4, 6));
6090
+ const date = Number(val.slice(6, 8));
6091
+ return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
6092
+ } else {
6093
+ return false;
6094
+ }
5766
6095
  }
5767
- function isUnset(val) {
5768
- return isObject(val) && val.kind === "Unset";
6096
+ function isIsoDate(val) {
6097
+ if (isString(val)) {
6098
+ return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
6099
+ } else {
6100
+ return false;
6101
+ }
5769
6102
  }
5770
- function isUri(val, ...protocols) {
5771
- const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
5772
- return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6103
+ function isIsoExplicitTime(val) {
6104
+ if (isString(val)) {
6105
+ const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
6106
+ return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
6107
+ } else {
6108
+ return false;
6109
+ }
5773
6110
  }
5774
- function isUrl(val, ...protocols) {
5775
- const p = protocols.length === 0 ? ["http", "https"] : protocols;
5776
- return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6111
+ function isIsoImplicitTime(val) {
6112
+ if (isString(val)) {
6113
+ const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
6114
+ return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
6115
+ } else {
6116
+ return false;
6117
+ }
5777
6118
  }
5778
- var VALID = [
5779
- ...ALPHA_CHARS2,
5780
- ...NUMERIC_CHAR2,
5781
- "_",
5782
- "."
5783
- ];
5784
- var alpha = null;
5785
- function valid(chars) {
5786
- return chars.every((i) => VALID.includes(i));
6119
+ function isIsoTime(val) {
6120
+ return isIsoExplicitTime(val) || isIsoImplicitTime(val);
5787
6121
  }
5788
- function isVariable(val) {
5789
- return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
6122
+ function isIsoYear(val) {
6123
+ return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
5790
6124
  }
5791
- function separate(s) {
5792
- return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
6125
+ function isLuxonDateTime(val) {
6126
+ 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";
5793
6127
  }
5794
- function isAreaMetric(val) {
5795
- return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6128
+ function isMoment(val) {
6129
+ if (val instanceof Date) {
6130
+ return false;
6131
+ }
6132
+ 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";
5796
6133
  }
5797
- function isLuminosityMetric(val) {
5798
- return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6134
+ function isThisMonth(val) {
6135
+ const now = /* @__PURE__ */ new Date();
6136
+ const currentYear = now.getFullYear();
6137
+ const currentMonth = now.getMonth() + 1;
6138
+ if (val instanceof Date) {
6139
+ return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
6140
+ }
6141
+ if (isMoment(val)) {
6142
+ const monthValue = val.month();
6143
+ return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
6144
+ }
6145
+ if (isLuxonDateTime(val)) {
6146
+ return val.year === currentYear && val.month === currentMonth;
6147
+ }
6148
+ if (typeof val === "string") {
6149
+ 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))?$/;
6150
+ if (!isoDateRegex.test(val)) {
6151
+ return false;
6152
+ }
6153
+ const dateMatch = val.match(/^(\d{4})-(\d{2})/);
6154
+ if (dateMatch) {
6155
+ const year = Number.parseInt(dateMatch[1], 10);
6156
+ const month = Number.parseInt(dateMatch[2], 10);
6157
+ return year === currentYear && month === currentMonth;
6158
+ }
6159
+ }
6160
+ return false;
5799
6161
  }
5800
- function isResistance(val) {
5801
- return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6162
+ function isThisWeek(date) {
6163
+ const targetDate = asDate(date);
6164
+ if (!targetDate) {
6165
+ return false;
6166
+ }
6167
+ const currentWeek = getWeekNumber();
6168
+ const targetWeek = getWeekNumber(targetDate);
6169
+ return currentWeek === targetWeek;
5802
6170
  }
5803
- function isCurrentMetric(val) {
5804
- return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6171
+ function isThisYear(val) {
6172
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
6173
+ if (isObject(val) || isNumber(val) || isString(val)) {
6174
+ const date = asDate(val);
6175
+ if (date) {
6176
+ return date.getFullYear() === currentYear;
6177
+ } else {
6178
+ return false;
6179
+ }
6180
+ }
6181
+ return false;
5805
6182
  }
5806
- function isVoltageMetric(val) {
5807
- return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6183
+ function isToday(test) {
6184
+ if (isString(test)) {
6185
+ const justDate = stripAfter(test, "T");
6186
+ return isIsoExplicitDate(justDate) && justDate === getToday();
6187
+ } else if (isMoment(test) || isDate(test)) {
6188
+ return stripAfter(test.toISOString(), "T") === getToday();
6189
+ } else if (isLuxonDateTime(test)) {
6190
+ return stripAfter(test.toISO(), "T") === getToday();
6191
+ }
6192
+ return false;
5808
6193
  }
5809
- function isFrequencyMetric(val) {
5810
- return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6194
+ function isTomorrow(test) {
6195
+ if (isString(test)) {
6196
+ const justDate = stripAfter(test, "T");
6197
+ return isIsoExplicitDate(justDate) && justDate === getTomorrow();
6198
+ } else if (isMoment(test) || isDate(test)) {
6199
+ return stripAfter(test.toISOString(), "T") === getTomorrow();
6200
+ } else if (isLuxonDateTime(test)) {
6201
+ return stripAfter(test.toISO(), "T") === getTomorrow();
6202
+ }
6203
+ return false;
5811
6204
  }
5812
- function isPowerMetric(val) {
5813
- return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6205
+ function isYesterday(test) {
6206
+ if (isString(test)) {
6207
+ const justDate = stripAfter(test, "T");
6208
+ return isIsoExplicitDate(justDate) && justDate === getYesterday();
6209
+ } else if (isMoment(test) || isDate(test)) {
6210
+ return stripAfter(test.toISOString(), "T") === getYesterday();
6211
+ } else if (isLuxonDateTime(test)) {
6212
+ return stripAfter(test.toISO(), "T") === getYesterday();
6213
+ }
6214
+ return false;
5814
6215
  }
5815
- function isTimeMetric(val) {
5816
- return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6216
+ function isString(value) {
6217
+ return typeof value === "string";
5817
6218
  }
5818
- function isEnergyMetric(val) {
5819
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6219
+ function isIso3166Alpha2(val) {
6220
+ const codes = ISO3166_12.map((i) => i.alpha2);
6221
+ return isString(val) && codes.includes(val);
5820
6222
  }
5821
- function isPressureMetric(val) {
5822
- return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6223
+ function isCountryCode2(val) {
6224
+ const codes = ISO3166_12.map((i) => i.alpha2);
6225
+ return isString(val) && codes.includes(val);
5823
6226
  }
5824
- function isTemperatureMetric(val) {
5825
- return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6227
+ function isIso3166Alpha3(val) {
6228
+ const codes = ISO3166_12.map((i) => i.alpha3);
6229
+ return isString(val) && codes.includes(val);
5826
6230
  }
5827
- function isVolumeMetric(val) {
5828
- return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6231
+ function isCountryCode3(val) {
6232
+ const codes = ISO3166_12.map((i) => i.alpha3);
6233
+ return isString(val) && codes.includes(val);
5829
6234
  }
5830
- function isAccelerationMetric(val) {
5831
- return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6235
+ function isIso3166CountryCode(val) {
6236
+ const codes = ISO3166_12.map((i) => i.countryCode);
6237
+ return isString(val) && codes.includes(val);
5832
6238
  }
5833
- function isSpeedMetric(val) {
5834
- const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
5835
- return isString(val) && speed.includes(separate(val));
6239
+ function isCountryAbbrev(val) {
6240
+ return isCountryCode2(val) || isCountryCode3(val);
5836
6241
  }
5837
- function isMassMetric(val) {
5838
- return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6242
+ function isIso3166CountryName(val) {
6243
+ const codes = ISO3166_12.map((i) => i.name);
6244
+ return isString(val) && codes.includes(val);
5839
6245
  }
5840
- function isDistanceMetric(val) {
5841
- return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6246
+ function isCountryName(val) {
6247
+ const codes = ISO3166_12.map((i) => i.name);
6248
+ return isString(val) && codes.includes(val);
5842
6249
  }
5843
- function isMetric(val) {
5844
- 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);
6250
+ var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
6251
+ var NAME = US_STATE_LOOKUP2.map((i) => i.name);
6252
+ function isUsStateAbbreviation(val) {
6253
+ return isString(val) && ABBREV.includes(val);
5845
6254
  }
5846
- function isAreaUom(val) {
5847
- return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6255
+ function isUsStateName(val) {
6256
+ return isString(val) && NAME.includes(val);
5848
6257
  }
5849
- function isLuminosityUom(val) {
5850
- return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6258
+ function isNumericString(value) {
6259
+ const numericChars = [...NUMERIC_CHAR2];
6260
+ return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
5851
6261
  }
5852
- function isResistanceUom(val) {
5853
- return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6262
+ function isNumberLike(value) {
6263
+ const numericChars = [...NUMERIC_CHAR2];
6264
+ return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
5854
6265
  }
5855
- function isCurrentUom(val) {
5856
- return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6266
+ function isNumber(value) {
6267
+ return typeof value === "number";
5857
6268
  }
5858
- function isVoltageUom(val) {
5859
- return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6269
+ function isZipCode5(val) {
6270
+ if (isNumber(val)) {
6271
+ return isZipCode5(`${val}`);
6272
+ }
6273
+ return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
5860
6274
  }
5861
- function isFrequencyUom(val) {
5862
- return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6275
+ function isZipPlus4(val) {
6276
+ if (isString(val)) {
6277
+ const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
6278
+ const next = stripChars(val.trim().replace(first, "").trim(), "-");
6279
+ return first.length === 5 && next.length === 4 && isNumberLike(next);
6280
+ }
6281
+ return false;
5863
6282
  }
5864
- function isPowerUom(val) {
5865
- return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6283
+ function isZipCode(val) {
6284
+ return isZipCode5(val) || isZipPlus4(val);
5866
6285
  }
5867
- function isTimeUom(val) {
5868
- return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6286
+ function isSpecificConstant(kind) {
6287
+ return (value) => {
6288
+ return !!(isConstant(value) && value.kind === kind);
6289
+ };
5869
6290
  }
5870
- function isEnergyUom(val) {
5871
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6291
+ function hasDefaultValue(value) {
6292
+ const noDefault = isSpecificConstant("no-default-value");
6293
+ return !noDefault(value);
5872
6294
  }
5873
- function isPressureUom(val) {
5874
- return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6295
+ function hasIndexOf(value, idx) {
6296
+ const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
6297
+ return isErrorCondition(result2, "invalid-index") ? false : result2;
5875
6298
  }
5876
- function isTemperatureUom(val) {
5877
- return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6299
+ function hasKeys(...props) {
6300
+ return (val) => {
6301
+ const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
6302
+ return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
6303
+ };
5878
6304
  }
5879
- function isVolumeUom(val) {
5880
- return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6305
+ function hasWhiteSpace(val) {
6306
+ return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
5881
6307
  }
5882
- function isAccelerationUom(val) {
5883
- return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6308
+ function endsWith(endingIn2) {
6309
+ return (val) => {
6310
+ return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
6311
+ };
5884
6312
  }
5885
- function isSpeedUom(val) {
5886
- return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6313
+ function isEqual(base) {
6314
+ return (value) => isSameTypeOf(base)(value) ? value === base : false;
5887
6315
  }
5888
- function isMassUom(val) {
5889
- return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6316
+ function isLength(value, len) {
6317
+ return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
5890
6318
  }
5891
- function isDistanceUom(val) {
5892
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6319
+ function isSameTypeOf(base) {
6320
+ return (compare) => {
6321
+ return typeof base === typeof compare;
6322
+ };
5893
6323
  }
5894
- function isUom(val) {
5895
- 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);
6324
+ function isTuple(...tuple3) {
6325
+ const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
6326
+ return (v) => {
6327
+ return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
6328
+ };
5896
6329
  }
5897
- function isIp4Address(val) {
5898
- return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
6330
+ function isTypeOf(type) {
6331
+ return (value) => {
6332
+ return typeof value === type;
6333
+ };
5899
6334
  }
5900
- function isIp6Address(val) {
5901
- const expanded = isString(val) ? ip6GroupExpansion(val) : "";
5902
- return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
6335
+ function startsWith(startingWith) {
6336
+ return (val) => {
6337
+ return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
6338
+ };
5903
6339
  }
5904
- function isIpAddress(val) {
5905
- return isIp4Address(val) || isIp6Address(val);
6340
+ function isHtmlElement(val) {
6341
+ return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
5906
6342
  }
5907
- function hasUrlPort(val) {
5908
- return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
6343
+ function isAlpha(value) {
6344
+ return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
5909
6345
  }
5910
- function isUrlPath(val) {
5911
- return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
5912
- (c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
5913
- );
6346
+ function isArray(value) {
6347
+ return Array.isArray(value) === true;
5914
6348
  }
5915
- function isDomainName(val) {
5916
- 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(
5917
- (i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
5918
- );
6349
+ function isBoolean(value) {
6350
+ return typeof value === "boolean";
5919
6351
  }
5920
- function isUrlSource(val) {
5921
- return isDomainName(val) || isIpAddress(val);
6352
+ function isBooleanLike(val) {
6353
+ return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
5922
6354
  }
5923
- function hasUrlQueryParameter(val, prop) {
5924
- return isString(getUrlQueryParams(val, prop));
6355
+ function isConstant(value) {
6356
+ return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
5925
6357
  }
5926
- function isNumericArray(val) {
5927
- return Array.isArray(val) && val.every((i) => isNumber(i));
6358
+ function isContainer(value) {
6359
+ return !!(Array.isArray(value) || isObject(value));
5928
6360
  }
5929
- function hasProtocol(val, ...protocols) {
5930
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
6361
+ var tokens = [
6362
+ "1",
6363
+ "inherit",
6364
+ "initial",
6365
+ "revert",
6366
+ "revert-layer",
6367
+ "unset",
6368
+ "auto"
6369
+ ];
6370
+ var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
6371
+ function isCssAspectRatio(val) {
6372
+ return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
5931
6373
  }
5932
- function isProtocol(val, ...protocols) {
5933
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
6374
+ function isCsv(val) {
6375
+ return isString(val) && val.includes(",") && !val.startsWith(",");
5934
6376
  }
5935
- function hasProtocolPrefix(val, ...protocols) {
5936
- 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));
6377
+ function isDefined(value) {
6378
+ return typeof value !== "undefined";
5937
6379
  }
5938
- function isProtocolPrefix(val, ...protocols) {
5939
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
6380
+ function isDoneFn(val) {
6381
+ return hasKeys("done")(val) && typeof val.done === "function";
5940
6382
  }
5941
- function isTypeToken(val, kind) {
5942
- if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
5943
- const stripped = stripSurround("<<", ">>")(val);
5944
- if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
5945
- if (kind) {
5946
- if (isAtomicKind(kind)) {
5947
- return val === `<<${kind}>>`;
5948
- } else if (isSetBasedKind(kind)) {
5949
- return val.startsWith(`<<${kind}::`);
5950
- } else {
5951
- return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
5952
- }
5953
- } else {
5954
- return true;
5955
- }
5956
- }
6383
+ function isEmail(val) {
6384
+ if (!isString(val)) {
5957
6385
  return false;
5958
6386
  }
5959
- return false;
5960
- }
5961
- function isTypeTokenKind(val) {
5962
- return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
5963
- }
5964
- function isAtomicToken(val) {
5965
- return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
5966
- }
5967
- function isAtomicKind(val) {
5968
- return isString(val) && TT_ATOMICS2.includes(val);
6387
+ const parts = val?.split("@");
6388
+ const domain = parts[1]?.split(".");
6389
+ const tld = domain ? domain.pop() : "";
6390
+ const firstChar = val[0].toLowerCase();
6391
+ return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
5969
6392
  }
5970
- function isObjectToken(val) {
5971
- return isTypeToken(val, "obj");
6393
+ function isEmpty(val) {
6394
+ return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
5972
6395
  }
5973
- function isRecordToken(val) {
5974
- return isTypeToken(val, "rec");
6396
+ function isErrorCondition(value, kind = null) {
6397
+ return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
5975
6398
  }
5976
- function isTupleToken(val) {
5977
- return isTypeToken(val, "tuple");
6399
+ function isFalse(i) {
6400
+ return typeof i === "boolean" && !i;
5978
6401
  }
5979
- function isArrayToken(val) {
5980
- return isTypeToken(val, "arr");
6402
+ function isFalsy(val) {
6403
+ return FALSY_VALUES2.includes(val);
5981
6404
  }
5982
- function isMapToken(val) {
5983
- return isTypeToken(val, "map");
6405
+ function isFnWithParams(input, ...params) {
6406
+ return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
5984
6407
  }
5985
- function isSetToken(val) {
5986
- return isTypeToken(val, "set");
6408
+ function isHexadecimal(val) {
6409
+ return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
5987
6410
  }
5988
- function isContainerToken(val) {
5989
- return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
6411
+ function isIndexable(value) {
6412
+ return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
5990
6413
  }
5991
- function isShapeCallback(val) {
5992
- return isFunction(val) && val.kind === "shape";
6414
+ function isInlineSvg(v) {
6415
+ return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
5993
6416
  }
5994
- var token_types = [
5995
- ...TT_ATOMICS2,
5996
- ...TT_CONTAINERS2,
5997
- ...TT_FUNCTIONS2,
5998
- ...TT_SETS2,
5999
- ...TT_SINGLETONS2
6000
- ];
6001
- function isShapeToken(val) {
6002
- return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
6417
+ function isMap(val) {
6418
+ return val instanceof Map;
6003
6419
  }
6004
- var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
6005
- var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
6006
- function isSimpleToken(val) {
6007
- return isString(val) && split_tokens.some(
6008
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6009
- );
6420
+ function isNever(val) {
6421
+ return isConstant(val) && val.kind === "never";
6010
6422
  }
6011
- function isSimpleScalarToken(val) {
6012
- return isString(val) && scalar_split_tokens.some(
6013
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6014
- );
6423
+ function isNothing(val) {
6424
+ return !!(val === null || val === void 0);
6015
6425
  }
6016
- function isSimpleContainerToken(val) {
6017
- return isString(val) && scalar_split_tokens.some(
6018
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6019
- );
6426
+ function isNotNull(value) {
6427
+ return value === null;
6020
6428
  }
6021
- function isSimpleTokenTuple(val) {
6022
- return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
6429
+ function isNull(value) {
6430
+ return value === null;
6023
6431
  }
6024
- function isSimpleScalarTokenTuple(val) {
6025
- return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
6432
+ function isPhoneNumber(val) {
6433
+ const svelte = String(val).trim();
6434
+ const chars = svelte.split("");
6435
+ const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
6436
+ const valid2 = ["+", "(", ...NUMERIC_CHAR2];
6437
+ const nothing = stripChars(svelte, ...[
6438
+ ...NUMERIC_CHAR2,
6439
+ ...WHITESPACE_CHARS2,
6440
+ "(",
6441
+ ")",
6442
+ "+",
6443
+ ".",
6444
+ "-"
6445
+ ]);
6446
+ return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
6026
6447
  }
6027
- function isSimpleContainerTokenTuple(val) {
6028
- return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
6448
+ function isReadonlyArray(value) {
6449
+ return Array.isArray(value) === true;
6029
6450
  }
6030
- function isDefineObject(val) {
6031
- return isObject(val) && Object.keys(val).some(
6032
- (key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
6033
- );
6451
+ function isRef(value) {
6452
+ return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
6034
6453
  }
6035
- function isFnBasedToken(val) {
6036
- if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
6037
- const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6038
- return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6039
- }
6454
+ function isRegExp(val) {
6455
+ return val instanceof RegExp;
6040
6456
  }
6041
- function isFnBasedKind(val) {
6042
- if (isString(val) && isTypeTokenKind(val)) {
6043
- const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6044
- return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6457
+ function isLikeRegExp(val) {
6458
+ if (isRegExp(val)) {
6459
+ return true;
6045
6460
  }
6046
- return false;
6047
- }
6048
- function isSetBasedToken(val) {
6049
- if (isTypeToken(val)) {
6050
- const kind = getTokenKind(val);
6051
- return kind.endsWith(`-set`);
6461
+ if (isString(val)) {
6462
+ try {
6463
+ const _re = new RegExp(val);
6464
+ return true;
6465
+ } catch {
6466
+ return false;
6467
+ }
6052
6468
  }
6053
6469
  return false;
6054
6470
  }
6055
- function isSetBasedKind(val) {
6056
- return isString(val) && val.endsWith(`-set`);
6057
- }
6058
- function isSingletonKind(val) {
6059
- return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
6060
- }
6061
- function isSingletonToken(val) {
6062
- return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
6063
- }
6064
- function isTailwindColorName(val) {
6065
- return isString(val) && Object.keys(TW_HUE2).includes(val);
6066
- }
6067
- function isTailwindColorWithLuminosity(val) {
6068
- 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, "-")));
6069
- }
6070
- function isTailwindColorWithLuminosityAndOpacity(val) {
6071
- return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
6072
- }
6073
- function isTailwindColor(val) {
6074
- return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
6471
+ function isSymbol(value) {
6472
+ return typeof value === "symbol";
6075
6473
  }
6076
- function isTailwindModifier(val) {
6077
- return isString(val) && TW_MODIFIERS2.includes(val);
6474
+ function isScalar(value) {
6475
+ return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
6078
6476
  }
6079
- function isTailwindColorTarget(val) {
6080
- return isString(val) && TW_COLOR_TARGETS2.includes(val);
6477
+ function isSet(val) {
6478
+ return isObject(val) ? val.kind !== "Unset" : true;
6081
6479
  }
6082
- function isTailwindColorClass(val, ...allowedModifiers) {
6083
- if (isString(val)) {
6084
- const mods = getTailwindModifiers(val);
6085
- const targetted = removeTailwindModifiers(val);
6086
- const target = targetted.split("-")[0];
6087
- const color = targetted.split("-").slice(1).join("-");
6088
- return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
6089
- }
6090
- return false;
6480
+ function isSetContainer(val) {
6481
+ return val instanceof Set;
6091
6482
  }
6092
- var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
6093
- function isAustralianNewsUrl(val) {
6094
- return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
6483
+ function isStringArray(val) {
6484
+ return Array.isArray(val) && val.every((i) => isString(i));
6095
6485
  }
6096
- var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
6097
- function isBelgiumNewsUrl(val) {
6098
- return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
6486
+ function isThenable(val) {
6487
+ return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
6099
6488
  }
6100
- var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
6101
- function isCanadianNewsUrl(val) {
6102
- return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
6489
+ function isTrimable(val) {
6490
+ return isString(val) && val !== val.trim();
6103
6491
  }
6104
- var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
6105
- function isDanishNewsUrl(val) {
6106
- return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
6492
+ function isTrue(value) {
6493
+ return value === true;
6107
6494
  }
6108
- var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
6109
- function isDutchNewsUrl(val) {
6110
- return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
6495
+ function isTruthy(val) {
6496
+ return !FALSY_VALUES2.includes(val);
6111
6497
  }
6112
- var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
6113
- function isFrenchNewsUrl(val) {
6114
- return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
6498
+ function isTypeSubtype(val) {
6499
+ return isString(val) && val.split("/").length === 2;
6115
6500
  }
6116
- var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
6117
- function isGermanNewsUrl(val) {
6118
- return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
6501
+ function isTypeTuple(value) {
6502
+ return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
6119
6503
  }
6120
- var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
6121
- function isIndianNewsUrl(val) {
6122
- return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
6504
+ function isUndefined(value) {
6505
+ return typeof value === "undefined";
6123
6506
  }
6124
- var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
6125
- function isItalianNewsUrl(val) {
6126
- return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
6507
+ function isUnset(val) {
6508
+ return isObject(val) && val.kind === "Unset";
6127
6509
  }
6128
- var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
6129
- function isJapaneseNewsUrl(val) {
6130
- return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
6510
+ function isUri(val, ...protocols) {
6511
+ const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
6512
+ return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6131
6513
  }
6132
- var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
6133
- function isMexicanNewsUrl(val) {
6134
- return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
6514
+ function isUrl(val, ...protocols) {
6515
+ const p = protocols.length === 0 ? ["http", "https"] : protocols;
6516
+ return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6135
6517
  }
6136
- var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
6137
- function isNorwegianNewsUrl(val) {
6138
- return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
6518
+ var VALID = [
6519
+ ...ALPHA_CHARS2,
6520
+ ...NUMERIC_CHAR2,
6521
+ "_",
6522
+ "."
6523
+ ];
6524
+ var alpha = null;
6525
+ function valid(chars) {
6526
+ return chars.every((i) => VALID.includes(i));
6139
6527
  }
6140
- var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
6141
- function isSouthKoreanNewsUrl(val) {
6142
- return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
6528
+ function isVariable(val) {
6529
+ return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
6143
6530
  }
6144
- var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
6145
- function isSpanishNewsUrl(val) {
6146
- return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
6531
+ function separate(s) {
6532
+ return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
6147
6533
  }
6148
- var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
6149
- function isSwissNewsUrl(val) {
6150
- return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
6534
+ function isAreaMetric(val) {
6535
+ return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6151
6536
  }
6152
- var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
6153
- function isTurkishNewsUrl(val) {
6154
- return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
6537
+ function isLuminosityMetric(val) {
6538
+ return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6155
6539
  }
6156
- var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
6157
- function isUkNewsUrl(val) {
6158
- return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
6540
+ function isResistance(val) {
6541
+ return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6159
6542
  }
6160
- var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
6161
- function isUsNewsUrl(val) {
6162
- return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
6543
+ function isCurrentMetric(val) {
6544
+ return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6163
6545
  }
6164
- var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
6165
- function isChineseNewsUrl(val) {
6166
- return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
6546
+ function isVoltageMetric(val) {
6547
+ return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6167
6548
  }
6168
- function isNewsUrl(val) {
6169
- 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);
6549
+ function isFrequencyMetric(val) {
6550
+ return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6170
6551
  }
6171
- function isBitbucketUrl(val) {
6172
- const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
6173
- return isString(val) && valid2.some(
6174
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6175
- );
6552
+ function isPowerMetric(val) {
6553
+ return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6176
6554
  }
6177
- function isCodeCommitUrl(val) {
6178
- const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
6179
- return isString(val) && valid2.some(
6180
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6181
- );
6555
+ function isTimeMetric(val) {
6556
+ return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6182
6557
  }
6183
- function isGithubUrl(val) {
6184
- const valid2 = [
6185
- "https://github.com",
6186
- "https://www.github.com",
6187
- "https://github.io"
6188
- ];
6189
- return isString(val) && valid2.some(
6190
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6191
- );
6558
+ function isEnergyMetric(val) {
6559
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6192
6560
  }
6193
- function isGithubOrgUrl(val) {
6194
- return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
6561
+ function isPressureMetric(val) {
6562
+ return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6195
6563
  }
6196
- function stripper(s) {
6197
- return stripTrailing(
6198
- stripLeading(s, "https://github.com/"),
6199
- "/"
6200
- );
6564
+ function isTemperatureMetric(val) {
6565
+ return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6201
6566
  }
6202
- function isGithubRepoUrl(val) {
6203
- return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
6567
+ function isVolumeMetric(val) {
6568
+ return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6204
6569
  }
6205
- function isGithubRepoReleasesUrl(val) {
6206
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
6570
+ function isAccelerationMetric(val) {
6571
+ return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6207
6572
  }
6208
- function isGithubRepoReleaseTagUrl(val) {
6209
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
6573
+ function isSpeedMetric(val) {
6574
+ const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
6575
+ return isString(val) && speed.includes(separate(val));
6210
6576
  }
6211
- function isGithubIssuesListUrl(val) {
6212
- return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
6577
+ function isMassMetric(val) {
6578
+ return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6213
6579
  }
6214
- function isGithubIssueUrl(val) {
6215
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
6580
+ function isDistanceMetric(val) {
6581
+ return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6216
6582
  }
6217
- function isGithubProjectsListUrl(val) {
6218
- return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
6583
+ function isMetric(val) {
6584
+ 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);
6219
6585
  }
6220
- function isGithubProjectUrl(val) {
6221
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
6586
+ function isAreaUom(val) {
6587
+ return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6222
6588
  }
6223
- function isGithubReleasesListUrl(val) {
6224
- return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
6589
+ function isLuminosityUom(val) {
6590
+ return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6225
6591
  }
6226
- function isGithubReleaseTagUrl(val) {
6227
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
6592
+ function isResistanceUom(val) {
6593
+ return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6228
6594
  }
6229
- function isRepoSource(v) {
6230
- return isString(v) && REPO_SOURCES2.includes(v);
6595
+ function isCurrentUom(val) {
6596
+ return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6231
6597
  }
6232
- function isSemanticVersion(v, allowPrefix = false) {
6233
- 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())));
6598
+ function isVoltageUom(val) {
6599
+ return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6234
6600
  }
6235
- function isRepoUrl(val) {
6236
- return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
6601
+ function isFrequencyUom(val) {
6602
+ return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6237
6603
  }
6238
- function isWholeFoodsUrl(val) {
6239
- return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
6604
+ function isPowerUom(val) {
6605
+ return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6240
6606
  }
6241
- function isCvsUrl(val) {
6242
- return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
6607
+ function isTimeUom(val) {
6608
+ return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6243
6609
  }
6244
- function isWalgreensUrl(val) {
6245
- return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
6610
+ function isEnergyUom(val) {
6611
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6246
6612
  }
6247
- function isKrogersUrl(val) {
6248
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6613
+ function isPressureUom(val) {
6614
+ return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6249
6615
  }
6250
- function isZaraUrl(val) {
6251
- return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
6616
+ function isTemperatureUom(val) {
6617
+ return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6252
6618
  }
6253
- function isHmUrl(val) {
6254
- return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
6619
+ function isVolumeUom(val) {
6620
+ return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6255
6621
  }
6256
- function isDellUrl(val) {
6257
- return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
6622
+ function isAccelerationUom(val) {
6623
+ return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6258
6624
  }
6259
- function isIkeaUrl(val) {
6260
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6625
+ function isSpeedUom(val) {
6626
+ return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6261
6627
  }
6262
- function isLowesUrl(val) {
6263
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6628
+ function isMassUom(val) {
6629
+ return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6264
6630
  }
6265
- function isNikeUrl(val) {
6266
- return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
6631
+ function isDistanceUom(val) {
6632
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6267
6633
  }
6268
- function isWayfairUrl(val) {
6269
- return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
6634
+ function isUom(val) {
6635
+ 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);
6270
6636
  }
6271
- function isBestBuyUrl(val) {
6272
- return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
6637
+ function isIp4Address(val) {
6638
+ return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
6273
6639
  }
6274
- function isCostCoUrl(val) {
6275
- return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
6640
+ function isIp6Address(val) {
6641
+ const expanded = isString(val) ? ip6GroupExpansion(val) : "";
6642
+ return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
6276
6643
  }
6277
- function isEtsyUrl(val) {
6278
- return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
6644
+ function isIpAddress(val) {
6645
+ return isIp4Address(val) || isIp6Address(val);
6279
6646
  }
6280
- function isTargetUrl(val) {
6281
- return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
6647
+ function hasUrlPort(val) {
6648
+ return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
6282
6649
  }
6283
- function isEbayUrl(val) {
6284
- return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
6650
+ function isUrlPath(val) {
6651
+ return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
6652
+ (c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
6653
+ );
6285
6654
  }
6286
- function isHomeDepotUrl(val) {
6287
- return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
6655
+ function isDomainName(val) {
6656
+ 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(
6657
+ (i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
6658
+ );
6288
6659
  }
6289
- function isMacysUrl(val) {
6290
- return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
6660
+ function isUrlSource(val) {
6661
+ return isDomainName(val) || isIpAddress(val);
6291
6662
  }
6292
- function isAppleUrl(val) {
6293
- return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
6663
+ function hasUrlQueryParameter(val, prop) {
6664
+ return isString(getUrlQueryParams(val, prop));
6294
6665
  }
6295
- function isWalmartUrl(val) {
6296
- return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
6666
+ function isNumericArray(val) {
6667
+ return Array.isArray(val) && val.every((i) => isNumber(i));
6297
6668
  }
6298
- function isAmazonUrl(val) {
6299
- return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
6669
+ function hasProtocol(val, ...protocols) {
6670
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
6300
6671
  }
6301
- function isRetailUrl(val) {
6302
- 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);
6672
+ function isProtocol(val, ...protocols) {
6673
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
6303
6674
  }
6304
- var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
6305
- var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
6306
- function isSocialMediaUrl(val) {
6307
- return isString(val) && URL20.some((i) => val.startsWith(i));
6675
+ function hasProtocolPrefix(val, ...protocols) {
6676
+ 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));
6308
6677
  }
6309
- function isSocialMediaProfileUrl(val) {
6310
- return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
6678
+ function isProtocolPrefix(val, ...protocols) {
6679
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
6311
6680
  }
6312
- function isYouTubeUrl(val) {
6313
- return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
6681
+ function isTypeToken(val, kind) {
6682
+ if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
6683
+ const stripped = stripSurround("<<", ">>")(val);
6684
+ if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
6685
+ if (kind) {
6686
+ if (isAtomicKind(kind)) {
6687
+ return val === `<<${kind}>>`;
6688
+ } else if (isSetBasedKind(kind)) {
6689
+ return val.startsWith(`<<${kind}::`);
6690
+ } else {
6691
+ return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
6692
+ }
6693
+ } else {
6694
+ return true;
6695
+ }
6696
+ }
6697
+ return false;
6698
+ }
6699
+ return false;
6314
6700
  }
6315
- function isYouTubeShareUrl(val) {
6316
- return isString(val) && val.startsWith(`https://youtu.be`);
6701
+ function isTypeTokenKind(val) {
6702
+ return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
6317
6703
  }
6318
- function isYouTubeVideoUrl(val) {
6319
- return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
6704
+ function isAtomicToken(val) {
6705
+ return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
6320
6706
  }
6321
- function isYouTubePlaylistUrl(val) {
6322
- 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`));
6707
+ function isAtomicKind(val) {
6708
+ return isString(val) && TT_ATOMICS2.includes(val);
6323
6709
  }
6324
- function feed_map(type) {
6325
- return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
6710
+ function isObjectToken(val) {
6711
+ return isTypeToken(val, "obj");
6326
6712
  }
6327
- function isYouTubeFeedUrl(val, type) {
6328
- return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
6713
+ function isRecordToken(val) {
6714
+ return isTypeToken(val, "rec");
6329
6715
  }
6330
- function isYouTubeFeedHistoryUrl(val) {
6331
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
6716
+ function isTupleToken(val) {
6717
+ return isTypeToken(val, "tuple");
6332
6718
  }
6333
- function isYouTubePlaylistsUrl(val) {
6334
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
6719
+ function isArrayToken(val) {
6720
+ return isTypeToken(val, "arr");
6335
6721
  }
6336
- function isYouTubeTrendingUrl(val) {
6337
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
6722
+ function isMapToken(val) {
6723
+ return isTypeToken(val, "map");
6338
6724
  }
6339
- function isYouTubeSubscriptionsUrl(val) {
6340
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
6725
+ function isSetToken(val) {
6726
+ return isTypeToken(val, "set");
6341
6727
  }
6342
- function isYouTubeCreatorUrl(url) {
6343
- return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
6728
+ function isContainerToken(val) {
6729
+ return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
6344
6730
  }
6345
- function isYouTubeVideosInPlaylist(val) {
6346
- return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
6731
+ function isShapeCallback(val) {
6732
+ return isFunction(val) && val.kind === "shape";
6347
6733
  }
6348
- function getTypeSubtype(str) {
6349
- if (isTypeSubtype(str)) {
6350
- const [t, st] = str.split("/");
6351
- return [t, st];
6352
- } else {
6353
- const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
6354
- err.name = "InvalidTypeSubtype";
6355
- throw err;
6356
- }
6734
+ var token_types = [
6735
+ ...TT_ATOMICS2,
6736
+ ...TT_CONTAINERS2,
6737
+ ...TT_FUNCTIONS2,
6738
+ ...TT_SETS2,
6739
+ ...TT_SINGLETONS2
6740
+ ];
6741
+ function isShapeToken(val) {
6742
+ return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
6357
6743
  }
6358
- function identity(...values) {
6359
- return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
6744
+ var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
6745
+ var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
6746
+ function isSimpleToken(val) {
6747
+ return isString(val) && split_tokens.some(
6748
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6749
+ );
6360
6750
  }
6361
- function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6362
- if (ch.length !== 1) {
6363
- throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
6364
- }
6365
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
6751
+ function isSimpleScalarToken(val) {
6752
+ return isString(val) && scalar_split_tokens.some(
6753
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6754
+ );
6366
6755
  }
6367
- function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6368
- if (ch.length !== 1) {
6369
- throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
6370
- }
6371
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
6756
+ function isSimpleContainerToken(val) {
6757
+ return isString(val) && scalar_split_tokens.some(
6758
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6759
+ );
6372
6760
  }
6373
- function parseTemplate(template) {
6374
- const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
6375
- let lastIndex = 0;
6376
- let match;
6377
- const segments = [];
6378
- while (match = pattern.exec(template)) {
6379
- const [fullMatch, varName, asType2] = match;
6380
- const staticPart = template.slice(lastIndex, match.index);
6381
- if (staticPart) {
6382
- segments.push({ dynamic: false, text: staticPart });
6383
- }
6384
- segments.push({
6385
- dynamic: true,
6386
- varName,
6387
- type: asType2 ? asType2 : "string"
6388
- });
6389
- lastIndex = match.index + fullMatch.length;
6390
- }
6391
- const remainder = template.slice(lastIndex);
6392
- if (remainder) {
6393
- segments.push({ dynamic: false, text: remainder });
6394
- }
6395
- return segments;
6761
+ function isSimpleTokenTuple(val) {
6762
+ return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
6396
6763
  }
6397
- function escapeRegex(str) {
6398
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6764
+ function isSimpleScalarTokenTuple(val) {
6765
+ return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
6399
6766
  }
6400
- function buildRegexPattern(segments) {
6401
- let regexStr = "^";
6402
- for (const seg of segments) {
6403
- if (!seg.dynamic) {
6404
- regexStr += escapeRegex(seg.text);
6405
- } else {
6406
- switch (seg.type) {
6407
- case "string":
6408
- regexStr += "(.*?)";
6409
- break;
6410
- case "number":
6411
- regexStr += "(\\d+)";
6412
- break;
6413
- case "boolean":
6414
- regexStr += "(true|false)";
6415
- break;
6416
- }
6417
- }
6418
- }
6419
- regexStr += "$";
6420
- return new RegExp(regexStr);
6767
+ function isSimpleContainerTokenTuple(val) {
6768
+ return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
6421
6769
  }
6422
- function convertValue(type, value) {
6423
- switch (type) {
6424
- case "string":
6425
- return value;
6426
- case "number":
6427
- return Number(value);
6428
- case "boolean":
6429
- return value === "true";
6430
- }
6770
+ function isDefineObject(val) {
6771
+ return isObject(val) && Object.keys(val).some(
6772
+ (key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
6773
+ );
6431
6774
  }
6432
- function matchTemplate(template, test) {
6433
- const segments = parseTemplate(template);
6434
- const regex = buildRegexPattern(segments);
6435
- const match = regex.exec(test);
6436
- if (!match)
6437
- return false;
6438
- let captureIndex = 1;
6439
- const result2 = {};
6440
- for (const seg of segments) {
6441
- if (seg.dynamic) {
6442
- const rawVal = match[captureIndex++];
6443
- if (rawVal === void 0)
6444
- return false;
6445
- result2[seg.varName] = convertValue(seg.type, rawVal);
6446
- }
6775
+ function isFnBasedToken(val) {
6776
+ if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
6777
+ const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6778
+ return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6447
6779
  }
6448
- return result2;
6449
6780
  }
6450
- function infer(inference) {
6451
- return (test) => {
6452
- return matchTemplate(inference, test);
6453
- };
6781
+ function isFnBasedKind(val) {
6782
+ if (isString(val) && isTypeTokenKind(val)) {
6783
+ const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6784
+ return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6785
+ }
6786
+ return false;
6454
6787
  }
6455
- function idLiteral(o) {
6456
- return { ...o, id: o.id };
6788
+ function isSetBasedToken(val) {
6789
+ if (isTypeToken(val)) {
6790
+ const kind = getTokenKind(val);
6791
+ return kind.endsWith(`-set`);
6792
+ }
6793
+ return false;
6457
6794
  }
6458
- function nameLiteral(o) {
6459
- return o;
6795
+ function isSetBasedKind(val) {
6796
+ return isString(val) && val.endsWith(`-set`);
6460
6797
  }
6461
- function kindLiteral(o) {
6462
- return o;
6798
+ function isSingletonKind(val) {
6799
+ return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
6463
6800
  }
6464
- function idTypeGuard(_o) {
6465
- return true;
6801
+ function isSingletonToken(val) {
6802
+ return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
6466
6803
  }
6467
- function literal(obj) {
6468
- return obj;
6804
+ function isTailwindColorName(val) {
6805
+ return isString(val) && Object.keys(TW_HUE2).includes(val);
6469
6806
  }
6470
- function lowercase(str) {
6471
- return str.toLowerCase();
6807
+ function isTailwindColorWithLuminosity(val) {
6808
+ 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, "-")));
6472
6809
  }
6473
- function narrow(...values) {
6474
- return values.length === 1 ? values[0] : values;
6810
+ function isTailwindColorWithLuminosityAndOpacity(val) {
6811
+ return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
6475
6812
  }
6476
- function pathJoin(...segments) {
6477
- const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
6478
- const original_path = segments.join("/");
6479
- const pre = original_path.startsWith("/") ? "/" : "";
6480
- const post = original_path.endsWith("/") ? "/" : "";
6481
- return `${pre}${clean_path}${post}`;
6813
+ function isTailwindColor(val) {
6814
+ return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
6482
6815
  }
6483
- var asPhoneFormat = () => `NOT IMPLEMENTED`;
6484
- function getPhoneCountryCode(phone) {
6485
- return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
6486
- stripLeading(stripLeading(phone.trim(), "+"), "00"),
6487
- ...NUMERIC_CHAR2
6488
- ) : "";
6816
+ function isTailwindModifier(val) {
6817
+ return isString(val) && TW_MODIFIERS2.includes(val);
6489
6818
  }
6490
- function removePhoneCountryCode(phone) {
6491
- const countryCode = getPhoneCountryCode(phone);
6492
- return countryCode !== "" ? stripLeading(stripLeading(
6493
- phone.trim(),
6494
- "+",
6495
- "00"
6496
- ), countryCode).trim() : phone.trim();
6819
+ function isTailwindColorTarget(val) {
6820
+ return isString(val) && TW_COLOR_TARGETS2.includes(val);
6497
6821
  }
6498
- var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
6499
- function endingIn(word, postfix) {
6500
- switch (postfix) {
6501
- case "is":
6502
- return word.endsWith(postfix) ? `${word}es` : void 0;
6503
- case "singular-noun":
6504
- return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
6505
- case "f":
6506
- return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
6507
- case "y":
6508
- return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
6509
- default:
6510
- throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
6822
+ function isTailwindColorClass(val, ...allowedModifiers) {
6823
+ if (isString(val)) {
6824
+ const mods = getTailwindModifiers(val);
6825
+ const targetted = removeTailwindModifiers(val);
6826
+ const target = targetted.split("-")[0];
6827
+ const color = targetted.split("-").slice(1).join("-");
6828
+ return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
6511
6829
  }
6830
+ return false;
6512
6831
  }
6513
- function pluralize(word) {
6514
- const right = rightWhitespace(word);
6515
- const w = word.trimEnd();
6516
- const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
6517
- return `${result2}${right}`;
6832
+ var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
6833
+ function isAustralianNewsUrl(val) {
6834
+ return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
6518
6835
  }
6519
- function retainAfter(content, ...find2) {
6520
- const idx = Math.min(
6521
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6522
- );
6523
- const min = Math.min(...find2.map((i) => i.length));
6524
- let len = Math.max(...find2.map((i) => i.length));
6525
- if (min !== len) {
6526
- if (!find2.includes(content.slice(idx, len))) {
6527
- len = min;
6528
- }
6529
- }
6530
- return idx && idx > 0 ? content.slice(idx + len) : "";
6836
+ var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
6837
+ function isBelgiumNewsUrl(val) {
6838
+ return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
6531
6839
  }
6532
- function retainAfterInclusive(content, ...find2) {
6533
- const minFound = Math.min(
6534
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6535
- );
6536
- return minFound > 0 ? content.slice(minFound) : "";
6840
+ var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
6841
+ function isCanadianNewsUrl(val) {
6842
+ return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
6537
6843
  }
6538
- function retainChars(content, ...retain2) {
6539
- const chars = asChars(content);
6540
- return chars.filter((c) => retain2.includes(c)).join("");
6844
+ var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
6845
+ function isDanishNewsUrl(val) {
6846
+ return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
6541
6847
  }
6542
- function retainUntil(content, ...find2) {
6543
- const chars = asChars(content);
6544
- let idx = 0;
6545
- while (!find2.includes(chars[idx]) && idx <= chars.length) {
6546
- idx = idx + 1;
6547
- }
6548
- return idx === 0 ? "" : content.slice(0, idx);
6848
+ var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
6849
+ function isDutchNewsUrl(val) {
6850
+ return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
6549
6851
  }
6550
- function retainUntilInclusive(content, ...find2) {
6551
- const chars = asChars(content);
6552
- let idx = 0;
6553
- while (!find2.includes(chars[idx]) && idx <= chars.length) {
6554
- idx = idx + 1;
6555
- }
6556
- return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
6852
+ var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
6853
+ function isFrenchNewsUrl(val) {
6854
+ return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
6557
6855
  }
6558
- function retainWhile(content, ...retain2) {
6559
- const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
6560
- return content.slice(0, stopIdx);
6856
+ var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
6857
+ function isGermanNewsUrl(val) {
6858
+ return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
6561
6859
  }
6562
- function rightWhitespace(content) {
6563
- const trimmed = content.trimStart();
6564
- return retainAfterInclusive(
6565
- trimmed,
6566
- ...WHITESPACE_CHARS2
6567
- );
6860
+ var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
6861
+ function isIndianNewsUrl(val) {
6862
+ return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
6568
6863
  }
6569
- function stripAfter(content, find2) {
6570
- return content.split(find2).shift();
6864
+ var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
6865
+ function isItalianNewsUrl(val) {
6866
+ return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
6571
6867
  }
6572
- function stripBefore(content, find2) {
6573
- return content.split(find2).slice(1).join(find2);
6868
+ var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
6869
+ function isJapaneseNewsUrl(val) {
6870
+ return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
6574
6871
  }
6575
- function stripChars(content, ...strip2) {
6576
- const chars = asChars(content);
6577
- return chars.filter((c) => !strip2.includes(c)).join("");
6872
+ var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
6873
+ function isMexicanNewsUrl(val) {
6874
+ return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
6578
6875
  }
6579
- function stripLeading(content, ...strip2) {
6580
- if (isUndefined(content)) {
6581
- return void 0;
6582
- }
6583
- let output = String(content);
6584
- for (const s of strip2) {
6585
- if (output.startsWith(String(s))) {
6586
- output = output.slice(String(s).length);
6587
- }
6588
- }
6589
- return isNumber(content) ? Number(output) : output;
6876
+ var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
6877
+ function isNorwegianNewsUrl(val) {
6878
+ return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
6590
6879
  }
6591
- function stripSurround(...chars) {
6592
- return (input) => {
6593
- let output = String(input);
6594
- for (const s of chars) {
6595
- if (output.startsWith(String(s))) {
6596
- output = output.slice(String(s).length);
6597
- }
6598
- if (output.endsWith(String(s))) {
6599
- output = output.slice(0, -1 * String(s).length);
6600
- }
6601
- }
6602
- return isNumber(input) ? Number(output) : output;
6603
- };
6880
+ var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
6881
+ function isSouthKoreanNewsUrl(val) {
6882
+ return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
6604
6883
  }
6605
- function stripUntil(content, ...until) {
6606
- const stopIdx = asChars(content).findIndex((c) => until.includes(c));
6607
- return content.slice(stopIdx);
6884
+ var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
6885
+ function isSpanishNewsUrl(val) {
6886
+ return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
6608
6887
  }
6609
- function stripWhile(content, ...match) {
6610
- const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
6611
- return content.slice(stopIdx);
6888
+ var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
6889
+ function isSwissNewsUrl(val) {
6890
+ return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
6612
6891
  }
6613
- function surround(prefix, postfix) {
6614
- return (input) => `${prefix}${input}${postfix}`;
6892
+ var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
6893
+ function isTurkishNewsUrl(val) {
6894
+ return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
6615
6895
  }
6616
- function takeNumericCharacters(content) {
6617
- const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
6618
- return content.slice(0, nonNumericIdx);
6896
+ var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
6897
+ function isUkNewsUrl(val) {
6898
+ return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
6619
6899
  }
6620
- function toCamelCase(input, preserveWhitespace) {
6621
- const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
6622
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
6623
- pascal
6624
- );
6625
- const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
6626
- return camel;
6900
+ var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
6901
+ function isUsNewsUrl(val) {
6902
+ return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
6627
6903
  }
6628
- function toKebabCase(input, _preserveWhitespace = false) {
6629
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
6630
- const replaceWhitespace = (i) => i.replace(/\s/g, "-");
6631
- const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
6632
- const replaceLeadingDash = (i) => i.replace(/^-/, "");
6633
- const replaceTrailingDash = (i) => i.replace(/-$/, "");
6634
- const replaceUnderscore = (i) => i.replace(/_/g, "-");
6635
- const removeDupDashes = (i) => i.replace(/-+/g, "-");
6636
- return removeDupDashes(`${preWhite}${replaceUnderscore(
6637
- replaceTrailingDash(
6638
- replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
6639
- )
6640
- )}${postWhite}`);
6904
+ var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
6905
+ function isChineseNewsUrl(val) {
6906
+ return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
6641
6907
  }
6642
- function toNumericArray(arr) {
6643
- return arr.map((i) => Number(i));
6908
+ function isNewsUrl(val) {
6909
+ 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);
6644
6910
  }
6645
- function toPascalCase(input, preserveWhitespace = void 0) {
6646
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
6647
- input
6911
+ function isBitbucketUrl(val) {
6912
+ const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
6913
+ return isString(val) && valid2.some(
6914
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6648
6915
  );
6649
- const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
6650
- const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
6651
- const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
6652
- const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
6653
- const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
6654
- replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
6655
- )}${preserveWhitespace ? postWhite : ""}`;
6656
- return pascal;
6657
6916
  }
6658
- function toSnakeCase(input, preserveWhitespace = false) {
6659
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
6660
- const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
6661
- const convertDashes = (input2) => input2.replace(/-/g, "_");
6662
- const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
6663
- const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
6664
- return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
6665
- injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
6666
- ).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
6917
+ function isCodeCommitUrl(val) {
6918
+ const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
6919
+ return isString(val) && valid2.some(
6920
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6921
+ );
6667
6922
  }
6668
- function toString(val) {
6669
- return String(val);
6923
+ function isGithubUrl(val) {
6924
+ const valid2 = [
6925
+ "https://github.com",
6926
+ "https://www.github.com",
6927
+ "https://github.io"
6928
+ ];
6929
+ return isString(val) && valid2.some(
6930
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6931
+ );
6670
6932
  }
6671
- function toUppercase(str) {
6672
- return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
6933
+ function isGithubOrgUrl(val) {
6934
+ return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
6673
6935
  }
6674
- function trim(input) {
6675
- return input.trim();
6936
+ function stripper(s) {
6937
+ return stripTrailing(
6938
+ stripLeading(s, "https://github.com/"),
6939
+ "/"
6940
+ );
6676
6941
  }
6677
- function trimLeft(input) {
6678
- return input.trimStart();
6942
+ function isGithubRepoUrl(val) {
6943
+ return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
6679
6944
  }
6680
- function trimStart(input) {
6681
- return input.trimStart();
6945
+ function isGithubRepoReleasesUrl(val) {
6946
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
6682
6947
  }
6683
- function trimRight(input) {
6684
- return input.trimEnd();
6948
+ function isGithubRepoReleaseTagUrl(val) {
6949
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
6685
6950
  }
6686
- function trimEnd(input) {
6687
- return input.trimEnd();
6951
+ function isGithubIssuesListUrl(val) {
6952
+ return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
6688
6953
  }
6689
- function truncate(content, maxLength, ellipsis = false) {
6690
- const overLimit = content.length > maxLength;
6691
- return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
6954
+ function isGithubIssueUrl(val) {
6955
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
6692
6956
  }
6693
- function tuple(...values) {
6694
- const arr = values.length === 1 ? values[0] : values;
6695
- return asArray(arr);
6957
+ function isGithubProjectsListUrl(val) {
6958
+ return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
6696
6959
  }
6697
- function uncapitalize(str) {
6698
- return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
6960
+ function isGithubProjectUrl(val) {
6961
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
6699
6962
  }
6700
- var unset = "<<unset>>";
6701
- function uppercase(str) {
6702
- return str.toUpperCase();
6963
+ function isGithubReleasesListUrl(val) {
6964
+ return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
6703
6965
  }
6704
- function widen(value) {
6705
- return value;
6966
+ function isGithubReleaseTagUrl(val) {
6967
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
6706
6968
  }
6707
- var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
6708
- function getUrlProtocol(url) {
6709
- const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
6710
- return proto;
6969
+ function isRepoSource(v) {
6970
+ return isString(v) && REPO_SOURCES2.includes(v);
6711
6971
  }
6712
- function removeUrlProtocol(url) {
6713
- return stripBefore(url, "://");
6972
+ function isSemanticVersion(v, allowPrefix = false) {
6973
+ 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())));
6714
6974
  }
6715
- function ensurePath(val) {
6716
- const val2 = ensureLeading(val, "/");
6717
- return val === "" ? "" : stripTrailing(val2, "/");
6975
+ function isRepoUrl(val) {
6976
+ return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
6718
6977
  }
6719
- function getUrlPath(url) {
6720
- return isUrl(url) ? ensurePath(
6721
- stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
6722
- ) : Never2;
6978
+ function isWholeFoodsUrl(val) {
6979
+ return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
6723
6980
  }
6724
- function getUrlQueryParams(url, specific = void 0) {
6725
- const qp = stripBefore(url, "?");
6726
- if (specific) {
6727
- return qp.includes(`${specific}=`) ? decodeURIComponent(
6728
- stripAfter(
6729
- stripBefore(qp, `${specific}=`),
6730
- "&"
6731
- ).replace(/\+/g, "%20")
6732
- ) : void 0;
6733
- }
6734
- return qp === "" ? qp : `?${qp}`;
6981
+ function isCvsUrl(val) {
6982
+ return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
6735
6983
  }
6736
- function getUrlDefaultPort(url) {
6737
- const proto = getUrlProtocol(url);
6738
- return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
6984
+ function isWalgreensUrl(val) {
6985
+ return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
6739
6986
  }
6740
- function getUrlPort(url, resolve = false) {
6741
- const re = /.*:(\d{2,3})/;
6742
- const match = url.match(re);
6743
- return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
6987
+ function isKrogersUrl(val) {
6988
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6744
6989
  }
6745
- function getUrlSource(url) {
6746
- const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
6747
- return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
6990
+ function isZaraUrl(val) {
6991
+ return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
6748
6992
  }
6749
- function getUrlBase(url) {
6750
- const path = getUrlPath(url);
6751
- const remaining = stripAfter(url, path);
6752
- return remaining;
6993
+ function isHmUrl(val) {
6994
+ return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
6753
6995
  }
6754
- function getUrlDynamics(url) {
6755
- const path = getUrlPath(url);
6756
- const qp = getUrlQueryParams(url);
6757
- const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
6758
- const segmentTypes = [
6759
- "string",
6760
- "number",
6761
- "boolean",
6762
- "Opt<string>",
6763
- "Opt<number>",
6764
- "Opt<boolean>"
6765
- ];
6766
- const pathVars = {};
6767
- const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
6768
- const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
6769
- const findPathNamed = infer(`<{{infer name}}>`);
6770
- for (const part of pathParts) {
6771
- const union4 = findPathUnion(part);
6772
- const typed = findPathTyped(part);
6773
- const named = findPathNamed(part);
6774
- if (union4) {
6775
- if (isVariable(union4.name) && isCsv(union4.union)) {
6776
- pathVars[union4.name] = `string(${union4.union})`;
6777
- }
6778
- } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
6779
- pathVars[typed.name] = typed.type;
6780
- } else if (named && isVariable(named.name)) {
6781
- pathVars[named.name] = "string";
6782
- }
6783
- }
6784
- const qpVars = {};
6785
- const qpParts = stripLeading(qp, "?").split("&");
6786
- for (const p of qpParts) {
6787
- const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
6788
- const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
6789
- const fixed = infer(`{{infer var}}={{infer val}}`)(p);
6790
- if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
6791
- qpVars[union4.var] = `string(${union4.params})`;
6792
- } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
6793
- qpVars[dynamic.var] = dynamic.val;
6794
- } else if (fixed && isVariable(fixed.var)) {
6795
- qpVars[fixed.var] = fixed.val;
6796
- }
6797
- }
6798
- return {
6799
- pathVars,
6800
- qpVars,
6801
- allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
6802
- ...pathVars,
6803
- ...qpVars
6804
- }
6805
- };
6996
+ function isDellUrl(val) {
6997
+ return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
6806
6998
  }
6807
- function urlMeta(url) {
6808
- return {
6809
- url,
6810
- isUrl: isUrl(url),
6811
- protocol: getUrlProtocol(url),
6812
- path: getUrlPath(url),
6813
- queryParameters: getUrlQueryParams(url),
6814
- params: getUrlDynamics,
6815
- port: getUrlPort(url),
6816
- source: getUrlSource(url),
6817
- isIpAddress: isIpAddress(getUrlSource(url)),
6818
- isIp4Address: isIp4Address(getUrlSource(url)),
6819
- isIp6Address: isIp6Address(getUrlSource(url))
6820
- };
6999
+ function isIkeaUrl(val) {
7000
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6821
7001
  }
6822
- function getYouTubePageType(url) {
6823
- 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;
7002
+ function isLowesUrl(val) {
7003
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
6824
7004
  }
6825
- function youtubeEmbed(url) {
6826
- if (hasUrlQueryParameter(url, "v")) {
6827
- const id = getUrlQueryParams(url, "v");
6828
- return `https://www.youtube.com/embed/${id}`;
6829
- } else if (isYouTubeShareUrl(url)) {
6830
- const id = url.split("/").pop();
6831
- if (id) {
6832
- return `https://www.youtube.com/embed/${id}`;
6833
- } else {
6834
- throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
6835
- }
6836
- } else {
6837
- throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
6838
- }
7005
+ function isNikeUrl(val) {
7006
+ return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
6839
7007
  }
6840
- function youtubeMeta(url) {
6841
- return isYouTubeUrl(url) ? {
6842
- url,
6843
- isYouTubeUrl: true,
6844
- isShareUrl: isYouTubeShareUrl(url),
6845
- pageType: getYouTubePageType(url)
6846
- } : {
6847
- url,
6848
- isYouTubeUrl: false
6849
- };
7008
+ function isWayfairUrl(val) {
7009
+ return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
7010
+ }
7011
+ function isBestBuyUrl(val) {
7012
+ return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
7013
+ }
7014
+ function isCostCoUrl(val) {
7015
+ return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
6850
7016
  }
6851
- function queue(state) {
6852
- return {
6853
- queue: state,
6854
- size: state.length,
6855
- isEmpty() {
6856
- return state.length === 0;
6857
- },
6858
- clear() {
6859
- state.slice(0, 0);
6860
- },
6861
- drain() {
6862
- const old_state = [...state];
6863
- state.slice(0, 0);
6864
- return old_state;
6865
- },
6866
- push(...add) {
6867
- state.push(...add);
6868
- },
6869
- drop(quantity) {
6870
- if (quantity && quantity > state.length) {
6871
- throw new Error("Cannot drop more elements than present in the queue");
6872
- }
6873
- state.splice(0, quantity || 1);
6874
- },
6875
- take(quantity) {
6876
- if (quantity && quantity > state.length) {
6877
- throw new Error("Cannot take more elements than present in the queue");
6878
- }
6879
- const result2 = state.slice(0, quantity || 1);
6880
- state.splice(0, quantity || 1);
6881
- return result2;
6882
- },
6883
- *[Symbol.iterator]() {
6884
- for (let i = 0; i < state.length; i++) {
6885
- yield state[i];
6886
- }
6887
- }
6888
- };
7017
+ function isEtsyUrl(val) {
7018
+ return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
6889
7019
  }
6890
- function createFifoQueue(...list2) {
6891
- return queue([...list2]);
7020
+ function isTargetUrl(val) {
7021
+ return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
6892
7022
  }
6893
- function queue2(state) {
6894
- return {
6895
- queue: state,
6896
- size: state.length,
6897
- isEmpty() {
6898
- return state.length === 0;
6899
- },
6900
- push(...add) {
6901
- state.push(...add);
6902
- },
6903
- drop(quantity) {
6904
- state.splice(-quantity);
6905
- },
6906
- clear() {
6907
- state.slice(0, 0);
6908
- },
6909
- drain() {
6910
- const old_state = [...state];
6911
- state.slice(0, 0);
6912
- return old_state;
6913
- },
6914
- take(quantity) {
6915
- const result2 = state.slice(-quantity);
6916
- state.splice(-quantity);
6917
- return result2;
6918
- },
6919
- *[Symbol.iterator]() {
6920
- for (let i = state.length - 1; i >= 0; i--) {
6921
- yield state[i];
6922
- }
6923
- }
6924
- };
7023
+ function isEbayUrl(val) {
7024
+ return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
6925
7025
  }
6926
- function createLifoQueue(...list2) {
6927
- return queue2([...list2]);
7026
+ function isHomeDepotUrl(val) {
7027
+ return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
6928
7028
  }
6929
- var scalarToToken = identity({
6930
- string: "<<string>>",
6931
- number: "<<number>>",
6932
- boolean: "<<boolean>>",
6933
- true: "<<true>>",
6934
- false: "<<false>>",
6935
- null: "<<null>>",
6936
- undefined: "<<undefined>>",
6937
- unknown: "<<unknown>>",
6938
- any: "<<any>>",
6939
- never: "<<never>>"
6940
- });
6941
- function stringLiteral(str) {
6942
- return stripAfter(stripBefore(str, "string("), ")");
7029
+ function isMacysUrl(val) {
7030
+ return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
6943
7031
  }
6944
- function numericLiteral(str) {
6945
- return stripAfter(stripBefore(str, "number("), ")");
7032
+ function isAppleUrl(val) {
7033
+ return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
6946
7034
  }
6947
- function handleOptional(token) {
6948
- const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
6949
- 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>>`;
7035
+ function isWalmartUrl(val) {
7036
+ return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
6950
7037
  }
6951
- function simpleScalarTokenToTypeToken(val) {
6952
- 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>>`;
7038
+ function isAmazonUrl(val) {
7039
+ return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
6953
7040
  }
6954
- function unionNode(node) {
6955
- return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
7041
+ function isRetailUrl(val) {
7042
+ 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);
6956
7043
  }
6957
- function union2(nodes) {
6958
- return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
7044
+ var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
7045
+ var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
7046
+ function isSocialMediaUrl(val) {
7047
+ return isString(val) && URL20.some((i) => val.startsWith(i));
6959
7048
  }
6960
- var stripUnion = stripSurround("Union(", ")");
6961
- function simpleUnionTokenToTypeToken(val) {
6962
- return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union2(stripUnion(val))} ]>>` : Never2;
7049
+ function isSocialMediaProfileUrl(val) {
7050
+ return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
6963
7051
  }
6964
- function simpleContainerTokenToTypeToken(_val) {
7052
+ function isYouTubeUrl(val) {
7053
+ return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
6965
7054
  }
6966
- function asTypeToken(_val) {
6967
- return "not ready";
7055
+ function isYouTubeShareUrl(val) {
7056
+ return isString(val) && val.startsWith(`https://youtu.be`);
6968
7057
  }
6969
- function addToken(token, ...params) {
6970
- return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
7058
+ function isYouTubeVideoUrl(val) {
7059
+ return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
6971
7060
  }
6972
- function boolean(literal2) {
6973
- return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
7061
+ function isYouTubePlaylistUrl(val) {
7062
+ 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`));
6974
7063
  }
6975
- var unknown = () => "<<unknown>>";
6976
- var undefinedType = () => "<<undefined>>";
6977
- var nullType = () => "<<null>>";
6978
- function fn(..._args) {
6979
- return {
6980
- returns: (_rtn) => ({
6981
- addProperties: (_kv) => {
6982
- return null;
6983
- },
6984
- done: () => {
6985
- return null;
6986
- }
6987
- }),
6988
- done: () => {
6989
- const result2 = null;
6990
- return result2;
6991
- }
6992
- };
7064
+ function feed_map(type) {
7065
+ return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
6993
7066
  }
6994
- function dictionary(_obj) {
6995
- return null;
7067
+ function isYouTubeFeedUrl(val, type) {
7068
+ return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
6996
7069
  }
6997
- function tuple2(..._elements) {
6998
- return null;
7070
+ function isYouTubeFeedHistoryUrl(val) {
7071
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
6999
7072
  }
7000
- function regexToken(re, ...rep) {
7001
- let exp = "";
7002
- if (isString(re)) {
7003
- try {
7004
- const test = new RegExp(re);
7005
- if (!isRegExp(test)) {
7006
- const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
7007
- err.name = "InvalidRegEx";
7008
- throw err;
7009
- } else {
7010
- exp = re;
7011
- }
7012
- } catch {
7013
- const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
7014
- err.name = "InvalidRegEx";
7015
- throw err;
7016
- }
7017
- } else if (isRegExp(re)) {
7018
- exp = re.toString();
7019
- }
7020
- const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
7021
- return token;
7073
+ function isYouTubePlaylistsUrl(val) {
7074
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
7022
7075
  }
7023
- function addSingleton(token, api2) {
7024
- return (...literals) => {
7025
- return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
7026
- "union",
7027
- literals.map((l) => addToken(token, `${l}`)).join(",")
7028
- );
7029
- };
7076
+ function isYouTubeTrendingUrl(val) {
7077
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
7030
7078
  }
7031
- var stringApi = {
7032
- startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
7033
- endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
7034
- zip: () => addToken("string-set", "Zip5"),
7035
- zipPlus4: () => addToken("string-set", "Zip5_4"),
7036
- zipCode: () => addToken("string-set", "ZipCode"),
7037
- militaryTime: (resolution) => {
7038
- return addToken(
7039
- "string-set",
7040
- "militaryTime",
7041
- resolution || "HH:MM"
7042
- );
7043
- },
7044
- civilianTime: (resolution) => {
7045
- return addToken(
7046
- "string-set",
7047
- "militaryTime",
7048
- resolution || "HH:MM"
7049
- );
7050
- },
7051
- numericString: () => addToken("string-set", "numeric"),
7052
- ipv4Address: () => addToken("string-set", "ipv4Address"),
7053
- ipv6Address: () => addToken("string-set", "ipv6Address"),
7054
- regex: (exp, ...literalRepresentation) => {
7055
- const token = regexToken(exp, ...literalRepresentation);
7056
- return token;
7057
- },
7058
- done: () => addToken("string")
7059
- };
7060
- var string22 = addSingleton("string", stringApi);
7061
- var number = addSingleton("number");
7062
- function union3(...elements) {
7063
- const result2 = elements.map((_el) => {
7064
- });
7065
- return result2;
7079
+ function isYouTubeSubscriptionsUrl(val) {
7080
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
7066
7081
  }
7067
- function record(_key, _value) {
7068
- return null;
7082
+ function isYouTubeCreatorUrl(url) {
7083
+ return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
7069
7084
  }
7070
- function array(_type) {
7071
- return null;
7085
+ function isYouTubeVideosInPlaylist(val) {
7086
+ return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
7072
7087
  }
7073
- function set(_type) {
7074
- return null;
7088
+ function isVueRef(val) {
7089
+ if (isObject(val)) {
7090
+ const keys = Object.keys(val);
7091
+ return !!["dep", "__v_isRef"].every((i) => keys.includes(i));
7092
+ }
7093
+ return false;
7094
+ }
7095
+ function csv(csv2, format = `string-numeric-tuple`) {
7096
+ const tuple3 = [];
7097
+ csv2.split(/,\s?/).forEach((v) => {
7098
+ tuple3.push(
7099
+ 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
7100
+ );
7101
+ });
7102
+ return tuple3;
7075
7103
  }
7076
- function map(_key, _value) {
7077
- return null;
7104
+ function fromKeyValue(kvs) {
7105
+ const obj = {};
7106
+ for (const kv of kvs) {
7107
+ obj[kv.key] = kv.value;
7108
+ }
7109
+ return obj;
7078
7110
  }
7079
- function weakMap(_key, _value) {
7080
- return null;
7111
+ function intersect(value, _intersectedWith) {
7112
+ return value;
7081
7113
  }
7082
- function isAddOrDone(val) {
7083
- return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
7114
+ function ip6GroupExpansion(ip) {
7115
+ return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
7084
7116
  }
7085
- var ShapeApiImplementation = {
7086
- string: string22,
7087
- number,
7088
- boolean,
7089
- unknown,
7090
- undefined: undefinedType,
7091
- null: nullType,
7092
- union: union3,
7093
- fn,
7094
- record,
7095
- array,
7096
- set,
7097
- map,
7098
- weakMap,
7099
- dictionary,
7100
- tuple: tuple2
7101
- };
7102
- function shape(cb) {
7103
- const rtn = cb(ShapeApiImplementation);
7104
- return handleDoneFn(
7105
- isAddOrDone(rtn) ? rtn.done() : rtn
7106
- );
7117
+ function jsonValue(val) {
7118
+ return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
7107
7119
  }
7108
- function isShape(v) {
7109
- return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
7120
+ function jsonValues(...val) {
7121
+ return val.map((i) => jsonValue(i));
7110
7122
  }
7111
- function asDefineObject(defn) {
7112
- const result2 = Object.keys(defn).reduce(
7113
- (acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
7114
- ...acc,
7115
- [i]: handleDoneFn(defn[i](ShapeApiImplementation))
7116
- } : isFunction(defn[i]) ? {
7117
- ...acc,
7118
- [i]: handleDoneFn(defn[i](ShapeApiImplementation))
7119
- } : Never2,
7120
- {}
7121
- );
7122
- return result2;
7123
+ function lookupAlpha2Code(code, prop) {
7124
+ const found = ISO3166_12.find((i) => i.alpha2 === code);
7125
+ return found ? found[prop] : void 0;
7123
7126
  }
7124
- function asType(...token) {
7125
- 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);
7127
+ function lookupAlpha3Code(code, prop) {
7128
+ const found = ISO3166_12.find((i) => i.alpha3 === code);
7129
+ return found ? found[prop] : void 0;
7126
7130
  }
7127
- function asStringLiteral(...values) {
7128
- return values.map((i) => i);
7131
+ function lookupName(name, prop) {
7132
+ const found = ISO3166_12.find((i) => i.name === name);
7133
+ return found ? found[prop] : void 0;
7129
7134
  }
7130
- var choices = "NOT READY";
7131
- function ip6Prefix(...groups) {
7132
- const empty = addToken("string");
7133
- const count = 4 - groups.length;
7134
- const fillIn = [];
7135
- for (let index = 0; index < count; index++) {
7136
- fillIn.push(empty);
7135
+ function lookupNumericCode(code, prop) {
7136
+ let num = isNumber(code) ? `${code}` : code;
7137
+ if (num.length === 1) {
7138
+ num = `00${num}`;
7139
+ } else if (num.length === 2) {
7140
+ num = `0${num}`;
7137
7141
  }
7138
- return [
7139
- "<<string::",
7140
- [
7141
- groups.join(":"),
7142
- fillIn.join(":")
7143
- ].join(":"),
7144
- ">>"
7145
- ].join("");
7142
+ const found = ISO3166_12.find((i) => i.countryCode === num);
7143
+ return found ? found[prop] : void 0;
7146
7144
  }
7147
- function createProxy(...initialize) {
7148
- const state = initialize;
7149
- state.id = null;
7150
- const proxy = new Proxy(state, {});
7151
- Object.defineProperty(proxy, "id", {
7152
- enumerable: false
7153
- });
7154
- return proxy;
7145
+ function lookupCountryName(code) {
7146
+ const uc = uppercase(code);
7147
+ return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
7155
7148
  }
7156
- function list(...init) {
7157
- return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
7149
+ function lookupCountryAlpha2(code) {
7150
+ const uc = uppercase(code);
7151
+ return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
7158
7152
  }
7159
- function singletonApi(kind) {
7160
- return {
7161
- wide: () => `<<${kind}>>`,
7162
- literal: (val) => `<<${kind}::${val}>>`
7163
- };
7153
+ function lookupCountryAlpha3(token) {
7154
+ const uc = uppercase(token);
7155
+ return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
7164
7156
  }
7165
- function setApi(_variant) {
7166
- return null;
7157
+ function lookupCountryCode(token) {
7158
+ const uc = uppercase(token);
7159
+ return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
7167
7160
  }
7168
- function fnReturnsApi(variant, _params, returns) {
7169
- return isSet(returns) ? null : (_rtn) => {
7170
- return isSet(returns) ? `<<${variant}::>>` : null;
7161
+ function asMapper(fn2) {
7162
+ const props = {
7163
+ kind: "Mapper",
7164
+ map: (from) => {
7165
+ return from.map(fn2);
7166
+ }
7171
7167
  };
7168
+ return createFnWithPropsExplicit(fn2, props);
7172
7169
  }
7173
- function fnParamsApi(variant, params, _returns) {
7174
- return isSet(params) ? null : (params2) => {
7175
- return isSet(params2) ? `<<${variant}::>>` : null;
7170
+ function createObjectMap() {
7171
+ return (map2) => {
7172
+ const fn2 = (input) => {
7173
+ return Object.keys(map2).reduce(
7174
+ (acc, key) => {
7175
+ const val = map2[key];
7176
+ return {
7177
+ ...acc,
7178
+ [key]: isFunction(val) ? val(input) : val
7179
+ };
7180
+ },
7181
+ {}
7182
+ );
7183
+ };
7184
+ return fn2;
7176
7185
  };
7177
7186
  }
7178
- function fnDoneApi(variant, params, returns) {
7179
- return isUnset(params) && isUnset(returns) ? `<<` : ``;
7187
+ function createMapper() {
7188
+ return (fn2) => {
7189
+ return asMapper(fn2);
7190
+ };
7180
7191
  }
7181
- function fnTokenClosure(kind, params, returns) {
7182
- return {
7183
- done: fnDoneApi(kind, params, returns),
7184
- params: fnParamsApi(kind, params, returns),
7185
- returns: fnReturnsApi(kind, params, returns)
7192
+ function mergeObjects(defVal, override) {
7193
+ const intersectingKeys = sharedKeys(defVal, override);
7194
+ const defUnique = withoutKeys(defVal, ...intersectingKeys);
7195
+ const overrideUnique = withoutKeys(defVal, ...intersectingKeys);
7196
+ const merged = {
7197
+ ...intersectingKeys.reduce(
7198
+ (acc, key) => typeof override[key] === "undefined" ? { ...acc, [key]: defVal[key] } : { ...acc, [key]: override[key] },
7199
+ {}
7200
+ ),
7201
+ ...defUnique,
7202
+ ...overrideUnique
7186
7203
  };
7204
+ return merged;
7187
7205
  }
7188
- function createTypeToken(kind) {
7189
- return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
7206
+ function mergeScalars(a, b) {
7207
+ return isUndefined(b) ? a : b;
7190
7208
  }
7191
- function fromDefineObject(defn) {
7192
- return defn;
7209
+ function mergeTuples(a, b) {
7210
+ 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]);
7193
7211
  }
7194
- function getTokenKind(token) {
7195
- const bare = stripSurround("<<", ">>")(token);
7196
- const parts = bare.split("::");
7197
- const kind = parts.pop();
7198
- return kind;
7212
+ function never(val) {
7213
+ return val;
7199
7214
  }
7200
- var simpleToken = (token) => token;
7201
- var simpleScalarToken = (token) => token;
7202
- var simpleContainerToken = (token) => token;
7203
- function simpleScalarType(token) {
7204
- const value = simpleScalarToken(token);
7215
+ function optional(value) {
7205
7216
  return value;
7206
7217
  }
7207
- function simpleContainerType(token) {
7208
- const value = simpleContainerToken(token);
7218
+ function orNull(value) {
7209
7219
  return value;
7210
7220
  }
7211
- function simpleType(token) {
7212
- const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
7221
+ function optionalOrNull(value) {
7213
7222
  return value;
7214
7223
  }
7215
- function hasOverlappingKeys(a, b) {
7216
- const keys = Object.keys(a);
7224
+ function stripParenthesis(val) {
7225
+ return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
7226
+ }
7227
+ function sortKeyApi(order) {
7228
+ return {
7229
+ order,
7230
+ toTop: (...keys) => sortKeyApi(
7231
+ [
7232
+ ...keys,
7233
+ ...order.filter((i) => !keys.includes(i))
7234
+ ]
7235
+ ),
7236
+ toBottom: (...keys) => sortKeyApi(
7237
+ [
7238
+ ...order.filter((i) => !keys.includes(i)),
7239
+ ...keys
7240
+ ]
7241
+ ),
7242
+ done: () => order
7243
+ };
7244
+ }
7245
+ function toKeyValue(obj, sort) {
7246
+ let keys = keysOf(obj);
7247
+ const tuple3 = [];
7248
+ if (sort) {
7249
+ keys = handleDoneFn(sort(sortKeyApi(keys)));
7250
+ }
7217
7251
  for (const k of keys) {
7218
- if (k in b) {
7219
- return true;
7220
- }
7252
+ tuple3.push({ key: k, value: obj[k] });
7221
7253
  }
7222
- return false;
7254
+ return tuple3;
7223
7255
  }
7224
- function uniqueKeys(left, right) {
7225
- const isNumeric = !!(isArray(left) && isArray(right));
7226
- if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
7227
- 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!");
7228
- }
7229
- const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
7230
- const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
7231
- if (isNumeric) {
7232
- throw new Error("uniqueKeys does not yet work with tuples");
7256
+ function convertScalar(val) {
7257
+ switch (typeof val) {
7258
+ case "number":
7259
+ return val;
7260
+ case "string":
7261
+ return Number(val);
7262
+ case "boolean":
7263
+ return val ? 1 : 0;
7264
+ default:
7265
+ throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
7233
7266
  }
7234
- const leftKeys = l.filter((i) => !r.includes(i));
7235
- const rightKeys = r.filter((i) => !l.includes(i));
7236
- return [
7237
- "LeftRight",
7238
- leftKeys,
7239
- rightKeys
7240
- ];
7267
+ }
7268
+ var convertList = (val) => val.map((i) => convertScalar(i));
7269
+ function toNumber(value) {
7270
+ return Array.isArray(value) ? convertList(value) : convertScalar(value);
7271
+ }
7272
+ var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
7273
+ function removeTailwindModifiers(val) {
7274
+ return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
7275
+ }
7276
+ function getTailwindModifiers(val) {
7277
+ return val.split(":").filter((i) => isTailwindModifier(i));
7278
+ }
7279
+ function union3(..._options) {
7280
+ return (value) => value;
7281
+ }
7282
+ function unionize(value, _inUnionWith) {
7283
+ return value;
7241
7284
  }
7242
7285
  function asVueRef(value) {
7243
7286
  return {
@@ -7678,6 +7721,7 @@ export {
7678
7721
  defineObject,
7679
7722
  defineObjectApi,
7680
7723
  defineTuple,
7724
+ doesExtend,
7681
7725
  endsWith,
7682
7726
  ensureLeading,
7683
7727
  ensureSurround,
@@ -7688,6 +7732,7 @@ export {
7688
7732
  find,
7689
7733
  fnMeta,
7690
7734
  fromDefineObject,
7735
+ fromKeyValue,
7691
7736
  get,
7692
7737
  getDaysBetween,
7693
7738
  getEach,
@@ -7970,6 +8015,7 @@ export {
7970
8015
  isVoltageUom,
7971
8016
  isVolumeMetric,
7972
8017
  isVolumeUom,
8018
+ isVueRef,
7973
8019
  isWalgreensUrl,
7974
8020
  isWalmartUrl,
7975
8021
  isWayfairUrl,
@@ -8063,6 +8109,7 @@ export {
8063
8109
  takeProp,
8064
8110
  toCamelCase,
8065
8111
  toKebabCase,
8112
+ toKeyValue,
8066
8113
  toNumber,
8067
8114
  toNumericArray,
8068
8115
  toPascalCase,
@@ -8079,7 +8126,7 @@ export {
8079
8126
  twColor,
8080
8127
  unbox,
8081
8128
  uncapitalize,
8082
- union,
8129
+ union3 as union,
8083
8130
  unionize,
8084
8131
  unique,
8085
8132
  uniqueKeys,