vercel
Version:
The command-line interface for Vercel
1,490 lines (1,468 loc) • 251 kB
JavaScript
import { createRequire as __createRequire } from 'node:module';
import { fileURLToPath as __fileURLToPath } from 'node:url';
import { dirname as __dirname_ } from 'node:path';
const require = __createRequire(import.meta.url);
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __dirname_(__filename);
import {
isJSONObject,
printIndications,
require_dist as require_dist2,
sleep
} from "./chunk-F2UPASLT.js";
import {
suggestNextCommands
} from "./chunk-LOS7HHU3.js";
import {
getDeployment,
mapCertError
} from "./chunk-NYJXGEIR.js";
import {
CommandTimeout
} from "./chunk-UVFXUXOZ.js";
import {
getScope
} from "./chunk-KWDV5FZH.js";
import {
ua_default
} from "./chunk-76ZNZKIN.js";
import {
showPluginTipIfNeeded
} from "./chunk-ZKKIBUCU.js";
import {
getProjectByNameOrId,
param,
printAlignedLabel,
require_dist as require_dist3,
require_pluralize
} from "./chunk-X775BOSL.js";
import {
require_ms,
stamp_default
} from "./chunk-CO5D46AG.js";
import {
require_lib
} from "./chunk-N2T234LO.js";
import {
require_strip_ansi,
responseError
} from "./chunk-4GQQJY5Y.js";
import {
APIError,
BuildError,
DomainAlreadyExists,
DomainNotAvailable,
DomainNotFound,
DomainPaymentError,
DomainPermissionDenied,
InvalidDomain,
NowError,
TLDNotSupportedViaCLI,
UnexpectedDomainPurchaseError,
UnsupportedTLD,
UserAborted,
getCommandName,
isAPIError,
require_bytes
} from "./chunk-UGXBNJMO.js";
import {
emoji,
eraseLines,
link_default,
output_manager_default,
prependEmoji,
require_ansi_escapes,
require_dist
} from "./chunk-ZQKJVHXY.js";
import {
require_source
} from "./chunk-S7KYDPEM.js";
import {
__commonJS,
__require,
__toESM
} from "./chunk-TZ2YI2VH.js";
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/is_date/index.js
var require_is_date = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/is_date/index.js"(exports, module) {
function isDate(argument) {
return argument instanceof Date;
}
module.exports = isDate;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/parse/index.js
var require_parse = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/parse/index.js"(exports, module) {
var isDate = require_is_date();
var MILLISECONDS_IN_HOUR = 36e5;
var MILLISECONDS_IN_MINUTE = 6e4;
var DEFAULT_ADDITIONAL_DIGITS = 2;
var parseTokenDateTimeDelimeter = /[T ]/;
var parseTokenPlainTime = /:/;
var parseTokenYY = /^(\d{2})$/;
var parseTokensYYY = [
/^([+-]\d{2})$/,
// 0 additional digits
/^([+-]\d{3})$/,
// 1 additional digit
/^([+-]\d{4})$/
// 2 additional digits
];
var parseTokenYYYY = /^(\d{4})/;
var parseTokensYYYYY = [
/^([+-]\d{4})/,
// 0 additional digits
/^([+-]\d{5})/,
// 1 additional digit
/^([+-]\d{6})/
// 2 additional digits
];
var parseTokenMM = /^-(\d{2})$/;
var parseTokenDDD = /^-?(\d{3})$/;
var parseTokenMMDD = /^-?(\d{2})-?(\d{2})$/;
var parseTokenWww = /^-?W(\d{2})$/;
var parseTokenWwwD = /^-?W(\d{2})-?(\d{1})$/;
var parseTokenHH = /^(\d{2}([.,]\d*)?)$/;
var parseTokenHHMM = /^(\d{2}):?(\d{2}([.,]\d*)?)$/;
var parseTokenHHMMSS = /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/;
var parseTokenTimezone = /([Z+-].*)$/;
var parseTokenTimezoneZ = /^(Z)$/;
var parseTokenTimezoneHH = /^([+-])(\d{2})$/;
var parseTokenTimezoneHHMM = /^([+-])(\d{2}):?(\d{2})$/;
function parse2(argument, dirtyOptions) {
if (isDate(argument)) {
return new Date(argument.getTime());
} else if (typeof argument !== "string") {
return new Date(argument);
}
var options = dirtyOptions || {};
var additionalDigits = options.additionalDigits;
if (additionalDigits == null) {
additionalDigits = DEFAULT_ADDITIONAL_DIGITS;
} else {
additionalDigits = Number(additionalDigits);
}
var dateStrings = splitDateString(argument);
var parseYearResult = parseYear(dateStrings.date, additionalDigits);
var year = parseYearResult.year;
var restDateString = parseYearResult.restDateString;
var date = parseDate(restDateString, year);
if (date) {
var timestamp = date.getTime();
var time = 0;
var offset;
if (dateStrings.time) {
time = parseTime(dateStrings.time);
}
if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone);
} else {
offset = new Date(timestamp + time).getTimezoneOffset();
offset = new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE).getTimezoneOffset();
}
return new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE);
} else {
return new Date(argument);
}
}
function splitDateString(dateString) {
var dateStrings = {};
var array = dateString.split(parseTokenDateTimeDelimeter);
var timeString;
if (parseTokenPlainTime.test(array[0])) {
dateStrings.date = null;
timeString = array[0];
} else {
dateStrings.date = array[0];
timeString = array[1];
}
if (timeString) {
var token = parseTokenTimezone.exec(timeString);
if (token) {
dateStrings.time = timeString.replace(token[1], "");
dateStrings.timezone = token[1];
} else {
dateStrings.time = timeString;
}
}
return dateStrings;
}
function parseYear(dateString, additionalDigits) {
var parseTokenYYY = parseTokensYYY[additionalDigits];
var parseTokenYYYYY = parseTokensYYYYY[additionalDigits];
var token;
token = parseTokenYYYY.exec(dateString) || parseTokenYYYYY.exec(dateString);
if (token) {
var yearString = token[1];
return {
year: parseInt(yearString, 10),
restDateString: dateString.slice(yearString.length)
};
}
token = parseTokenYY.exec(dateString) || parseTokenYYY.exec(dateString);
if (token) {
var centuryString = token[1];
return {
year: parseInt(centuryString, 10) * 100,
restDateString: dateString.slice(centuryString.length)
};
}
return {
year: null
};
}
function parseDate(dateString, year) {
if (year === null) {
return null;
}
var token;
var date;
var month;
var week;
if (dateString.length === 0) {
date = /* @__PURE__ */ new Date(0);
date.setUTCFullYear(year);
return date;
}
token = parseTokenMM.exec(dateString);
if (token) {
date = /* @__PURE__ */ new Date(0);
month = parseInt(token[1], 10) - 1;
date.setUTCFullYear(year, month);
return date;
}
token = parseTokenDDD.exec(dateString);
if (token) {
date = /* @__PURE__ */ new Date(0);
var dayOfYear = parseInt(token[1], 10);
date.setUTCFullYear(year, 0, dayOfYear);
return date;
}
token = parseTokenMMDD.exec(dateString);
if (token) {
date = /* @__PURE__ */ new Date(0);
month = parseInt(token[1], 10) - 1;
var day = parseInt(token[2], 10);
date.setUTCFullYear(year, month, day);
return date;
}
token = parseTokenWww.exec(dateString);
if (token) {
week = parseInt(token[1], 10) - 1;
return dayOfISOYear(year, week);
}
token = parseTokenWwwD.exec(dateString);
if (token) {
week = parseInt(token[1], 10) - 1;
var dayOfWeek = parseInt(token[2], 10) - 1;
return dayOfISOYear(year, week, dayOfWeek);
}
return null;
}
function parseTime(timeString) {
var token;
var hours;
var minutes;
token = parseTokenHH.exec(timeString);
if (token) {
hours = parseFloat(token[1].replace(",", "."));
return hours % 24 * MILLISECONDS_IN_HOUR;
}
token = parseTokenHHMM.exec(timeString);
if (token) {
hours = parseInt(token[1], 10);
minutes = parseFloat(token[2].replace(",", "."));
return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;
}
token = parseTokenHHMMSS.exec(timeString);
if (token) {
hours = parseInt(token[1], 10);
minutes = parseInt(token[2], 10);
var seconds = parseFloat(token[3].replace(",", "."));
return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1e3;
}
return null;
}
function parseTimezone(timezoneString) {
var token;
var absoluteOffset;
token = parseTokenTimezoneZ.exec(timezoneString);
if (token) {
return 0;
}
token = parseTokenTimezoneHH.exec(timezoneString);
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60;
return token[1] === "+" ? -absoluteOffset : absoluteOffset;
}
token = parseTokenTimezoneHHMM.exec(timezoneString);
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10);
return token[1] === "+" ? -absoluteOffset : absoluteOffset;
}
return 0;
}
function dayOfISOYear(isoYear, week, day) {
week = week || 0;
day = day || 0;
var date = /* @__PURE__ */ new Date(0);
date.setUTCFullYear(isoYear, 0, 4);
var fourthOfJanuaryDay = date.getUTCDay() || 7;
var diff = week * 7 + day + 1 - fourthOfJanuaryDay;
date.setUTCDate(date.getUTCDate() + diff);
return date;
}
module.exports = parse2;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_year/index.js
var require_start_of_year = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_year/index.js"(exports, module) {
var parse2 = require_parse();
function startOfYear(dirtyDate) {
var cleanDate = parse2(dirtyDate);
var date = /* @__PURE__ */ new Date(0);
date.setFullYear(cleanDate.getFullYear(), 0, 1);
date.setHours(0, 0, 0, 0);
return date;
}
module.exports = startOfYear;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_day/index.js
var require_start_of_day = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_day/index.js"(exports, module) {
var parse2 = require_parse();
function startOfDay(dirtyDate) {
var date = parse2(dirtyDate);
date.setHours(0, 0, 0, 0);
return date;
}
module.exports = startOfDay;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/difference_in_calendar_days/index.js
var require_difference_in_calendar_days = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/difference_in_calendar_days/index.js"(exports, module) {
var startOfDay = require_start_of_day();
var MILLISECONDS_IN_MINUTE = 6e4;
var MILLISECONDS_IN_DAY = 864e5;
function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
var startOfDayLeft = startOfDay(dirtyDateLeft);
var startOfDayRight = startOfDay(dirtyDateRight);
var timestampLeft = startOfDayLeft.getTime() - startOfDayLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE;
var timestampRight = startOfDayRight.getTime() - startOfDayRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE;
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
}
module.exports = differenceInCalendarDays;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_day_of_year/index.js
var require_get_day_of_year = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_day_of_year/index.js"(exports, module) {
var parse2 = require_parse();
var startOfYear = require_start_of_year();
var differenceInCalendarDays = require_difference_in_calendar_days();
function getDayOfYear(dirtyDate) {
var date = parse2(dirtyDate);
var diff = differenceInCalendarDays(date, startOfYear(date));
var dayOfYear = diff + 1;
return dayOfYear;
}
module.exports = getDayOfYear;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_week/index.js
var require_start_of_week = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_week/index.js"(exports, module) {
var parse2 = require_parse();
function startOfWeek(dirtyDate, dirtyOptions) {
var weekStartsOn = dirtyOptions ? Number(dirtyOptions.weekStartsOn) || 0 : 0;
var date = parse2(dirtyDate);
var day = date.getDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date.setDate(date.getDate() - diff);
date.setHours(0, 0, 0, 0);
return date;
}
module.exports = startOfWeek;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_iso_week/index.js
var require_start_of_iso_week = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_iso_week/index.js"(exports, module) {
var startOfWeek = require_start_of_week();
function startOfISOWeek(dirtyDate) {
return startOfWeek(dirtyDate, { weekStartsOn: 1 });
}
module.exports = startOfISOWeek;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_iso_year/index.js
var require_get_iso_year = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_iso_year/index.js"(exports, module) {
var parse2 = require_parse();
var startOfISOWeek = require_start_of_iso_week();
function getISOYear(dirtyDate) {
var date = parse2(dirtyDate);
var year = date.getFullYear();
var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0);
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0);
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
if (date.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (date.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
module.exports = getISOYear;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_iso_year/index.js
var require_start_of_iso_year = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_iso_year/index.js"(exports, module) {
var getISOYear = require_get_iso_year();
var startOfISOWeek = require_start_of_iso_week();
function startOfISOYear(dirtyDate) {
var year = getISOYear(dirtyDate);
var fourthOfJanuary = /* @__PURE__ */ new Date(0);
fourthOfJanuary.setFullYear(year, 0, 4);
fourthOfJanuary.setHours(0, 0, 0, 0);
var date = startOfISOWeek(fourthOfJanuary);
return date;
}
module.exports = startOfISOYear;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_iso_week/index.js
var require_get_iso_week = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_iso_week/index.js"(exports, module) {
var parse2 = require_parse();
var startOfISOWeek = require_start_of_iso_week();
var startOfISOYear = require_start_of_iso_year();
var MILLISECONDS_IN_WEEK = 6048e5;
function getISOWeek(dirtyDate) {
var date = parse2(dirtyDate);
var diff = startOfISOWeek(date).getTime() - startOfISOYear(date).getTime();
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
}
module.exports = getISOWeek;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/is_valid/index.js
var require_is_valid = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/is_valid/index.js"(exports, module) {
var isDate = require_is_date();
function isValid(dirtyDate) {
if (isDate(dirtyDate)) {
return !isNaN(dirtyDate);
} else {
throw new TypeError(toString.call(dirtyDate) + " is not an instance of Date");
}
}
module.exports = isValid;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/build_distance_in_words_locale/index.js
var require_build_distance_in_words_locale = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/build_distance_in_words_locale/index.js"(exports, module) {
function buildDistanceInWordsLocale() {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: "less than a second",
other: "less than {{count}} seconds"
},
xSeconds: {
one: "1 second",
other: "{{count}} seconds"
},
halfAMinute: "half a minute",
lessThanXMinutes: {
one: "less than a minute",
other: "less than {{count}} minutes"
},
xMinutes: {
one: "1 minute",
other: "{{count}} minutes"
},
aboutXHours: {
one: "about 1 hour",
other: "about {{count}} hours"
},
xHours: {
one: "1 hour",
other: "{{count}} hours"
},
xDays: {
one: "1 day",
other: "{{count}} days"
},
aboutXMonths: {
one: "about 1 month",
other: "about {{count}} months"
},
xMonths: {
one: "1 month",
other: "{{count}} months"
},
aboutXYears: {
one: "about 1 year",
other: "about {{count}} years"
},
xYears: {
one: "1 year",
other: "{{count}} years"
},
overXYears: {
one: "over 1 year",
other: "over {{count}} years"
},
almostXYears: {
one: "almost 1 year",
other: "almost {{count}} years"
}
};
function localize(token, count, options) {
options = options || {};
var result;
if (typeof distanceInWordsLocale[token] === "string") {
result = distanceInWordsLocale[token];
} else if (count === 1) {
result = distanceInWordsLocale[token].one;
} else {
result = distanceInWordsLocale[token].other.replace("{{count}}", count);
}
if (options.addSuffix) {
if (options.comparison > 0) {
return "in " + result;
} else {
return result + " ago";
}
}
return result;
}
return {
localize
};
}
module.exports = buildDistanceInWordsLocale;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/_lib/build_formatting_tokens_reg_exp/index.js
var require_build_formatting_tokens_reg_exp = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/_lib/build_formatting_tokens_reg_exp/index.js"(exports, module) {
var commonFormatterKeys = [
"M",
"MM",
"Q",
"D",
"DD",
"DDD",
"DDDD",
"d",
"E",
"W",
"WW",
"YY",
"YYYY",
"GG",
"GGGG",
"H",
"HH",
"h",
"hh",
"m",
"mm",
"s",
"ss",
"S",
"SS",
"SSS",
"Z",
"ZZ",
"X",
"x"
];
function buildFormattingTokensRegExp(formatters) {
var formatterKeys = [];
for (var key in formatters) {
if (formatters.hasOwnProperty(key)) {
formatterKeys.push(key);
}
}
var formattingTokens = commonFormatterKeys.concat(formatterKeys).sort().reverse();
var formattingTokensRegExp = new RegExp(
"(\\[[^\\[]*\\])|(\\\\)?(" + formattingTokens.join("|") + "|.)",
"g"
);
return formattingTokensRegExp;
}
module.exports = buildFormattingTokensRegExp;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/build_format_locale/index.js
var require_build_format_locale = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/build_format_locale/index.js"(exports, module) {
var buildFormattingTokensRegExp = require_build_formatting_tokens_reg_exp();
function buildFormatLocale() {
var months3char = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var monthsFull = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var weekdays2char = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
var weekdays3char = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var weekdaysFull = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var meridiemUppercase = ["AM", "PM"];
var meridiemLowercase = ["am", "pm"];
var meridiemFull = ["a.m.", "p.m."];
var formatters = {
// Month: Jan, Feb, ..., Dec
"MMM": function(date) {
return months3char[date.getMonth()];
},
// Month: January, February, ..., December
"MMMM": function(date) {
return monthsFull[date.getMonth()];
},
// Day of week: Su, Mo, ..., Sa
"dd": function(date) {
return weekdays2char[date.getDay()];
},
// Day of week: Sun, Mon, ..., Sat
"ddd": function(date) {
return weekdays3char[date.getDay()];
},
// Day of week: Sunday, Monday, ..., Saturday
"dddd": function(date) {
return weekdaysFull[date.getDay()];
},
// AM, PM
"A": function(date) {
return date.getHours() / 12 >= 1 ? meridiemUppercase[1] : meridiemUppercase[0];
},
// am, pm
"a": function(date) {
return date.getHours() / 12 >= 1 ? meridiemLowercase[1] : meridiemLowercase[0];
},
// a.m., p.m.
"aa": function(date) {
return date.getHours() / 12 >= 1 ? meridiemFull[1] : meridiemFull[0];
}
};
var ordinalFormatters = ["M", "D", "DDD", "d", "Q", "W"];
ordinalFormatters.forEach(function(formatterToken) {
formatters[formatterToken + "o"] = function(date, formatters2) {
return ordinal(formatters2[formatterToken](date));
};
});
return {
formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
};
}
function ordinal(number) {
var rem100 = number % 100;
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + "st";
case 2:
return number + "nd";
case 3:
return number + "rd";
}
}
return number + "th";
}
module.exports = buildFormatLocale;
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/index.js
var require_en = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/index.js"(exports, module) {
var buildDistanceInWordsLocale = require_build_distance_in_words_locale();
var buildFormatLocale = require_build_format_locale();
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
};
}
});
// ../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/format/index.js
var require_format = __commonJS({
"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/format/index.js"(exports, module) {
var getDayOfYear = require_get_day_of_year();
var getISOWeek = require_get_iso_week();
var getISOYear = require_get_iso_year();
var parse2 = require_parse();
var isValid = require_is_valid();
var enLocale = require_en();
function format2(dirtyDate, dirtyFormatStr, dirtyOptions) {
var formatStr = dirtyFormatStr ? String(dirtyFormatStr) : "YYYY-MM-DDTHH:mm:ss.SSSZ";
var options = dirtyOptions || {};
var locale = options.locale;
var localeFormatters = enLocale.format.formatters;
var formattingTokensRegExp = enLocale.format.formattingTokensRegExp;
if (locale && locale.format && locale.format.formatters) {
localeFormatters = locale.format.formatters;
if (locale.format.formattingTokensRegExp) {
formattingTokensRegExp = locale.format.formattingTokensRegExp;
}
}
var date = parse2(dirtyDate);
if (!isValid(date)) {
return "Invalid Date";
}
var formatFn = buildFormatFn(formatStr, localeFormatters, formattingTokensRegExp);
return formatFn(date);
}
var formatters = {
// Month: 1, 2, ..., 12
"M": function(date) {
return date.getMonth() + 1;
},
// Month: 01, 02, ..., 12
"MM": function(date) {
return addLeadingZeros(date.getMonth() + 1, 2);
},
// Quarter: 1, 2, 3, 4
"Q": function(date) {
return Math.ceil((date.getMonth() + 1) / 3);
},
// Day of month: 1, 2, ..., 31
"D": function(date) {
return date.getDate();
},
// Day of month: 01, 02, ..., 31
"DD": function(date) {
return addLeadingZeros(date.getDate(), 2);
},
// Day of year: 1, 2, ..., 366
"DDD": function(date) {
return getDayOfYear(date);
},
// Day of year: 001, 002, ..., 366
"DDDD": function(date) {
return addLeadingZeros(getDayOfYear(date), 3);
},
// Day of week: 0, 1, ..., 6
"d": function(date) {
return date.getDay();
},
// Day of ISO week: 1, 2, ..., 7
"E": function(date) {
return date.getDay() || 7;
},
// ISO week: 1, 2, ..., 53
"W": function(date) {
return getISOWeek(date);
},
// ISO week: 01, 02, ..., 53
"WW": function(date) {
return addLeadingZeros(getISOWeek(date), 2);
},
// Year: 00, 01, ..., 99
"YY": function(date) {
return addLeadingZeros(date.getFullYear(), 4).substr(2);
},
// Year: 1900, 1901, ..., 2099
"YYYY": function(date) {
return addLeadingZeros(date.getFullYear(), 4);
},
// ISO week-numbering year: 00, 01, ..., 99
"GG": function(date) {
return String(getISOYear(date)).substr(2);
},
// ISO week-numbering year: 1900, 1901, ..., 2099
"GGGG": function(date) {
return getISOYear(date);
},
// Hour: 0, 1, ... 23
"H": function(date) {
return date.getHours();
},
// Hour: 00, 01, ..., 23
"HH": function(date) {
return addLeadingZeros(date.getHours(), 2);
},
// Hour: 1, 2, ..., 12
"h": function(date) {
var hours = date.getHours();
if (hours === 0) {
return 12;
} else if (hours > 12) {
return hours % 12;
} else {
return hours;
}
},
// Hour: 01, 02, ..., 12
"hh": function(date) {
return addLeadingZeros(formatters["h"](date), 2);
},
// Minute: 0, 1, ..., 59
"m": function(date) {
return date.getMinutes();
},
// Minute: 00, 01, ..., 59
"mm": function(date) {
return addLeadingZeros(date.getMinutes(), 2);
},
// Second: 0, 1, ..., 59
"s": function(date) {
return date.getSeconds();
},
// Second: 00, 01, ..., 59
"ss": function(date) {
return addLeadingZeros(date.getSeconds(), 2);
},
// 1/10 of second: 0, 1, ..., 9
"S": function(date) {
return Math.floor(date.getMilliseconds() / 100);
},
// 1/100 of second: 00, 01, ..., 99
"SS": function(date) {
return addLeadingZeros(Math.floor(date.getMilliseconds() / 10), 2);
},
// Millisecond: 000, 001, ..., 999
"SSS": function(date) {
return addLeadingZeros(date.getMilliseconds(), 3);
},
// Timezone: -01:00, +00:00, ... +12:00
"Z": function(date) {
return formatTimezone(date.getTimezoneOffset(), ":");
},
// Timezone: -0100, +0000, ... +1200
"ZZ": function(date) {
return formatTimezone(date.getTimezoneOffset());
},
// Seconds timestamp: 512969520
"X": function(date) {
return Math.floor(date.getTime() / 1e3);
},
// Milliseconds timestamp: 512969520900
"x": function(date) {
return date.getTime();
}
};
function buildFormatFn(formatStr, localeFormatters, formattingTokensRegExp) {
var array = formatStr.match(formattingTokensRegExp);
var length = array.length;
var i;
var formatter;
for (i = 0; i < length; i++) {
formatter = localeFormatters[array[i]] || formatters[array[i]];
if (formatter) {
array[i] = formatter;
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return function(date) {
var output = "";
for (var i2 = 0; i2 < length; i2++) {
if (array[i2] instanceof Function) {
output += array[i2](date, formatters);
} else {
output += array[i2];
}
}
return output;
};
}
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|]$/g, "");
}
return input.replace(/\\/g, "");
}
function formatTimezone(offset, delimeter) {
delimeter = delimeter || "";
var sign = offset > 0 ? "-" : "+";
var absOffset = Math.abs(offset);
var hours = Math.floor(absOffset / 60);
var minutes = absOffset % 60;
return sign + addLeadingZeros(hours, 2) + delimeter + addLeadingZeros(minutes, 2);
}
function addLeadingZeros(number, targetLength) {
var output = Math.abs(number).toString();
while (output.length < targetLength) {
output = "0" + output;
}
return output;
}
module.exports = format2;
}
});
// ../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/lib/parser.js
var require_parser = __commonJS({
"../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/lib/parser.js"(exports, module) {
var Transform = __require("stream").Transform;
function Parser(options) {
if (!(this instanceof Parser)) {
throw new TypeError("Cannot call a class as a function");
}
options = options || {};
Transform.call(this, { objectMode: true });
this._memory = "";
this._emitInvalidLines = options.emitInvalidLines || false;
}
Parser.prototype = Object.create(Transform.prototype);
Parser.prototype._handleLines = function(lines, cb) {
for (var i = 0; i < lines.length; i++) {
if (lines[i] === "")
continue;
var err = null;
var json = null;
try {
json = JSON.parse(lines[i]);
} catch (_err) {
_err.source = lines[i];
err = _err;
}
if (err) {
if (this._emitInvalidLines) {
this.emit("invalid-line", err);
} else {
return cb(err);
}
} else {
this.push(json);
}
}
cb(null);
};
Parser.prototype._transform = function(chunk, encoding, cb) {
var lines = (this._memory + chunk.toString()).split("\n");
this._memory = lines.pop();
this._handleLines(lines, cb);
};
Parser.prototype._flush = function(cb) {
if (!this._memory)
return cb(null);
var line = this._memory;
this._memory = "";
this._handleLines([line], cb);
};
module.exports = Parser;
}
});
// ../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/lib/stringifier.js
var require_stringifier = __commonJS({
"../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/lib/stringifier.js"(exports, module) {
var Transform = __require("stream").Transform;
function Stringifier() {
if (!(this instanceof Stringifier)) {
throw new TypeError("Cannot call a class as a function");
}
Transform.call(this, { objectMode: true });
}
Stringifier.prototype = Object.create(Transform.prototype);
Stringifier.prototype._transform = function(data, _, cb) {
var value;
try {
value = JSON.stringify(data);
} catch (err) {
err.source = data;
return cb(err);
}
cb(null, value + "\n");
};
module.exports = Stringifier;
}
});
// ../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/index.js
var require_jsonlines = __commonJS({
"../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/index.js"(exports) {
var Parser = require_parser();
var Stringifier = require_stringifier();
exports.parse = function parse2(options) {
return new Parser(options);
};
exports.stringify = function stringify() {
return new Stringifier();
};
}
});
// ../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js
var require_split2 = __commonJS({
"../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module) {
"use strict";
var { Transform } = __require("stream");
var { StringDecoder } = __require("string_decoder");
var kLast = Symbol("last");
var kDecoder = Symbol("decoder");
function transform(chunk, enc, cb) {
let list;
if (this.overflow) {
const buf = this[kDecoder].write(chunk);
list = buf.split(this.matcher);
if (list.length === 1)
return cb();
list.shift();
this.overflow = false;
} else {
this[kLast] += this[kDecoder].write(chunk);
list = this[kLast].split(this.matcher);
}
this[kLast] = list.pop();
for (let i = 0; i < list.length; i++) {
try {
push(this, this.mapper(list[i]));
} catch (error) {
return cb(error);
}
}
this.overflow = this[kLast].length > this.maxLength;
if (this.overflow && !this.skipOverflow) {
cb(new Error("maximum buffer reached"));
return;
}
cb();
}
function flush(cb) {
this[kLast] += this[kDecoder].end();
if (this[kLast]) {
try {
push(this, this.mapper(this[kLast]));
} catch (error) {
return cb(error);
}
}
cb();
}
function push(self, val) {
if (val !== void 0) {
self.push(val);
}
}
function noop(incoming) {
return incoming;
}
function split2(matcher, mapper, options) {
matcher = matcher || /\r?\n/;
mapper = mapper || noop;
options = options || {};
switch (arguments.length) {
case 1:
if (typeof matcher === "function") {
mapper = matcher;
matcher = /\r?\n/;
} else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
options = matcher;
matcher = /\r?\n/;
}
break;
case 2:
if (typeof matcher === "function") {
options = mapper;
mapper = matcher;
matcher = /\r?\n/;
} else if (typeof mapper === "object") {
options = mapper;
mapper = noop;
}
}
options = Object.assign({}, options);
options.autoDestroy = true;
options.transform = transform;
options.flush = flush;
options.readableObjectMode = true;
const stream = new Transform(options);
stream[kLast] = "";
stream[kDecoder] = new StringDecoder("utf8");
stream.matcher = matcher;
stream.mapper = mapper;
stream.maxLength = options.maxLength;
stream.skipOverflow = options.skipOverflow || false;
stream.overflow = false;
stream._destroy = function(err, cb) {
this._writableState.errorEmitted = false;
cb(err);
};
return stream;
}
module.exports = split2;
}
});
// ../../node_modules/.pnpm/tldts@6.1.47/node_modules/tldts/dist/cjs/index.js
var require_cjs = __commonJS({
"../../node_modules/.pnpm/tldts@6.1.47/node_modules/tldts/dist/cjs/index.js"(exports) {
"use strict";
function shareSameDomainSuffix(hostname, vhost) {
if (hostname.endsWith(vhost)) {
return hostname.length === vhost.length || hostname[hostname.length - vhost.length - 1] === ".";
}
return false;
}
function extractDomainWithSuffix(hostname, publicSuffix) {
const publicSuffixIndex = hostname.length - publicSuffix.length - 2;
const lastDotBeforeSuffixIndex = hostname.lastIndexOf(".", publicSuffixIndex);
if (lastDotBeforeSuffixIndex === -1) {
return hostname;
}
return hostname.slice(lastDotBeforeSuffixIndex + 1);
}
function getDomain$1(suffix, hostname, options) {
if (options.validHosts !== null) {
const validHosts = options.validHosts;
for (const vhost of validHosts) {
if (
/*@__INLINE__*/
shareSameDomainSuffix(hostname, vhost)
) {
return vhost;
}
}
}
let numberOfLeadingDots = 0;
if (hostname.startsWith(".")) {
while (numberOfLeadingDots < hostname.length && hostname[numberOfLeadingDots] === ".") {
numberOfLeadingDots += 1;
}
}
if (suffix.length === hostname.length - numberOfLeadingDots) {
return null;
}
return (
/*@__INLINE__*/
extractDomainWithSuffix(hostname, suffix)
);
}
function getDomainWithoutSuffix$1(domain, suffix) {
return domain.slice(0, -suffix.length - 1);
}
function extractHostname(url, urlIsValidHostname) {
let start = 0;
let end = url.length;
let hasUpper = false;
if (!urlIsValidHostname) {
if (url.startsWith("data:")) {
return null;
}
while (start < url.length && url.charCodeAt(start) <= 32) {
start += 1;
}
while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
end -= 1;
}
if (url.charCodeAt(start) === 47 && url.charCodeAt(start + 1) === 47) {
start += 2;
} else {
const indexOfProtocol = url.indexOf(":/", start);
if (indexOfProtocol !== -1) {
const protocolSize = indexOfProtocol - start;
const c0 = url.charCodeAt(start);
const c1 = url.charCodeAt(start + 1);
const c2 = url.charCodeAt(start + 2);
const c3 = url.charCodeAt(start + 3);
const c4 = url.charCodeAt(start + 4);
if (protocolSize === 5 && c0 === 104 && c1 === 116 && c2 === 116 && c3 === 112 && c4 === 115)
;
else if (protocolSize === 4 && c0 === 104 && c1 === 116 && c2 === 116 && c3 === 112)
;
else if (protocolSize === 3 && c0 === 119 && c1 === 115 && c2 === 115)
;
else if (protocolSize === 2 && c0 === 119 && c1 === 115)
;
else {
for (let i = start; i < indexOfProtocol; i += 1) {
const lowerCaseCode = url.charCodeAt(i) | 32;
if (!(lowerCaseCode >= 97 && lowerCaseCode <= 122 || // [a, z]
lowerCaseCode >= 48 && lowerCaseCode <= 57 || // [0, 9]
lowerCaseCode === 46 || // '.'
lowerCaseCode === 45 || // '-'
lowerCaseCode === 43)) {
return null;
}
}
}
start = indexOfProtocol + 2;
while (url.charCodeAt(start) === 47) {
start += 1;
}
}
}
let indexOfIdentifier = -1;
let indexOfClosingBracket = -1;
let indexOfPort = -1;
for (let i = start; i < end; i += 1) {
const code = url.charCodeAt(i);
if (code === 35 || // '#'
code === 47 || // '/'
code === 63) {
end = i;
break;
} else if (code === 64) {
indexOfIdentifier = i;
} else if (code === 93) {
indexOfClosingBracket = i;
} else if (code === 58) {
indexOfPort = i;
} else if (code >= 65 && code <= 90) {
hasUpper = true;
}
}
if (indexOfIdentifier !== -1 && indexOfIdentifier > start && indexOfIdentifier < end) {
start = indexOfIdentifier + 1;
}
if (url.charCodeAt(start) === 91) {
if (indexOfClosingBracket !== -1) {
return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
}
return null;
} else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) {
end = indexOfPort;
}
}
while (end > start + 1 && url.charCodeAt(end - 1) === 46) {
end -= 1;
}
const hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url;
if (hasUpper) {
return hostname.toLowerCase();
}
return hostname;
}
function isProbablyIpv4(hostname) {
if (hostname.length < 7) {
return false;
}
if (hostname.length > 15) {
return false;
}
let numberOfDots = 0;
for (let i = 0; i < hostname.length; i += 1) {
const code = hostname.charCodeAt(i);
if (code === 46) {
numberOfDots += 1;
} else if (code < 48 || code > 57) {
return false;
}
}
return numberOfDots === 3 && hostname.charCodeAt(0) !== 46 && hostname.charCodeAt(hostname.length - 1) !== 46;
}
function isProbablyIpv6(hostname) {
if (hostname.length < 3) {
return false;
}
let start = hostname.startsWith("[") ? 1 : 0;
let end = hostname.length;
if (hostname[end - 1] === "]") {
end -= 1;
}
if (end - start > 39) {
return false;
}
let hasColon = false;
for (; start < end; start += 1) {
const code = hostname.charCodeAt(start);
if (code === 58) {
hasColon = true;
} else if (!(code >= 48 && code <= 57 || // 0-9
code >= 97 && code <= 102 || // a-f
code >= 65 && code <= 90)) {
return false;
}
}
return hasColon;
}
function isIp(hostname) {
return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
}
function isValidAscii(code) {
return code >= 97 && code <= 122 || code >= 48 && code <= 57 || code > 127;
}
function isValidHostname(hostname) {
if (hostname.length > 255) {
return false;
}
if (hostname.length === 0) {
return false;
}
if (
/*@__INLINE__*/
!isValidAscii(hostname.charCodeAt(0)) && hostname.charCodeAt(0) !== 46 && // '.' (dot)
hostname.charCodeAt(0) !== 95
) {
return false;
}
let lastDotIndex = -1;
let lastCharCode = -1;
const len = hostname.length;
for (let i = 0; i < len; i += 1) {
const code = hostname.charCodeAt(i);
if (code === 46) {
if (
// Check that previous label is < 63 bytes long (64 = 63 + '.')
i - lastDotIndex > 64 || // Check that previous character was not already a '.'
lastCharCode === 46 || // Check that the previous label does not end with a '-' (dash)
lastCharCode === 45 || // Check that the previous label does not end with a '_' (underscore)
lastCharCode === 95
) {
return false;
}
lastDotIndex = i;
} else if (!/*@__INLINE__*/
(isValidAscii(code) || code === 45 || code === 95)) {
return false;
}
lastCharCode = code;
}
return (
// Check that last label is shorter than 63 chars
len - lastDotIndex - 1 <= 63 && // Check that the last character is an allowed trailing label character.
// Since we already checked that the char is a valid hostname character,
// we only need to check that it's different from '-'.
lastCharCode !== 45
);
}
function setDefaultsImpl({ allowIcannDomains = true, allowPrivateDomains = false, detectIp = true, extractHostname: extractHostname2 = true, mixedInputs = true, validHosts = null, validateHostname = true }) {
return {
allowIcannDomains,
allowPrivateDomains,
detectIp,
extractHostname: extractHostname2,
mixedInputs,
validHosts,
validateHostname
};
}
var DEFAULT_OPTIONS = (
/*@__INLINE__*/
setDefaultsImpl({})
);
function setDefaults(options) {
if (options === void 0) {
return DEFAULT_OPTIONS;
}
return (
/*@__INLINE__*/
setDefaultsImpl(options)
);
}
function getSubdomain$1(hostname, domain) {
if (domain.length === hostname.length) {
return "";
}
return hostname.slice(0, -domain.length - 1);
}
function getEmptyResult() {
return {
domain: null,
domainWithoutSuffix: null,
hostname: null,
isIcann: null,
isIp: null,
isPrivate: null,
publicSuffix: null,
subdomain: null
};
}
function resetResult(result) {
result.domain = null;
result.domainWithoutSuffix = null;
result.hostname = null;
result.isIcann = null;
result.isIp = null;
result.isPrivate = null;
result.publicSuffix = null;
result.subdomain = null;
}
function parseImpl(url, step, suffixLookup2, partialOptions, result) {
const options = (
/*@__INLINE__*/
setDefaults(partialOptions)
);
if (typeof url !== "string") {
return result;
}
if (!options.extractHostname) {
result.hostname = url;
} else if (options.mixedInputs) {
result.hostname = extractHostname(url, isValidHostname(url));
} else {
result.hostname = extractHostname(url, false);
}
if (step === 0 || result.hostname === null) {
return result;
}
if (options.detectIp) {
result.isIp = isIp(result.hostname);
if (result.isIp) {
return result;
}
}
if (options.validateHostname && options.extractHostname && !isValidHostname(result.hostname)) {
result.hostname = null;
return result;
}
suffixLookup2(result.hostname, options, result);
if (step === 2 || result.publicSuffix === null) {
return result;
}
result.domain = getDomain$1(result.publicSuffix, result.hostname, options);
if (step === 3 || result.domain === null) {
return result;
}
result.subdomain = getSubdomain$1(result.hostname, result.domain);
if (step === 4) {
return result;
}
result.domainWithoutSuffix = getDomainWithoutSuffix$1(result.domain, result.publicSuffix);
return result;
}
function fastPathLookup(hostname, options, out) {
if (!options.allowPrivateDomains && hostname.length > 3) {
const last = hostname.length - 1;
const c3 = hostname.charCodeAt(last);
const c2 = hostname.charCodeAt(last - 1);
const c1 = hostname.charCodeAt(last - 2);
const c0 = hostname.charCodeAt(last - 3);
if (c3 === 109 && c2 === 111 && c1 === 99 && c0 === 46) {
out.isIcann = true;
out.isPrivate = false;
out.publicSuffix = "com";
return true;
} else if (c3 === 103 && c2 === 114 && c1 === 111 && c0 === 46) {
out.isIcann = true;
out.isPrivate = false;
out.publicSuffix = "org";
return true;
} else if (c3 === 117 && c2 === 100 && c1 === 101 && c0 === 46) {
out.isIcann = true;
out.isPrivate = false;
out.publicSuffix = "edu";
return true;
} else if (c3 === 118 && c2 === 111 && c1 === 103 && c0 === 46) {
out.isIcann = true;
out.isPrivate = false;
out.publicSuffix = "gov";
return true;
} else if (c3 === 116 && c2 === 101 && c1 === 110 && c0 === 46) {
out.isIcann = true;
out.isPrivate = false;
out.publicSuffix = "net";
return true;
} else if (c3 === 101 && c2 === 100 && c1 === 46) {
out.isIcann = true;
out.isPrivate = false;
out.publicSuffix = "de";
return true;
}
}
return false;
}
var exceptions = function() {
const _0 = [1, {}], _1 = [0, { "city": _0 }];
const exceptions2 = [0, { "ck": [0, { "www": _0 }], "jp": [0, { "kawasaki": _1, "kitakyushu": _1, "kobe": _1, "nagoya": _1, "sapporo": _1, "sendai": _1, "yokohama": _1 }] }];
return exceptions2;
}();
var rules = function() {
const _2 = [1, {}], _3 = [2, {}], _4 = [1, { "gov": _2, "com": _2, "org": _2, "net": _2, "edu": _2 }], _5 = [0, { "*": _3 }], _6 = [2, { "preview": _3 }], _7 = [0, { "relay": _3 }], _8 = [2, { "staging": _3 }], _9 = [2, { "id": _3 }], _10 = [1, { "blogspot": _3 }], _11 = [1, { "gov": _2 }], _12 = [0, { "notebook": _3, "studio": _3 }], _13 = [0, { "labeling": _3, "notebook"