we0-cms-supabase-api
Version:
A CMS API package for Next.js applications with Supabase and dynamic table management
4,576 lines (4,471 loc) • 1.37 MB
JavaScript
'use strict';
var require$$0$1 = require('stream');
var require$$1$1 = require('http');
var require$$2 = require('url');
var require$$0 = require('punycode');
var require$$4 = require('https');
var require$$5 = require('zlib');
var require$$0$3 = require('events');
var require$$3 = require('net');
var require$$4$1 = require('tls');
var require$$1$2 = require('crypto');
var require$$0$2 = require('buffer');
function _mergeNamespaces(n, m) {
m.forEach(function (e) {
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
});
return Object.freeze(n);
}
function asyncGeneratorStep(n, t, e, r, o, a, c) {
try {
var i = n[a](c),
u = i.value;
} catch (n) {
return void e(n);
}
i.done ? t(u) : Promise.resolve(u).then(r, o);
}
function _asyncToGenerator(n) {
return function () {
var t = this,
e = arguments;
return new Promise(function (r, o) {
var a = n.apply(t, e);
function _next(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
}
function _throw(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
}
_next(void 0);
});
};
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var regeneratorRuntime$1 = {exports: {}};
var OverloadYield = {exports: {}};
(function (module) {
function _OverloadYield(e, d) {
this.v = e, this.k = d;
}
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (OverloadYield));
var OverloadYieldExports = OverloadYield.exports;
var regenerator$1 = {exports: {}};
var regeneratorDefine = {exports: {}};
(function (module) {
function _regeneratorDefine(e, r, n, t) {
var i = Object.defineProperty;
try {
i({}, "", {});
} catch (e) {
i = 0;
}
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
function o(r, n) {
_regeneratorDefine(e, r, function (e) {
return this._invoke(r, n, e);
});
}
r ? i ? i(e, r, {
value: n,
enumerable: !t,
configurable: !t,
writable: !t
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
}
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorDefine));
var regeneratorDefineExports = regeneratorDefine.exports;
(function (module) {
var regeneratorDefine = regeneratorDefineExports;
function _regenerator() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,
t,
r = "function" == typeof Symbol ? Symbol : {},
n = r.iterator || "@@iterator",
o = r.toStringTag || "@@toStringTag";
function i(r, n, o, i) {
var c = n && n.prototype instanceof Generator ? n : Generator,
u = Object.create(c.prototype);
return regeneratorDefine(u, "_invoke", function (r, n, o) {
var i,
c,
u,
f = 0,
p = o || [],
y = !1,
G = {
p: 0,
n: 0,
v: e,
a: d,
f: d.bind(e, 4),
d: function d(t, r) {
return i = t, c = 0, u = e, G.n = r, a;
}
};
function d(r, n) {
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
var o,
i = p[t],
d = G.p,
l = i[2];
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
}
if (o || r > 1) return a;
throw y = !0, n;
}
return function (o, p, l) {
if (f > 1) throw TypeError("Generator is already running");
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
try {
if (f = 2, i) {
if (c || (o = "next"), t = i[o]) {
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
if (!t.done) return t;
u = t.value, c < 2 && (c = 0);
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
i = e;
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
} catch (t) {
i = e, c = 1, u = t;
} finally {
f = 1;
}
}
return {
value: t,
done: y
};
};
}(r, o, i), !0), u;
}
var a = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
t = Object.getPrototypeOf;
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
return this;
}), t),
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
function f(e) {
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function () {
return this;
}), regeneratorDefine(u, "toString", function () {
return "[object Generator]";
}), (module.exports = _regenerator = function _regenerator() {
return {
w: i,
m: f
};
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
}
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regenerator$1));
var regeneratorExports = regenerator$1.exports;
var regeneratorAsync = {exports: {}};
var regeneratorAsyncGen = {exports: {}};
var regeneratorAsyncIterator = {exports: {}};
(function (module) {
var OverloadYield = OverloadYieldExports;
var regeneratorDefine = regeneratorDefineExports;
function AsyncIterator(t, e) {
function n(r, o, i, f) {
try {
var c = t[r](o),
u = c.value;
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
n("next", t, i, f);
}, function (t) {
n("throw", t, i, f);
}) : e.resolve(u).then(function (t) {
c.value = t, i(c);
}, function (t) {
return n("throw", t, i, f);
});
} catch (t) {
f(t);
}
}
var r;
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
return this;
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
function f() {
return new e(function (e, r) {
n(t, i, e, r);
});
}
return r = r ? r.then(f, f) : f();
}, !0);
}
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorAsyncIterator));
var regeneratorAsyncIteratorExports = regeneratorAsyncIterator.exports;
(function (module) {
var regenerator = regeneratorExports;
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports;
function _regeneratorAsyncGen(r, e, t, o, n) {
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
}
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorAsyncGen));
var regeneratorAsyncGenExports = regeneratorAsyncGen.exports;
(function (module) {
var regeneratorAsyncGen = regeneratorAsyncGenExports;
function _regeneratorAsync(n, e, r, t, o) {
var a = regeneratorAsyncGen(n, e, r, t, o);
return a.next().then(function (n) {
return n.done ? n.value : a.next();
});
}
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorAsync));
var regeneratorAsyncExports = regeneratorAsync.exports;
var regeneratorKeys = {exports: {}};
(function (module) {
function _regeneratorKeys(e) {
var n = Object(e),
r = [];
for (var t in n) r.unshift(t);
return function e() {
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
return e.done = !0, e;
};
}
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorKeys));
var regeneratorKeysExports = regeneratorKeys.exports;
var regeneratorValues = {exports: {}};
var _typeof$1 = {exports: {}};
(function (module) {
function _typeof(o) {
"@babel/helpers - typeof";
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
}
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (_typeof$1));
var _typeofExports = _typeof$1.exports;
(function (module) {
var _typeof = _typeofExports["default"];
function _regeneratorValues(e) {
if (null != e) {
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
r = 0;
if (t) return t.call(e);
if ("function" == typeof e.next) return e;
if (!isNaN(e.length)) return {
next: function next() {
return e && r >= e.length && (e = void 0), {
value: e && e[r++],
done: !e
};
}
};
}
throw new TypeError(_typeof(e) + " is not iterable");
}
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorValues));
var regeneratorValuesExports = regeneratorValues.exports;
(function (module) {
var OverloadYield = OverloadYieldExports;
var regenerator = regeneratorExports;
var regeneratorAsync = regeneratorAsyncExports;
var regeneratorAsyncGen = regeneratorAsyncGenExports;
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports;
var regeneratorKeys = regeneratorKeysExports;
var regeneratorValues = regeneratorValuesExports;
function _regeneratorRuntime() {
var r = regenerator(),
e = r.m(_regeneratorRuntime),
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
function n(r) {
var e = "function" == typeof r && r.constructor;
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
}
var o = {
"throw": 1,
"return": 2,
"break": 3,
"continue": 3
};
function a(r) {
var e, t;
return function (n) {
e || (e = {
stop: function stop() {
return t(n.a, 2);
},
"catch": function _catch() {
return n.v;
},
abrupt: function abrupt(r, e) {
return t(n.a, o[r], e);
},
delegateYield: function delegateYield(r, o, a) {
return e.resultName = o, t(n.d, regeneratorValues(r), a);
},
finish: function finish(r) {
return t(n.f, r);
}
}, t = function t(r, _t, o) {
n.p = e.prev, n.n = e.next;
try {
return r(_t, o);
} finally {
e.next = n.n;
}
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
try {
return r.call(this, e);
} finally {
n.p = e.prev, n.n = e.next;
}
};
}
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
return {
wrap: function wrap(e, t, n, o) {
return r.w(a(e), t, n, o && o.reverse());
},
isGeneratorFunction: n,
mark: r.m,
awrap: function awrap(r, e) {
return new OverloadYield(r, e);
},
AsyncIterator: regeneratorAsyncIterator,
async: function async(r, e, t, o, u) {
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
},
keys: regeneratorKeys,
values: regeneratorValues
};
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
}
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
} (regeneratorRuntime$1));
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
// TODO(Babel 8): Remove this file.
var runtime = regeneratorRuntimeExports();
var regenerator = runtime;
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
if (typeof globalThis === "object") {
globalThis.regeneratorRuntime = runtime;
} else {
Function("r", "regeneratorRuntime = r")(runtime);
}
}
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
const resolveFetch$3 = (customFetch) => {
let _fetch;
if (customFetch) {
_fetch = customFetch;
}
else if (typeof fetch === 'undefined') {
_fetch = (...args) => Promise.resolve().then(function () { return index; }).then(({ default: fetch }) => fetch(...args));
}
else {
_fetch = fetch;
}
return (...args) => _fetch(...args);
};
class FunctionsError extends Error {
constructor(message, name = 'FunctionsError', context) {
super(message);
this.name = name;
this.context = context;
}
}
class FunctionsFetchError extends FunctionsError {
constructor(context) {
super('Failed to send a request to the Edge Function', 'FunctionsFetchError', context);
}
}
class FunctionsRelayError extends FunctionsError {
constructor(context) {
super('Relay Error invoking the Edge Function', 'FunctionsRelayError', context);
}
}
class FunctionsHttpError extends FunctionsError {
constructor(context) {
super('Edge Function returned a non-2xx status code', 'FunctionsHttpError', context);
}
}
// Define the enum for the 'region' property
var FunctionRegion;
(function (FunctionRegion) {
FunctionRegion["Any"] = "any";
FunctionRegion["ApNortheast1"] = "ap-northeast-1";
FunctionRegion["ApNortheast2"] = "ap-northeast-2";
FunctionRegion["ApSouth1"] = "ap-south-1";
FunctionRegion["ApSoutheast1"] = "ap-southeast-1";
FunctionRegion["ApSoutheast2"] = "ap-southeast-2";
FunctionRegion["CaCentral1"] = "ca-central-1";
FunctionRegion["EuCentral1"] = "eu-central-1";
FunctionRegion["EuWest1"] = "eu-west-1";
FunctionRegion["EuWest2"] = "eu-west-2";
FunctionRegion["EuWest3"] = "eu-west-3";
FunctionRegion["SaEast1"] = "sa-east-1";
FunctionRegion["UsEast1"] = "us-east-1";
FunctionRegion["UsWest1"] = "us-west-1";
FunctionRegion["UsWest2"] = "us-west-2";
})(FunctionRegion || (FunctionRegion = {}));
var __awaiter$7 = (globalThis && globalThis.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
class FunctionsClient {
constructor(url, { headers = {}, customFetch, region = FunctionRegion.Any, } = {}) {
this.url = url;
this.headers = headers;
this.region = region;
this.fetch = resolveFetch$3(customFetch);
}
/**
* Updates the authorization header
* @param token - the new jwt token sent in the authorisation header
*/
setAuth(token) {
this.headers.Authorization = `Bearer ${token}`;
}
/**
* Invokes a function
* @param functionName - The name of the Function to invoke.
* @param options - Options for invoking the Function.
*/
invoke(functionName, options = {}) {
var _a;
return __awaiter$7(this, void 0, void 0, function* () {
try {
const { headers, method, body: functionArgs } = options;
let _headers = {};
let { region } = options;
if (!region) {
region = this.region;
}
// Add region as query parameter using URL API
const url = new URL(`${this.url}/${functionName}`);
if (region && region !== 'any') {
_headers['x-region'] = region;
url.searchParams.set('forceFunctionRegion', region);
}
let body;
if (functionArgs &&
((headers && !Object.prototype.hasOwnProperty.call(headers, 'Content-Type')) || !headers)) {
if ((typeof Blob !== 'undefined' && functionArgs instanceof Blob) ||
functionArgs instanceof ArrayBuffer) {
// will work for File as File inherits Blob
// also works for ArrayBuffer as it is the same underlying structure as a Blob
_headers['Content-Type'] = 'application/octet-stream';
body = functionArgs;
}
else if (typeof functionArgs === 'string') {
// plain string
_headers['Content-Type'] = 'text/plain';
body = functionArgs;
}
else if (typeof FormData !== 'undefined' && functionArgs instanceof FormData) {
// don't set content-type headers
// Request will automatically add the right boundary value
body = functionArgs;
}
else {
// default, assume this is JSON
_headers['Content-Type'] = 'application/json';
body = JSON.stringify(functionArgs);
}
}
const response = yield this.fetch(url.toString(), {
method: method || 'POST',
// headers priority is (high to low):
// 1. invoke-level headers
// 2. client-level headers
// 3. default Content-Type header
headers: Object.assign(Object.assign(Object.assign({}, _headers), this.headers), headers),
body,
}).catch((fetchError) => {
throw new FunctionsFetchError(fetchError);
});
const isRelayError = response.headers.get('x-relay-error');
if (isRelayError && isRelayError === 'true') {
throw new FunctionsRelayError(response);
}
if (!response.ok) {
throw new FunctionsHttpError(response);
}
let responseType = ((_a = response.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'text/plain').split(';')[0].trim();
let data;
if (responseType === 'application/json') {
data = yield response.json();
}
else if (responseType === 'application/octet-stream') {
data = yield response.blob();
}
else if (responseType === 'text/event-stream') {
data = response;
}
else if (responseType === 'multipart/form-data') {
data = yield response.formData();
}
else {
// default to text
data = yield response.text();
}
return { data, error: null, response };
}
catch (error) {
return {
data: null,
error,
response: error instanceof FunctionsHttpError || error instanceof FunctionsRelayError
? error.context
: undefined,
};
}
});
}
}
var cjs = {};
var PostgrestClient$2 = {};
var PostgrestQueryBuilder$2 = {};
var PostgrestFilterBuilder$2 = {};
var PostgrestTransformBuilder$2 = {};
var PostgrestBuilder$2 = {};
var lib$1 = {exports: {}};
var publicApi = {};
var URL$2 = {exports: {}};
var conversions = {};
var lib = conversions;
function sign(x) {
return x < 0 ? -1 : 1;
}
function evenRound(x) {
// Round x to the nearest integer, choosing the even integer if it lies halfway between two.
if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor)
return Math.floor(x);
} else {
return Math.round(x);
}
}
function createNumberConversion(bitLength, typeOpts) {
if (!typeOpts.unsigned) {
--bitLength;
}
const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength);
const upperBound = Math.pow(2, bitLength) - 1;
const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength);
const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1);
return function(V, opts) {
if (!opts) opts = {};
let x = +V;
if (opts.enforceRange) {
if (!Number.isFinite(x)) {
throw new TypeError("Argument is not a finite number");
}
x = sign(x) * Math.floor(Math.abs(x));
if (x < lowerBound || x > upperBound) {
throw new TypeError("Argument is not in byte range");
}
return x;
}
if (!isNaN(x) && opts.clamp) {
x = evenRound(x);
if (x < lowerBound) x = lowerBound;
if (x > upperBound) x = upperBound;
return x;
}
if (!Number.isFinite(x) || x === 0) {
return 0;
}
x = sign(x) * Math.floor(Math.abs(x));
x = x % moduloVal;
if (!typeOpts.unsigned && x >= moduloBound) {
return x - moduloVal;
} else if (typeOpts.unsigned) {
if (x < 0) {
x += moduloVal;
} else if (x === -0) { // don't return negative zero
return 0;
}
}
return x;
}
}
conversions["void"] = function () {
return undefined;
};
conversions["boolean"] = function (val) {
return !!val;
};
conversions["byte"] = createNumberConversion(8, { unsigned: false });
conversions["octet"] = createNumberConversion(8, { unsigned: true });
conversions["short"] = createNumberConversion(16, { unsigned: false });
conversions["unsigned short"] = createNumberConversion(16, { unsigned: true });
conversions["long"] = createNumberConversion(32, { unsigned: false });
conversions["unsigned long"] = createNumberConversion(32, { unsigned: true });
conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 });
conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 });
conversions["double"] = function (V) {
const x = +V;
if (!Number.isFinite(x)) {
throw new TypeError("Argument is not a finite floating-point value");
}
return x;
};
conversions["unrestricted double"] = function (V) {
const x = +V;
if (isNaN(x)) {
throw new TypeError("Argument is NaN");
}
return x;
};
// not quite valid, but good enough for JS
conversions["float"] = conversions["double"];
conversions["unrestricted float"] = conversions["unrestricted double"];
conversions["DOMString"] = function (V, opts) {
if (!opts) opts = {};
if (opts.treatNullAsEmptyString && V === null) {
return "";
}
return String(V);
};
conversions["ByteString"] = function (V, opts) {
const x = String(V);
let c = undefined;
for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) {
if (c > 255) {
throw new TypeError("Argument is not a valid bytestring");
}
}
return x;
};
conversions["USVString"] = function (V) {
const S = String(V);
const n = S.length;
const U = [];
for (let i = 0; i < n; ++i) {
const c = S.charCodeAt(i);
if (c < 0xD800 || c > 0xDFFF) {
U.push(String.fromCodePoint(c));
} else if (0xDC00 <= c && c <= 0xDFFF) {
U.push(String.fromCodePoint(0xFFFD));
} else {
if (i === n - 1) {
U.push(String.fromCodePoint(0xFFFD));
} else {
const d = S.charCodeAt(i + 1);
if (0xDC00 <= d && d <= 0xDFFF) {
const a = c & 0x3FF;
const b = d & 0x3FF;
U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b));
++i;
} else {
U.push(String.fromCodePoint(0xFFFD));
}
}
}
}
return U.join('');
};
conversions["Date"] = function (V, opts) {
if (!(V instanceof Date)) {
throw new TypeError("Argument is not a Date object");
}
if (isNaN(V)) {
return undefined;
}
return V;
};
conversions["RegExp"] = function (V, opts) {
if (!(V instanceof RegExp)) {
V = new RegExp(V);
}
return V;
};
var utils$2 = {exports: {}};
(function (module) {
module.exports.mixin = function mixin(target, source) {
const keys = Object.getOwnPropertyNames(source);
for (let i = 0; i < keys.length; ++i) {
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
}
};
module.exports.wrapperSymbol = Symbol("wrapper");
module.exports.implSymbol = Symbol("impl");
module.exports.wrapperForImpl = function (impl) {
return impl[module.exports.wrapperSymbol];
};
module.exports.implForWrapper = function (wrapper) {
return wrapper[module.exports.implSymbol];
};
} (utils$2));
var utilsExports = utils$2.exports;
var URLImpl = {};
var urlStateMachine = {exports: {}};
var tr46 = {};
var require$$1 = [
[
[
0,
44
],
"disallowed_STD3_valid"
],
[
[
45,
46
],
"valid"
],
[
[
47,
47
],
"disallowed_STD3_valid"
],
[
[
48,
57
],
"valid"
],
[
[
58,
64
],
"disallowed_STD3_valid"
],
[
[
65,
65
],
"mapped",
[
97
]
],
[
[
66,
66
],
"mapped",
[
98
]
],
[
[
67,
67
],
"mapped",
[
99
]
],
[
[
68,
68
],
"mapped",
[
100
]
],
[
[
69,
69
],
"mapped",
[
101
]
],
[
[
70,
70
],
"mapped",
[
102
]
],
[
[
71,
71
],
"mapped",
[
103
]
],
[
[
72,
72
],
"mapped",
[
104
]
],
[
[
73,
73
],
"mapped",
[
105
]
],
[
[
74,
74
],
"mapped",
[
106
]
],
[
[
75,
75
],
"mapped",
[
107
]
],
[
[
76,
76
],
"mapped",
[
108
]
],
[
[
77,
77
],
"mapped",
[
109
]
],
[
[
78,
78
],
"mapped",
[
110
]
],
[
[
79,
79
],
"mapped",
[
111
]
],
[
[
80,
80
],
"mapped",
[
112
]
],
[
[
81,
81
],
"mapped",
[
113
]
],
[
[
82,
82
],
"mapped",
[
114
]
],
[
[
83,
83
],
"mapped",
[
115
]
],
[
[
84,
84
],
"mapped",
[
116
]
],
[
[
85,
85
],
"mapped",
[
117
]
],
[
[
86,
86
],
"mapped",
[
118
]
],
[
[
87,
87
],
"mapped",
[
119
]
],
[
[
88,
88
],
"mapped",
[
120
]
],
[
[
89,
89
],
"mapped",
[
121
]
],
[
[
90,
90
],
"mapped",
[
122
]
],
[
[
91,
96
],
"disallowed_STD3_valid"
],
[
[
97,
122
],
"valid"
],
[
[
123,
127
],
"disallowed_STD3_valid"
],
[
[
128,
159
],
"disallowed"
],
[
[
160,
160
],
"disallowed_STD3_mapped",
[
32
]
],
[
[
161,
167
],
"valid",
[
],
"NV8"
],
[
[
168,
168
],
"disallowed_STD3_mapped",
[
32,
776
]
],
[
[
169,
169
],
"valid",
[
],
"NV8"
],
[
[
170,
170
],
"mapped",
[
97
]
],
[
[
171,
172
],
"valid",
[
],
"NV8"
],
[
[
173,
173
],
"ignored"
],
[
[
174,
174
],
"valid",
[
],
"NV8"
],
[
[
175,
175
],
"disallowed_STD3_mapped",
[
32,
772
]
],
[
[
176,
177
],
"valid",
[
],
"NV8"
],
[
[
178,
178
],
"mapped",
[
50
]
],
[
[
179,
179
],
"mapped",
[
51
]
],
[
[
180,
180
],
"disallowed_STD3_mapped",
[
32,
769
]
],
[
[
181,
181
],
"mapped",
[
956
]
],
[
[
182,
182
],
"valid",
[
],
"NV8"
],
[
[
183,
183
],
"valid"
],
[
[
184,
184
],
"disallowed_STD3_mapped",
[
32,
807
]
],
[
[
185,
185
],
"mapped",
[
49
]
],
[
[
186,
186
],
"mapped",
[
111
]
],
[
[
187,
187
],
"valid",
[
],
"NV8"
],
[
[
188,
188
],
"mapped",
[
49,
8260,
52
]
],
[
[
189,
189
],
"mapped",
[
49,
8260,
50
]
],
[
[
190,
190
],
"mapped",
[
51,
8260,
52
]
],
[
[
191,
191
],
"valid",
[
],
"NV8"
],
[
[
192,
192
],
"mapped",
[
224
]
],
[
[
193,
193
],
"mapped",
[
225
]
],
[
[
194,
194
],
"mapped",
[
226
]
],
[
[
195,
195
],
"mapped",
[
227
]
],
[
[
196,
196
],
"mapped",
[
228
]
],
[
[
197,
197
],
"mapped",
[
229
]
],
[
[
198,
198
],
"mapped",
[
230
]
],
[
[
199,
199
],
"mapped",
[
231
]
],
[
[
200,
200
],
"mapped",
[
232
]
],
[
[
201,
201
],
"mapped",
[
233
]
],
[
[
202,
202
],
"mapped",
[
234
]
],
[
[
203,
203
],
"mapped",
[
235
]
],
[
[
204,
204
],
"mapped",
[
236
]
],
[
[
205,
205
],
"mapped",
[
237
]
],
[
[
206,
206
],
"mapped",
[
238
]
],
[
[
207,
207
],
"mapped",
[
239
]
],
[
[
208,
208
],
"mapped",
[
240
]
],
[
[
209,
209
],
"mapped",
[
241
]
],
[
[
210,
210
],
"mapped",
[
242
]
],
[
[
211,
211
],
"mapped",
[
243
]
],
[
[
212,
212
],
"mapped",
[
244
]
],
[
[
213,
213
],
"mapped",
[
245
]
],
[
[
214,
214
],
"mapped",
[
246
]
],
[
[
215,
215
],
"valid",
[
],
"NV8"
],
[
[
216,
216
],
"mapped",
[
248
]
],
[
[
217,
217
],
"mapped",
[
249
]
],
[
[
218,
218
],
"mapped",
[
250
]
],
[
[
219,
219
],
"mapped",
[
251
]
],
[
[
220,
220
],
"mapped",
[
252
]
],
[
[
221,
221
],
"mapped",
[
253
]
],
[
[
222,
222
],
"mapped",
[
254
]
],
[
[
223,
223
],
"deviation",
[
115,
115
]
],
[
[
224,
246
],
"valid"
],
[
[
247,
247
],
"valid",
[
],
"NV8"
],
[
[
248,
255
],
"valid"
],
[
[
256,
256
],
"mapped",
[
257
]
],
[
[
257,
257
],
"valid"
],
[
[
258,
258
],
"mapped",
[
259
]
],
[
[
259,
259
],
"valid"
],
[
[
260,
260
],
"mapped",
[
261
]
],
[
[
261,
261
],
"valid"
],
[
[
262,
262
],
"mapped",
[
263
]
],
[
[
263,
263
],
"valid"
],
[
[
264,
264
],
"mapped",
[
265
]
],
[
[
265,
265
],
"valid"
],
[
[
266,
266
],
"mapped",
[
267
]
],
[
[
267,
267
],
"valid"
],
[
[
268,
268
],
"mapped",
[
269
]
],
[
[
269,
269
],
"valid"
],
[
[
270,
270
],
"mapped",
[
271
]
],
[
[
271,
271
],
"valid"
],
[
[
272,
272
],
"mapped",
[
273
]
],
[
[
273,
273
],
"valid"
],
[
[
274,
274
],
"mapped",
[
275
]
],
[
[
275,
275
],
"valid"
],
[
[
276,
276
],
"mapped",
[
277
]
],
[
[
277,
277
],
"valid"
],
[
[
278,
278
],
"mapped",
[
279
]
],
[
[
279,
279
],
"valid"
],
[
[
280,
280
],
"mapped",
[
281
]
],
[
[
281,
281
],
"valid"
],
[
[
282,
282
],
"mapped",
[
283
]
],
[
[
283,
283
],
"valid"
],
[
[
284,
284
],
"mapped",
[
285
]
],
[
[
285,
285
],
"valid"
],
[
[
286,
286
],
"mapped",
[
287
]
],
[
[
287,
287
],
"valid"
],
[
[
288,
288
],
"mapped",
[
289
]
],
[
[
289,
289
],
"valid"
],
[
[
290,
290
],
"mapped",
[
291
]
],
[
[
291,
291
],
"valid"
],
[
[
292,
292
],
"mapped",
[
293
]
],
[
[
293,
293
],
"valid"
],
[
[
294,
294
],
"mapped",
[
295
]
],
[
[
295,
295
],
"valid"
],
[
[
296,
296
],
"mapped",
[
297
]
],
[
[
297,
297
],
"valid"
],
[
[
298,
298
],
"mapped",
[
299
]
],
[
[
299,
299
],
"valid"
],
[
[
300,
300
],
"mapped",
[
301
]
],
[
[
301,
301
],
"valid"
],
[
[
302,
302
],
"mapped",
[
303
]
],
[
[
303,
303
],
"valid"
],
[
[
304,
304
],
"mapped",
[
105,
775
]
],
[
[
305,
305
],
"valid"
],
[
[
306,
307
],
"mapped",
[
105,
106
]
],
[
[
308,
308
],
"mapped",
[
309
]
],
[
[
309,
309
],
"valid"
],
[
[
310,
310
],
"mapped",
[
311
]
],
[
[
311,
312
],
"valid"
],
[
[
313,
313
],
"mapped",
[
314
]
],
[
[
314,
314
],
"valid"
],
[
[
315,
315
],
"mapped",
[
316
]
],
[
[
316,
316
],
"valid"
],
[
[
317,
317
],
"mapped",
[
318
]
],
[
[
318,
318
],
"valid"
],
[
[
319,
320
],
"mapped",
[
108,
183
]
],
[
[
321,
321
],
"mapped",
[
322
]
],
[
[
322,
322
],
"valid"
],
[
[
323,
323
],
"mapped",
[
324
]
],
[
[
324,
324
],
"valid"
],
[
[
325,
325
],
"mapped",
[
326
]
],
[
[
326,
326
],
"valid"
],
[
[
327,
327
],
"mapped",
[
328
]
],
[
[
328,
328
],
"valid"
],
[
[
329,
329
],
"mapped",
[
700,
110
]
],
[
[
330,
330
],
"mapped",
[
331
]
],
[
[
331,
331
],
"valid"
],
[
[
332,
332
],
"mapped",
[
333
]
],
[
[
333,
333
],
"valid"
],
[
[
334,
334
],
"mapped",
[
335
]
],
[
[
335,
335
],
"valid"
],
[
[
336,
336
],
"mapped",
[
337
]
],
[
[
337,
337
],
"valid"
],
[
[
338,
338
],
"mapped",
[
339
]
],
[
[
339,
339
],
"valid"
],
[
[
340,
340
],
"mapped",
[
341
]
],
[
[
341,
341
],
"valid"
],
[
[
342,
342
],
"mapped",
[
343
]
],
[
[
343,
343
],
"valid"
],
[
[
344,
344
],
"mapped",
[
345
]
],
[
[
345,
345
],
"valid"
],
[
[
346,
346
],
"mapped",
[
347
]
],
[
[
347,
347
],
"valid"
],
[
[
348,
348
],
"mapped",
[
349
]
],
[
[
349,
349
],
"valid"
],
[
[
350,
350
],
"mapped",
[
351
]
],
[
[
351,
351
],
"valid"
],
[
[
352,
352
],
"mapped",
[
353
]
],
[
[
353,
353
],
"valid"
],
[
[
354,
354
],
"mapped",
[
355
]
],
[
[
355,
355
],
"valid"
],
[
[
356,
356
],
"mapped",
[
357
]
],
[
[
357,
357
],
"valid"
],
[
[
358,
358
],
"mapped",
[
359
]
],
[
[
359,
359
],
"valid"
],
[
[
360,
360
],
"mapped",
[
361
]
],
[
[
361,
361
],
"valid"
],
[
[
362,
362
],
"mapped",
[
363
]
],
[
[
363,
363
],
"valid"
],
[
[
364,
364
],
"mapped",
[
365
]
],
[
[
365,
365
],
"valid"
],
[
[
366,
366
],
"mapped",
[
367
]
],
[
[
367,
367
],
"valid"
],
[
[
368,
368
],
"mapped",
[
369
]
],
[
[
369,
369
],
"valid"
],
[
[
370,
370
],
"mapped",
[
371
]
],
[
[
371,
371
],
"valid"
],
[
[
372,
372
],
"mapped",
[
373
]
],
[
[
373,
373
],
"valid"
],
[
[
374,
374
],
"mapped",
[
375
]
],
[
[
375,
375
],
"valid"
],
[
[
376,
376
],
"mapped",
[
255
]
],
[
[
377,
377
],
"mapped",
[
378
]
],
[
[
378,
378
],
"valid"
],
[
[
379,
379
],
"mapped",
[
380
]
],
[
[
380,
380
],
"valid"
],
[
[
381,
381
],
"mapped",
[
382
]
],
[
[
382,
382
],
"valid"
],
[
[
383,
383
],
"mapped",
[
115
]
],
[
[
384,
384
],
"valid"
],
[
[
385,
385
],
"mapped",
[
595
]
],
[
[
386,
386
],
"mapped",
[
387
]
],
[
[
387,
387
],
"valid"
],
[
[
388,
388
],
"mapped",
[
389
]
],
[
[
389,
389
],
"valid"
],
[
[
390,
390
],
"mapped",
[
596
]
],
[
[
391,
391
],
"mapped",
[
392
]
],
[
[
392,
392
],
"valid"
],
[
[
393,
393
],
"mapped",
[
598
]
],
[
[
394,
394
],
"mapped",
[
599
]
],
[
[
395,
395
],
"mapped",
[
396
]
],
[
[
396,
397
],
"valid"
],
[
[
398,
398
],
"mapped",
[
477
]
],
[
[
399,
399
],
"mapped",
[
601
]
],
[
[
400,
400
],
"mapped",
[
603
]
],
[
[
401,
401
],
"mapped",
[
402
]
],
[
[
402,
402
],
"valid"
],
[
[
403,
403
],
"mapped",
[
608
]
],
[
[
404,
404
],
"mapped",
[
611
]
],
[
[
405,
405
],
"valid"
],
[
[
406,
406
],
"mapped",
[
617
]
],
[
[
407,
407
],
"mapped",
[
616
]
],
[
[
408,
408
],
"mapped",
[
409
]
],
[
[
409,
411
],
"valid"
],
[
[
412,
412
],
"mapped",
[
623
]
],
[
[
413,
413
],
"mapped",
[
626
]
],
[
[
414,
414
],
"valid"
],
[
[
415,
415
],
"mapped",
[
629
]
],
[
[
416,
416
],
"mapped",
[
417
]
],
[
[
417,
417
],
"valid"
],
[
[
418,
418
],
"mapped",
[
419
]
],
[
[
419,
419
],
"valid"
],
[
[
420,
420
],
"mapped",
[
421
]
],
[
[
421,
421
],
"valid"
],
[
[
422,
422
],
"mapped",
[
640
]
],
[
[
423,
423
],
"mapped",
[
424
]
],
[
[
424,
424
],
"valid"
],
[
[
425,
425
],
"mapped",
[
643
]
],
[
[
426,
427
],
"valid"
],
[
[
428,
428
],
"mapped",
[
429
]
],
[
[
429,
429
],
"valid"
],
[
[
430,
430
],
"mapped",
[
648
]
],
[
[
431,
431
],
"mapped",
[
432
]
],
[
[
432,
432
],
"valid"
],
[
[
433,
433
],
"mapped",
[
650
]
],
[
[
434,
434
],
"mapped",
[
651
]
],
[
[
435,
435
],
"mapped",
[
436
]
],
[
[
436,
436
],
"valid"
],
[
[
437,
437
],
"mapped",
[
438
]
],
[
[
438,
438
],
"valid"
],
[
[
439,
439
],
"mapped",
[
658
]
],
[
[
440,
440
],
"mapped",
[
441
]
],
[
[
441,
443
],
"valid"
],
[
[
444,
444
],
"mapped",
[
445
]
],
[
[
445,
451
],
"valid"
],
[
[
452,
454
],
"mapped",
[
100,
382
]
],
[
[
455,
457
],
"mapped",
[
108,
106
]
],
[
[
458,
460
],
"mapped",
[
110,
106
]
],
[
[
461,
461
],
"mapped",
[
462
]
],
[
[
462,
462
],
"valid"
],
[
[
463,
463
],
"mapped",
[
464
]
],
[
[
464,
464
],
"valid"
],
[
[
465,
465
],
"mapped",
[
466
]
],
[
[
466,
466
],
"valid"
],
[
[
467,
467
],
"mapped",
[
468
]
],
[
[
468,
468
],
"valid"
],
[
[
469,
469
],
"mapped",
[
470
]
],
[
[
470,
470
],
"valid"
],
[
[
471,
471
],
"mapped",
[
472
]
],
[
[
472,
472
],
"valid"
],
[
[
473,
473
],
"mapped",
[
474
]
],
[
[
474,
474
],
"valid"
],
[
[
475,
475
],
"mapped",
[
476
]
],
[
[
476,
477
],
"valid"
],
[
[
478,
478
],
"mapped",
[
479
]
],
[
[
479,
479
],
"valid"
],
[
[
480,
480
],
"mapped",
[
481
]
],
[
[
481,
481
],
"valid"
],
[
[
482,
482
],
"mapped",
[
483
]
],
[
[
483,
483
],
"valid"
],
[
[
484,
484
],
"mapped",
[
485
]
],
[
[
485,
485
],
"valid"
],
[
[
486,
486
],
"mapped",
[
487
]
],
[
[
487,
487
],
"valid"
],
[
[
488,
488
],
"mapped",
[
489
]
],
[
[
489,
489
],
"valid"
],
[
[
490,
490
],
"mapped",
[
491
]
],
[
[
491,
491
],
"valid"
],
[
[
492,
492
],
"mapped",
[
493
]
],
[
[
493,
493
],
"valid"
],
[
[
494,
494
],
"mapped",
[
495
]
],
[
[
495,
496
],
"valid"
],
[
[
497,
499
],
"mapped",
[
100,
122
]
],
[
[
500,
500
],
"mapped",
[
501
]
],
[
[
501,
501
],
"valid"
],
[
[
502,
502
],
"mapped",
[
405
]
],
[
[
503,
503
],
"mapped",
[
447
]
],
[
[
504,
504
],
"mapped",
[
505
]
],
[
[
505,
505
],
"valid"
],
[
[
506,
506
],
"mapped",
[
507
]
],
[
[
507,
507
],
"valid"
],
[
[
508,
508
],
"mapped",
[
509
]
],
[
[
509,
509
],
"valid"
],
[
[
510,
510
],
"mapped",
[
511
]
],
[
[
511,
511
],
"valid"
],
[
[
512,
512
],
"mapped",
[
513
]
],
[
[
513,
513
],
"valid"
],
[
[
514,
514
],
"mapped",
[
515
]
],
[
[
515,
515
],
"valid"
],
[
[
516,
516
],
"mapped",
[
517
]
],
[
[
517,
517
],
"valid"
],
[
[
518,
518
],
"mapped",
[
519
]
],
[
[
519,
519
],
"valid"
],
[
[
520,
520
],
"mapped",
[
521
]
],
[
[
521,
521
],
"valid"
],
[
[
522,
522
],
"mapped",
[
523
]
],
[
[
523,
523
],
"valid"
],
[
[
524,
524
],
"mapped",
[
525
]
],
[
[
525,
525
],
"valid"
],
[
[
526,
526
],
"mapped",
[
527
]
],
[
[
527,
527
],
"valid"
],
[
[
528,
528
],
"mapped",
[
529
]
],
[
[
529,
529
],
"valid"
],
[
[
530,
530
],
"mapped",
[
531
]
],
[
[
531,
531
],
"valid"
],
[
[
532,
532
],
"mapped",
[
533
]
],
[
[
533,
533
],
"valid"
],
[
[
534,
534
],
"mapped",
[
535
]
],
[
[
535,
535
],
"valid"
],
[
[
536,
536
],
"mapped",
[
537
]
],
[
[
537,
537
],
"valid"
],
[
[
538,
538
],
"mapped",
[
539
]
],
[
[
539,
539
],
"valid"
],
[
[
540,
540
],
"mapped",
[
541
]
],
[
[
541,
541
],
"valid"
],
[
[
542,
542
],
"mapped",
[
543
]
],
[
[
543,
543
],
"valid"
],
[
[
544,
544
],
"mapped",
[
414
]
],
[
[
545,
545
],
"valid"
],
[
[
546,
546
],
"mapped",
[
547
]
],
[
[
547,
547
],
"valid"
],
[
[
548,
548
],
"mapped",
[
549
]
],
[
[
549,
549
],
"valid"
],
[
[
550,
550
],
"mapped",
[
551
]
],
[
[
551,
551
],
"valid"
],
[
[
552,
552
],
"mapped",
[
553
]
],
[
[
553,
553
],
"valid"
],
[
[
554,
554
],
"mapped",
[
555
]
],
[
[
555,
555
],
"valid"
],
[
[
556,
556
],
"mapped",
[
557
]
],
[
[
557,
557
],
"valid"
],
[
[
558,
558
],
"mapped",
[
559
]
],
[
[
559,
559
],
"valid"
],
[
[
560,
560
],
"mapped",
[
561
]
],
[
[
561,
561
],
"valid"
],
[
[
562,
562
],
"mapped",
[
563
]
],
[
[
563,
563
],
"valid"
],
[
[
564,
566
],
"valid"
],
[
[
567,
569
],
"valid"
],
[
[
570,
570
],
"mapped",
[
11365
]
],
[
[
571,
571
],
"mapped",
[
572
]
],
[
[
572,
572
],
"valid"
],
[
[
573,
573
],
"mapped",
[
410
]
],
[
[
574,
574
],
"mapped",
[
11366
]
],
[
[
575,
576
],
"valid"
],
[
[
577,
577
],
"mapped",
[
578
]
],
[
[
578,
578
],
"valid"
],
[
[
579,
579
],
"mapped",
[
384
]
],
[
[
580,
580
],
"mapped",
[
649
]
],
[
[
581,
581
],
"mapped",
[
652
]
],
[
[
582,
582
],
"mapped",
[
583
]
],
[
[
583,
583
],
"valid"
],
[
[
584,
584
],
"mapped",
[
585
]
],
[
[
585,
585
],
"valid"
],
[
[
586,
586
],
"mapped",
[
587
]
],
[
[
587,
587
],
"valid"
],
[
[
588,
588
],
"mapped",
[
589
]
],
[
[
589,
589
],
"valid"
],
[
[
590,
590
],
"mapped",
[
591
]
],
[
[
591,
591
],
"valid"
],
[
[
592,
680
],
"valid"
],
[
[
681,
685
],
"valid"
],
[
[
686,
687
],
"valid"
],
[
[
688,
688
],
"mapped",
[
104
]
],
[
[
689,
689
],
"mapped",
[
614
]
],
[
[
690,
690
],
"mapped",
[
106
]
],
[
[
691,
691
],
"mapped",
[
114
]
],
[
[
692,
692
],
"mapped",
[
633
]
],
[
[
693,
693
],
"mapped",
[
635
]
],
[
[
694,
694
],
"mapped",
[
641
]
],
[
[
695,
695
],
"mapped",
[
119
]
],
[
[
696,
696
],
"mapped",
[
121
]
],
[
[
697,
705
],
"valid"
],
[
[
706,
709
],
"valid",
[
],
"NV8"
],
[
[
710,
721
],
"valid"
],
[
[
722,
727
],
"valid",
[
],
"NV8"
],
[
[
728,
728
],
"disallowed_STD3_mapped",
[
32,
774
]
],
[
[
729,
729
],
"disallowed_STD3_mapped",
[
32,
775
]
],
[