diff --git a/public/libs/zhi-publisher-sdk/index.js b/public/libs/zhi-publisher-sdk/index.js
index 78bc84a9..26dd2ca3 100644
--- a/public/libs/zhi-publisher-sdk/index.js
+++ b/public/libs/zhi-publisher-sdk/index.js
@@ -1,12 +1,12 @@
var r = Object.defineProperty;
-var g = (i, t, s) => t in i ? r(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
-var n = (i, t, s) => (g(i, typeof t != "symbol" ? t + "" : t, s), s);
-(function(i, t) {
- !i || i.getElementById("livereloadscript") || (t = i.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35730/livereload.js?snipver=1", t.id = "livereloadscript", i.getElementsByTagName("head")[0].appendChild(t));
+var g = (n, t, s) => t in n ? r(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s;
+var i = (n, t, s) => (g(n, typeof t != "symbol" ? t + "" : t, s), s);
+(function(n, t) {
+ !n || n.getElementById("livereloadscript") || (t = n.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35729/livereload.js?snipver=1", t.id = "livereloadscript", n.getElementsByTagName("head")[0].appendChild(t));
})(self.document);
class a {
static init(t) {
- this.Env = t.Env, this.BlogConstants = t.BlogConstants, this.BlogTypeEnum = t.BlogTypeEnum, this.SiyuanConstants = t.SiyuanConstants, this.SiyuanConfig = t.SiyuanConfig, this.SiYuanApiAdaptor = t.SiYuanApiAdaptor, this.BlogApi = t.BlogApi;
+ this.appInstance = t.appInstance, this.Env = t.Env, this.BlogConstants = t.BlogConstants, this.BlogTypeEnum = t.BlogTypeEnum, this.SiyuanConstants = t.SiyuanConstants, this.SiyuanConfig = t.SiyuanConfig, this.SiYuanApiAdaptor = t.SiYuanApiAdaptor, this.BlogApi = t.BlogApi;
}
/**
* 获取 siyuan-kernel-api 实例
@@ -23,10 +23,10 @@ class a {
break;
default: {
if (t instanceof this.Env) {
- const p = t.getEnvOrDefault(this.SiyuanConstants.VITE_SIYUAN_API_URL_KEY, "http://127.0.0.1:6806"), c = t.getStringEnv(this.SiyuanConstants.VITE_SIYUAN_AUTH_TOKEN_KEY), l = new this.SiyuanConfig(p, c);
- l.fixTitle = !0, e = new this.SiYuanApiAdaptor(l);
+ const c = t.getEnvOrDefault(this.SiyuanConstants.VITE_SIYUAN_API_URL_KEY, "http://127.0.0.1:6806"), l = t.getStringEnv(this.SiyuanConstants.VITE_SIYUAN_AUTH_TOKEN_KEY), p = new this.SiyuanConfig(c, l);
+ p.fixTitle = !0, e = new this.SiYuanApiAdaptor(p);
} else
- e = new this.SiYuanApiAdaptor(s);
+ e = new this.SiYuanApiAdaptor(s), e.init(this.appInstance);
break;
}
}
@@ -41,7 +41,7 @@ class a {
* BlogApi
* @private
*/
-n(a, "bApi"), n(a, "Env"), n(a, "BlogConstants"), n(a, "BlogTypeEnum"), n(a, "SiyuanConstants"), n(a, "SiyuanConfig"), n(a, "SiYuanApiAdaptor"), n(a, "BlogApi");
+i(a, "appInstance"), i(a, "bApi"), i(a, "Env"), i(a, "BlogConstants"), i(a, "BlogTypeEnum"), i(a, "SiyuanConstants"), i(a, "SiyuanConfig"), i(a, "SiYuanApiAdaptor"), i(a, "BlogApi");
export {
a as PublishSdk
};
diff --git a/public/libs/zhi-publisher-sdk/publish-sdk.d.ts b/public/libs/zhi-publisher-sdk/publish-sdk.d.ts
index a027dfe3..524653dd 100644
--- a/public/libs/zhi-publisher-sdk/publish-sdk.d.ts
+++ b/public/libs/zhi-publisher-sdk/publish-sdk.d.ts
@@ -10,6 +10,7 @@ declare class PublishSdk {
* BlogApi
* @private
*/
+ private static appInstance;
private static bApi;
private static Env;
private static BlogConstants;
@@ -19,6 +20,7 @@ declare class PublishSdk {
private static SiYuanApiAdaptor;
private static BlogApi;
static init(options: {
+ appInstance: any;
Env: any;
BlogConstants: any;
BlogTypeEnum: any;
diff --git a/public/libs/zhi-siyuan-api/index.js b/public/libs/zhi-siyuan-api/index.js
index 079c2d41..72d4eefb 100644
--- a/public/libs/zhi-siyuan-api/index.js
+++ b/public/libs/zhi-siyuan-api/index.js
@@ -1,37 +1,41 @@
-var Nu = Object.defineProperty;
-var Lu = (e, t, a) => t in e ? Nu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
-var Ke = (e, t, a) => (Lu(e, typeof t != "symbol" ? t + "" : t, a), a);
-var Ru = Object.defineProperty, Iu = (e, t, a) => t in e ? Ru(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, ye = (e, t, a) => (Iu(e, typeof t != "symbol" ? t + "" : t, a), a), Lc = /* @__PURE__ */ ((e) => (e[e.PasswordType_Password = 0] = "PasswordType_Password", e[e.PasswordType_Token = 1] = "PasswordType_Token", e))(Lc || {});
-let Au = class {
+var bs = Object.defineProperty;
+var ys = (e, t, r) => t in e ? bs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
+var $e = (e, t, r) => (ys(e, typeof t != "symbol" ? t + "" : t, r), r);
+(function(e, t) {
+ !e || e.getElementById("livereloadscript") || (t = e.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35729/livereload.js?snipver=1", t.id = "livereloadscript", e.getElementsByTagName("head")[0].appendChild(t));
+})(self.document);
+var _s = Object.defineProperty, ws = (e, t, r) => t in e ? _s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, oe = (e, t, r) => (ws(e, typeof t != "symbol" ? t + "" : t, r), r), ao = /* @__PURE__ */ ((e) => (e[e.PasswordType_Password = 0] = "PasswordType_Password", e[e.PasswordType_Token = 1] = "PasswordType_Token", e))(ao || {});
+class vs {
constructor() {
- ye(this, "home"), ye(this, "apiUrl"), ye(this, "username"), ye(this, "passwordType"), ye(this, "password"), ye(this, "apiStatus"), ye(this, "blogName"), ye(this, "posidKey"), ye(this, "previewUrl"), ye(this, "pageType"), ye(this, "placeholder"), ye(this, "fixTitle"), this.home = "", this.apiUrl = "", this.username = "", this.passwordType = 0, this.password = "", this.apiStatus = !1, this.blogName = "", this.posidKey = "", this.previewUrl = "", this.pageType = 0, this.placeholder = void 0, this.fixTitle = !1;
+ oe(this, "home"), oe(this, "apiUrl"), oe(this, "username"), oe(this, "passwordType"), oe(this, "password"), oe(this, "apiStatus"), oe(this, "blogName"), oe(this, "posidKey"), oe(this, "previewUrl"), oe(this, "pageType"), oe(this, "placeholder"), oe(this, "fixTitle"), this.home = "", this.apiUrl = "", this.username = "", this.passwordType = 0, this.password = "", this.apiStatus = !1, this.blogName = "", this.posidKey = "", this.previewUrl = "", this.pageType = 0, this.placeholder = void 0, this.fixTitle = !1;
}
-}, Mu = class {
+}
+class ks {
constructor() {
- ye(this, "homePlaceholder"), ye(this, "apiUrlPlaceholder"), ye(this, "usernamePlaceholder"), ye(this, "passwordTypePlaceholder"), ye(this, "passwordPlaceholder"), ye(this, "apiStatusPlaceholder"), ye(this, "blogNamePlaceholder"), ye(this, "posidKeyPlaceholder"), ye(this, "previewUrlPlaceholder"), ye(this, "pageTypePlaceholder"), this.homePlaceholder = "", this.apiUrlPlaceholder = "", this.usernamePlaceholder = "", this.passwordTypePlaceholder = "", this.passwordPlaceholder = "", this.apiStatusPlaceholder = !1, this.blogNamePlaceholder = "", this.posidKeyPlaceholder = "", this.previewUrlPlaceholder = "", this.pageTypePlaceholder = "";
+ oe(this, "homePlaceholder"), oe(this, "apiUrlPlaceholder"), oe(this, "usernamePlaceholder"), oe(this, "passwordTypePlaceholder"), oe(this, "passwordPlaceholder"), oe(this, "apiStatusPlaceholder"), oe(this, "blogNamePlaceholder"), oe(this, "posidKeyPlaceholder"), oe(this, "previewUrlPlaceholder"), oe(this, "pageTypePlaceholder"), this.homePlaceholder = "", this.apiUrlPlaceholder = "", this.usernamePlaceholder = "", this.passwordTypePlaceholder = "", this.passwordPlaceholder = "", this.apiStatusPlaceholder = !1, this.blogNamePlaceholder = "", this.posidKeyPlaceholder = "", this.previewUrlPlaceholder = "", this.pageTypePlaceholder = "";
}
-};
-var Sn = /* @__PURE__ */ ((e) => (e.PostStatusEnum_Publish = "publish", e.PostStatusEnum_Draft = "draft", e.PostStatusEnum_Inherit = "inherit", e))(Sn || {});
-let gi = class {
+}
+var Br = /* @__PURE__ */ ((e) => (e.PostStatusEnum_Publish = "publish", e.PostStatusEnum_Draft = "draft", e.PostStatusEnum_Inherit = "inherit", e))(Br || {});
+class _n {
constructor() {
- ye(this, "postid"), ye(this, "title"), ye(this, "mt_keywords"), ye(this, "link"), ye(this, "permalink"), ye(this, "shortDesc"), ye(this, "description"), ye(this, "mt_excerpt"), ye(this, "wp_slug"), ye(this, "dateCreated"), ye(this, "categories"), ye(this, "mt_text_more"), ye(this, "post_status"), ye(this, "isPublished"), ye(this, "wp_password"), this.postid = "", this.title = "", this.mt_keywords = "", this.permalink = "", this.description = "", this.wp_slug = "", this.dateCreated = /* @__PURE__ */ new Date(), this.categories = [], this.isPublished = !0, this.post_status = Sn.PostStatusEnum_Publish, this.wp_password = "";
+ oe(this, "postid"), oe(this, "title"), oe(this, "mt_keywords"), oe(this, "link"), oe(this, "permalink"), oe(this, "shortDesc"), oe(this, "description"), oe(this, "mt_excerpt"), oe(this, "wp_slug"), oe(this, "dateCreated"), oe(this, "categories"), oe(this, "mt_text_more"), oe(this, "post_status"), oe(this, "isPublished"), oe(this, "wp_password"), this.postid = "", this.title = "", this.mt_keywords = "", this.permalink = "", this.description = "", this.wp_slug = "", this.dateCreated = /* @__PURE__ */ new Date(), this.categories = [], this.isPublished = !0, this.post_status = Br.PostStatusEnum_Publish, this.wp_password = "";
}
-};
-var Du = Object.defineProperty, zu = (e, t, a) => t in e ? Du(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Ye = (e, t, a) => (zu(e, typeof t != "symbol" ? t + "" : t, a), a), Rc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
-function Ic(e) {
+}
+var Es = Object.defineProperty, $s = (e, t, r) => t in e ? Es(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Te = (e, t, r) => ($s(e, typeof t != "symbol" ? t + "" : t, r), r), no = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
+function oo(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
-var vo = { exports: {} }, Ac = {}, er = {}, sa = {}, Ka = {}, we = {}, qa = {};
+var la = { exports: {} }, so = {}, rt = {}, Ht = {}, br = {}, ie = {}, fr = {};
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0;
class t {
}
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
- class a extends t {
- constructor(j) {
- if (super(), !e.IDENTIFIER.test(j))
+ class r extends t {
+ constructor(T) {
+ if (super(), !e.IDENTIFIER.test(T))
throw new Error("CodeGen: name must be a valid identifier");
- this.str = j;
+ this.str = T;
}
toString() {
return this.str;
@@ -43,10 +47,10 @@ var vo = { exports: {} }, Ac = {}, er = {}, sa = {}, Ka = {}, we = {}, qa = {};
return { [this.str]: 1 };
}
}
- e.Name = a;
- class n extends t {
- constructor(j) {
- super(), this._items = typeof j == "string" ? [j] : j;
+ e.Name = r;
+ class a extends t {
+ constructor(T) {
+ super(), this._items = typeof T == "string" ? [T] : T;
}
toString() {
return this.str;
@@ -54,114 +58,114 @@ var vo = { exports: {} }, Ac = {}, er = {}, sa = {}, Ka = {}, we = {}, qa = {};
emptyStr() {
if (this._items.length > 1)
return !1;
- const j = this._items[0];
- return j === "" || j === '""';
+ const T = this._items[0];
+ return T === "" || T === '""';
}
get str() {
- var j;
- return (j = this._str) !== null && j !== void 0 ? j : this._str = this._items.reduce((I, r) => `${I}${r}`, "");
+ var T;
+ return (T = this._str) !== null && T !== void 0 ? T : this._str = this._items.reduce((R, n) => `${R}${n}`, "");
}
get names() {
- var j;
- return (j = this._names) !== null && j !== void 0 ? j : this._names = this._items.reduce((I, r) => (r instanceof a && (I[r.str] = (I[r.str] || 0) + 1), I), {});
+ var T;
+ return (T = this._names) !== null && T !== void 0 ? T : this._names = this._items.reduce((R, n) => (n instanceof r && (R[n.str] = (R[n.str] || 0) + 1), R), {});
}
}
- e._Code = n, e.nil = new n("");
- function s(v, ...j) {
- const I = [v[0]];
- let r = 0;
- for (; r < j.length; )
- b(I, j[r]), I.push(v[++r]);
- return new n(I);
+ e._Code = a, e.nil = new a("");
+ function s(v, ...T) {
+ const R = [v[0]];
+ let n = 0;
+ for (; n < T.length; )
+ b(R, T[n]), R.push(v[++n]);
+ return new a(R);
}
e._ = s;
- const c = new n("+");
- function p(v, ...j) {
- const I = [A(v[0])];
- let r = 0;
- for (; r < j.length; )
- I.push(c), b(I, j[r]), I.push(c, A(v[++r]));
- return _(I), new n(I);
- }
- e.str = p;
- function b(v, j) {
- j instanceof n ? v.push(...j._items) : j instanceof a ? v.push(j) : v.push(S(j));
+ const l = new a("+");
+ function d(v, ...T) {
+ const R = [A(v[0])];
+ let n = 0;
+ for (; n < T.length; )
+ R.push(l), b(R, T[n]), R.push(l, A(v[++n]));
+ return _(R), new a(R);
+ }
+ e.str = d;
+ function b(v, T) {
+ T instanceof a ? v.push(...T._items) : T instanceof r ? v.push(T) : v.push(k(T));
}
e.addCodeArg = b;
function _(v) {
- let j = 1;
- for (; j < v.length - 1; ) {
- if (v[j] === c) {
- const I = y(v[j - 1], v[j + 1]);
- if (I !== void 0) {
- v.splice(j - 1, 3, I);
+ let T = 1;
+ for (; T < v.length - 1; ) {
+ if (v[T] === l) {
+ const R = y(v[T - 1], v[T + 1]);
+ if (R !== void 0) {
+ v.splice(T - 1, 3, R);
continue;
}
- v[j++] = "+";
+ v[T++] = "+";
}
- j++;
+ T++;
}
}
- function y(v, j) {
- if (j === '""')
+ function y(v, T) {
+ if (T === '""')
return v;
if (v === '""')
- return j;
+ return T;
if (typeof v == "string")
- return j instanceof a || v[v.length - 1] !== '"' ? void 0 : typeof j != "string" ? `${v.slice(0, -1)}${j}"` : j[0] === '"' ? v.slice(0, -1) + j.slice(1) : void 0;
- if (typeof j == "string" && j[0] === '"' && !(v instanceof a))
- return `"${v}${j.slice(1)}`;
+ return T instanceof r || v[v.length - 1] !== '"' ? void 0 : typeof T != "string" ? `${v.slice(0, -1)}${T}"` : T[0] === '"' ? v.slice(0, -1) + T.slice(1) : void 0;
+ if (typeof T == "string" && T[0] === '"' && !(v instanceof r))
+ return `"${v}${T.slice(1)}`;
}
- function g(v, j) {
- return j.emptyStr() ? v : v.emptyStr() ? j : p`${v}${j}`;
+ function m(v, T) {
+ return T.emptyStr() ? v : v.emptyStr() ? T : d`${v}${T}`;
}
- e.strConcat = g;
- function S(v) {
+ e.strConcat = m;
+ function k(v) {
return typeof v == "number" || typeof v == "boolean" || v === null ? v : A(Array.isArray(v) ? v.join(",") : v);
}
- function L(v) {
- return new n(A(v));
+ function N(v) {
+ return new a(A(v));
}
- e.stringify = L;
+ e.stringify = N;
function A(v) {
return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
}
e.safeStringify = A;
- function N(v) {
- return typeof v == "string" && e.IDENTIFIER.test(v) ? new n(`.${v}`) : s`[${v}]`;
+ function j(v) {
+ return typeof v == "string" && e.IDENTIFIER.test(v) ? new a(`.${v}`) : s`[${v}]`;
}
- e.getProperty = N;
+ e.getProperty = j;
function C(v) {
if (typeof v == "string" && e.IDENTIFIER.test(v))
- return new n(`${v}`);
+ return new a(`${v}`);
throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`);
}
e.getEsmExportName = C;
- function T(v) {
- return new n(v.toString());
+ function x(v) {
+ return new a(v.toString());
}
- e.regexpCode = T;
-})(qa);
-var $o = {};
+ e.regexpCode = x;
+})(fr);
+var ca = {};
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0;
- const t = qa;
- class a extends Error {
+ const t = fr;
+ class r extends Error {
constructor(y) {
super(`CodeGen: "code" for ${y} not defined`), this.value = y.value;
}
}
- var n;
+ var a;
(function(_) {
_[_.Started = 0] = "Started", _[_.Completed = 1] = "Completed";
- })(n = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = {
+ })(a = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = {
const: new t.Name("const"),
let: new t.Name("let"),
var: new t.Name("var")
};
class s {
- constructor({ prefixes: y, parent: g } = {}) {
- this._names = {}, this._prefixes = y, this._parent = g;
+ constructor({ prefixes: y, parent: m } = {}) {
+ this._names = {}, this._prefixes = y, this._parent = m;
}
toName(y) {
return y instanceof t.Name ? y : this.name(y);
@@ -170,121 +174,121 @@ var $o = {};
return new t.Name(this._newName(y));
}
_newName(y) {
- const g = this._names[y] || this._nameGroup(y);
- return `${y}${g.index++}`;
+ const m = this._names[y] || this._nameGroup(y);
+ return `${y}${m.index++}`;
}
_nameGroup(y) {
- var g, S;
- if (!((S = (g = this._parent) === null || g === void 0 ? void 0 : g._prefixes) === null || S === void 0) && S.has(y) || this._prefixes && !this._prefixes.has(y))
+ var m, k;
+ if (!((k = (m = this._parent) === null || m === void 0 ? void 0 : m._prefixes) === null || k === void 0) && k.has(y) || this._prefixes && !this._prefixes.has(y))
throw new Error(`CodeGen: prefix "${y}" is not allowed in this scope`);
return this._names[y] = { prefix: y, index: 0 };
}
}
e.Scope = s;
- class c extends t.Name {
- constructor(y, g) {
- super(g), this.prefix = y;
+ class l extends t.Name {
+ constructor(y, m) {
+ super(m), this.prefix = y;
}
- setValue(y, { property: g, itemIndex: S }) {
- this.value = y, this.scopePath = (0, t._)`.${new t.Name(g)}[${S}]`;
+ setValue(y, { property: m, itemIndex: k }) {
+ this.value = y, this.scopePath = (0, t._)`.${new t.Name(m)}[${k}]`;
}
}
- e.ValueScopeName = c;
- const p = (0, t._)`\n`;
+ e.ValueScopeName = l;
+ const d = (0, t._)`\n`;
class b extends s {
constructor(y) {
- super(y), this._values = {}, this._scope = y.scope, this.opts = { ...y, _n: y.lines ? p : t.nil };
+ super(y), this._values = {}, this._scope = y.scope, this.opts = { ...y, _n: y.lines ? d : t.nil };
}
get() {
return this._scope;
}
name(y) {
- return new c(y, this._newName(y));
+ return new l(y, this._newName(y));
}
- value(y, g) {
- var S;
- if (g.ref === void 0)
+ value(y, m) {
+ var k;
+ if (m.ref === void 0)
throw new Error("CodeGen: ref must be passed in value");
- const L = this.toName(y), { prefix: A } = L, N = (S = g.key) !== null && S !== void 0 ? S : g.ref;
+ const N = this.toName(y), { prefix: A } = N, j = (k = m.key) !== null && k !== void 0 ? k : m.ref;
let C = this._values[A];
if (C) {
- const j = C.get(N);
- if (j)
- return j;
+ const T = C.get(j);
+ if (T)
+ return T;
} else
C = this._values[A] = /* @__PURE__ */ new Map();
- C.set(N, L);
- const T = this._scope[A] || (this._scope[A] = []), v = T.length;
- return T[v] = g.ref, L.setValue(g, { property: A, itemIndex: v }), L;
- }
- getValue(y, g) {
- const S = this._values[y];
- if (S)
- return S.get(g);
- }
- scopeRefs(y, g = this._values) {
- return this._reduceValues(g, (S) => {
- if (S.scopePath === void 0)
- throw new Error(`CodeGen: name "${S}" has no value`);
- return (0, t._)`${y}${S.scopePath}`;
+ C.set(j, N);
+ const x = this._scope[A] || (this._scope[A] = []), v = x.length;
+ return x[v] = m.ref, N.setValue(m, { property: A, itemIndex: v }), N;
+ }
+ getValue(y, m) {
+ const k = this._values[y];
+ if (k)
+ return k.get(m);
+ }
+ scopeRefs(y, m = this._values) {
+ return this._reduceValues(m, (k) => {
+ if (k.scopePath === void 0)
+ throw new Error(`CodeGen: name "${k}" has no value`);
+ return (0, t._)`${y}${k.scopePath}`;
});
}
- scopeCode(y = this._values, g, S) {
- return this._reduceValues(y, (L) => {
- if (L.value === void 0)
- throw new Error(`CodeGen: name "${L}" has no value`);
- return L.value.code;
- }, g, S);
+ scopeCode(y = this._values, m, k) {
+ return this._reduceValues(y, (N) => {
+ if (N.value === void 0)
+ throw new Error(`CodeGen: name "${N}" has no value`);
+ return N.value.code;
+ }, m, k);
}
- _reduceValues(y, g, S = {}, L) {
+ _reduceValues(y, m, k = {}, N) {
let A = t.nil;
- for (const N in y) {
- const C = y[N];
+ for (const j in y) {
+ const C = y[j];
if (!C)
continue;
- const T = S[N] = S[N] || /* @__PURE__ */ new Map();
+ const x = k[j] = k[j] || /* @__PURE__ */ new Map();
C.forEach((v) => {
- if (T.has(v))
+ if (x.has(v))
return;
- T.set(v, n.Started);
- let j = g(v);
- if (j) {
- const I = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
- A = (0, t._)`${A}${I} ${v} = ${j};${this.opts._n}`;
- } else if (j = L == null ? void 0 : L(v))
- A = (0, t._)`${A}${j}${this.opts._n}`;
+ x.set(v, a.Started);
+ let T = m(v);
+ if (T) {
+ const R = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
+ A = (0, t._)`${A}${R} ${v} = ${T};${this.opts._n}`;
+ } else if (T = N == null ? void 0 : N(v))
+ A = (0, t._)`${A}${T}${this.opts._n}`;
else
- throw new a(v);
- T.set(v, n.Completed);
+ throw new r(v);
+ x.set(v, a.Completed);
});
}
return A;
}
}
e.ValueScope = b;
-})($o);
+})(ca);
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0;
- const t = qa, a = $o;
- var n = qa;
+ const t = fr, r = ca;
+ var a = fr;
Object.defineProperty(e, "_", { enumerable: !0, get: function() {
- return n._;
+ return a._;
} }), Object.defineProperty(e, "str", { enumerable: !0, get: function() {
- return n.str;
+ return a.str;
} }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() {
- return n.strConcat;
+ return a.strConcat;
} }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() {
- return n.nil;
+ return a.nil;
} }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() {
- return n.getProperty;
+ return a.getProperty;
} }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() {
- return n.stringify;
+ return a.stringify;
} }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() {
- return n.regexpCode;
+ return a.regexpCode;
} }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() {
- return n.Name;
+ return a.Name;
} });
- var s = $o;
+ var s = ca;
Object.defineProperty(e, "Scope", { enumerable: !0, get: function() {
return s.Scope;
} }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() {
@@ -305,729 +309,729 @@ var $o = {};
AND: new t._Code("&&"),
ADD: new t._Code("+")
};
- class c {
+ class l {
optimizeNodes() {
return this;
}
- optimizeNames(d, k) {
+ optimizeNames(h, $) {
return this;
}
}
- class p extends c {
- constructor(d, k, R) {
- super(), this.varKind = d, this.name = k, this.rhs = R;
+ class d extends l {
+ constructor(h, $, I) {
+ super(), this.varKind = h, this.name = $, this.rhs = I;
}
- render({ es5: d, _n: k }) {
- const R = d ? a.varKinds.var : this.varKind, G = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
- return `${R} ${this.name}${G};` + k;
+ render({ es5: h, _n: $ }) {
+ const I = h ? r.varKinds.var : this.varKind, H = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
+ return `${I} ${this.name}${H};` + $;
}
- optimizeNames(d, k) {
- if (d[this.name.str])
- return this.rhs && (this.rhs = z(this.rhs, d, k)), this;
+ optimizeNames(h, $) {
+ if (h[this.name.str])
+ return this.rhs && (this.rhs = B(this.rhs, h, $)), this;
}
get names() {
return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
}
}
- class b extends c {
- constructor(d, k, R) {
- super(), this.lhs = d, this.rhs = k, this.sideEffects = R;
+ class b extends l {
+ constructor(h, $, I) {
+ super(), this.lhs = h, this.rhs = $, this.sideEffects = I;
}
- render({ _n: d }) {
- return `${this.lhs} = ${this.rhs};` + d;
+ render({ _n: h }) {
+ return `${this.lhs} = ${this.rhs};` + h;
}
- optimizeNames(d, k) {
- if (!(this.lhs instanceof t.Name && !d[this.lhs.str] && !this.sideEffects))
- return this.rhs = z(this.rhs, d, k), this;
+ optimizeNames(h, $) {
+ if (!(this.lhs instanceof t.Name && !h[this.lhs.str] && !this.sideEffects))
+ return this.rhs = B(this.rhs, h, $), this;
}
get names() {
- const d = this.lhs instanceof t.Name ? {} : { ...this.lhs.names };
- return U(d, this.rhs);
+ const h = this.lhs instanceof t.Name ? {} : { ...this.lhs.names };
+ return q(h, this.rhs);
}
}
class _ extends b {
- constructor(d, k, R, G) {
- super(d, R, G), this.op = k;
+ constructor(h, $, I, H) {
+ super(h, I, H), this.op = $;
}
- render({ _n: d }) {
- return `${this.lhs} ${this.op}= ${this.rhs};` + d;
+ render({ _n: h }) {
+ return `${this.lhs} ${this.op}= ${this.rhs};` + h;
}
}
- class y extends c {
- constructor(d) {
- super(), this.label = d, this.names = {};
+ class y extends l {
+ constructor(h) {
+ super(), this.label = h, this.names = {};
}
- render({ _n: d }) {
- return `${this.label}:` + d;
+ render({ _n: h }) {
+ return `${this.label}:` + h;
}
}
- class g extends c {
- constructor(d) {
- super(), this.label = d, this.names = {};
+ class m extends l {
+ constructor(h) {
+ super(), this.label = h, this.names = {};
}
- render({ _n: d }) {
- return `break${this.label ? ` ${this.label}` : ""};` + d;
+ render({ _n: h }) {
+ return `break${this.label ? ` ${this.label}` : ""};` + h;
}
}
- class S extends c {
- constructor(d) {
- super(), this.error = d;
+ class k extends l {
+ constructor(h) {
+ super(), this.error = h;
}
- render({ _n: d }) {
- return `throw ${this.error};` + d;
+ render({ _n: h }) {
+ return `throw ${this.error};` + h;
}
get names() {
return this.error.names;
}
}
- class L extends c {
- constructor(d) {
- super(), this.code = d;
+ class N extends l {
+ constructor(h) {
+ super(), this.code = h;
}
- render({ _n: d }) {
- return `${this.code};` + d;
+ render({ _n: h }) {
+ return `${this.code};` + h;
}
optimizeNodes() {
return `${this.code}` ? this : void 0;
}
- optimizeNames(d, k) {
- return this.code = z(this.code, d, k), this;
+ optimizeNames(h, $) {
+ return this.code = B(this.code, h, $), this;
}
get names() {
return this.code instanceof t._CodeOrName ? this.code.names : {};
}
}
- class A extends c {
- constructor(d = []) {
- super(), this.nodes = d;
+ class A extends l {
+ constructor(h = []) {
+ super(), this.nodes = h;
}
- render(d) {
- return this.nodes.reduce((k, R) => k + R.render(d), "");
+ render(h) {
+ return this.nodes.reduce(($, I) => $ + I.render(h), "");
}
optimizeNodes() {
- const { nodes: d } = this;
- let k = d.length;
- for (; k--; ) {
- const R = d[k].optimizeNodes();
- Array.isArray(R) ? d.splice(k, 1, ...R) : R ? d[k] = R : d.splice(k, 1);
+ const { nodes: h } = this;
+ let $ = h.length;
+ for (; $--; ) {
+ const I = h[$].optimizeNodes();
+ Array.isArray(I) ? h.splice($, 1, ...I) : I ? h[$] = I : h.splice($, 1);
}
- return d.length > 0 ? this : void 0;
- }
- optimizeNames(d, k) {
- const { nodes: R } = this;
- let G = R.length;
- for (; G--; ) {
- const K = R[G];
- K.optimizeNames(d, k) || (H(d, K.names), R.splice(G, 1));
+ return h.length > 0 ? this : void 0;
+ }
+ optimizeNames(h, $) {
+ const { nodes: I } = this;
+ let H = I.length;
+ for (; H--; ) {
+ const K = I[H];
+ K.optimizeNames(h, $) || (G(h, K.names), I.splice(H, 1));
}
- return R.length > 0 ? this : void 0;
+ return I.length > 0 ? this : void 0;
}
get names() {
- return this.nodes.reduce((d, k) => B(d, k.names), {});
+ return this.nodes.reduce((h, $) => z(h, $.names), {});
}
}
- class N extends A {
- render(d) {
- return "{" + d._n + super.render(d) + "}" + d._n;
+ class j extends A {
+ render(h) {
+ return "{" + h._n + super.render(h) + "}" + h._n;
}
}
class C extends A {
}
- class T extends N {
+ class x extends j {
}
- T.kind = "else";
- class v extends N {
- constructor(d, k) {
- super(k), this.condition = d;
+ x.kind = "else";
+ class v extends j {
+ constructor(h, $) {
+ super($), this.condition = h;
}
- render(d) {
- let k = `if(${this.condition})` + super.render(d);
- return this.else && (k += "else " + this.else.render(d)), k;
+ render(h) {
+ let $ = `if(${this.condition})` + super.render(h);
+ return this.else && ($ += "else " + this.else.render(h)), $;
}
optimizeNodes() {
super.optimizeNodes();
- const d = this.condition;
- if (d === !0)
+ const h = this.condition;
+ if (h === !0)
return this.nodes;
- let k = this.else;
- if (k) {
- const R = k.optimizeNodes();
- k = this.else = Array.isArray(R) ? new T(R) : R;
+ let $ = this.else;
+ if ($) {
+ const I = $.optimizeNodes();
+ $ = this.else = Array.isArray(I) ? new x(I) : I;
}
- if (k)
- return d === !1 ? k instanceof v ? k : k.nodes : this.nodes.length ? this : new v(w(d), k instanceof v ? [k] : k.nodes);
- if (!(d === !1 || !this.nodes.length))
+ if ($)
+ return h === !1 ? $ instanceof v ? $ : $.nodes : this.nodes.length ? this : new v(w(h), $ instanceof v ? [$] : $.nodes);
+ if (!(h === !1 || !this.nodes.length))
return this;
}
- optimizeNames(d, k) {
- var R;
- if (this.else = (R = this.else) === null || R === void 0 ? void 0 : R.optimizeNames(d, k), !!(super.optimizeNames(d, k) || this.else))
- return this.condition = z(this.condition, d, k), this;
+ optimizeNames(h, $) {
+ var I;
+ if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(h, $), !!(super.optimizeNames(h, $) || this.else))
+ return this.condition = B(this.condition, h, $), this;
}
get names() {
- const d = super.names;
- return U(d, this.condition), this.else && B(d, this.else.names), d;
+ const h = super.names;
+ return q(h, this.condition), this.else && z(h, this.else.names), h;
}
}
v.kind = "if";
- class j extends N {
+ class T extends j {
}
- j.kind = "for";
- class I extends j {
- constructor(d) {
- super(), this.iteration = d;
+ T.kind = "for";
+ class R extends T {
+ constructor(h) {
+ super(), this.iteration = h;
}
- render(d) {
- return `for(${this.iteration})` + super.render(d);
+ render(h) {
+ return `for(${this.iteration})` + super.render(h);
}
- optimizeNames(d, k) {
- if (super.optimizeNames(d, k))
- return this.iteration = z(this.iteration, d, k), this;
+ optimizeNames(h, $) {
+ if (super.optimizeNames(h, $))
+ return this.iteration = B(this.iteration, h, $), this;
}
get names() {
- return B(super.names, this.iteration.names);
+ return z(super.names, this.iteration.names);
}
}
- class r extends j {
- constructor(d, k, R, G) {
- super(), this.varKind = d, this.name = k, this.from = R, this.to = G;
+ class n extends T {
+ constructor(h, $, I, H) {
+ super(), this.varKind = h, this.name = $, this.from = I, this.to = H;
}
- render(d) {
- const k = d.es5 ? a.varKinds.var : this.varKind, { name: R, from: G, to: K } = this;
- return `for(${k} ${R}=${G}; ${R}<${K}; ${R}++)` + super.render(d);
+ render(h) {
+ const $ = h.es5 ? r.varKinds.var : this.varKind, { name: I, from: H, to: K } = this;
+ return `for(${$} ${I}=${H}; ${I}<${K}; ${I}++)` + super.render(h);
}
get names() {
- const d = U(super.names, this.from);
- return U(d, this.to);
+ const h = q(super.names, this.from);
+ return q(h, this.to);
}
}
- class i extends j {
- constructor(d, k, R, G) {
- super(), this.loop = d, this.varKind = k, this.name = R, this.iterable = G;
+ class i extends T {
+ constructor(h, $, I, H) {
+ super(), this.loop = h, this.varKind = $, this.name = I, this.iterable = H;
}
- render(d) {
- return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(d);
+ render(h) {
+ return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(h);
}
- optimizeNames(d, k) {
- if (super.optimizeNames(d, k))
- return this.iterable = z(this.iterable, d, k), this;
+ optimizeNames(h, $) {
+ if (super.optimizeNames(h, $))
+ return this.iterable = B(this.iterable, h, $), this;
}
get names() {
- return B(super.names, this.iterable.names);
+ return z(super.names, this.iterable.names);
}
}
- class o extends N {
- constructor(d, k, R) {
- super(), this.name = d, this.args = k, this.async = R;
+ class o extends j {
+ constructor(h, $, I) {
+ super(), this.name = h, this.args = $, this.async = I;
}
- render(d) {
- return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(d);
+ render(h) {
+ return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(h);
}
}
o.kind = "func";
- class l extends A {
- render(d) {
- return "return " + super.render(d);
+ class c extends A {
+ render(h) {
+ return "return " + super.render(h);
}
}
- l.kind = "return";
- class u extends N {
- render(d) {
- let k = "try" + super.render(d);
- return this.catch && (k += this.catch.render(d)), this.finally && (k += this.finally.render(d)), k;
+ c.kind = "return";
+ class u extends j {
+ render(h) {
+ let $ = "try" + super.render(h);
+ return this.catch && ($ += this.catch.render(h)), this.finally && ($ += this.finally.render(h)), $;
}
optimizeNodes() {
- var d, k;
- return super.optimizeNodes(), (d = this.catch) === null || d === void 0 || d.optimizeNodes(), (k = this.finally) === null || k === void 0 || k.optimizeNodes(), this;
+ var h, $;
+ return super.optimizeNodes(), (h = this.catch) === null || h === void 0 || h.optimizeNodes(), ($ = this.finally) === null || $ === void 0 || $.optimizeNodes(), this;
}
- optimizeNames(d, k) {
- var R, G;
- return super.optimizeNames(d, k), (R = this.catch) === null || R === void 0 || R.optimizeNames(d, k), (G = this.finally) === null || G === void 0 || G.optimizeNames(d, k), this;
+ optimizeNames(h, $) {
+ var I, H;
+ return super.optimizeNames(h, $), (I = this.catch) === null || I === void 0 || I.optimizeNames(h, $), (H = this.finally) === null || H === void 0 || H.optimizeNames(h, $), this;
}
get names() {
- const d = super.names;
- return this.catch && B(d, this.catch.names), this.finally && B(d, this.finally.names), d;
+ const h = super.names;
+ return this.catch && z(h, this.catch.names), this.finally && z(h, this.finally.names), h;
}
}
- class m extends N {
- constructor(d) {
- super(), this.error = d;
+ class f extends j {
+ constructor(h) {
+ super(), this.error = h;
}
- render(d) {
- return `catch(${this.error})` + super.render(d);
+ render(h) {
+ return `catch(${this.error})` + super.render(h);
}
}
- m.kind = "catch";
- class f extends N {
- render(d) {
- return "finally" + super.render(d);
+ f.kind = "catch";
+ class g extends j {
+ render(h) {
+ return "finally" + super.render(h);
}
}
- f.kind = "finally";
- class x {
- constructor(d, k = {}) {
- this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...k, _n: k.lines ? `
-` : "" }, this._extScope = d, this._scope = new a.Scope({ parent: d }), this._nodes = [new C()];
+ g.kind = "finally";
+ class O {
+ constructor(h, $ = {}) {
+ this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...$, _n: $.lines ? `
+` : "" }, this._extScope = h, this._scope = new r.Scope({ parent: h }), this._nodes = [new C()];
}
toString() {
return this._root.render(this.opts);
}
// returns unique name in the internal scope
- name(d) {
- return this._scope.name(d);
+ name(h) {
+ return this._scope.name(h);
}
// reserves unique name in the external scope
- scopeName(d) {
- return this._extScope.name(d);
+ scopeName(h) {
+ return this._extScope.name(h);
}
// reserves unique name in the external scope and assigns value to it
- scopeValue(d, k) {
- const R = this._extScope.value(d, k);
- return (this._values[R.prefix] || (this._values[R.prefix] = /* @__PURE__ */ new Set())).add(R), R;
+ scopeValue(h, $) {
+ const I = this._extScope.value(h, $);
+ return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I;
}
- getScopeValue(d, k) {
- return this._extScope.getValue(d, k);
+ getScopeValue(h, $) {
+ return this._extScope.getValue(h, $);
}
// return code that assigns values in the external scope to the names that are used internally
// (same names that were returned by gen.scopeName or gen.scopeValue)
- scopeRefs(d) {
- return this._extScope.scopeRefs(d, this._values);
+ scopeRefs(h) {
+ return this._extScope.scopeRefs(h, this._values);
}
scopeCode() {
return this._extScope.scopeCode(this._values);
}
- _def(d, k, R, G) {
- const K = this._scope.toName(k);
- return R !== void 0 && G && (this._constants[K.str] = R), this._leafNode(new p(d, K, R)), K;
+ _def(h, $, I, H) {
+ const K = this._scope.toName($);
+ return I !== void 0 && H && (this._constants[K.str] = I), this._leafNode(new d(h, K, I)), K;
}
// `const` declaration (`var` in es5 mode)
- const(d, k, R) {
- return this._def(a.varKinds.const, d, k, R);
+ const(h, $, I) {
+ return this._def(r.varKinds.const, h, $, I);
}
// `let` declaration with optional assignment (`var` in es5 mode)
- let(d, k, R) {
- return this._def(a.varKinds.let, d, k, R);
+ let(h, $, I) {
+ return this._def(r.varKinds.let, h, $, I);
}
// `var` declaration with optional assignment
- var(d, k, R) {
- return this._def(a.varKinds.var, d, k, R);
+ var(h, $, I) {
+ return this._def(r.varKinds.var, h, $, I);
}
// assignment code
- assign(d, k, R) {
- return this._leafNode(new b(d, k, R));
+ assign(h, $, I) {
+ return this._leafNode(new b(h, $, I));
}
// `+=` code
- add(d, k) {
- return this._leafNode(new _(d, e.operators.ADD, k));
+ add(h, $) {
+ return this._leafNode(new _(h, e.operators.ADD, $));
}
// appends passed SafeExpr to code or executes Block
- code(d) {
- return typeof d == "function" ? d() : d !== t.nil && this._leafNode(new L(d)), this;
+ code(h) {
+ return typeof h == "function" ? h() : h !== t.nil && this._leafNode(new N(h)), this;
}
// returns code for object literal for the passed argument list of key-value pairs
- object(...d) {
- const k = ["{"];
- for (const [R, G] of d)
- k.length > 1 && k.push(","), k.push(R), (R !== G || this.opts.es5) && (k.push(":"), (0, t.addCodeArg)(k, G));
- return k.push("}"), new t._Code(k);
+ object(...h) {
+ const $ = ["{"];
+ for (const [I, H] of h)
+ $.length > 1 && $.push(","), $.push(I), (I !== H || this.opts.es5) && ($.push(":"), (0, t.addCodeArg)($, H));
+ return $.push("}"), new t._Code($);
}
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
- if(d, k, R) {
- if (this._blockNode(new v(d)), k && R)
- this.code(k).else().code(R).endIf();
- else if (k)
- this.code(k).endIf();
- else if (R)
+ if(h, $, I) {
+ if (this._blockNode(new v(h)), $ && I)
+ this.code($).else().code(I).endIf();
+ else if ($)
+ this.code($).endIf();
+ else if (I)
throw new Error('CodeGen: "else" body without "then" body');
return this;
}
// `else if` clause - invalid without `if` or after `else` clauses
- elseIf(d) {
- return this._elseNode(new v(d));
+ elseIf(h) {
+ return this._elseNode(new v(h));
}
// `else` clause - only valid after `if` or `else if` clauses
else() {
- return this._elseNode(new T());
+ return this._elseNode(new x());
}
// end `if` statement (needed if gen.if was used only with condition)
endIf() {
- return this._endBlockNode(v, T);
+ return this._endBlockNode(v, x);
}
- _for(d, k) {
- return this._blockNode(d), k && this.code(k).endFor(), this;
+ _for(h, $) {
+ return this._blockNode(h), $ && this.code($).endFor(), this;
}
// a generic `for` clause (or statement if `forBody` is passed)
- for(d, k) {
- return this._for(new I(d), k);
+ for(h, $) {
+ return this._for(new R(h), $);
}
// `for` statement for a range of values
- forRange(d, k, R, G, K = this.opts.es5 ? a.varKinds.var : a.varKinds.let) {
- const X = this._scope.toName(d);
- return this._for(new r(K, X, k, R), () => G(X));
+ forRange(h, $, I, H, K = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
+ const te = this._scope.toName(h);
+ return this._for(new n(K, te, $, I), () => H(te));
}
// `for-of` statement (in es5 mode replace with a normal for loop)
- forOf(d, k, R, G = a.varKinds.const) {
- const K = this._scope.toName(d);
+ forOf(h, $, I, H = r.varKinds.const) {
+ const K = this._scope.toName(h);
if (this.opts.es5) {
- const X = k instanceof t.Name ? k : this.var("_arr", k);
- return this.forRange("_i", 0, (0, t._)`${X}.length`, (ee) => {
- this.var(K, (0, t._)`${X}[${ee}]`), R(K);
+ const te = $ instanceof t.Name ? $ : this.var("_arr", $);
+ return this.forRange("_i", 0, (0, t._)`${te}.length`, (ne) => {
+ this.var(K, (0, t._)`${te}[${ne}]`), I(K);
});
}
- return this._for(new i("of", G, K, k), () => R(K));
+ return this._for(new i("of", H, K, $), () => I(K));
}
// `for-in` statement.
// With option `ownProperties` replaced with a `for-of` loop for object keys
- forIn(d, k, R, G = this.opts.es5 ? a.varKinds.var : a.varKinds.const) {
+ forIn(h, $, I, H = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
if (this.opts.ownProperties)
- return this.forOf(d, (0, t._)`Object.keys(${k})`, R);
- const K = this._scope.toName(d);
- return this._for(new i("in", G, K, k), () => R(K));
+ return this.forOf(h, (0, t._)`Object.keys(${$})`, I);
+ const K = this._scope.toName(h);
+ return this._for(new i("in", H, K, $), () => I(K));
}
// end `for` loop
endFor() {
- return this._endBlockNode(j);
+ return this._endBlockNode(T);
}
// `label` statement
- label(d) {
- return this._leafNode(new y(d));
+ label(h) {
+ return this._leafNode(new y(h));
}
// `break` statement
- break(d) {
- return this._leafNode(new g(d));
+ break(h) {
+ return this._leafNode(new m(h));
}
// `return` statement
- return(d) {
- const k = new l();
- if (this._blockNode(k), this.code(d), k.nodes.length !== 1)
+ return(h) {
+ const $ = new c();
+ if (this._blockNode($), this.code(h), $.nodes.length !== 1)
throw new Error('CodeGen: "return" should have one node');
- return this._endBlockNode(l);
+ return this._endBlockNode(c);
}
// `try` statement
- try(d, k, R) {
- if (!k && !R)
+ try(h, $, I) {
+ if (!$ && !I)
throw new Error('CodeGen: "try" without "catch" and "finally"');
- const G = new u();
- if (this._blockNode(G), this.code(d), k) {
+ const H = new u();
+ if (this._blockNode(H), this.code(h), $) {
const K = this.name("e");
- this._currNode = G.catch = new m(K), k(K);
+ this._currNode = H.catch = new f(K), $(K);
}
- return R && (this._currNode = G.finally = new f(), this.code(R)), this._endBlockNode(m, f);
+ return I && (this._currNode = H.finally = new g(), this.code(I)), this._endBlockNode(f, g);
}
// `throw` statement
- throw(d) {
- return this._leafNode(new S(d));
+ throw(h) {
+ return this._leafNode(new k(h));
}
// start self-balancing block
- block(d, k) {
- return this._blockStarts.push(this._nodes.length), d && this.code(d).endBlock(k), this;
+ block(h, $) {
+ return this._blockStarts.push(this._nodes.length), h && this.code(h).endBlock($), this;
}
// end the current self-balancing block
- endBlock(d) {
- const k = this._blockStarts.pop();
- if (k === void 0)
+ endBlock(h) {
+ const $ = this._blockStarts.pop();
+ if ($ === void 0)
throw new Error("CodeGen: not in self-balancing block");
- const R = this._nodes.length - k;
- if (R < 0 || d !== void 0 && R !== d)
- throw new Error(`CodeGen: wrong number of nodes: ${R} vs ${d} expected`);
- return this._nodes.length = k, this;
+ const I = this._nodes.length - $;
+ if (I < 0 || h !== void 0 && I !== h)
+ throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${h} expected`);
+ return this._nodes.length = $, this;
}
// `function` heading (or definition if funcBody is passed)
- func(d, k = t.nil, R, G) {
- return this._blockNode(new o(d, k, R)), G && this.code(G).endFunc(), this;
+ func(h, $ = t.nil, I, H) {
+ return this._blockNode(new o(h, $, I)), H && this.code(H).endFunc(), this;
}
// end function definition
endFunc() {
return this._endBlockNode(o);
}
- optimize(d = 1) {
- for (; d-- > 0; )
+ optimize(h = 1) {
+ for (; h-- > 0; )
this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants);
}
- _leafNode(d) {
- return this._currNode.nodes.push(d), this;
+ _leafNode(h) {
+ return this._currNode.nodes.push(h), this;
}
- _blockNode(d) {
- this._currNode.nodes.push(d), this._nodes.push(d);
+ _blockNode(h) {
+ this._currNode.nodes.push(h), this._nodes.push(h);
}
- _endBlockNode(d, k) {
- const R = this._currNode;
- if (R instanceof d || k && R instanceof k)
+ _endBlockNode(h, $) {
+ const I = this._currNode;
+ if (I instanceof h || $ && I instanceof $)
return this._nodes.pop(), this;
- throw new Error(`CodeGen: not in block "${k ? `${d.kind}/${k.kind}` : d.kind}"`);
+ throw new Error(`CodeGen: not in block "${$ ? `${h.kind}/${$.kind}` : h.kind}"`);
}
- _elseNode(d) {
- const k = this._currNode;
- if (!(k instanceof v))
+ _elseNode(h) {
+ const $ = this._currNode;
+ if (!($ instanceof v))
throw new Error('CodeGen: "else" without "if"');
- return this._currNode = k.else = d, this;
+ return this._currNode = $.else = h, this;
}
get _root() {
return this._nodes[0];
}
get _currNode() {
- const d = this._nodes;
- return d[d.length - 1];
+ const h = this._nodes;
+ return h[h.length - 1];
}
- set _currNode(d) {
- const k = this._nodes;
- k[k.length - 1] = d;
+ set _currNode(h) {
+ const $ = this._nodes;
+ $[$.length - 1] = h;
}
}
- e.CodeGen = x;
- function B(O, d) {
- for (const k in d)
- O[k] = (O[k] || 0) + (d[k] || 0);
- return O;
+ e.CodeGen = O;
+ function z(L, h) {
+ for (const $ in h)
+ L[$] = (L[$] || 0) + (h[$] || 0);
+ return L;
}
- function U(O, d) {
- return d instanceof t._CodeOrName ? B(O, d.names) : O;
+ function q(L, h) {
+ return h instanceof t._CodeOrName ? z(L, h.names) : L;
}
- function z(O, d, k) {
- if (O instanceof t.Name)
- return R(O);
- if (!G(O))
- return O;
- return new t._Code(O._items.reduce((K, X) => (X instanceof t.Name && (X = R(X)), X instanceof t._Code ? K.push(...X._items) : K.push(X), K), []));
- function R(K) {
- const X = k[K.str];
- return X === void 0 || d[K.str] !== 1 ? K : (delete d[K.str], X);
+ function B(L, h, $) {
+ if (L instanceof t.Name)
+ return I(L);
+ if (!H(L))
+ return L;
+ return new t._Code(L._items.reduce((K, te) => (te instanceof t.Name && (te = I(te)), te instanceof t._Code ? K.push(...te._items) : K.push(te), K), []));
+ function I(K) {
+ const te = $[K.str];
+ return te === void 0 || h[K.str] !== 1 ? K : (delete h[K.str], te);
}
- function G(K) {
- return K instanceof t._Code && K._items.some((X) => X instanceof t.Name && d[X.str] === 1 && k[X.str] !== void 0);
+ function H(K) {
+ return K instanceof t._Code && K._items.some((te) => te instanceof t.Name && h[te.str] === 1 && $[te.str] !== void 0);
}
}
- function H(O, d) {
- for (const k in d)
- O[k] = (O[k] || 0) - (d[k] || 0);
+ function G(L, h) {
+ for (const $ in h)
+ L[$] = (L[$] || 0) - (h[$] || 0);
}
- function w(O) {
- return typeof O == "boolean" || typeof O == "number" || O === null ? !O : (0, t._)`!${F(O)}`;
+ function w(L) {
+ return typeof L == "boolean" || typeof L == "number" || L === null ? !L : (0, t._)`!${F(L)}`;
}
e.not = w;
- const q = E(e.operators.AND);
- function W(...O) {
- return O.reduce(q);
+ const U = P(e.operators.AND);
+ function W(...L) {
+ return L.reduce(U);
}
e.and = W;
- const J = E(e.operators.OR);
- function V(...O) {
- return O.reduce(J);
+ const J = P(e.operators.OR);
+ function V(...L) {
+ return L.reduce(J);
}
e.or = V;
- function E(O) {
- return (d, k) => d === t.nil ? k : k === t.nil ? d : (0, t._)`${F(d)} ${O} ${F(k)}`;
+ function P(L) {
+ return (h, $) => h === t.nil ? $ : $ === t.nil ? h : (0, t._)`${F(h)} ${L} ${F($)}`;
}
- function F(O) {
- return O instanceof t.Name ? O : (0, t._)`(${O})`;
+ function F(L) {
+ return L instanceof t.Name ? L : (0, t._)`(${L})`;
}
-})(we);
-var $e = {};
+})(ie);
+var ce = {};
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0;
- const t = we, a = qa;
- function n(o) {
- const l = {};
+ const t = ie, r = fr;
+ function a(o) {
+ const c = {};
for (const u of o)
- l[u] = !0;
- return l;
+ c[u] = !0;
+ return c;
}
- e.toHash = n;
- function s(o, l) {
- return typeof l == "boolean" ? l : Object.keys(l).length === 0 ? !0 : (c(o, l), !p(l, o.self.RULES.all));
+ e.toHash = a;
+ function s(o, c) {
+ return typeof c == "boolean" ? c : Object.keys(c).length === 0 ? !0 : (l(o, c), !d(c, o.self.RULES.all));
}
e.alwaysValidSchema = s;
- function c(o, l = o.schema) {
- const { opts: u, self: m } = o;
- if (!u.strictSchema || typeof l == "boolean")
+ function l(o, c = o.schema) {
+ const { opts: u, self: f } = o;
+ if (!u.strictSchema || typeof c == "boolean")
return;
- const f = m.RULES.keywords;
- for (const x in l)
- f[x] || i(o, `unknown keyword: "${x}"`);
+ const g = f.RULES.keywords;
+ for (const O in c)
+ g[O] || i(o, `unknown keyword: "${O}"`);
}
- e.checkUnknownRules = c;
- function p(o, l) {
+ e.checkUnknownRules = l;
+ function d(o, c) {
if (typeof o == "boolean")
return !o;
for (const u in o)
- if (l[u])
+ if (c[u])
return !0;
return !1;
}
- e.schemaHasRules = p;
- function b(o, l) {
+ e.schemaHasRules = d;
+ function b(o, c) {
if (typeof o == "boolean")
return !o;
for (const u in o)
- if (u !== "$ref" && l.all[u])
+ if (u !== "$ref" && c.all[u])
return !0;
return !1;
}
e.schemaHasRulesButRef = b;
- function _({ topSchemaRef: o, schemaPath: l }, u, m, f) {
- if (!f) {
+ function _({ topSchemaRef: o, schemaPath: c }, u, f, g) {
+ if (!g) {
if (typeof u == "number" || typeof u == "boolean")
return u;
if (typeof u == "string")
return (0, t._)`${u}`;
}
- return (0, t._)`${o}${l}${(0, t.getProperty)(m)}`;
+ return (0, t._)`${o}${c}${(0, t.getProperty)(f)}`;
}
e.schemaRefOrVal = _;
function y(o) {
- return L(decodeURIComponent(o));
+ return N(decodeURIComponent(o));
}
e.unescapeFragment = y;
- function g(o) {
- return encodeURIComponent(S(o));
+ function m(o) {
+ return encodeURIComponent(k(o));
}
- e.escapeFragment = g;
- function S(o) {
+ e.escapeFragment = m;
+ function k(o) {
return typeof o == "number" ? `${o}` : o.replace(/~/g, "~0").replace(/\//g, "~1");
}
- e.escapeJsonPointer = S;
- function L(o) {
+ e.escapeJsonPointer = k;
+ function N(o) {
return o.replace(/~1/g, "/").replace(/~0/g, "~");
}
- e.unescapeJsonPointer = L;
- function A(o, l) {
+ e.unescapeJsonPointer = N;
+ function A(o, c) {
if (Array.isArray(o))
for (const u of o)
- l(u);
+ c(u);
else
- l(o);
+ c(o);
}
e.eachItem = A;
- function N({ mergeNames: o, mergeToName: l, mergeValues: u, resultToName: m }) {
- return (f, x, B, U) => {
- const z = B === void 0 ? x : B instanceof t.Name ? (x instanceof t.Name ? o(f, x, B) : l(f, x, B), B) : x instanceof t.Name ? (l(f, B, x), x) : u(x, B);
- return U === t.Name && !(z instanceof t.Name) ? m(f, z) : z;
+ function j({ mergeNames: o, mergeToName: c, mergeValues: u, resultToName: f }) {
+ return (g, O, z, q) => {
+ const B = z === void 0 ? O : z instanceof t.Name ? (O instanceof t.Name ? o(g, O, z) : c(g, O, z), z) : O instanceof t.Name ? (c(g, z, O), O) : u(O, z);
+ return q === t.Name && !(B instanceof t.Name) ? f(g, B) : B;
};
}
e.mergeEvaluated = {
- props: N({
- mergeNames: (o, l, u) => o.if((0, t._)`${u} !== true && ${l} !== undefined`, () => {
- o.if((0, t._)`${l} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${l})`));
+ props: j({
+ mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => {
+ o.if((0, t._)`${c} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${c})`));
}),
- mergeToName: (o, l, u) => o.if((0, t._)`${u} !== true`, () => {
- l === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), T(o, u, l));
+ mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => {
+ c === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), x(o, u, c));
}),
- mergeValues: (o, l) => o === !0 ? !0 : { ...o, ...l },
+ mergeValues: (o, c) => o === !0 ? !0 : { ...o, ...c },
resultToName: C
}),
- items: N({
- mergeNames: (o, l, u) => o.if((0, t._)`${u} !== true && ${l} !== undefined`, () => o.assign(u, (0, t._)`${l} === true ? true : ${u} > ${l} ? ${u} : ${l}`)),
- mergeToName: (o, l, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, l === !0 ? !0 : (0, t._)`${u} > ${l} ? ${u} : ${l}`)),
- mergeValues: (o, l) => o === !0 ? !0 : Math.max(o, l),
- resultToName: (o, l) => o.var("items", l)
+ items: j({
+ mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => o.assign(u, (0, t._)`${c} === true ? true : ${u} > ${c} ? ${u} : ${c}`)),
+ mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, c === !0 ? !0 : (0, t._)`${u} > ${c} ? ${u} : ${c}`)),
+ mergeValues: (o, c) => o === !0 ? !0 : Math.max(o, c),
+ resultToName: (o, c) => o.var("items", c)
})
};
- function C(o, l) {
- if (l === !0)
+ function C(o, c) {
+ if (c === !0)
return o.var("props", !0);
const u = o.var("props", (0, t._)`{}`);
- return l !== void 0 && T(o, u, l), u;
+ return c !== void 0 && x(o, u, c), u;
}
e.evaluatedPropsToName = C;
- function T(o, l, u) {
- Object.keys(u).forEach((m) => o.assign((0, t._)`${l}${(0, t.getProperty)(m)}`, !0));
+ function x(o, c, u) {
+ Object.keys(u).forEach((f) => o.assign((0, t._)`${c}${(0, t.getProperty)(f)}`, !0));
}
- e.setEvaluated = T;
+ e.setEvaluated = x;
const v = {};
- function j(o, l) {
+ function T(o, c) {
return o.scopeValue("func", {
- ref: l,
- code: v[l.code] || (v[l.code] = new a._Code(l.code))
+ ref: c,
+ code: v[c.code] || (v[c.code] = new r._Code(c.code))
});
}
- e.useFunc = j;
- var I;
+ e.useFunc = T;
+ var R;
(function(o) {
o[o.Num = 0] = "Num", o[o.Str = 1] = "Str";
- })(I = e.Type || (e.Type = {}));
- function r(o, l, u) {
+ })(R = e.Type || (e.Type = {}));
+ function n(o, c, u) {
if (o instanceof t.Name) {
- const m = l === I.Num;
- return u ? m ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : m ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
+ const f = c === R.Num;
+ return u ? f ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : f ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
}
- return u ? (0, t.getProperty)(o).toString() : "/" + S(o);
+ return u ? (0, t.getProperty)(o).toString() : "/" + k(o);
}
- e.getErrorPath = r;
- function i(o, l, u = o.opts.strictSchema) {
+ e.getErrorPath = n;
+ function i(o, c, u = o.opts.strictSchema) {
if (u) {
- if (l = `strict mode: ${l}`, u === !0)
- throw new Error(l);
- o.self.logger.warn(l);
+ if (c = `strict mode: ${c}`, u === !0)
+ throw new Error(c);
+ o.self.logger.warn(c);
}
}
e.checkStrictMode = i;
-})($e);
-var cr = {};
-Object.defineProperty(cr, "__esModule", { value: !0 });
-const at = we, Bu = {
+})(ce);
+var ct = {};
+Object.defineProperty(ct, "__esModule", { value: !0 });
+const Oe = ie, Ps = {
// validation function arguments
- data: new at.Name("data"),
+ data: new Oe.Name("data"),
// args passed from referencing schema
- valCxt: new at.Name("valCxt"),
- instancePath: new at.Name("instancePath"),
- parentData: new at.Name("parentData"),
- parentDataProperty: new at.Name("parentDataProperty"),
- rootData: new at.Name("rootData"),
- dynamicAnchors: new at.Name("dynamicAnchors"),
+ valCxt: new Oe.Name("valCxt"),
+ instancePath: new Oe.Name("instancePath"),
+ parentData: new Oe.Name("parentData"),
+ parentDataProperty: new Oe.Name("parentDataProperty"),
+ rootData: new Oe.Name("rootData"),
+ dynamicAnchors: new Oe.Name("dynamicAnchors"),
// function scoped variables
- vErrors: new at.Name("vErrors"),
- errors: new at.Name("errors"),
- this: new at.Name("this"),
+ vErrors: new Oe.Name("vErrors"),
+ errors: new Oe.Name("errors"),
+ this: new Oe.Name("this"),
// "globals"
- self: new at.Name("self"),
- scope: new at.Name("scope"),
+ self: new Oe.Name("self"),
+ scope: new Oe.Name("scope"),
// JTD serialize/parse name for JSON string and position
- json: new at.Name("json"),
- jsonPos: new at.Name("jsonPos"),
- jsonLen: new at.Name("jsonLen"),
- jsonPart: new at.Name("jsonPart")
+ json: new Oe.Name("json"),
+ jsonPos: new Oe.Name("jsonPos"),
+ jsonLen: new Oe.Name("jsonLen"),
+ jsonPart: new Oe.Name("jsonPart")
};
-cr.default = Bu;
+ct.default = Ps;
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
- const t = we, a = $e, n = cr;
+ const t = ie, r = ce, a = ct;
e.keywordError = {
- message: ({ keyword: T }) => (0, t.str)`must pass "${T}" keyword validation`
+ message: ({ keyword: x }) => (0, t.str)`must pass "${x}" keyword validation`
}, e.keyword$DataError = {
- message: ({ keyword: T, schemaType: v }) => v ? (0, t.str)`"${T}" keyword must be ${v} ($data)` : (0, t.str)`"${T}" keyword is invalid ($data)`
+ message: ({ keyword: x, schemaType: v }) => v ? (0, t.str)`"${x}" keyword must be ${v} ($data)` : (0, t.str)`"${x}" keyword is invalid ($data)`
};
- function s(T, v = e.keywordError, j, I) {
- const { it: r } = T, { gen: i, compositeRule: o, allErrors: l } = r, u = S(T, v, j);
- I ?? (o || l) ? _(i, u) : y(r, (0, t._)`[${u}]`);
+ function s(x, v = e.keywordError, T, R) {
+ const { it: n } = x, { gen: i, compositeRule: o, allErrors: c } = n, u = k(x, v, T);
+ R ?? (o || c) ? _(i, u) : y(n, (0, t._)`[${u}]`);
}
e.reportError = s;
- function c(T, v = e.keywordError, j) {
- const { it: I } = T, { gen: r, compositeRule: i, allErrors: o } = I, l = S(T, v, j);
- _(r, l), i || o || y(I, n.default.vErrors);
+ function l(x, v = e.keywordError, T) {
+ const { it: R } = x, { gen: n, compositeRule: i, allErrors: o } = R, c = k(x, v, T);
+ _(n, c), i || o || y(R, a.default.vErrors);
}
- e.reportExtraError = c;
- function p(T, v) {
- T.assign(n.default.errors, v), T.if((0, t._)`${n.default.vErrors} !== null`, () => T.if(v, () => T.assign((0, t._)`${n.default.vErrors}.length`, v), () => T.assign(n.default.vErrors, null)));
+ e.reportExtraError = l;
+ function d(x, v) {
+ x.assign(a.default.errors, v), x.if((0, t._)`${a.default.vErrors} !== null`, () => x.if(v, () => x.assign((0, t._)`${a.default.vErrors}.length`, v), () => x.assign(a.default.vErrors, null)));
}
- e.resetErrorsCount = p;
- function b({ gen: T, keyword: v, schemaValue: j, data: I, errsCount: r, it: i }) {
- if (r === void 0)
+ e.resetErrorsCount = d;
+ function b({ gen: x, keyword: v, schemaValue: T, data: R, errsCount: n, it: i }) {
+ if (n === void 0)
throw new Error("ajv implementation error");
- const o = T.name("err");
- T.forRange("i", r, n.default.errors, (l) => {
- T.const(o, (0, t._)`${n.default.vErrors}[${l}]`), T.if((0, t._)`${o}.instancePath === undefined`, () => T.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(n.default.instancePath, i.errorPath))), T.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${i.errSchemaPath}/${v}`), i.opts.verbose && (T.assign((0, t._)`${o}.schema`, j), T.assign((0, t._)`${o}.data`, I));
+ const o = x.name("err");
+ x.forRange("i", n, a.default.errors, (c) => {
+ x.const(o, (0, t._)`${a.default.vErrors}[${c}]`), x.if((0, t._)`${o}.instancePath === undefined`, () => x.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(a.default.instancePath, i.errorPath))), x.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${i.errSchemaPath}/${v}`), i.opts.verbose && (x.assign((0, t._)`${o}.schema`, T), x.assign((0, t._)`${o}.data`, R));
});
}
e.extendErrors = b;
- function _(T, v) {
- const j = T.const("err", v);
- T.if((0, t._)`${n.default.vErrors} === null`, () => T.assign(n.default.vErrors, (0, t._)`[${j}]`), (0, t._)`${n.default.vErrors}.push(${j})`), T.code((0, t._)`${n.default.errors}++`);
+ function _(x, v) {
+ const T = x.const("err", v);
+ x.if((0, t._)`${a.default.vErrors} === null`, () => x.assign(a.default.vErrors, (0, t._)`[${T}]`), (0, t._)`${a.default.vErrors}.push(${T})`), x.code((0, t._)`${a.default.errors}++`);
}
- function y(T, v) {
- const { gen: j, validateName: I, schemaEnv: r } = T;
- r.$async ? j.throw((0, t._)`new ${T.ValidationError}(${v})`) : (j.assign((0, t._)`${I}.errors`, v), j.return(!1));
+ function y(x, v) {
+ const { gen: T, validateName: R, schemaEnv: n } = x;
+ n.$async ? T.throw((0, t._)`new ${x.ValidationError}(${v})`) : (T.assign((0, t._)`${R}.errors`, v), T.return(!1));
}
- const g = {
+ const m = {
keyword: new t.Name("keyword"),
schemaPath: new t.Name("schemaPath"),
params: new t.Name("params"),
@@ -1036,67 +1040,67 @@ cr.default = Bu;
schema: new t.Name("schema"),
parentSchema: new t.Name("parentSchema")
};
- function S(T, v, j) {
- const { createErrors: I } = T.it;
- return I === !1 ? (0, t._)`{}` : L(T, v, j);
- }
- function L(T, v, j = {}) {
- const { gen: I, it: r } = T, i = [
- A(r, j),
- N(T, j)
+ function k(x, v, T) {
+ const { createErrors: R } = x.it;
+ return R === !1 ? (0, t._)`{}` : N(x, v, T);
+ }
+ function N(x, v, T = {}) {
+ const { gen: R, it: n } = x, i = [
+ A(n, T),
+ j(x, T)
];
- return C(T, v, i), I.object(...i);
+ return C(x, v, i), R.object(...i);
}
- function A({ errorPath: T }, { instancePath: v }) {
- const j = v ? (0, t.str)`${T}${(0, a.getErrorPath)(v, a.Type.Str)}` : T;
- return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, j)];
+ function A({ errorPath: x }, { instancePath: v }) {
+ const T = v ? (0, t.str)`${x}${(0, r.getErrorPath)(v, r.Type.Str)}` : x;
+ return [a.default.instancePath, (0, t.strConcat)(a.default.instancePath, T)];
}
- function N({ keyword: T, it: { errSchemaPath: v } }, { schemaPath: j, parentSchema: I }) {
- let r = I ? v : (0, t.str)`${v}/${T}`;
- return j && (r = (0, t.str)`${r}${(0, a.getErrorPath)(j, a.Type.Str)}`), [g.schemaPath, r];
+ function j({ keyword: x, it: { errSchemaPath: v } }, { schemaPath: T, parentSchema: R }) {
+ let n = R ? v : (0, t.str)`${v}/${x}`;
+ return T && (n = (0, t.str)`${n}${(0, r.getErrorPath)(T, r.Type.Str)}`), [m.schemaPath, n];
}
- function C(T, { params: v, message: j }, I) {
- const { keyword: r, data: i, schemaValue: o, it: l } = T, { opts: u, propertyName: m, topSchemaRef: f, schemaPath: x } = l;
- I.push([g.keyword, r], [g.params, typeof v == "function" ? v(T) : v || (0, t._)`{}`]), u.messages && I.push([g.message, typeof j == "function" ? j(T) : j]), u.verbose && I.push([g.schema, o], [g.parentSchema, (0, t._)`${f}${x}`], [n.default.data, i]), m && I.push([g.propertyName, m]);
+ function C(x, { params: v, message: T }, R) {
+ const { keyword: n, data: i, schemaValue: o, it: c } = x, { opts: u, propertyName: f, topSchemaRef: g, schemaPath: O } = c;
+ R.push([m.keyword, n], [m.params, typeof v == "function" ? v(x) : v || (0, t._)`{}`]), u.messages && R.push([m.message, typeof T == "function" ? T(x) : T]), u.verbose && R.push([m.schema, o], [m.parentSchema, (0, t._)`${g}${O}`], [a.default.data, i]), f && R.push([m.propertyName, f]);
}
-})(Ka);
-Object.defineProperty(sa, "__esModule", { value: !0 });
-sa.boolOrEmptySchema = sa.topBoolOrEmptySchema = void 0;
-const Vu = Ka, Fu = we, Uu = cr, qu = {
+})(br);
+Object.defineProperty(Ht, "__esModule", { value: !0 });
+Ht.boolOrEmptySchema = Ht.topBoolOrEmptySchema = void 0;
+const Ss = br, Ts = ie, Cs = ct, xs = {
message: "boolean schema is false"
};
-function Hu(e) {
- const { gen: t, schema: a, validateName: n } = e;
- a === !1 ? Mc(e, !1) : typeof a == "object" && a.$async === !0 ? t.return(Uu.default.data) : (t.assign((0, Fu._)`${n}.errors`, null), t.return(!0));
+function Os(e) {
+ const { gen: t, schema: r, validateName: a } = e;
+ r === !1 ? io(e, !1) : typeof r == "object" && r.$async === !0 ? t.return(Cs.default.data) : (t.assign((0, Ts._)`${a}.errors`, null), t.return(!0));
}
-sa.topBoolOrEmptySchema = Hu;
-function Gu(e, t) {
- const { gen: a, schema: n } = e;
- n === !1 ? (a.var(t, !1), Mc(e)) : a.var(t, !0);
+Ht.topBoolOrEmptySchema = Os;
+function Ns(e, t) {
+ const { gen: r, schema: a } = e;
+ a === !1 ? (r.var(t, !1), io(e)) : r.var(t, !0);
}
-sa.boolOrEmptySchema = Gu;
-function Mc(e, t) {
- const { gen: a, data: n } = e, s = {
- gen: a,
+Ht.boolOrEmptySchema = Ns;
+function io(e, t) {
+ const { gen: r, data: a } = e, s = {
+ gen: r,
keyword: "false schema",
- data: n,
+ data: a,
schema: !1,
schemaCode: !1,
schemaValue: !1,
params: {},
it: e
};
- (0, Vu.reportError)(s, qu, void 0, t);
+ (0, Ss.reportError)(s, xs, void 0, t);
}
-var Wa = {}, Fr = {};
-Object.defineProperty(Fr, "__esModule", { value: !0 });
-Fr.getRules = Fr.isJSONType = void 0;
-const Ku = ["string", "number", "integer", "boolean", "null", "object", "array"], Wu = new Set(Ku);
-function Ju(e) {
- return typeof e == "string" && Wu.has(e);
+var yr = {}, Nt = {};
+Object.defineProperty(Nt, "__esModule", { value: !0 });
+Nt.getRules = Nt.isJSONType = void 0;
+const js = ["string", "number", "integer", "boolean", "null", "object", "array"], Ls = new Set(js);
+function As(e) {
+ return typeof e == "string" && Ls.has(e);
}
-Fr.isJSONType = Ju;
-function Zu() {
+Nt.isJSONType = As;
+function Rs() {
const e = {
number: { type: "number", rules: [] },
string: { type: "string", rules: [] },
@@ -1111,483 +1115,483 @@ function Zu() {
keywords: {}
};
}
-Fr.getRules = Zu;
-var mr = {};
-Object.defineProperty(mr, "__esModule", { value: !0 });
-mr.shouldUseRule = mr.shouldUseGroup = mr.schemaHasRulesForType = void 0;
-function Yu({ schema: e, self: t }, a) {
- const n = t.RULES.types[a];
- return n && n !== !0 && Dc(e, n);
+Nt.getRules = Rs;
+var pt = {};
+Object.defineProperty(pt, "__esModule", { value: !0 });
+pt.shouldUseRule = pt.shouldUseGroup = pt.schemaHasRulesForType = void 0;
+function Is({ schema: e, self: t }, r) {
+ const a = t.RULES.types[r];
+ return a && a !== !0 && lo(e, a);
}
-mr.schemaHasRulesForType = Yu;
-function Dc(e, t) {
- return t.rules.some((a) => zc(e, a));
+pt.schemaHasRulesForType = Is;
+function lo(e, t) {
+ return t.rules.some((r) => co(e, r));
}
-mr.shouldUseGroup = Dc;
-function zc(e, t) {
- var a;
- return e[t.keyword] !== void 0 || ((a = t.definition.implements) === null || a === void 0 ? void 0 : a.some((n) => e[n] !== void 0));
+pt.shouldUseGroup = lo;
+function co(e, t) {
+ var r;
+ return e[t.keyword] !== void 0 || ((r = t.definition.implements) === null || r === void 0 ? void 0 : r.some((a) => e[a] !== void 0));
}
-mr.shouldUseRule = zc;
+pt.shouldUseRule = co;
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
- const t = Fr, a = mr, n = Ka, s = we, c = $e;
- var p;
- (function(I) {
- I[I.Correct = 0] = "Correct", I[I.Wrong = 1] = "Wrong";
- })(p = e.DataType || (e.DataType = {}));
- function b(I) {
- const r = _(I.type);
- if (r.includes("null")) {
- if (I.nullable === !1)
+ const t = Nt, r = pt, a = br, s = ie, l = ce;
+ var d;
+ (function(R) {
+ R[R.Correct = 0] = "Correct", R[R.Wrong = 1] = "Wrong";
+ })(d = e.DataType || (e.DataType = {}));
+ function b(R) {
+ const n = _(R.type);
+ if (n.includes("null")) {
+ if (R.nullable === !1)
throw new Error("type: null contradicts nullable: false");
} else {
- if (!r.length && I.nullable !== void 0)
+ if (!n.length && R.nullable !== void 0)
throw new Error('"nullable" cannot be used without "type"');
- I.nullable === !0 && r.push("null");
+ R.nullable === !0 && n.push("null");
}
- return r;
+ return n;
}
e.getSchemaTypes = b;
- function _(I) {
- const r = Array.isArray(I) ? I : I ? [I] : [];
- if (r.every(t.isJSONType))
- return r;
- throw new Error("type must be JSONType or JSONType[]: " + r.join(","));
+ function _(R) {
+ const n = Array.isArray(R) ? R : R ? [R] : [];
+ if (n.every(t.isJSONType))
+ return n;
+ throw new Error("type must be JSONType or JSONType[]: " + n.join(","));
}
e.getJSONTypes = _;
- function y(I, r) {
- const { gen: i, data: o, opts: l } = I, u = S(r, l.coerceTypes), m = r.length > 0 && !(u.length === 0 && r.length === 1 && (0, a.schemaHasRulesForType)(I, r[0]));
- if (m) {
- const f = C(r, o, l.strictNumbers, p.Wrong);
- i.if(f, () => {
- u.length ? L(I, r, u) : v(I);
+ function y(R, n) {
+ const { gen: i, data: o, opts: c } = R, u = k(n, c.coerceTypes), f = n.length > 0 && !(u.length === 0 && n.length === 1 && (0, r.schemaHasRulesForType)(R, n[0]));
+ if (f) {
+ const g = C(n, o, c.strictNumbers, d.Wrong);
+ i.if(g, () => {
+ u.length ? N(R, n, u) : v(R);
});
}
- return m;
+ return f;
}
e.coerceAndCheckDataType = y;
- const g = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
- function S(I, r) {
- return r ? I.filter((i) => g.has(i) || r === "array" && i === "array") : [];
- }
- function L(I, r, i) {
- const { gen: o, data: l, opts: u } = I, m = o.let("dataType", (0, s._)`typeof ${l}`), f = o.let("coerced", (0, s._)`undefined`);
- u.coerceTypes === "array" && o.if((0, s._)`${m} == 'object' && Array.isArray(${l}) && ${l}.length == 1`, () => o.assign(l, (0, s._)`${l}[0]`).assign(m, (0, s._)`typeof ${l}`).if(C(r, l, u.strictNumbers), () => o.assign(f, l))), o.if((0, s._)`${f} !== undefined`);
- for (const B of i)
- (g.has(B) || B === "array" && u.coerceTypes === "array") && x(B);
- o.else(), v(I), o.endIf(), o.if((0, s._)`${f} !== undefined`, () => {
- o.assign(l, f), A(I, f);
+ const m = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
+ function k(R, n) {
+ return n ? R.filter((i) => m.has(i) || n === "array" && i === "array") : [];
+ }
+ function N(R, n, i) {
+ const { gen: o, data: c, opts: u } = R, f = o.let("dataType", (0, s._)`typeof ${c}`), g = o.let("coerced", (0, s._)`undefined`);
+ u.coerceTypes === "array" && o.if((0, s._)`${f} == 'object' && Array.isArray(${c}) && ${c}.length == 1`, () => o.assign(c, (0, s._)`${c}[0]`).assign(f, (0, s._)`typeof ${c}`).if(C(n, c, u.strictNumbers), () => o.assign(g, c))), o.if((0, s._)`${g} !== undefined`);
+ for (const z of i)
+ (m.has(z) || z === "array" && u.coerceTypes === "array") && O(z);
+ o.else(), v(R), o.endIf(), o.if((0, s._)`${g} !== undefined`, () => {
+ o.assign(c, g), A(R, g);
});
- function x(B) {
- switch (B) {
+ function O(z) {
+ switch (z) {
case "string":
- o.elseIf((0, s._)`${m} == "number" || ${m} == "boolean"`).assign(f, (0, s._)`"" + ${l}`).elseIf((0, s._)`${l} === null`).assign(f, (0, s._)`""`);
+ o.elseIf((0, s._)`${f} == "number" || ${f} == "boolean"`).assign(g, (0, s._)`"" + ${c}`).elseIf((0, s._)`${c} === null`).assign(g, (0, s._)`""`);
return;
case "number":
- o.elseIf((0, s._)`${m} == "boolean" || ${l} === null
- || (${m} == "string" && ${l} && ${l} == +${l})`).assign(f, (0, s._)`+${l}`);
+ o.elseIf((0, s._)`${f} == "boolean" || ${c} === null
+ || (${f} == "string" && ${c} && ${c} == +${c})`).assign(g, (0, s._)`+${c}`);
return;
case "integer":
- o.elseIf((0, s._)`${m} === "boolean" || ${l} === null
- || (${m} === "string" && ${l} && ${l} == +${l} && !(${l} % 1))`).assign(f, (0, s._)`+${l}`);
+ o.elseIf((0, s._)`${f} === "boolean" || ${c} === null
+ || (${f} === "string" && ${c} && ${c} == +${c} && !(${c} % 1))`).assign(g, (0, s._)`+${c}`);
return;
case "boolean":
- o.elseIf((0, s._)`${l} === "false" || ${l} === 0 || ${l} === null`).assign(f, !1).elseIf((0, s._)`${l} === "true" || ${l} === 1`).assign(f, !0);
+ o.elseIf((0, s._)`${c} === "false" || ${c} === 0 || ${c} === null`).assign(g, !1).elseIf((0, s._)`${c} === "true" || ${c} === 1`).assign(g, !0);
return;
case "null":
- o.elseIf((0, s._)`${l} === "" || ${l} === 0 || ${l} === false`), o.assign(f, null);
+ o.elseIf((0, s._)`${c} === "" || ${c} === 0 || ${c} === false`), o.assign(g, null);
return;
case "array":
- o.elseIf((0, s._)`${m} === "string" || ${m} === "number"
- || ${m} === "boolean" || ${l} === null`).assign(f, (0, s._)`[${l}]`);
+ o.elseIf((0, s._)`${f} === "string" || ${f} === "number"
+ || ${f} === "boolean" || ${c} === null`).assign(g, (0, s._)`[${c}]`);
}
}
}
- function A({ gen: I, parentData: r, parentDataProperty: i }, o) {
- I.if((0, s._)`${r} !== undefined`, () => I.assign((0, s._)`${r}[${i}]`, o));
+ function A({ gen: R, parentData: n, parentDataProperty: i }, o) {
+ R.if((0, s._)`${n} !== undefined`, () => R.assign((0, s._)`${n}[${i}]`, o));
}
- function N(I, r, i, o = p.Correct) {
- const l = o === p.Correct ? s.operators.EQ : s.operators.NEQ;
+ function j(R, n, i, o = d.Correct) {
+ const c = o === d.Correct ? s.operators.EQ : s.operators.NEQ;
let u;
- switch (I) {
+ switch (R) {
case "null":
- return (0, s._)`${r} ${l} null`;
+ return (0, s._)`${n} ${c} null`;
case "array":
- u = (0, s._)`Array.isArray(${r})`;
+ u = (0, s._)`Array.isArray(${n})`;
break;
case "object":
- u = (0, s._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;
+ u = (0, s._)`${n} && typeof ${n} == "object" && !Array.isArray(${n})`;
break;
case "integer":
- u = m((0, s._)`!(${r} % 1) && !isNaN(${r})`);
+ u = f((0, s._)`!(${n} % 1) && !isNaN(${n})`);
break;
case "number":
- u = m();
+ u = f();
break;
default:
- return (0, s._)`typeof ${r} ${l} ${I}`;
+ return (0, s._)`typeof ${n} ${c} ${R}`;
}
- return o === p.Correct ? u : (0, s.not)(u);
- function m(f = s.nil) {
- return (0, s.and)((0, s._)`typeof ${r} == "number"`, f, i ? (0, s._)`isFinite(${r})` : s.nil);
+ return o === d.Correct ? u : (0, s.not)(u);
+ function f(g = s.nil) {
+ return (0, s.and)((0, s._)`typeof ${n} == "number"`, g, i ? (0, s._)`isFinite(${n})` : s.nil);
}
}
- e.checkDataType = N;
- function C(I, r, i, o) {
- if (I.length === 1)
- return N(I[0], r, i, o);
- let l;
- const u = (0, c.toHash)(I);
+ e.checkDataType = j;
+ function C(R, n, i, o) {
+ if (R.length === 1)
+ return j(R[0], n, i, o);
+ let c;
+ const u = (0, l.toHash)(R);
if (u.array && u.object) {
- const m = (0, s._)`typeof ${r} != "object"`;
- l = u.null ? m : (0, s._)`!${r} || ${m}`, delete u.null, delete u.array, delete u.object;
+ const f = (0, s._)`typeof ${n} != "object"`;
+ c = u.null ? f : (0, s._)`!${n} || ${f}`, delete u.null, delete u.array, delete u.object;
} else
- l = s.nil;
+ c = s.nil;
u.number && delete u.integer;
- for (const m in u)
- l = (0, s.and)(l, N(m, r, i, o));
- return l;
+ for (const f in u)
+ c = (0, s.and)(c, j(f, n, i, o));
+ return c;
}
e.checkDataTypes = C;
- const T = {
- message: ({ schema: I }) => `must be ${I}`,
- params: ({ schema: I, schemaValue: r }) => typeof I == "string" ? (0, s._)`{type: ${I}}` : (0, s._)`{type: ${r}}`
+ const x = {
+ message: ({ schema: R }) => `must be ${R}`,
+ params: ({ schema: R, schemaValue: n }) => typeof R == "string" ? (0, s._)`{type: ${R}}` : (0, s._)`{type: ${n}}`
};
- function v(I) {
- const r = j(I);
- (0, n.reportError)(r, T);
+ function v(R) {
+ const n = T(R);
+ (0, a.reportError)(n, x);
}
e.reportTypeError = v;
- function j(I) {
- const { gen: r, data: i, schema: o } = I, l = (0, c.schemaRefOrVal)(I, o, "type");
+ function T(R) {
+ const { gen: n, data: i, schema: o } = R, c = (0, l.schemaRefOrVal)(R, o, "type");
return {
- gen: r,
+ gen: n,
keyword: "type",
data: i,
schema: o.type,
- schemaCode: l,
- schemaValue: l,
+ schemaCode: c,
+ schemaValue: c,
parentSchema: o,
params: {},
- it: I
+ it: R
};
}
-})(Wa);
-var Fn = {};
-Object.defineProperty(Fn, "__esModule", { value: !0 });
-Fn.assignDefaults = void 0;
-const Gr = we, Qu = $e;
-function Xu(e, t) {
- const { properties: a, items: n } = e.schema;
- if (t === "object" && a)
- for (const s in a)
- yi(e, s, a[s].default);
+})(yr);
+var Zr = {};
+Object.defineProperty(Zr, "__esModule", { value: !0 });
+Zr.assignDefaults = void 0;
+const Bt = ie, Ms = ce;
+function Ds(e, t) {
+ const { properties: r, items: a } = e.schema;
+ if (t === "object" && r)
+ for (const s in r)
+ wn(e, s, r[s].default);
else
- t === "array" && Array.isArray(n) && n.forEach((s, c) => yi(e, c, s.default));
+ t === "array" && Array.isArray(a) && a.forEach((s, l) => wn(e, l, s.default));
}
-Fn.assignDefaults = Xu;
-function yi(e, t, a) {
- const { gen: n, compositeRule: s, data: c, opts: p } = e;
- if (a === void 0)
+Zr.assignDefaults = Ds;
+function wn(e, t, r) {
+ const { gen: a, compositeRule: s, data: l, opts: d } = e;
+ if (r === void 0)
return;
- const b = (0, Gr._)`${c}${(0, Gr.getProperty)(t)}`;
+ const b = (0, Bt._)`${l}${(0, Bt.getProperty)(t)}`;
if (s) {
- (0, Qu.checkStrictMode)(e, `default is ignored for: ${b}`);
+ (0, Ms.checkStrictMode)(e, `default is ignored for: ${b}`);
return;
}
- let _ = (0, Gr._)`${b} === undefined`;
- p.useDefaults === "empty" && (_ = (0, Gr._)`${_} || ${b} === null || ${b} === ""`), n.if(_, (0, Gr._)`${b} = ${(0, Gr.stringify)(a)}`);
-}
-var sr = {}, be = {};
-Object.defineProperty(be, "__esModule", { value: !0 });
-be.validateUnion = be.validateArray = be.usePattern = be.callValidateCode = be.schemaProperties = be.allSchemaProperties = be.noPropertyInData = be.propertyInData = be.isOwnProperty = be.hasPropFunc = be.reportMissingProp = be.checkMissingProp = be.checkReportMissingProp = void 0;
-const Ae = we, zo = $e, _r = cr, ed = $e;
-function td(e, t) {
- const { gen: a, data: n, it: s } = e;
- a.if(Vo(a, n, t, s.opts.ownProperties), () => {
- e.setParams({ missingProperty: (0, Ae._)`${t}` }, !0), e.error();
+ let _ = (0, Bt._)`${b} === undefined`;
+ d.useDefaults === "empty" && (_ = (0, Bt._)`${_} || ${b} === null || ${b} === ""`), a.if(_, (0, Bt._)`${b} = ${(0, Bt.stringify)(r)}`);
+}
+var lt = {}, se = {};
+Object.defineProperty(se, "__esModule", { value: !0 });
+se.validateUnion = se.validateArray = se.usePattern = se.callValidateCode = se.schemaProperties = se.allSchemaProperties = se.noPropertyInData = se.propertyInData = se.isOwnProperty = se.hasPropFunc = se.reportMissingProp = se.checkMissingProp = se.checkReportMissingProp = void 0;
+const _e = ie, ba = ce, mt = ct, Bs = ce;
+function zs(e, t) {
+ const { gen: r, data: a, it: s } = e;
+ r.if(_a(r, a, t, s.opts.ownProperties), () => {
+ e.setParams({ missingProperty: (0, _e._)`${t}` }, !0), e.error();
});
}
-be.checkReportMissingProp = td;
-function rd({ gen: e, data: t, it: { opts: a } }, n, s) {
- return (0, Ae.or)(...n.map((c) => (0, Ae.and)(Vo(e, t, c, a.ownProperties), (0, Ae._)`${s} = ${c}`)));
+se.checkReportMissingProp = zs;
+function Vs({ gen: e, data: t, it: { opts: r } }, a, s) {
+ return (0, _e.or)(...a.map((l) => (0, _e.and)(_a(e, t, l, r.ownProperties), (0, _e._)`${s} = ${l}`)));
}
-be.checkMissingProp = rd;
-function ad(e, t) {
+se.checkMissingProp = Vs;
+function Fs(e, t) {
e.setParams({ missingProperty: t }, !0), e.error();
}
-be.reportMissingProp = ad;
-function Bc(e) {
+se.reportMissingProp = Fs;
+function uo(e) {
return e.scopeValue("func", {
// eslint-disable-next-line @typescript-eslint/unbound-method
ref: Object.prototype.hasOwnProperty,
- code: (0, Ae._)`Object.prototype.hasOwnProperty`
+ code: (0, _e._)`Object.prototype.hasOwnProperty`
});
}
-be.hasPropFunc = Bc;
-function Bo(e, t, a) {
- return (0, Ae._)`${Bc(e)}.call(${t}, ${a})`;
+se.hasPropFunc = uo;
+function ya(e, t, r) {
+ return (0, _e._)`${uo(e)}.call(${t}, ${r})`;
}
-be.isOwnProperty = Bo;
-function nd(e, t, a, n) {
- const s = (0, Ae._)`${t}${(0, Ae.getProperty)(a)} !== undefined`;
- return n ? (0, Ae._)`${s} && ${Bo(e, t, a)}` : s;
+se.isOwnProperty = ya;
+function qs(e, t, r, a) {
+ const s = (0, _e._)`${t}${(0, _e.getProperty)(r)} !== undefined`;
+ return a ? (0, _e._)`${s} && ${ya(e, t, r)}` : s;
}
-be.propertyInData = nd;
-function Vo(e, t, a, n) {
- const s = (0, Ae._)`${t}${(0, Ae.getProperty)(a)} === undefined`;
- return n ? (0, Ae.or)(s, (0, Ae.not)(Bo(e, t, a))) : s;
+se.propertyInData = qs;
+function _a(e, t, r, a) {
+ const s = (0, _e._)`${t}${(0, _e.getProperty)(r)} === undefined`;
+ return a ? (0, _e.or)(s, (0, _e.not)(ya(e, t, r))) : s;
}
-be.noPropertyInData = Vo;
-function Vc(e) {
+se.noPropertyInData = _a;
+function ho(e) {
return e ? Object.keys(e).filter((t) => t !== "__proto__") : [];
}
-be.allSchemaProperties = Vc;
-function od(e, t) {
- return Vc(t).filter((a) => !(0, zo.alwaysValidSchema)(e, t[a]));
-}
-be.schemaProperties = od;
-function sd({ schemaCode: e, data: t, it: { gen: a, topSchemaRef: n, schemaPath: s, errorPath: c }, it: p }, b, _, y) {
- const g = y ? (0, Ae._)`${e}, ${t}, ${n}${s}` : t, S = [
- [_r.default.instancePath, (0, Ae.strConcat)(_r.default.instancePath, c)],
- [_r.default.parentData, p.parentData],
- [_r.default.parentDataProperty, p.parentDataProperty],
- [_r.default.rootData, _r.default.rootData]
+se.allSchemaProperties = ho;
+function Us(e, t) {
+ return ho(t).filter((r) => !(0, ba.alwaysValidSchema)(e, t[r]));
+}
+se.schemaProperties = Us;
+function Gs({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: a, schemaPath: s, errorPath: l }, it: d }, b, _, y) {
+ const m = y ? (0, _e._)`${e}, ${t}, ${a}${s}` : t, k = [
+ [mt.default.instancePath, (0, _e.strConcat)(mt.default.instancePath, l)],
+ [mt.default.parentData, d.parentData],
+ [mt.default.parentDataProperty, d.parentDataProperty],
+ [mt.default.rootData, mt.default.rootData]
];
- p.opts.dynamicRef && S.push([_r.default.dynamicAnchors, _r.default.dynamicAnchors]);
- const L = (0, Ae._)`${g}, ${a.object(...S)}`;
- return _ !== Ae.nil ? (0, Ae._)`${b}.call(${_}, ${L})` : (0, Ae._)`${b}(${L})`;
-}
-be.callValidateCode = sd;
-const id = (0, Ae._)`new RegExp`;
-function cd({ gen: e, it: { opts: t } }, a) {
- const n = t.unicodeRegExp ? "u" : "", { regExp: s } = t.code, c = s(a, n);
+ d.opts.dynamicRef && k.push([mt.default.dynamicAnchors, mt.default.dynamicAnchors]);
+ const N = (0, _e._)`${m}, ${r.object(...k)}`;
+ return _ !== _e.nil ? (0, _e._)`${b}.call(${_}, ${N})` : (0, _e._)`${b}(${N})`;
+}
+se.callValidateCode = Gs;
+const Hs = (0, _e._)`new RegExp`;
+function Ks({ gen: e, it: { opts: t } }, r) {
+ const a = t.unicodeRegExp ? "u" : "", { regExp: s } = t.code, l = s(r, a);
return e.scopeValue("pattern", {
- key: c.toString(),
- ref: c,
- code: (0, Ae._)`${s.code === "new RegExp" ? id : (0, ed.useFunc)(e, s)}(${a}, ${n})`
+ key: l.toString(),
+ ref: l,
+ code: (0, _e._)`${s.code === "new RegExp" ? Hs : (0, Bs.useFunc)(e, s)}(${r}, ${a})`
});
}
-be.usePattern = cd;
-function ld(e) {
- const { gen: t, data: a, keyword: n, it: s } = e, c = t.name("valid");
+se.usePattern = Ks;
+function Ws(e) {
+ const { gen: t, data: r, keyword: a, it: s } = e, l = t.name("valid");
if (s.allErrors) {
const b = t.let("valid", !0);
- return p(() => t.assign(b, !1)), b;
+ return d(() => t.assign(b, !1)), b;
}
- return t.var(c, !0), p(() => t.break()), c;
- function p(b) {
- const _ = t.const("len", (0, Ae._)`${a}.length`);
+ return t.var(l, !0), d(() => t.break()), l;
+ function d(b) {
+ const _ = t.const("len", (0, _e._)`${r}.length`);
t.forRange("i", 0, _, (y) => {
e.subschema({
- keyword: n,
+ keyword: a,
dataProp: y,
- dataPropType: zo.Type.Num
- }, c), t.if((0, Ae.not)(c), b);
+ dataPropType: ba.Type.Num
+ }, l), t.if((0, _e.not)(l), b);
});
}
}
-be.validateArray = ld;
-function ud(e) {
- const { gen: t, schema: a, keyword: n, it: s } = e;
- if (!Array.isArray(a))
+se.validateArray = Ws;
+function Js(e) {
+ const { gen: t, schema: r, keyword: a, it: s } = e;
+ if (!Array.isArray(r))
throw new Error("ajv implementation error");
- if (a.some((b) => (0, zo.alwaysValidSchema)(s, b)) && !s.opts.unevaluated)
+ if (r.some((b) => (0, ba.alwaysValidSchema)(s, b)) && !s.opts.unevaluated)
return;
- const c = t.let("valid", !1), p = t.name("_valid");
- t.block(() => a.forEach((b, _) => {
+ const l = t.let("valid", !1), d = t.name("_valid");
+ t.block(() => r.forEach((b, _) => {
const y = e.subschema({
- keyword: n,
+ keyword: a,
schemaProp: _,
compositeRule: !0
- }, p);
- t.assign(c, (0, Ae._)`${c} || ${p}`), e.mergeValidEvaluated(y, p) || t.if((0, Ae.not)(c));
- })), e.result(c, () => e.reset(), () => e.error(!0));
-}
-be.validateUnion = ud;
-Object.defineProperty(sr, "__esModule", { value: !0 });
-sr.validateKeywordUsage = sr.validSchemaType = sr.funcKeywordCode = sr.macroKeywordCode = void 0;
-const ut = we, Ar = cr, dd = be, hd = Ka;
-function pd(e, t) {
- const { gen: a, keyword: n, schema: s, parentSchema: c, it: p } = e, b = t.macro.call(p.self, s, c, p), _ = Fc(a, n, b);
- p.opts.validateSchema !== !1 && p.self.validateSchema(b, !0);
- const y = a.name("valid");
+ }, d);
+ t.assign(l, (0, _e._)`${l} || ${d}`), e.mergeValidEvaluated(y, d) || t.if((0, _e.not)(l));
+ })), e.result(l, () => e.reset(), () => e.error(!0));
+}
+se.validateUnion = Js;
+Object.defineProperty(lt, "__esModule", { value: !0 });
+lt.validateKeywordUsage = lt.validSchemaType = lt.funcKeywordCode = lt.macroKeywordCode = void 0;
+const Ne = ie, Ct = ct, Zs = se, Ys = br;
+function Qs(e, t) {
+ const { gen: r, keyword: a, schema: s, parentSchema: l, it: d } = e, b = t.macro.call(d.self, s, l, d), _ = po(r, a, b);
+ d.opts.validateSchema !== !1 && d.self.validateSchema(b, !0);
+ const y = r.name("valid");
e.subschema({
schema: b,
- schemaPath: ut.nil,
- errSchemaPath: `${p.errSchemaPath}/${n}`,
+ schemaPath: Ne.nil,
+ errSchemaPath: `${d.errSchemaPath}/${a}`,
topSchemaRef: _,
compositeRule: !0
}, y), e.pass(y, () => e.error(!0));
}
-sr.macroKeywordCode = pd;
-function fd(e, t) {
- var a;
- const { gen: n, keyword: s, schema: c, parentSchema: p, $data: b, it: _ } = e;
- gd(_, t);
- const y = !b && t.compile ? t.compile.call(_.self, c, p, _) : t.validate, g = Fc(n, s, y), S = n.let("valid");
- e.block$data(S, L), e.ok((a = t.valid) !== null && a !== void 0 ? a : S);
- function L() {
+lt.macroKeywordCode = Qs;
+function Xs(e, t) {
+ var r;
+ const { gen: a, keyword: s, schema: l, parentSchema: d, $data: b, it: _ } = e;
+ ti(_, t);
+ const y = !b && t.compile ? t.compile.call(_.self, l, d, _) : t.validate, m = po(a, s, y), k = a.let("valid");
+ e.block$data(k, N), e.ok((r = t.valid) !== null && r !== void 0 ? r : k);
+ function N() {
if (t.errors === !1)
- C(), t.modifying && bi(e), T(() => e.error());
+ C(), t.modifying && vn(e), x(() => e.error());
else {
- const v = t.async ? A() : N();
- t.modifying && bi(e), T(() => md(e, v));
+ const v = t.async ? A() : j();
+ t.modifying && vn(e), x(() => ei(e, v));
}
}
function A() {
- const v = n.let("ruleErrs", null);
- return n.try(() => C((0, ut._)`await `), (j) => n.assign(S, !1).if((0, ut._)`${j} instanceof ${_.ValidationError}`, () => n.assign(v, (0, ut._)`${j}.errors`), () => n.throw(j))), v;
+ const v = a.let("ruleErrs", null);
+ return a.try(() => C((0, Ne._)`await `), (T) => a.assign(k, !1).if((0, Ne._)`${T} instanceof ${_.ValidationError}`, () => a.assign(v, (0, Ne._)`${T}.errors`), () => a.throw(T))), v;
}
- function N() {
- const v = (0, ut._)`${g}.errors`;
- return n.assign(v, null), C(ut.nil), v;
+ function j() {
+ const v = (0, Ne._)`${m}.errors`;
+ return a.assign(v, null), C(Ne.nil), v;
}
- function C(v = t.async ? (0, ut._)`await ` : ut.nil) {
- const j = _.opts.passContext ? Ar.default.this : Ar.default.self, I = !("compile" in t && !b || t.schema === !1);
- n.assign(S, (0, ut._)`${v}${(0, dd.callValidateCode)(e, g, j, I)}`, t.modifying);
+ function C(v = t.async ? (0, Ne._)`await ` : Ne.nil) {
+ const T = _.opts.passContext ? Ct.default.this : Ct.default.self, R = !("compile" in t && !b || t.schema === !1);
+ a.assign(k, (0, Ne._)`${v}${(0, Zs.callValidateCode)(e, m, T, R)}`, t.modifying);
}
- function T(v) {
- var j;
- n.if((0, ut.not)((j = t.valid) !== null && j !== void 0 ? j : S), v);
+ function x(v) {
+ var T;
+ a.if((0, Ne.not)((T = t.valid) !== null && T !== void 0 ? T : k), v);
}
}
-sr.funcKeywordCode = fd;
-function bi(e) {
- const { gen: t, data: a, it: n } = e;
- t.if(n.parentData, () => t.assign(a, (0, ut._)`${n.parentData}[${n.parentDataProperty}]`));
+lt.funcKeywordCode = Xs;
+function vn(e) {
+ const { gen: t, data: r, it: a } = e;
+ t.if(a.parentData, () => t.assign(r, (0, Ne._)`${a.parentData}[${a.parentDataProperty}]`));
}
-function md(e, t) {
- const { gen: a } = e;
- a.if((0, ut._)`Array.isArray(${t})`, () => {
- a.assign(Ar.default.vErrors, (0, ut._)`${Ar.default.vErrors} === null ? ${t} : ${Ar.default.vErrors}.concat(${t})`).assign(Ar.default.errors, (0, ut._)`${Ar.default.vErrors}.length`), (0, hd.extendErrors)(e);
+function ei(e, t) {
+ const { gen: r } = e;
+ r.if((0, Ne._)`Array.isArray(${t})`, () => {
+ r.assign(Ct.default.vErrors, (0, Ne._)`${Ct.default.vErrors} === null ? ${t} : ${Ct.default.vErrors}.concat(${t})`).assign(Ct.default.errors, (0, Ne._)`${Ct.default.vErrors}.length`), (0, Ys.extendErrors)(e);
}, () => e.error());
}
-function gd({ schemaEnv: e }, t) {
+function ti({ schemaEnv: e }, t) {
if (t.async && !e.$async)
throw new Error("async keyword in sync schema");
}
-function Fc(e, t, a) {
- if (a === void 0)
+function po(e, t, r) {
+ if (r === void 0)
throw new Error(`keyword "${t}" failed to compile`);
- return e.scopeValue("keyword", typeof a == "function" ? { ref: a } : { ref: a, code: (0, ut.stringify)(a) });
+ return e.scopeValue("keyword", typeof r == "function" ? { ref: r } : { ref: r, code: (0, Ne.stringify)(r) });
}
-function yd(e, t, a = !1) {
- return !t.length || t.some((n) => n === "array" ? Array.isArray(e) : n === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == n || a && typeof e > "u");
+function ri(e, t, r = !1) {
+ return !t.length || t.some((a) => a === "array" ? Array.isArray(e) : a === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == a || r && typeof e > "u");
}
-sr.validSchemaType = yd;
-function bd({ schema: e, opts: t, self: a, errSchemaPath: n }, s, c) {
- if (Array.isArray(s.keyword) ? !s.keyword.includes(c) : s.keyword !== c)
+lt.validSchemaType = ri;
+function ai({ schema: e, opts: t, self: r, errSchemaPath: a }, s, l) {
+ if (Array.isArray(s.keyword) ? !s.keyword.includes(l) : s.keyword !== l)
throw new Error("ajv implementation error");
- const p = s.dependencies;
- if (p != null && p.some((b) => !Object.prototype.hasOwnProperty.call(e, b)))
- throw new Error(`parent schema must have dependencies of ${c}: ${p.join(",")}`);
- if (s.validateSchema && !s.validateSchema(e[c])) {
- const b = `keyword "${c}" value is invalid at path "${n}": ` + a.errorsText(s.validateSchema.errors);
+ const d = s.dependencies;
+ if (d != null && d.some((b) => !Object.prototype.hasOwnProperty.call(e, b)))
+ throw new Error(`parent schema must have dependencies of ${l}: ${d.join(",")}`);
+ if (s.validateSchema && !s.validateSchema(e[l])) {
+ const b = `keyword "${l}" value is invalid at path "${a}": ` + r.errorsText(s.validateSchema.errors);
if (t.validateSchema === "log")
- a.logger.error(b);
+ r.logger.error(b);
else
throw new Error(b);
}
}
-sr.validateKeywordUsage = bd;
-var Tr = {};
-Object.defineProperty(Tr, "__esModule", { value: !0 });
-Tr.extendSubschemaMode = Tr.extendSubschemaData = Tr.getSubschema = void 0;
-const nr = we, Uc = $e;
-function _d(e, { keyword: t, schemaProp: a, schema: n, schemaPath: s, errSchemaPath: c, topSchemaRef: p }) {
- if (t !== void 0 && n !== void 0)
+lt.validateKeywordUsage = ai;
+var _t = {};
+Object.defineProperty(_t, "__esModule", { value: !0 });
+_t.extendSubschemaMode = _t.extendSubschemaData = _t.getSubschema = void 0;
+const it = ie, fo = ce;
+function ni(e, { keyword: t, schemaProp: r, schema: a, schemaPath: s, errSchemaPath: l, topSchemaRef: d }) {
+ if (t !== void 0 && a !== void 0)
throw new Error('both "keyword" and "schema" passed, only one allowed');
if (t !== void 0) {
const b = e.schema[t];
- return a === void 0 ? {
+ return r === void 0 ? {
schema: b,
- schemaPath: (0, nr._)`${e.schemaPath}${(0, nr.getProperty)(t)}`,
+ schemaPath: (0, it._)`${e.schemaPath}${(0, it.getProperty)(t)}`,
errSchemaPath: `${e.errSchemaPath}/${t}`
} : {
- schema: b[a],
- schemaPath: (0, nr._)`${e.schemaPath}${(0, nr.getProperty)(t)}${(0, nr.getProperty)(a)}`,
- errSchemaPath: `${e.errSchemaPath}/${t}/${(0, Uc.escapeFragment)(a)}`
+ schema: b[r],
+ schemaPath: (0, it._)`${e.schemaPath}${(0, it.getProperty)(t)}${(0, it.getProperty)(r)}`,
+ errSchemaPath: `${e.errSchemaPath}/${t}/${(0, fo.escapeFragment)(r)}`
};
}
- if (n !== void 0) {
- if (s === void 0 || c === void 0 || p === void 0)
+ if (a !== void 0) {
+ if (s === void 0 || l === void 0 || d === void 0)
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
return {
- schema: n,
+ schema: a,
schemaPath: s,
- topSchemaRef: p,
- errSchemaPath: c
+ topSchemaRef: d,
+ errSchemaPath: l
};
}
throw new Error('either "keyword" or "schema" must be passed');
}
-Tr.getSubschema = _d;
-function wd(e, t, { dataProp: a, dataPropType: n, data: s, dataTypes: c, propertyName: p }) {
- if (s !== void 0 && a !== void 0)
+_t.getSubschema = ni;
+function oi(e, t, { dataProp: r, dataPropType: a, data: s, dataTypes: l, propertyName: d }) {
+ if (s !== void 0 && r !== void 0)
throw new Error('both "data" and "dataProp" passed, only one allowed');
const { gen: b } = t;
- if (a !== void 0) {
- const { errorPath: y, dataPathArr: g, opts: S } = t, L = b.let("data", (0, nr._)`${t.data}${(0, nr.getProperty)(a)}`, !0);
- _(L), e.errorPath = (0, nr.str)`${y}${(0, Uc.getErrorPath)(a, n, S.jsPropertySyntax)}`, e.parentDataProperty = (0, nr._)`${a}`, e.dataPathArr = [...g, e.parentDataProperty];
+ if (r !== void 0) {
+ const { errorPath: y, dataPathArr: m, opts: k } = t, N = b.let("data", (0, it._)`${t.data}${(0, it.getProperty)(r)}`, !0);
+ _(N), e.errorPath = (0, it.str)`${y}${(0, fo.getErrorPath)(r, a, k.jsPropertySyntax)}`, e.parentDataProperty = (0, it._)`${r}`, e.dataPathArr = [...m, e.parentDataProperty];
}
if (s !== void 0) {
- const y = s instanceof nr.Name ? s : b.let("data", s, !0);
- _(y), p !== void 0 && (e.propertyName = p);
+ const y = s instanceof it.Name ? s : b.let("data", s, !0);
+ _(y), d !== void 0 && (e.propertyName = d);
}
- c && (e.dataTypes = c);
+ l && (e.dataTypes = l);
function _(y) {
e.data = y, e.dataLevel = t.dataLevel + 1, e.dataTypes = [], t.definedProperties = /* @__PURE__ */ new Set(), e.parentData = t.data, e.dataNames = [...t.dataNames, y];
}
}
-Tr.extendSubschemaData = wd;
-function vd(e, { jtdDiscriminator: t, jtdMetadata: a, compositeRule: n, createErrors: s, allErrors: c }) {
- n !== void 0 && (e.compositeRule = n), s !== void 0 && (e.createErrors = s), c !== void 0 && (e.allErrors = c), e.jtdDiscriminator = t, e.jtdMetadata = a;
+_t.extendSubschemaData = oi;
+function si(e, { jtdDiscriminator: t, jtdMetadata: r, compositeRule: a, createErrors: s, allErrors: l }) {
+ a !== void 0 && (e.compositeRule = a), s !== void 0 && (e.createErrors = s), l !== void 0 && (e.allErrors = l), e.jtdDiscriminator = t, e.jtdMetadata = r;
}
-Tr.extendSubschemaMode = vd;
-var tt = {}, qc = function e(t, a) {
- if (t === a)
+_t.extendSubschemaMode = si;
+var xe = {}, mo = function e(t, r) {
+ if (t === r)
return !0;
- if (t && a && typeof t == "object" && typeof a == "object") {
- if (t.constructor !== a.constructor)
+ if (t && r && typeof t == "object" && typeof r == "object") {
+ if (t.constructor !== r.constructor)
return !1;
- var n, s, c;
+ var a, s, l;
if (Array.isArray(t)) {
- if (n = t.length, n != a.length)
+ if (a = t.length, a != r.length)
return !1;
- for (s = n; s-- !== 0; )
- if (!e(t[s], a[s]))
+ for (s = a; s-- !== 0; )
+ if (!e(t[s], r[s]))
return !1;
return !0;
}
if (t.constructor === RegExp)
- return t.source === a.source && t.flags === a.flags;
+ return t.source === r.source && t.flags === r.flags;
if (t.valueOf !== Object.prototype.valueOf)
- return t.valueOf() === a.valueOf();
+ return t.valueOf() === r.valueOf();
if (t.toString !== Object.prototype.toString)
- return t.toString() === a.toString();
- if (c = Object.keys(t), n = c.length, n !== Object.keys(a).length)
+ return t.toString() === r.toString();
+ if (l = Object.keys(t), a = l.length, a !== Object.keys(r).length)
return !1;
- for (s = n; s-- !== 0; )
- if (!Object.prototype.hasOwnProperty.call(a, c[s]))
+ for (s = a; s-- !== 0; )
+ if (!Object.prototype.hasOwnProperty.call(r, l[s]))
return !1;
- for (s = n; s-- !== 0; ) {
- var p = c[s];
- if (!e(t[p], a[p]))
+ for (s = a; s-- !== 0; ) {
+ var d = l[s];
+ if (!e(t[d], r[d]))
return !1;
}
return !0;
}
- return t !== t && a !== a;
-}, Hc = { exports: {} }, Sr = Hc.exports = function(e, t, a) {
- typeof t == "function" && (a = t, t = {}), a = t.cb || a;
- var n = typeof a == "function" ? a : a.pre || function() {
- }, s = a.post || function() {
+ return t !== t && r !== r;
+}, go = { exports: {} }, yt = go.exports = function(e, t, r) {
+ typeof t == "function" && (r = t, t = {}), r = t.cb || r;
+ var a = typeof r == "function" ? r : r.pre || function() {
+ }, s = r.post || function() {
};
- yn(t, n, s, e, "", e);
+ Ar(t, a, s, e, "", e);
};
-Sr.keywords = {
+yt.keywords = {
additionalItems: !0,
items: !0,
contains: !0,
@@ -1598,20 +1602,20 @@ Sr.keywords = {
then: !0,
else: !0
};
-Sr.arrayKeywords = {
+yt.arrayKeywords = {
items: !0,
allOf: !0,
anyOf: !0,
oneOf: !0
};
-Sr.propsKeywords = {
+yt.propsKeywords = {
$defs: !0,
definitions: !0,
properties: !0,
patternProperties: !0,
dependencies: !0
};
-Sr.skipKeywords = {
+yt.skipKeywords = {
default: !0,
enum: !0,
const: !0,
@@ -1631,32 +1635,32 @@ Sr.skipKeywords = {
maxProperties: !0,
minProperties: !0
};
-function yn(e, t, a, n, s, c, p, b, _, y) {
- if (n && typeof n == "object" && !Array.isArray(n)) {
- t(n, s, c, p, b, _, y);
- for (var g in n) {
- var S = n[g];
- if (Array.isArray(S)) {
- if (g in Sr.arrayKeywords)
- for (var L = 0; L < S.length; L++)
- yn(e, t, a, S[L], s + "/" + g + "/" + L, c, s, g, n, L);
- } else if (g in Sr.propsKeywords) {
- if (S && typeof S == "object")
- for (var A in S)
- yn(e, t, a, S[A], s + "/" + g + "/" + $d(A), c, s, g, n, A);
+function Ar(e, t, r, a, s, l, d, b, _, y) {
+ if (a && typeof a == "object" && !Array.isArray(a)) {
+ t(a, s, l, d, b, _, y);
+ for (var m in a) {
+ var k = a[m];
+ if (Array.isArray(k)) {
+ if (m in yt.arrayKeywords)
+ for (var N = 0; N < k.length; N++)
+ Ar(e, t, r, k[N], s + "/" + m + "/" + N, l, s, m, a, N);
+ } else if (m in yt.propsKeywords) {
+ if (k && typeof k == "object")
+ for (var A in k)
+ Ar(e, t, r, k[A], s + "/" + m + "/" + ii(A), l, s, m, a, A);
} else
- (g in Sr.keywords || e.allKeys && !(g in Sr.skipKeywords)) && yn(e, t, a, S, s + "/" + g, c, s, g, n);
+ (m in yt.keywords || e.allKeys && !(m in yt.skipKeywords)) && Ar(e, t, r, k, s + "/" + m, l, s, m, a);
}
- a(n, s, c, p, b, _, y);
+ r(a, s, l, d, b, _, y);
}
}
-function $d(e) {
+function ii(e) {
return e.replace(/~/g, "~0").replace(/\//g, "~1");
}
-var kd = Hc.exports;
-Object.defineProperty(tt, "__esModule", { value: !0 });
-tt.getSchemaRefs = tt.resolveUrl = tt.normalizeId = tt._getFullPath = tt.getFullPath = tt.inlineRef = void 0;
-const Ed = $e, Pd = qc, Sd = kd, xd = /* @__PURE__ */ new Set([
+var li = go.exports;
+Object.defineProperty(xe, "__esModule", { value: !0 });
+xe.getSchemaRefs = xe.resolveUrl = xe.normalizeId = xe._getFullPath = xe.getFullPath = xe.inlineRef = void 0;
+const ci = ce, ui = mo, di = li, hi = /* @__PURE__ */ new Set([
"type",
"format",
"pattern",
@@ -1674,275 +1678,275 @@ const Ed = $e, Pd = qc, Sd = kd, xd = /* @__PURE__ */ new Set([
"enum",
"const"
]);
-function Td(e, t = !0) {
- return typeof e == "boolean" ? !0 : t === !0 ? !ko(e) : t ? Gc(e) <= t : !1;
+function pi(e, t = !0) {
+ return typeof e == "boolean" ? !0 : t === !0 ? !ua(e) : t ? bo(e) <= t : !1;
}
-tt.inlineRef = Td;
-const jd = /* @__PURE__ */ new Set([
+xe.inlineRef = pi;
+const fi = /* @__PURE__ */ new Set([
"$ref",
"$recursiveRef",
"$recursiveAnchor",
"$dynamicRef",
"$dynamicAnchor"
]);
-function ko(e) {
+function ua(e) {
for (const t in e) {
- if (jd.has(t))
+ if (fi.has(t))
return !0;
- const a = e[t];
- if (Array.isArray(a) && a.some(ko) || typeof a == "object" && ko(a))
+ const r = e[t];
+ if (Array.isArray(r) && r.some(ua) || typeof r == "object" && ua(r))
return !0;
}
return !1;
}
-function Gc(e) {
+function bo(e) {
let t = 0;
- for (const a in e)
- if (a === "$ref" || (t++, !xd.has(a) && (typeof e[a] == "object" && (0, Ed.eachItem)(e[a], (n) => t += Gc(n)), t === 1 / 0)))
+ for (const r in e)
+ if (r === "$ref" || (t++, !hi.has(r) && (typeof e[r] == "object" && (0, ci.eachItem)(e[r], (a) => t += bo(a)), t === 1 / 0)))
return 1 / 0;
return t;
}
-function Kc(e, t = "", a) {
- a !== !1 && (t = ta(t));
- const n = e.parse(t);
- return Wc(e, n);
+function yo(e, t = "", r) {
+ r !== !1 && (t = qt(t));
+ const a = e.parse(t);
+ return _o(e, a);
}
-tt.getFullPath = Kc;
-function Wc(e, t) {
+xe.getFullPath = yo;
+function _o(e, t) {
return e.serialize(t).split("#")[0] + "#";
}
-tt._getFullPath = Wc;
-const Cd = /#\/?$/;
-function ta(e) {
- return e ? e.replace(Cd, "") : "";
+xe._getFullPath = _o;
+const mi = /#\/?$/;
+function qt(e) {
+ return e ? e.replace(mi, "") : "";
}
-tt.normalizeId = ta;
-function Od(e, t, a) {
- return a = ta(a), e.resolve(t, a);
+xe.normalizeId = qt;
+function gi(e, t, r) {
+ return r = qt(r), e.resolve(t, r);
}
-tt.resolveUrl = Od;
-const Nd = /^[a-z_][-a-z0-9._]*$/i;
-function Ld(e, t) {
+xe.resolveUrl = gi;
+const bi = /^[a-z_][-a-z0-9._]*$/i;
+function yi(e, t) {
if (typeof e == "boolean")
return {};
- const { schemaId: a, uriResolver: n } = this.opts, s = ta(e[a] || t), c = { "": s }, p = Kc(n, s, !1), b = {}, _ = /* @__PURE__ */ new Set();
- return Sd(e, { allKeys: !0 }, (S, L, A, N) => {
- if (N === void 0)
+ const { schemaId: r, uriResolver: a } = this.opts, s = qt(e[r] || t), l = { "": s }, d = yo(a, s, !1), b = {}, _ = /* @__PURE__ */ new Set();
+ return di(e, { allKeys: !0 }, (k, N, A, j) => {
+ if (j === void 0)
return;
- const C = p + L;
- let T = c[N];
- typeof S[a] == "string" && (T = v.call(this, S[a])), j.call(this, S.$anchor), j.call(this, S.$dynamicAnchor), c[L] = T;
- function v(I) {
- const r = this.opts.uriResolver.resolve;
- if (I = ta(T ? r(T, I) : I), _.has(I))
- throw g(I);
- _.add(I);
- let i = this.refs[I];
- return typeof i == "string" && (i = this.refs[i]), typeof i == "object" ? y(S, i.schema, I) : I !== ta(C) && (I[0] === "#" ? (y(S, b[I], I), b[I] = S) : this.refs[I] = C), I;
- }
- function j(I) {
- if (typeof I == "string") {
- if (!Nd.test(I))
- throw new Error(`invalid anchor "${I}"`);
- v.call(this, `#${I}`);
+ const C = d + N;
+ let x = l[j];
+ typeof k[r] == "string" && (x = v.call(this, k[r])), T.call(this, k.$anchor), T.call(this, k.$dynamicAnchor), l[N] = x;
+ function v(R) {
+ const n = this.opts.uriResolver.resolve;
+ if (R = qt(x ? n(x, R) : R), _.has(R))
+ throw m(R);
+ _.add(R);
+ let i = this.refs[R];
+ return typeof i == "string" && (i = this.refs[i]), typeof i == "object" ? y(k, i.schema, R) : R !== qt(C) && (R[0] === "#" ? (y(k, b[R], R), b[R] = k) : this.refs[R] = C), R;
+ }
+ function T(R) {
+ if (typeof R == "string") {
+ if (!bi.test(R))
+ throw new Error(`invalid anchor "${R}"`);
+ v.call(this, `#${R}`);
}
}
}), b;
- function y(S, L, A) {
- if (L !== void 0 && !Pd(S, L))
- throw g(A);
+ function y(k, N, A) {
+ if (N !== void 0 && !ui(k, N))
+ throw m(A);
}
- function g(S) {
- return new Error(`reference "${S}" resolves to more than one schema`);
+ function m(k) {
+ return new Error(`reference "${k}" resolves to more than one schema`);
}
}
-tt.getSchemaRefs = Ld;
-Object.defineProperty(er, "__esModule", { value: !0 });
-er.getData = er.KeywordCxt = er.validateFunctionCode = void 0;
-const Jc = sa, _i = Wa, Fo = mr, xn = Wa, Rd = Fn, La = sr, co = Tr, ae = we, le = cr, Id = tt, gr = $e, Pa = Ka;
-function Ad(e) {
- if (Qc(e) && (Xc(e), Yc(e))) {
- zd(e);
+xe.getSchemaRefs = yi;
+Object.defineProperty(rt, "__esModule", { value: !0 });
+rt.getData = rt.KeywordCxt = rt.validateFunctionCode = void 0;
+const wo = Ht, kn = yr, wa = pt, zr = yr, _i = Zr, cr = lt, ra = _t, Z = ie, X = ct, wi = xe, ft = ce, nr = br;
+function vi(e) {
+ if (Eo(e) && ($o(e), ko(e))) {
+ $i(e);
return;
}
- Zc(e, () => (0, Jc.topBoolOrEmptySchema)(e));
+ vo(e, () => (0, wo.topBoolOrEmptySchema)(e));
}
-er.validateFunctionCode = Ad;
-function Zc({ gen: e, validateName: t, schema: a, schemaEnv: n, opts: s }, c) {
- s.code.es5 ? e.func(t, (0, ae._)`${le.default.data}, ${le.default.valCxt}`, n.$async, () => {
- e.code((0, ae._)`"use strict"; ${wi(a, s)}`), Dd(e, s), e.code(c);
- }) : e.func(t, (0, ae._)`${le.default.data}, ${Md(s)}`, n.$async, () => e.code(wi(a, s)).code(c));
+rt.validateFunctionCode = vi;
+function vo({ gen: e, validateName: t, schema: r, schemaEnv: a, opts: s }, l) {
+ s.code.es5 ? e.func(t, (0, Z._)`${X.default.data}, ${X.default.valCxt}`, a.$async, () => {
+ e.code((0, Z._)`"use strict"; ${En(r, s)}`), Ei(e, s), e.code(l);
+ }) : e.func(t, (0, Z._)`${X.default.data}, ${ki(s)}`, a.$async, () => e.code(En(r, s)).code(l));
}
-function Md(e) {
- return (0, ae._)`{${le.default.instancePath}="", ${le.default.parentData}, ${le.default.parentDataProperty}, ${le.default.rootData}=${le.default.data}${e.dynamicRef ? (0, ae._)`, ${le.default.dynamicAnchors}={}` : ae.nil}}={}`;
+function ki(e) {
+ return (0, Z._)`{${X.default.instancePath}="", ${X.default.parentData}, ${X.default.parentDataProperty}, ${X.default.rootData}=${X.default.data}${e.dynamicRef ? (0, Z._)`, ${X.default.dynamicAnchors}={}` : Z.nil}}={}`;
}
-function Dd(e, t) {
- e.if(le.default.valCxt, () => {
- e.var(le.default.instancePath, (0, ae._)`${le.default.valCxt}.${le.default.instancePath}`), e.var(le.default.parentData, (0, ae._)`${le.default.valCxt}.${le.default.parentData}`), e.var(le.default.parentDataProperty, (0, ae._)`${le.default.valCxt}.${le.default.parentDataProperty}`), e.var(le.default.rootData, (0, ae._)`${le.default.valCxt}.${le.default.rootData}`), t.dynamicRef && e.var(le.default.dynamicAnchors, (0, ae._)`${le.default.valCxt}.${le.default.dynamicAnchors}`);
+function Ei(e, t) {
+ e.if(X.default.valCxt, () => {
+ e.var(X.default.instancePath, (0, Z._)`${X.default.valCxt}.${X.default.instancePath}`), e.var(X.default.parentData, (0, Z._)`${X.default.valCxt}.${X.default.parentData}`), e.var(X.default.parentDataProperty, (0, Z._)`${X.default.valCxt}.${X.default.parentDataProperty}`), e.var(X.default.rootData, (0, Z._)`${X.default.valCxt}.${X.default.rootData}`), t.dynamicRef && e.var(X.default.dynamicAnchors, (0, Z._)`${X.default.valCxt}.${X.default.dynamicAnchors}`);
}, () => {
- e.var(le.default.instancePath, (0, ae._)`""`), e.var(le.default.parentData, (0, ae._)`undefined`), e.var(le.default.parentDataProperty, (0, ae._)`undefined`), e.var(le.default.rootData, le.default.data), t.dynamicRef && e.var(le.default.dynamicAnchors, (0, ae._)`{}`);
+ e.var(X.default.instancePath, (0, Z._)`""`), e.var(X.default.parentData, (0, Z._)`undefined`), e.var(X.default.parentDataProperty, (0, Z._)`undefined`), e.var(X.default.rootData, X.default.data), t.dynamicRef && e.var(X.default.dynamicAnchors, (0, Z._)`{}`);
});
}
-function zd(e) {
- const { schema: t, opts: a, gen: n } = e;
- Zc(e, () => {
- a.$comment && t.$comment && tl(e), qd(e), n.let(le.default.vErrors, null), n.let(le.default.errors, 0), a.unevaluated && Bd(e), el(e), Kd(e);
+function $i(e) {
+ const { schema: t, opts: r, gen: a } = e;
+ vo(e, () => {
+ r.$comment && t.$comment && So(e), xi(e), a.let(X.default.vErrors, null), a.let(X.default.errors, 0), r.unevaluated && Pi(e), Po(e), ji(e);
});
}
-function Bd(e) {
- const { gen: t, validateName: a } = e;
- e.evaluated = t.const("evaluated", (0, ae._)`${a}.evaluated`), t.if((0, ae._)`${e.evaluated}.dynamicProps`, () => t.assign((0, ae._)`${e.evaluated}.props`, (0, ae._)`undefined`)), t.if((0, ae._)`${e.evaluated}.dynamicItems`, () => t.assign((0, ae._)`${e.evaluated}.items`, (0, ae._)`undefined`));
+function Pi(e) {
+ const { gen: t, validateName: r } = e;
+ e.evaluated = t.const("evaluated", (0, Z._)`${r}.evaluated`), t.if((0, Z._)`${e.evaluated}.dynamicProps`, () => t.assign((0, Z._)`${e.evaluated}.props`, (0, Z._)`undefined`)), t.if((0, Z._)`${e.evaluated}.dynamicItems`, () => t.assign((0, Z._)`${e.evaluated}.items`, (0, Z._)`undefined`));
}
-function wi(e, t) {
- const a = typeof e == "object" && e[t.schemaId];
- return a && (t.code.source || t.code.process) ? (0, ae._)`/*# sourceURL=${a} */` : ae.nil;
+function En(e, t) {
+ const r = typeof e == "object" && e[t.schemaId];
+ return r && (t.code.source || t.code.process) ? (0, Z._)`/*# sourceURL=${r} */` : Z.nil;
}
-function Vd(e, t) {
- if (Qc(e) && (Xc(e), Yc(e))) {
- Fd(e, t);
+function Si(e, t) {
+ if (Eo(e) && ($o(e), ko(e))) {
+ Ti(e, t);
return;
}
- (0, Jc.boolOrEmptySchema)(e, t);
+ (0, wo.boolOrEmptySchema)(e, t);
}
-function Yc({ schema: e, self: t }) {
+function ko({ schema: e, self: t }) {
if (typeof e == "boolean")
return !e;
- for (const a in e)
- if (t.RULES.all[a])
+ for (const r in e)
+ if (t.RULES.all[r])
return !0;
return !1;
}
-function Qc(e) {
+function Eo(e) {
return typeof e.schema != "boolean";
}
-function Fd(e, t) {
- const { schema: a, gen: n, opts: s } = e;
- s.$comment && a.$comment && tl(e), Hd(e), Gd(e);
- const c = n.const("_errs", le.default.errors);
- el(e, c), n.var(t, (0, ae._)`${c} === ${le.default.errors}`);
+function Ti(e, t) {
+ const { schema: r, gen: a, opts: s } = e;
+ s.$comment && r.$comment && So(e), Oi(e), Ni(e);
+ const l = a.const("_errs", X.default.errors);
+ Po(e, l), a.var(t, (0, Z._)`${l} === ${X.default.errors}`);
}
-function Xc(e) {
- (0, gr.checkUnknownRules)(e), Ud(e);
+function $o(e) {
+ (0, ft.checkUnknownRules)(e), Ci(e);
}
-function el(e, t) {
+function Po(e, t) {
if (e.opts.jtd)
- return vi(e, [], !1, t);
- const a = (0, _i.getSchemaTypes)(e.schema), n = (0, _i.coerceAndCheckDataType)(e, a);
- vi(e, a, !n, t);
+ return $n(e, [], !1, t);
+ const r = (0, kn.getSchemaTypes)(e.schema), a = (0, kn.coerceAndCheckDataType)(e, r);
+ $n(e, r, !a, t);
}
-function Ud(e) {
- const { schema: t, errSchemaPath: a, opts: n, self: s } = e;
- t.$ref && n.ignoreKeywordsWithRef && (0, gr.schemaHasRulesButRef)(t, s.RULES) && s.logger.warn(`$ref: keywords ignored in schema at path "${a}"`);
+function Ci(e) {
+ const { schema: t, errSchemaPath: r, opts: a, self: s } = e;
+ t.$ref && a.ignoreKeywordsWithRef && (0, ft.schemaHasRulesButRef)(t, s.RULES) && s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);
}
-function qd(e) {
- const { schema: t, opts: a } = e;
- t.default !== void 0 && a.useDefaults && a.strictSchema && (0, gr.checkStrictMode)(e, "default is ignored in the schema root");
+function xi(e) {
+ const { schema: t, opts: r } = e;
+ t.default !== void 0 && r.useDefaults && r.strictSchema && (0, ft.checkStrictMode)(e, "default is ignored in the schema root");
}
-function Hd(e) {
+function Oi(e) {
const t = e.schema[e.opts.schemaId];
- t && (e.baseId = (0, Id.resolveUrl)(e.opts.uriResolver, e.baseId, t));
+ t && (e.baseId = (0, wi.resolveUrl)(e.opts.uriResolver, e.baseId, t));
}
-function Gd(e) {
+function Ni(e) {
if (e.schema.$async && !e.schemaEnv.$async)
throw new Error("async schema in sync schema");
}
-function tl({ gen: e, schemaEnv: t, schema: a, errSchemaPath: n, opts: s }) {
- const c = a.$comment;
+function So({ gen: e, schemaEnv: t, schema: r, errSchemaPath: a, opts: s }) {
+ const l = r.$comment;
if (s.$comment === !0)
- e.code((0, ae._)`${le.default.self}.logger.log(${c})`);
+ e.code((0, Z._)`${X.default.self}.logger.log(${l})`);
else if (typeof s.$comment == "function") {
- const p = (0, ae.str)`${n}/$comment`, b = e.scopeValue("root", { ref: t.root });
- e.code((0, ae._)`${le.default.self}.opts.$comment(${c}, ${p}, ${b}.schema)`);
+ const d = (0, Z.str)`${a}/$comment`, b = e.scopeValue("root", { ref: t.root });
+ e.code((0, Z._)`${X.default.self}.opts.$comment(${l}, ${d}, ${b}.schema)`);
}
}
-function Kd(e) {
- const { gen: t, schemaEnv: a, validateName: n, ValidationError: s, opts: c } = e;
- a.$async ? t.if((0, ae._)`${le.default.errors} === 0`, () => t.return(le.default.data), () => t.throw((0, ae._)`new ${s}(${le.default.vErrors})`)) : (t.assign((0, ae._)`${n}.errors`, le.default.vErrors), c.unevaluated && Wd(e), t.return((0, ae._)`${le.default.errors} === 0`));
+function ji(e) {
+ const { gen: t, schemaEnv: r, validateName: a, ValidationError: s, opts: l } = e;
+ r.$async ? t.if((0, Z._)`${X.default.errors} === 0`, () => t.return(X.default.data), () => t.throw((0, Z._)`new ${s}(${X.default.vErrors})`)) : (t.assign((0, Z._)`${a}.errors`, X.default.vErrors), l.unevaluated && Li(e), t.return((0, Z._)`${X.default.errors} === 0`));
}
-function Wd({ gen: e, evaluated: t, props: a, items: n }) {
- a instanceof ae.Name && e.assign((0, ae._)`${t}.props`, a), n instanceof ae.Name && e.assign((0, ae._)`${t}.items`, n);
+function Li({ gen: e, evaluated: t, props: r, items: a }) {
+ r instanceof Z.Name && e.assign((0, Z._)`${t}.props`, r), a instanceof Z.Name && e.assign((0, Z._)`${t}.items`, a);
}
-function vi(e, t, a, n) {
- const { gen: s, schema: c, data: p, allErrors: b, opts: _, self: y } = e, { RULES: g } = y;
- if (c.$ref && (_.ignoreKeywordsWithRef || !(0, gr.schemaHasRulesButRef)(c, g))) {
- s.block(() => nl(e, "$ref", g.all.$ref.definition));
+function $n(e, t, r, a) {
+ const { gen: s, schema: l, data: d, allErrors: b, opts: _, self: y } = e, { RULES: m } = y;
+ if (l.$ref && (_.ignoreKeywordsWithRef || !(0, ft.schemaHasRulesButRef)(l, m))) {
+ s.block(() => xo(e, "$ref", m.all.$ref.definition));
return;
}
- _.jtd || Jd(e, t), s.block(() => {
- for (const L of g.rules)
- S(L);
- S(g.post);
+ _.jtd || Ai(e, t), s.block(() => {
+ for (const N of m.rules)
+ k(N);
+ k(m.post);
});
- function S(L) {
- (0, Fo.shouldUseGroup)(c, L) && (L.type ? (s.if((0, xn.checkDataType)(L.type, p, _.strictNumbers)), $i(e, L), t.length === 1 && t[0] === L.type && a && (s.else(), (0, xn.reportTypeError)(e)), s.endIf()) : $i(e, L), b || s.if((0, ae._)`${le.default.errors} === ${n || 0}`));
+ function k(N) {
+ (0, wa.shouldUseGroup)(l, N) && (N.type ? (s.if((0, zr.checkDataType)(N.type, d, _.strictNumbers)), Pn(e, N), t.length === 1 && t[0] === N.type && r && (s.else(), (0, zr.reportTypeError)(e)), s.endIf()) : Pn(e, N), b || s.if((0, Z._)`${X.default.errors} === ${a || 0}`));
}
}
-function $i(e, t) {
- const { gen: a, schema: n, opts: { useDefaults: s } } = e;
- s && (0, Rd.assignDefaults)(e, t.type), a.block(() => {
- for (const c of t.rules)
- (0, Fo.shouldUseRule)(n, c) && nl(e, c.keyword, c.definition, t.type);
+function Pn(e, t) {
+ const { gen: r, schema: a, opts: { useDefaults: s } } = e;
+ s && (0, _i.assignDefaults)(e, t.type), r.block(() => {
+ for (const l of t.rules)
+ (0, wa.shouldUseRule)(a, l) && xo(e, l.keyword, l.definition, t.type);
});
}
-function Jd(e, t) {
- e.schemaEnv.meta || !e.opts.strictTypes || (Zd(e, t), e.opts.allowUnionTypes || Yd(e, t), Qd(e, e.dataTypes));
+function Ai(e, t) {
+ e.schemaEnv.meta || !e.opts.strictTypes || (Ri(e, t), e.opts.allowUnionTypes || Ii(e, t), Mi(e, e.dataTypes));
}
-function Zd(e, t) {
+function Ri(e, t) {
if (t.length) {
if (!e.dataTypes.length) {
e.dataTypes = t;
return;
}
- t.forEach((a) => {
- rl(e.dataTypes, a) || Uo(e, `type "${a}" not allowed by context "${e.dataTypes.join(",")}"`);
- }), eh(e, t);
+ t.forEach((r) => {
+ To(e.dataTypes, r) || va(e, `type "${r}" not allowed by context "${e.dataTypes.join(",")}"`);
+ }), Bi(e, t);
}
}
-function Yd(e, t) {
- t.length > 1 && !(t.length === 2 && t.includes("null")) && Uo(e, "use allowUnionTypes to allow union type keyword");
+function Ii(e, t) {
+ t.length > 1 && !(t.length === 2 && t.includes("null")) && va(e, "use allowUnionTypes to allow union type keyword");
}
-function Qd(e, t) {
- const a = e.self.RULES.all;
- for (const n in a) {
- const s = a[n];
- if (typeof s == "object" && (0, Fo.shouldUseRule)(e.schema, s)) {
- const { type: c } = s.definition;
- c.length && !c.some((p) => Xd(t, p)) && Uo(e, `missing type "${c.join(",")}" for keyword "${n}"`);
+function Mi(e, t) {
+ const r = e.self.RULES.all;
+ for (const a in r) {
+ const s = r[a];
+ if (typeof s == "object" && (0, wa.shouldUseRule)(e.schema, s)) {
+ const { type: l } = s.definition;
+ l.length && !l.some((d) => Di(t, d)) && va(e, `missing type "${l.join(",")}" for keyword "${a}"`);
}
}
}
-function Xd(e, t) {
+function Di(e, t) {
return e.includes(t) || t === "number" && e.includes("integer");
}
-function rl(e, t) {
+function To(e, t) {
return e.includes(t) || t === "integer" && e.includes("number");
}
-function eh(e, t) {
- const a = [];
- for (const n of e.dataTypes)
- rl(t, n) ? a.push(n) : t.includes("integer") && n === "number" && a.push("integer");
- e.dataTypes = a;
+function Bi(e, t) {
+ const r = [];
+ for (const a of e.dataTypes)
+ To(t, a) ? r.push(a) : t.includes("integer") && a === "number" && r.push("integer");
+ e.dataTypes = r;
}
-function Uo(e, t) {
- const a = e.schemaEnv.baseId + e.errSchemaPath;
- t += ` at "${a}" (strictTypes)`, (0, gr.checkStrictMode)(e, t, e.opts.strictTypes);
+function va(e, t) {
+ const r = e.schemaEnv.baseId + e.errSchemaPath;
+ t += ` at "${r}" (strictTypes)`, (0, ft.checkStrictMode)(e, t, e.opts.strictTypes);
}
-let al = class {
- constructor(t, a, n) {
- if ((0, La.validateKeywordUsage)(t, a, n), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = n, this.data = t.data, this.schema = t.schema[n], this.$data = a.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, gr.schemaRefOrVal)(t, this.schema, n, this.$data), this.schemaType = a.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = a, this.$data)
- this.schemaCode = t.gen.const("vSchema", ol(this.$data, t));
- else if (this.schemaCode = this.schemaValue, !(0, La.validSchemaType)(this.schema, a.schemaType, a.allowUndefined))
- throw new Error(`${n} value must be ${JSON.stringify(a.schemaType)}`);
- ("code" in a ? a.trackErrors : a.errors !== !1) && (this.errsCount = t.gen.const("_errs", le.default.errors));
+class Co {
+ constructor(t, r, a) {
+ if ((0, cr.validateKeywordUsage)(t, r, a), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = a, this.data = t.data, this.schema = t.schema[a], this.$data = r.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, ft.schemaRefOrVal)(t, this.schema, a, this.$data), this.schemaType = r.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = r, this.$data)
+ this.schemaCode = t.gen.const("vSchema", Oo(this.$data, t));
+ else if (this.schemaCode = this.schemaValue, !(0, cr.validSchemaType)(this.schema, r.schemaType, r.allowUndefined))
+ throw new Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);
+ ("code" in r ? r.trackErrors : r.errors !== !1) && (this.errsCount = t.gen.const("_errs", X.default.errors));
}
- result(t, a, n) {
- this.failResult((0, ae.not)(t), a, n);
+ result(t, r, a) {
+ this.failResult((0, Z.not)(t), r, a);
}
- failResult(t, a, n) {
- this.gen.if(t), n ? n() : this.error(), a ? (this.gen.else(), a(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else();
+ failResult(t, r, a) {
+ this.gen.if(t), a ? a() : this.error(), r ? (this.gen.else(), r(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else();
}
- pass(t, a) {
- this.failResult((0, ae.not)(t), void 0, a);
+ pass(t, r) {
+ this.failResult((0, Z.not)(t), void 0, r);
}
fail(t) {
if (t === void 0) {
@@ -1954,293 +1958,293 @@ let al = class {
fail$data(t) {
if (!this.$data)
return this.fail(t);
- const { schemaCode: a } = this;
- this.fail((0, ae._)`${a} !== undefined && (${(0, ae.or)(this.invalid$data(), t)})`);
+ const { schemaCode: r } = this;
+ this.fail((0, Z._)`${r} !== undefined && (${(0, Z.or)(this.invalid$data(), t)})`);
}
- error(t, a, n) {
- if (a) {
- this.setParams(a), this._error(t, n), this.setParams({});
+ error(t, r, a) {
+ if (r) {
+ this.setParams(r), this._error(t, a), this.setParams({});
return;
}
- this._error(t, n);
+ this._error(t, a);
}
- _error(t, a) {
- (t ? Pa.reportExtraError : Pa.reportError)(this, this.def.error, a);
+ _error(t, r) {
+ (t ? nr.reportExtraError : nr.reportError)(this, this.def.error, r);
}
$dataError() {
- (0, Pa.reportError)(this, this.def.$dataError || Pa.keyword$DataError);
+ (0, nr.reportError)(this, this.def.$dataError || nr.keyword$DataError);
}
reset() {
if (this.errsCount === void 0)
throw new Error('add "trackErrors" to keyword definition');
- (0, Pa.resetErrorsCount)(this.gen, this.errsCount);
+ (0, nr.resetErrorsCount)(this.gen, this.errsCount);
}
ok(t) {
this.allErrors || this.gen.if(t);
}
- setParams(t, a) {
- a ? Object.assign(this.params, t) : this.params = t;
+ setParams(t, r) {
+ r ? Object.assign(this.params, t) : this.params = t;
}
- block$data(t, a, n = ae.nil) {
+ block$data(t, r, a = Z.nil) {
this.gen.block(() => {
- this.check$data(t, n), a();
+ this.check$data(t, a), r();
});
}
- check$data(t = ae.nil, a = ae.nil) {
+ check$data(t = Z.nil, r = Z.nil) {
if (!this.$data)
return;
- const { gen: n, schemaCode: s, schemaType: c, def: p } = this;
- n.if((0, ae.or)((0, ae._)`${s} === undefined`, a)), t !== ae.nil && n.assign(t, !0), (c.length || p.validateSchema) && (n.elseIf(this.invalid$data()), this.$dataError(), t !== ae.nil && n.assign(t, !1)), n.else();
+ const { gen: a, schemaCode: s, schemaType: l, def: d } = this;
+ a.if((0, Z.or)((0, Z._)`${s} === undefined`, r)), t !== Z.nil && a.assign(t, !0), (l.length || d.validateSchema) && (a.elseIf(this.invalid$data()), this.$dataError(), t !== Z.nil && a.assign(t, !1)), a.else();
}
invalid$data() {
- const { gen: t, schemaCode: a, schemaType: n, def: s, it: c } = this;
- return (0, ae.or)(p(), b());
- function p() {
- if (n.length) {
- if (!(a instanceof ae.Name))
+ const { gen: t, schemaCode: r, schemaType: a, def: s, it: l } = this;
+ return (0, Z.or)(d(), b());
+ function d() {
+ if (a.length) {
+ if (!(r instanceof Z.Name))
throw new Error("ajv implementation error");
- const _ = Array.isArray(n) ? n : [n];
- return (0, ae._)`${(0, xn.checkDataTypes)(_, a, c.opts.strictNumbers, xn.DataType.Wrong)}`;
+ const _ = Array.isArray(a) ? a : [a];
+ return (0, Z._)`${(0, zr.checkDataTypes)(_, r, l.opts.strictNumbers, zr.DataType.Wrong)}`;
}
- return ae.nil;
+ return Z.nil;
}
function b() {
if (s.validateSchema) {
const _ = t.scopeValue("validate$data", { ref: s.validateSchema });
- return (0, ae._)`!${_}(${a})`;
+ return (0, Z._)`!${_}(${r})`;
}
- return ae.nil;
+ return Z.nil;
}
}
- subschema(t, a) {
- const n = (0, co.getSubschema)(this.it, t);
- (0, co.extendSubschemaData)(n, this.it, t), (0, co.extendSubschemaMode)(n, t);
- const s = { ...this.it, ...n, items: void 0, props: void 0 };
- return Vd(s, a), s;
+ subschema(t, r) {
+ const a = (0, ra.getSubschema)(this.it, t);
+ (0, ra.extendSubschemaData)(a, this.it, t), (0, ra.extendSubschemaMode)(a, t);
+ const s = { ...this.it, ...a, items: void 0, props: void 0 };
+ return Si(s, r), s;
}
- mergeEvaluated(t, a) {
- const { it: n, gen: s } = this;
- n.opts.unevaluated && (n.props !== !0 && t.props !== void 0 && (n.props = gr.mergeEvaluated.props(s, t.props, n.props, a)), n.items !== !0 && t.items !== void 0 && (n.items = gr.mergeEvaluated.items(s, t.items, n.items, a)));
+ mergeEvaluated(t, r) {
+ const { it: a, gen: s } = this;
+ a.opts.unevaluated && (a.props !== !0 && t.props !== void 0 && (a.props = ft.mergeEvaluated.props(s, t.props, a.props, r)), a.items !== !0 && t.items !== void 0 && (a.items = ft.mergeEvaluated.items(s, t.items, a.items, r)));
}
- mergeValidEvaluated(t, a) {
- const { it: n, gen: s } = this;
- if (n.opts.unevaluated && (n.props !== !0 || n.items !== !0))
- return s.if(a, () => this.mergeEvaluated(t, ae.Name)), !0;
+ mergeValidEvaluated(t, r) {
+ const { it: a, gen: s } = this;
+ if (a.opts.unevaluated && (a.props !== !0 || a.items !== !0))
+ return s.if(r, () => this.mergeEvaluated(t, Z.Name)), !0;
}
-};
-er.KeywordCxt = al;
-function nl(e, t, a, n) {
- const s = new al(e, a, t);
- "code" in a ? a.code(s, n) : s.$data && a.validate ? (0, La.funcKeywordCode)(s, a) : "macro" in a ? (0, La.macroKeywordCode)(s, a) : (a.compile || a.validate) && (0, La.funcKeywordCode)(s, a);
}
-const th = /^\/(?:[^~]|~0|~1)*$/, rh = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
-function ol(e, { dataLevel: t, dataNames: a, dataPathArr: n }) {
- let s, c;
+rt.KeywordCxt = Co;
+function xo(e, t, r, a) {
+ const s = new Co(e, r, t);
+ "code" in r ? r.code(s, a) : s.$data && r.validate ? (0, cr.funcKeywordCode)(s, r) : "macro" in r ? (0, cr.macroKeywordCode)(s, r) : (r.compile || r.validate) && (0, cr.funcKeywordCode)(s, r);
+}
+const zi = /^\/(?:[^~]|~0|~1)*$/, Vi = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
+function Oo(e, { dataLevel: t, dataNames: r, dataPathArr: a }) {
+ let s, l;
if (e === "")
- return le.default.rootData;
+ return X.default.rootData;
if (e[0] === "/") {
- if (!th.test(e))
+ if (!zi.test(e))
throw new Error(`Invalid JSON-pointer: ${e}`);
- s = e, c = le.default.rootData;
+ s = e, l = X.default.rootData;
} else {
- const y = rh.exec(e);
+ const y = Vi.exec(e);
if (!y)
throw new Error(`Invalid JSON-pointer: ${e}`);
- const g = +y[1];
+ const m = +y[1];
if (s = y[2], s === "#") {
- if (g >= t)
- throw new Error(_("property/index", g));
- return n[t - g];
+ if (m >= t)
+ throw new Error(_("property/index", m));
+ return a[t - m];
}
- if (g > t)
- throw new Error(_("data", g));
- if (c = a[t - g], !s)
- return c;
+ if (m > t)
+ throw new Error(_("data", m));
+ if (l = r[t - m], !s)
+ return l;
}
- let p = c;
+ let d = l;
const b = s.split("/");
for (const y of b)
- y && (c = (0, ae._)`${c}${(0, ae.getProperty)((0, gr.unescapeJsonPointer)(y))}`, p = (0, ae._)`${p} && ${c}`);
- return p;
- function _(y, g) {
- return `Cannot access ${y} ${g} levels up, current level is ${t}`;
+ y && (l = (0, Z._)`${l}${(0, Z.getProperty)((0, ft.unescapeJsonPointer)(y))}`, d = (0, Z._)`${d} && ${l}`);
+ return d;
+ function _(y, m) {
+ return `Cannot access ${y} ${m} levels up, current level is ${t}`;
}
}
-er.getData = ol;
-var Ja = {};
-Object.defineProperty(Ja, "__esModule", { value: !0 });
-let ah = class extends Error {
+rt.getData = Oo;
+var _r = {};
+Object.defineProperty(_r, "__esModule", { value: !0 });
+class Fi extends Error {
constructor(t) {
super("validation failed"), this.errors = t, this.ajv = this.validation = !0;
}
-};
-Ja.default = ah;
-var Za = {};
-Object.defineProperty(Za, "__esModule", { value: !0 });
-const lo = tt;
-let nh = class extends Error {
- constructor(t, a, n, s) {
- super(s || `can't resolve reference ${n} from id ${a}`), this.missingRef = (0, lo.resolveUrl)(t, a, n), this.missingSchema = (0, lo.normalizeId)((0, lo.getFullPath)(t, this.missingRef));
+}
+_r.default = Fi;
+var wr = {};
+Object.defineProperty(wr, "__esModule", { value: !0 });
+const aa = xe;
+class qi extends Error {
+ constructor(t, r, a, s) {
+ super(s || `can't resolve reference ${a} from id ${r}`), this.missingRef = (0, aa.resolveUrl)(t, r, a), this.missingSchema = (0, aa.normalizeId)((0, aa.getFullPath)(t, this.missingRef));
}
-};
-Za.default = nh;
-var wt = {};
-Object.defineProperty(wt, "__esModule", { value: !0 });
-wt.resolveSchema = wt.getCompilingSchema = wt.resolveRef = wt.compileSchema = wt.SchemaEnv = void 0;
-const qt = we, oh = Ja, Or = cr, Qt = tt, ki = $e, sh = er;
-let Un = class {
+}
+wr.default = qi;
+var Be = {};
+Object.defineProperty(Be, "__esModule", { value: !0 });
+Be.resolveSchema = Be.getCompilingSchema = Be.resolveRef = Be.compileSchema = Be.SchemaEnv = void 0;
+const Ze = ie, Ui = _r, Pt = ct, tt = xe, Sn = ce, Gi = rt;
+class Yr {
constructor(t) {
- var a;
+ var r;
this.refs = {}, this.dynamicAnchors = {};
- let n;
- typeof t.schema == "object" && (n = t.schema), this.schema = t.schema, this.schemaId = t.schemaId, this.root = t.root || this, this.baseId = (a = t.baseId) !== null && a !== void 0 ? a : (0, Qt.normalizeId)(n == null ? void 0 : n[t.schemaId || "$id"]), this.schemaPath = t.schemaPath, this.localRefs = t.localRefs, this.meta = t.meta, this.$async = n == null ? void 0 : n.$async, this.refs = {};
+ let a;
+ typeof t.schema == "object" && (a = t.schema), this.schema = t.schema, this.schemaId = t.schemaId, this.root = t.root || this, this.baseId = (r = t.baseId) !== null && r !== void 0 ? r : (0, tt.normalizeId)(a == null ? void 0 : a[t.schemaId || "$id"]), this.schemaPath = t.schemaPath, this.localRefs = t.localRefs, this.meta = t.meta, this.$async = a == null ? void 0 : a.$async, this.refs = {};
}
-};
-wt.SchemaEnv = Un;
-function qo(e) {
- const t = sl.call(this, e);
+}
+Be.SchemaEnv = Yr;
+function ka(e) {
+ const t = No.call(this, e);
if (t)
return t;
- const a = (0, Qt.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: n, lines: s } = this.opts.code, { ownProperties: c } = this.opts, p = new qt.CodeGen(this.scope, { es5: n, lines: s, ownProperties: c });
+ const r = (0, tt.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: a, lines: s } = this.opts.code, { ownProperties: l } = this.opts, d = new Ze.CodeGen(this.scope, { es5: a, lines: s, ownProperties: l });
let b;
- e.$async && (b = p.scopeValue("Error", {
- ref: oh.default,
- code: (0, qt._)`require("ajv/dist/runtime/validation_error").default`
+ e.$async && (b = d.scopeValue("Error", {
+ ref: Ui.default,
+ code: (0, Ze._)`require("ajv/dist/runtime/validation_error").default`
}));
- const _ = p.scopeName("validate");
+ const _ = d.scopeName("validate");
e.validateName = _;
const y = {
- gen: p,
+ gen: d,
allErrors: this.opts.allErrors,
- data: Or.default.data,
- parentData: Or.default.parentData,
- parentDataProperty: Or.default.parentDataProperty,
- dataNames: [Or.default.data],
- dataPathArr: [qt.nil],
+ data: Pt.default.data,
+ parentData: Pt.default.parentData,
+ parentDataProperty: Pt.default.parentDataProperty,
+ dataNames: [Pt.default.data],
+ dataPathArr: [Ze.nil],
dataLevel: 0,
dataTypes: [],
definedProperties: /* @__PURE__ */ new Set(),
- topSchemaRef: p.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, qt.stringify)(e.schema) } : { ref: e.schema }),
+ topSchemaRef: d.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, Ze.stringify)(e.schema) } : { ref: e.schema }),
validateName: _,
ValidationError: b,
schema: e.schema,
schemaEnv: e,
- rootId: a,
- baseId: e.baseId || a,
- schemaPath: qt.nil,
+ rootId: r,
+ baseId: e.baseId || r,
+ schemaPath: Ze.nil,
errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"),
- errorPath: (0, qt._)`""`,
+ errorPath: (0, Ze._)`""`,
opts: this.opts,
self: this
};
- let g;
+ let m;
try {
- this._compilations.add(e), (0, sh.validateFunctionCode)(y), p.optimize(this.opts.code.optimize);
- const S = p.toString();
- g = `${p.scopeRefs(Or.default.scope)}return ${S}`, this.opts.code.process && (g = this.opts.code.process(g, e));
- const L = new Function(`${Or.default.self}`, `${Or.default.scope}`, g)(this, this.scope.get());
- if (this.scope.value(_, { ref: L }), L.errors = null, L.schema = e.schema, L.schemaEnv = e, e.$async && (L.$async = !0), this.opts.code.source === !0 && (L.source = { validateName: _, validateCode: S, scopeValues: p._values }), this.opts.unevaluated) {
- const { props: A, items: N } = y;
- L.evaluated = {
- props: A instanceof qt.Name ? void 0 : A,
- items: N instanceof qt.Name ? void 0 : N,
- dynamicProps: A instanceof qt.Name,
- dynamicItems: N instanceof qt.Name
- }, L.source && (L.source.evaluated = (0, qt.stringify)(L.evaluated));
- }
- return e.validate = L, e;
- } catch (S) {
- throw delete e.validate, delete e.validateName, g && this.logger.error("Error compiling schema, function code:", g), S;
+ this._compilations.add(e), (0, Gi.validateFunctionCode)(y), d.optimize(this.opts.code.optimize);
+ const k = d.toString();
+ m = `${d.scopeRefs(Pt.default.scope)}return ${k}`, this.opts.code.process && (m = this.opts.code.process(m, e));
+ const N = new Function(`${Pt.default.self}`, `${Pt.default.scope}`, m)(this, this.scope.get());
+ if (this.scope.value(_, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: _, validateCode: k, scopeValues: d._values }), this.opts.unevaluated) {
+ const { props: A, items: j } = y;
+ N.evaluated = {
+ props: A instanceof Ze.Name ? void 0 : A,
+ items: j instanceof Ze.Name ? void 0 : j,
+ dynamicProps: A instanceof Ze.Name,
+ dynamicItems: j instanceof Ze.Name
+ }, N.source && (N.source.evaluated = (0, Ze.stringify)(N.evaluated));
+ }
+ return e.validate = N, e;
+ } catch (k) {
+ throw delete e.validate, delete e.validateName, m && this.logger.error("Error compiling schema, function code:", m), k;
} finally {
this._compilations.delete(e);
}
}
-wt.compileSchema = qo;
-function ih(e, t, a) {
- var n;
- a = (0, Qt.resolveUrl)(this.opts.uriResolver, t, a);
- const s = e.refs[a];
+Be.compileSchema = ka;
+function Hi(e, t, r) {
+ var a;
+ r = (0, tt.resolveUrl)(this.opts.uriResolver, t, r);
+ const s = e.refs[r];
if (s)
return s;
- let c = uh.call(this, e, a);
- if (c === void 0) {
- const p = (n = e.localRefs) === null || n === void 0 ? void 0 : n[a], { schemaId: b } = this.opts;
- p && (c = new Un({ schema: p, schemaId: b, root: e, baseId: t }));
+ let l = Ji.call(this, e, r);
+ if (l === void 0) {
+ const d = (a = e.localRefs) === null || a === void 0 ? void 0 : a[r], { schemaId: b } = this.opts;
+ d && (l = new Yr({ schema: d, schemaId: b, root: e, baseId: t }));
}
- if (c !== void 0)
- return e.refs[a] = ch.call(this, c);
+ if (l !== void 0)
+ return e.refs[r] = Ki.call(this, l);
}
-wt.resolveRef = ih;
-function ch(e) {
- return (0, Qt.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : qo.call(this, e);
+Be.resolveRef = Hi;
+function Ki(e) {
+ return (0, tt.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : ka.call(this, e);
}
-function sl(e) {
+function No(e) {
for (const t of this._compilations)
- if (lh(t, e))
+ if (Wi(t, e))
return t;
}
-wt.getCompilingSchema = sl;
-function lh(e, t) {
+Be.getCompilingSchema = No;
+function Wi(e, t) {
return e.schema === t.schema && e.root === t.root && e.baseId === t.baseId;
}
-function uh(e, t) {
- let a;
- for (; typeof (a = this.refs[t]) == "string"; )
- t = a;
- return a || this.schemas[t] || qn.call(this, e, t);
+function Ji(e, t) {
+ let r;
+ for (; typeof (r = this.refs[t]) == "string"; )
+ t = r;
+ return r || this.schemas[t] || Qr.call(this, e, t);
}
-function qn(e, t) {
- const a = this.opts.uriResolver.parse(t), n = (0, Qt._getFullPath)(this.opts.uriResolver, a);
- let s = (0, Qt.getFullPath)(this.opts.uriResolver, e.baseId, void 0);
- if (Object.keys(e.schema).length > 0 && n === s)
- return uo.call(this, a, e);
- const c = (0, Qt.normalizeId)(n), p = this.refs[c] || this.schemas[c];
- if (typeof p == "string") {
- const b = qn.call(this, e, p);
- return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : uo.call(this, a, b);
- }
- if (typeof (p == null ? void 0 : p.schema) == "object") {
- if (p.validate || qo.call(this, p), c === (0, Qt.normalizeId)(t)) {
- const { schema: b } = p, { schemaId: _ } = this.opts, y = b[_];
- return y && (s = (0, Qt.resolveUrl)(this.opts.uriResolver, s, y)), new Un({ schema: b, schemaId: _, root: e, baseId: s });
- }
- return uo.call(this, a, p);
+function Qr(e, t) {
+ const r = this.opts.uriResolver.parse(t), a = (0, tt._getFullPath)(this.opts.uriResolver, r);
+ let s = (0, tt.getFullPath)(this.opts.uriResolver, e.baseId, void 0);
+ if (Object.keys(e.schema).length > 0 && a === s)
+ return na.call(this, r, e);
+ const l = (0, tt.normalizeId)(a), d = this.refs[l] || this.schemas[l];
+ if (typeof d == "string") {
+ const b = Qr.call(this, e, d);
+ return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : na.call(this, r, b);
+ }
+ if (typeof (d == null ? void 0 : d.schema) == "object") {
+ if (d.validate || ka.call(this, d), l === (0, tt.normalizeId)(t)) {
+ const { schema: b } = d, { schemaId: _ } = this.opts, y = b[_];
+ return y && (s = (0, tt.resolveUrl)(this.opts.uriResolver, s, y)), new Yr({ schema: b, schemaId: _, root: e, baseId: s });
+ }
+ return na.call(this, r, d);
}
}
-wt.resolveSchema = qn;
-const dh = /* @__PURE__ */ new Set([
+Be.resolveSchema = Qr;
+const Zi = /* @__PURE__ */ new Set([
"properties",
"patternProperties",
"enum",
"dependencies",
"definitions"
]);
-function uo(e, { baseId: t, schema: a, root: n }) {
+function na(e, { baseId: t, schema: r, root: a }) {
var s;
if (((s = e.fragment) === null || s === void 0 ? void 0 : s[0]) !== "/")
return;
for (const b of e.fragment.slice(1).split("/")) {
- if (typeof a == "boolean")
+ if (typeof r == "boolean")
return;
- const _ = a[(0, ki.unescapeFragment)(b)];
+ const _ = r[(0, Sn.unescapeFragment)(b)];
if (_ === void 0)
return;
- a = _;
- const y = typeof a == "object" && a[this.opts.schemaId];
- !dh.has(b) && y && (t = (0, Qt.resolveUrl)(this.opts.uriResolver, t, y));
+ r = _;
+ const y = typeof r == "object" && r[this.opts.schemaId];
+ !Zi.has(b) && y && (t = (0, tt.resolveUrl)(this.opts.uriResolver, t, y));
}
- let c;
- if (typeof a != "boolean" && a.$ref && !(0, ki.schemaHasRulesButRef)(a, this.RULES)) {
- const b = (0, Qt.resolveUrl)(this.opts.uriResolver, t, a.$ref);
- c = qn.call(this, n, b);
+ let l;
+ if (typeof r != "boolean" && r.$ref && !(0, Sn.schemaHasRulesButRef)(r, this.RULES)) {
+ const b = (0, tt.resolveUrl)(this.opts.uriResolver, t, r.$ref);
+ l = Qr.call(this, a, b);
}
- const { schemaId: p } = this.opts;
- if (c = c || new Un({ schema: a, schemaId: p, root: n, baseId: t }), c.schema !== c.root.schema)
- return c;
+ const { schemaId: d } = this.opts;
+ if (l = l || new Yr({ schema: r, schemaId: d, root: a, baseId: t }), l.schema !== l.root.schema)
+ return l;
}
-const hh = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", ph = "Meta-schema for $data reference (JSON AnySchema extension proposal)", fh = "object", mh = [
+const Yi = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", Qi = "Meta-schema for $data reference (JSON AnySchema extension proposal)", Xi = "object", el = [
"$data"
-], gh = {
+], tl = {
$data: {
type: "string",
anyOf: [
@@ -2252,257 +2256,257 @@ const hh = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/
}
]
}
-}, yh = !1, bh = {
- $id: hh,
- description: ph,
- type: fh,
- required: mh,
- properties: gh,
- additionalProperties: yh
+}, rl = !1, al = {
+ $id: Yi,
+ description: Qi,
+ type: Xi,
+ required: el,
+ properties: tl,
+ additionalProperties: rl
};
-var Ho = {}, Eo = { exports: {} };
+var Ea = {}, da = { exports: {} };
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
(function(e, t) {
- (function(a, n) {
- n(t);
- })(Rc, function(a) {
- function n() {
- for (var h = arguments.length, $ = Array(h), P = 0; P < h; P++)
- $[P] = arguments[P];
- if ($.length > 1) {
- $[0] = $[0].slice(0, -1);
- for (var M = $.length - 1, D = 1; D < M; ++D)
- $[D] = $[D].slice(1, -1);
- return $[M] = $[M].slice(1), $.join("");
+ (function(r, a) {
+ a(t);
+ })(no, function(r) {
+ function a() {
+ for (var p = arguments.length, E = Array(p), S = 0; S < p; S++)
+ E[S] = arguments[S];
+ if (E.length > 1) {
+ E[0] = E[0].slice(0, -1);
+ for (var M = E.length - 1, D = 1; D < M; ++D)
+ E[D] = E[D].slice(1, -1);
+ return E[M] = E[M].slice(1), E.join("");
} else
- return $[0];
- }
- function s(h) {
- return "(?:" + h + ")";
- }
- function c(h) {
- return h === void 0 ? "undefined" : h === null ? "null" : Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase();
- }
- function p(h) {
- return h.toUpperCase();
- }
- function b(h) {
- return h != null ? h instanceof Array ? h : typeof h.length != "number" || h.split || h.setInterval || h.call ? [h] : Array.prototype.slice.call(h) : [];
- }
- function _(h, $) {
- var P = h;
- if ($)
- for (var M in $)
- P[M] = $[M];
- return P;
- }
- function y(h) {
- var $ = "[A-Za-z]", P = "[0-9]", M = n(P, "[A-Fa-f]"), D = s(s("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + s("%[89A-Fa-f]" + M + "%" + M + M) + "|" + s("%" + M + M)), Y = "[\\:\\/\\?\\#\\[\\]\\@]", Z = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", re = n(Y, Z), he = h ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", oe = h ? "[\\uE000-\\uF8FF]" : "[]", te = n($, P, "[\\-\\.\\_\\~]", he);
- s($ + n($, P, "[\\+\\-\\.]") + "*"), s(s(D + "|" + n(te, Z, "[\\:]")) + "*");
- var ce = s(s("25[0-5]") + "|" + s("2[0-4]" + P) + "|" + s("1" + P + P) + "|" + s("0?[1-9]" + P) + "|0?0?" + P), de = s(ce + "\\." + ce + "\\." + ce + "\\." + ce), Q = s(M + "{1,4}"), pe = s(s(Q + "\\:" + Q) + "|" + de), se = s(s(Q + "\\:") + "{6}" + pe), Re = s("\\:\\:" + s(Q + "\\:") + "{5}" + pe), xt = s(s(Q) + "?\\:\\:" + s(Q + "\\:") + "{4}" + pe), De = s(s(s(Q + "\\:") + "{0,1}" + Q) + "?\\:\\:" + s(Q + "\\:") + "{3}" + pe), He = s(s(s(Q + "\\:") + "{0,2}" + Q) + "?\\:\\:" + s(Q + "\\:") + "{2}" + pe), it = s(s(s(Q + "\\:") + "{0,3}" + Q) + "?\\:\\:" + Q + "\\:" + pe), ct = s(s(s(Q + "\\:") + "{0,4}" + Q) + "?\\:\\:" + pe), Ie = s(s(s(Q + "\\:") + "{0,5}" + Q) + "?\\:\\:" + Q), Ge = s(s(s(Q + "\\:") + "{0,6}" + Q) + "?\\:\\:"), lt = s([se, Re, xt, De, He, it, ct, Ie, Ge].join("|")), Ve = s(s(te + "|" + D) + "+");
- s("[vV]" + M + "+\\." + n(te, Z, "[\\:]") + "+"), s(s(D + "|" + n(te, Z)) + "*");
- var dr = s(D + "|" + n(te, Z, "[\\:\\@]"));
- return s(s(D + "|" + n(te, Z, "[\\@]")) + "+"), s(s(dr + "|" + n("[\\/\\?]", oe)) + "*"), {
- NOT_SCHEME: new RegExp(n("[^]", $, P, "[\\+\\-\\.]"), "g"),
- NOT_USERINFO: new RegExp(n("[^\\%\\:]", te, Z), "g"),
- NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", te, Z), "g"),
- NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", te, Z), "g"),
- NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", te, Z), "g"),
- NOT_QUERY: new RegExp(n("[^\\%]", te, Z, "[\\:\\@\\/\\?]", oe), "g"),
- NOT_FRAGMENT: new RegExp(n("[^\\%]", te, Z, "[\\:\\@\\/\\?]"), "g"),
- ESCAPE: new RegExp(n("[^]", te, Z), "g"),
- UNRESERVED: new RegExp(te, "g"),
- OTHER_CHARS: new RegExp(n("[^\\%]", te, re), "g"),
+ return E[0];
+ }
+ function s(p) {
+ return "(?:" + p + ")";
+ }
+ function l(p) {
+ return p === void 0 ? "undefined" : p === null ? "null" : Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase();
+ }
+ function d(p) {
+ return p.toUpperCase();
+ }
+ function b(p) {
+ return p != null ? p instanceof Array ? p : typeof p.length != "number" || p.split || p.setInterval || p.call ? [p] : Array.prototype.slice.call(p) : [];
+ }
+ function _(p, E) {
+ var S = p;
+ if (E)
+ for (var M in E)
+ S[M] = E[M];
+ return S;
+ }
+ function y(p) {
+ var E = "[A-Za-z]", S = "[0-9]", M = a(S, "[A-Fa-f]"), D = s(s("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + s("%[89A-Fa-f]" + M + "%" + M + M) + "|" + s("%" + M + M)), Q = "[\\:\\/\\?\\#\\[\\]\\@]", Y = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", ue = a(Q, Y), ke = p ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", pe = p ? "[\\uE000-\\uF8FF]" : "[]", le = a(E, S, "[\\-\\.\\_\\~]", ke);
+ s(E + a(E, S, "[\\+\\-\\.]") + "*"), s(s(D + "|" + a(le, Y, "[\\:]")) + "*");
+ var ye = s(s("25[0-5]") + "|" + s("2[0-4]" + S) + "|" + s("1" + S + S) + "|" + s("0?[1-9]" + S) + "|0?0?" + S), we = s(ye + "\\." + ye + "\\." + ye + "\\." + ye), ee = s(M + "{1,4}"), Ee = s(s(ee + "\\:" + ee) + "|" + we), fe = s(s(ee + "\\:") + "{6}" + Ee), Fe = s("\\:\\:" + s(ee + "\\:") + "{5}" + Ee), Dt = s(s(ee) + "?\\:\\:" + s(ee + "\\:") + "{4}" + Ee), Je = s(s(s(ee + "\\:") + "{0,1}" + ee) + "?\\:\\:" + s(ee + "\\:") + "{3}" + Ee), dt = s(s(s(ee + "\\:") + "{0,2}" + ee) + "?\\:\\:" + s(ee + "\\:") + "{2}" + Ee), kt = s(s(s(ee + "\\:") + "{0,3}" + ee) + "?\\:\\:" + ee + "\\:" + Ee), Et = s(s(s(ee + "\\:") + "{0,4}" + ee) + "?\\:\\:" + Ee), qe = s(s(s(ee + "\\:") + "{0,5}" + ee) + "?\\:\\:" + ee), ht = s(s(s(ee + "\\:") + "{0,6}" + ee) + "?\\:\\:"), $t = s([fe, Fe, Dt, Je, dt, kt, Et, qe, ht].join("|")), ot = s(s(le + "|" + D) + "+");
+ s("[vV]" + M + "+\\." + a(le, Y, "[\\:]") + "+"), s(s(D + "|" + a(le, Y)) + "*");
+ var Er = s(D + "|" + a(le, Y, "[\\:\\@]"));
+ return s(s(D + "|" + a(le, Y, "[\\@]")) + "+"), s(s(Er + "|" + a("[\\/\\?]", pe)) + "*"), {
+ NOT_SCHEME: new RegExp(a("[^]", E, S, "[\\+\\-\\.]"), "g"),
+ NOT_USERINFO: new RegExp(a("[^\\%\\:]", le, Y), "g"),
+ NOT_HOST: new RegExp(a("[^\\%\\[\\]\\:]", le, Y), "g"),
+ NOT_PATH: new RegExp(a("[^\\%\\/\\:\\@]", le, Y), "g"),
+ NOT_PATH_NOSCHEME: new RegExp(a("[^\\%\\/\\@]", le, Y), "g"),
+ NOT_QUERY: new RegExp(a("[^\\%]", le, Y, "[\\:\\@\\/\\?]", pe), "g"),
+ NOT_FRAGMENT: new RegExp(a("[^\\%]", le, Y, "[\\:\\@\\/\\?]"), "g"),
+ ESCAPE: new RegExp(a("[^]", le, Y), "g"),
+ UNRESERVED: new RegExp(le, "g"),
+ OTHER_CHARS: new RegExp(a("[^\\%]", le, ue), "g"),
PCT_ENCODED: new RegExp(D, "g"),
- IPV4ADDRESS: new RegExp("^(" + de + ")$"),
- IPV6ADDRESS: new RegExp("^\\[?(" + lt + ")" + s(s("\\%25|\\%(?!" + M + "{2})") + "(" + Ve + ")") + "?\\]?$")
+ IPV4ADDRESS: new RegExp("^(" + we + ")$"),
+ IPV6ADDRESS: new RegExp("^\\[?(" + $t + ")" + s(s("\\%25|\\%(?!" + M + "{2})") + "(" + ot + ")") + "?\\]?$")
//RFC 6874, with relaxed parsing rules
};
}
- var g = y(!1), S = y(!0), L = function() {
- function h($, P) {
- var M = [], D = !0, Y = !1, Z = void 0;
+ var m = y(!1), k = y(!0), N = function() {
+ function p(E, S) {
+ var M = [], D = !0, Q = !1, Y = void 0;
try {
- for (var re = $[Symbol.iterator](), he; !(D = (he = re.next()).done) && (M.push(he.value), !(P && M.length === P)); D = !0)
+ for (var ue = E[Symbol.iterator](), ke; !(D = (ke = ue.next()).done) && (M.push(ke.value), !(S && M.length === S)); D = !0)
;
- } catch (oe) {
- Y = !0, Z = oe;
+ } catch (pe) {
+ Q = !0, Y = pe;
} finally {
try {
- !D && re.return && re.return();
+ !D && ue.return && ue.return();
} finally {
- if (Y)
- throw Z;
+ if (Q)
+ throw Y;
}
}
return M;
}
- return function($, P) {
- if (Array.isArray($))
- return $;
- if (Symbol.iterator in Object($))
- return h($, P);
+ return function(E, S) {
+ if (Array.isArray(E))
+ return E;
+ if (Symbol.iterator in Object(E))
+ return p(E, S);
throw new TypeError("Invalid attempt to destructure non-iterable instance");
};
- }(), A = function(h) {
- if (Array.isArray(h)) {
- for (var $ = 0, P = Array(h.length); $ < h.length; $++)
- P[$] = h[$];
- return P;
+ }(), A = function(p) {
+ if (Array.isArray(p)) {
+ for (var E = 0, S = Array(p.length); E < p.length; E++)
+ S[E] = p[E];
+ return S;
} else
- return Array.from(h);
- }, N = 2147483647, C = 36, T = 1, v = 26, j = 38, I = 700, r = 72, i = 128, o = "-", l = /^xn--/, u = /[^\0-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, f = {
+ return Array.from(p);
+ }, j = 2147483647, C = 36, x = 1, v = 26, T = 38, R = 700, n = 72, i = 128, o = "-", c = /^xn--/, u = /[^\0-\x7E]/, f = /[\x2E\u3002\uFF0E\uFF61]/g, g = {
overflow: "Overflow: input needs wider integers to process",
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
"invalid-input": "Invalid input"
- }, x = C - T, B = Math.floor, U = String.fromCharCode;
- function z(h) {
- throw new RangeError(f[h]);
- }
- function H(h, $) {
- for (var P = [], M = h.length; M--; )
- P[M] = $(h[M]);
- return P;
- }
- function w(h, $) {
- var P = h.split("@"), M = "";
- P.length > 1 && (M = P[0] + "@", h = P[1]), h = h.replace(m, ".");
- var D = h.split("."), Y = H(D, $).join(".");
- return M + Y;
- }
- function q(h) {
- for (var $ = [], P = 0, M = h.length; P < M; ) {
- var D = h.charCodeAt(P++);
- if (D >= 55296 && D <= 56319 && P < M) {
- var Y = h.charCodeAt(P++);
- (Y & 64512) == 56320 ? $.push(((D & 1023) << 10) + (Y & 1023) + 65536) : ($.push(D), P--);
+ }, O = C - x, z = Math.floor, q = String.fromCharCode;
+ function B(p) {
+ throw new RangeError(g[p]);
+ }
+ function G(p, E) {
+ for (var S = [], M = p.length; M--; )
+ S[M] = E(p[M]);
+ return S;
+ }
+ function w(p, E) {
+ var S = p.split("@"), M = "";
+ S.length > 1 && (M = S[0] + "@", p = S[1]), p = p.replace(f, ".");
+ var D = p.split("."), Q = G(D, E).join(".");
+ return M + Q;
+ }
+ function U(p) {
+ for (var E = [], S = 0, M = p.length; S < M; ) {
+ var D = p.charCodeAt(S++);
+ if (D >= 55296 && D <= 56319 && S < M) {
+ var Q = p.charCodeAt(S++);
+ (Q & 64512) == 56320 ? E.push(((D & 1023) << 10) + (Q & 1023) + 65536) : (E.push(D), S--);
} else
- $.push(D);
+ E.push(D);
}
- return $;
- }
- var W = function(h) {
- return String.fromCodePoint.apply(String, A(h));
- }, J = function(h) {
- return h - 48 < 10 ? h - 22 : h - 65 < 26 ? h - 65 : h - 97 < 26 ? h - 97 : C;
- }, V = function(h, $) {
- return h + 22 + 75 * (h < 26) - (($ != 0) << 5);
- }, E = function(h, $, P) {
+ return E;
+ }
+ var W = function(p) {
+ return String.fromCodePoint.apply(String, A(p));
+ }, J = function(p) {
+ return p - 48 < 10 ? p - 22 : p - 65 < 26 ? p - 65 : p - 97 < 26 ? p - 97 : C;
+ }, V = function(p, E) {
+ return p + 22 + 75 * (p < 26) - ((E != 0) << 5);
+ }, P = function(p, E, S) {
var M = 0;
for (
- h = P ? B(h / I) : h >> 1, h += B(h / $);
+ p = S ? z(p / R) : p >> 1, p += z(p / E);
/* no initialization */
- h > x * v >> 1;
+ p > O * v >> 1;
M += C
)
- h = B(h / x);
- return B(M + (x + 1) * h / (h + j));
- }, F = function(h) {
- var $ = [], P = h.length, M = 0, D = i, Y = r, Z = h.lastIndexOf(o);
- Z < 0 && (Z = 0);
- for (var re = 0; re < Z; ++re)
- h.charCodeAt(re) >= 128 && z("not-basic"), $.push(h.charCodeAt(re));
- for (var he = Z > 0 ? Z + 1 : 0; he < P; ) {
+ p = z(p / O);
+ return z(M + (O + 1) * p / (p + T));
+ }, F = function(p) {
+ var E = [], S = p.length, M = 0, D = i, Q = n, Y = p.lastIndexOf(o);
+ Y < 0 && (Y = 0);
+ for (var ue = 0; ue < Y; ++ue)
+ p.charCodeAt(ue) >= 128 && B("not-basic"), E.push(p.charCodeAt(ue));
+ for (var ke = Y > 0 ? Y + 1 : 0; ke < S; ) {
for (
- var oe = M, te = 1, ce = C;
+ var pe = M, le = 1, ye = C;
;
/* no condition */
- ce += C
+ ye += C
) {
- he >= P && z("invalid-input");
- var de = J(h.charCodeAt(he++));
- (de >= C || de > B((N - M) / te)) && z("overflow"), M += de * te;
- var Q = ce <= Y ? T : ce >= Y + v ? v : ce - Y;
- if (de < Q)
+ ke >= S && B("invalid-input");
+ var we = J(p.charCodeAt(ke++));
+ (we >= C || we > z((j - M) / le)) && B("overflow"), M += we * le;
+ var ee = ye <= Q ? x : ye >= Q + v ? v : ye - Q;
+ if (we < ee)
break;
- var pe = C - Q;
- te > B(N / pe) && z("overflow"), te *= pe;
+ var Ee = C - ee;
+ le > z(j / Ee) && B("overflow"), le *= Ee;
}
- var se = $.length + 1;
- Y = E(M - oe, se, oe == 0), B(M / se) > N - D && z("overflow"), D += B(M / se), M %= se, $.splice(M++, 0, D);
- }
- return String.fromCodePoint.apply(String, $);
- }, O = function(h) {
- var $ = [];
- h = q(h);
- var P = h.length, M = i, D = 0, Y = r, Z = !0, re = !1, he = void 0;
+ var fe = E.length + 1;
+ Q = P(M - pe, fe, pe == 0), z(M / fe) > j - D && B("overflow"), D += z(M / fe), M %= fe, E.splice(M++, 0, D);
+ }
+ return String.fromCodePoint.apply(String, E);
+ }, L = function(p) {
+ var E = [];
+ p = U(p);
+ var S = p.length, M = i, D = 0, Q = n, Y = !0, ue = !1, ke = void 0;
try {
- for (var oe = h[Symbol.iterator](), te; !(Z = (te = oe.next()).done); Z = !0) {
- var ce = te.value;
- ce < 128 && $.push(U(ce));
+ for (var pe = p[Symbol.iterator](), le; !(Y = (le = pe.next()).done); Y = !0) {
+ var ye = le.value;
+ ye < 128 && E.push(q(ye));
}
- } catch (Ut) {
- re = !0, he = Ut;
+ } catch (ar) {
+ ue = !0, ke = ar;
} finally {
try {
- !Z && oe.return && oe.return();
+ !Y && pe.return && pe.return();
} finally {
- if (re)
- throw he;
+ if (ue)
+ throw ke;
}
}
- var de = $.length, Q = de;
- for (de && $.push(o); Q < P; ) {
- var pe = N, se = !0, Re = !1, xt = void 0;
+ var we = E.length, ee = we;
+ for (we && E.push(o); ee < S; ) {
+ var Ee = j, fe = !0, Fe = !1, Dt = void 0;
try {
- for (var De = h[Symbol.iterator](), He; !(se = (He = De.next()).done); se = !0) {
- var it = He.value;
- it >= M && it < pe && (pe = it);
+ for (var Je = p[Symbol.iterator](), dt; !(fe = (dt = Je.next()).done); fe = !0) {
+ var kt = dt.value;
+ kt >= M && kt < Ee && (Ee = kt);
}
- } catch (Ut) {
- Re = !0, xt = Ut;
+ } catch (ar) {
+ Fe = !0, Dt = ar;
} finally {
try {
- !se && De.return && De.return();
+ !fe && Je.return && Je.return();
} finally {
- if (Re)
- throw xt;
+ if (Fe)
+ throw Dt;
}
}
- var ct = Q + 1;
- pe - M > B((N - D) / ct) && z("overflow"), D += (pe - M) * ct, M = pe;
- var Ie = !0, Ge = !1, lt = void 0;
+ var Et = ee + 1;
+ Ee - M > z((j - D) / Et) && B("overflow"), D += (Ee - M) * Et, M = Ee;
+ var qe = !0, ht = !1, $t = void 0;
try {
- for (var Ve = h[Symbol.iterator](), dr; !(Ie = (dr = Ve.next()).done); Ie = !0) {
- var $a = dr.value;
- if ($a < M && ++D > N && z("overflow"), $a == M) {
+ for (var ot = p[Symbol.iterator](), Er; !(qe = (Er = ot.next()).done); qe = !0) {
+ var gn = Er.value;
+ if (gn < M && ++D > j && B("overflow"), gn == M) {
for (
- var hr = D, pr = C;
+ var $r = D, Pr = C;
;
/* no condition */
- pr += C
+ Pr += C
) {
- var fr = pr <= Y ? T : pr >= Y + v ? v : pr - Y;
- if (hr < fr)
+ var Sr = Pr <= Q ? x : Pr >= Q + v ? v : Pr - Q;
+ if ($r < Sr)
break;
- var ka = hr - fr, Ea = C - fr;
- $.push(U(V(fr + ka % Ea, 0))), hr = B(ka / Ea);
+ var bn = $r - Sr, yn = C - Sr;
+ E.push(q(V(Sr + bn % yn, 0))), $r = z(bn / yn);
}
- $.push(U(V(hr, 0))), Y = E(D, ct, Q == de), D = 0, ++Q;
+ E.push(q(V($r, 0))), Q = P(D, Et, ee == we), D = 0, ++ee;
}
}
- } catch (Ut) {
- Ge = !0, lt = Ut;
+ } catch (ar) {
+ ht = !0, $t = ar;
} finally {
try {
- !Ie && Ve.return && Ve.return();
+ !qe && ot.return && ot.return();
} finally {
- if (Ge)
- throw lt;
+ if (ht)
+ throw $t;
}
}
++D, ++M;
}
- return $.join("");
- }, d = function(h) {
- return w(h, function($) {
- return l.test($) ? F($.slice(4).toLowerCase()) : $;
+ return E.join("");
+ }, h = function(p) {
+ return w(p, function(E) {
+ return c.test(E) ? F(E.slice(4).toLowerCase()) : E;
});
- }, k = function(h) {
- return w(h, function($) {
- return u.test($) ? "xn--" + O($) : $;
+ }, $ = function(p) {
+ return w(p, function(E) {
+ return u.test(E) ? "xn--" + L(E) : E;
});
- }, R = {
+ }, I = {
/**
* A string representing the current Punycode.js version number.
* @memberOf punycode
@@ -2517,329 +2521,329 @@ var Ho = {}, Eo = { exports: {} };
* @type Object
*/
ucs2: {
- decode: q,
+ decode: U,
encode: W
},
decode: F,
- encode: O,
- toASCII: k,
- toUnicode: d
- }, G = {};
- function K(h) {
- var $ = h.charCodeAt(0), P = void 0;
- return $ < 16 ? P = "%0" + $.toString(16).toUpperCase() : $ < 128 ? P = "%" + $.toString(16).toUpperCase() : $ < 2048 ? P = "%" + ($ >> 6 | 192).toString(16).toUpperCase() + "%" + ($ & 63 | 128).toString(16).toUpperCase() : P = "%" + ($ >> 12 | 224).toString(16).toUpperCase() + "%" + ($ >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + ($ & 63 | 128).toString(16).toUpperCase(), P;
- }
- function X(h) {
- for (var $ = "", P = 0, M = h.length; P < M; ) {
- var D = parseInt(h.substr(P + 1, 2), 16);
+ encode: L,
+ toASCII: $,
+ toUnicode: h
+ }, H = {};
+ function K(p) {
+ var E = p.charCodeAt(0), S = void 0;
+ return E < 16 ? S = "%0" + E.toString(16).toUpperCase() : E < 128 ? S = "%" + E.toString(16).toUpperCase() : E < 2048 ? S = "%" + (E >> 6 | 192).toString(16).toUpperCase() + "%" + (E & 63 | 128).toString(16).toUpperCase() : S = "%" + (E >> 12 | 224).toString(16).toUpperCase() + "%" + (E >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (E & 63 | 128).toString(16).toUpperCase(), S;
+ }
+ function te(p) {
+ for (var E = "", S = 0, M = p.length; S < M; ) {
+ var D = parseInt(p.substr(S + 1, 2), 16);
if (D < 128)
- $ += String.fromCharCode(D), P += 3;
+ E += String.fromCharCode(D), S += 3;
else if (D >= 194 && D < 224) {
- if (M - P >= 6) {
- var Y = parseInt(h.substr(P + 4, 2), 16);
- $ += String.fromCharCode((D & 31) << 6 | Y & 63);
+ if (M - S >= 6) {
+ var Q = parseInt(p.substr(S + 4, 2), 16);
+ E += String.fromCharCode((D & 31) << 6 | Q & 63);
} else
- $ += h.substr(P, 6);
- P += 6;
+ E += p.substr(S, 6);
+ S += 6;
} else if (D >= 224) {
- if (M - P >= 9) {
- var Z = parseInt(h.substr(P + 4, 2), 16), re = parseInt(h.substr(P + 7, 2), 16);
- $ += String.fromCharCode((D & 15) << 12 | (Z & 63) << 6 | re & 63);
+ if (M - S >= 9) {
+ var Y = parseInt(p.substr(S + 4, 2), 16), ue = parseInt(p.substr(S + 7, 2), 16);
+ E += String.fromCharCode((D & 15) << 12 | (Y & 63) << 6 | ue & 63);
} else
- $ += h.substr(P, 9);
- P += 9;
+ E += p.substr(S, 9);
+ S += 9;
} else
- $ += h.substr(P, 3), P += 3;
+ E += p.substr(S, 3), S += 3;
}
- return $;
+ return E;
}
- function ee(h, $) {
- function P(M) {
- var D = X(M);
- return D.match($.UNRESERVED) ? D : M;
+ function ne(p, E) {
+ function S(M) {
+ var D = te(M);
+ return D.match(E.UNRESERVED) ? D : M;
}
- return h.scheme && (h.scheme = String(h.scheme).replace($.PCT_ENCODED, P).toLowerCase().replace($.NOT_SCHEME, "")), h.userinfo !== void 0 && (h.userinfo = String(h.userinfo).replace($.PCT_ENCODED, P).replace($.NOT_USERINFO, K).replace($.PCT_ENCODED, p)), h.host !== void 0 && (h.host = String(h.host).replace($.PCT_ENCODED, P).toLowerCase().replace($.NOT_HOST, K).replace($.PCT_ENCODED, p)), h.path !== void 0 && (h.path = String(h.path).replace($.PCT_ENCODED, P).replace(h.scheme ? $.NOT_PATH : $.NOT_PATH_NOSCHEME, K).replace($.PCT_ENCODED, p)), h.query !== void 0 && (h.query = String(h.query).replace($.PCT_ENCODED, P).replace($.NOT_QUERY, K).replace($.PCT_ENCODED, p)), h.fragment !== void 0 && (h.fragment = String(h.fragment).replace($.PCT_ENCODED, P).replace($.NOT_FRAGMENT, K).replace($.PCT_ENCODED, p)), h;
+ return p.scheme && (p.scheme = String(p.scheme).replace(E.PCT_ENCODED, S).toLowerCase().replace(E.NOT_SCHEME, "")), p.userinfo !== void 0 && (p.userinfo = String(p.userinfo).replace(E.PCT_ENCODED, S).replace(E.NOT_USERINFO, K).replace(E.PCT_ENCODED, d)), p.host !== void 0 && (p.host = String(p.host).replace(E.PCT_ENCODED, S).toLowerCase().replace(E.NOT_HOST, K).replace(E.PCT_ENCODED, d)), p.path !== void 0 && (p.path = String(p.path).replace(E.PCT_ENCODED, S).replace(p.scheme ? E.NOT_PATH : E.NOT_PATH_NOSCHEME, K).replace(E.PCT_ENCODED, d)), p.query !== void 0 && (p.query = String(p.query).replace(E.PCT_ENCODED, S).replace(E.NOT_QUERY, K).replace(E.PCT_ENCODED, d)), p.fragment !== void 0 && (p.fragment = String(p.fragment).replace(E.PCT_ENCODED, S).replace(E.NOT_FRAGMENT, K).replace(E.PCT_ENCODED, d)), p;
}
- function ie(h) {
- return h.replace(/^0*(.*)/, "$1") || "0";
+ function be(p) {
+ return p.replace(/^0*(.*)/, "$1") || "0";
}
- function xe(h, $) {
- var P = h.match($.IPV4ADDRESS) || [], M = L(P, 2), D = M[1];
- return D ? D.split(".").map(ie).join(".") : h;
+ function Ae(p, E) {
+ var S = p.match(E.IPV4ADDRESS) || [], M = N(S, 2), D = M[1];
+ return D ? D.split(".").map(be).join(".") : p;
}
- function qe(h, $) {
- var P = h.match($.IPV6ADDRESS) || [], M = L(P, 3), D = M[1], Y = M[2];
+ function ut(p, E) {
+ var S = p.match(E.IPV6ADDRESS) || [], M = N(S, 3), D = M[1], Q = M[2];
if (D) {
- for (var Z = D.toLowerCase().split("::").reverse(), re = L(Z, 2), he = re[0], oe = re[1], te = oe ? oe.split(":").map(ie) : [], ce = he.split(":").map(ie), de = $.IPV4ADDRESS.test(ce[ce.length - 1]), Q = de ? 7 : 8, pe = ce.length - Q, se = Array(Q), Re = 0; Re < Q; ++Re)
- se[Re] = te[Re] || ce[pe + Re] || "";
- de && (se[Q - 1] = xe(se[Q - 1], $));
- var xt = se.reduce(function(Ie, Ge, lt) {
- if (!Ge || Ge === "0") {
- var Ve = Ie[Ie.length - 1];
- Ve && Ve.index + Ve.length === lt ? Ve.length++ : Ie.push({ index: lt, length: 1 });
+ for (var Y = D.toLowerCase().split("::").reverse(), ue = N(Y, 2), ke = ue[0], pe = ue[1], le = pe ? pe.split(":").map(be) : [], ye = ke.split(":").map(be), we = E.IPV4ADDRESS.test(ye[ye.length - 1]), ee = we ? 7 : 8, Ee = ye.length - ee, fe = Array(ee), Fe = 0; Fe < ee; ++Fe)
+ fe[Fe] = le[Fe] || ye[Ee + Fe] || "";
+ we && (fe[ee - 1] = Ae(fe[ee - 1], E));
+ var Dt = fe.reduce(function(qe, ht, $t) {
+ if (!ht || ht === "0") {
+ var ot = qe[qe.length - 1];
+ ot && ot.index + ot.length === $t ? ot.length++ : qe.push({ index: $t, length: 1 });
}
- return Ie;
- }, []), De = xt.sort(function(Ie, Ge) {
- return Ge.length - Ie.length;
- })[0], He = void 0;
- if (De && De.length > 1) {
- var it = se.slice(0, De.index), ct = se.slice(De.index + De.length);
- He = it.join(":") + "::" + ct.join(":");
+ return qe;
+ }, []), Je = Dt.sort(function(qe, ht) {
+ return ht.length - qe.length;
+ })[0], dt = void 0;
+ if (Je && Je.length > 1) {
+ var kt = fe.slice(0, Je.index), Et = fe.slice(Je.index + Je.length);
+ dt = kt.join(":") + "::" + Et.join(":");
} else
- He = se.join(":");
- return Y && (He += "%" + Y), He;
+ dt = fe.join(":");
+ return Q && (dt += "%" + Q), dt;
} else
- return h;
+ return p;
}
- var At = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Mt = "".match(/(){0}/)[1] === void 0;
- function je(h) {
- var $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = {}, M = $.iri !== !1 ? S : g;
- $.reference === "suffix" && (h = ($.scheme ? $.scheme + ":" : "") + "//" + h);
- var D = h.match(At);
+ var Zt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Yt = "".match(/(){0}/)[1] === void 0;
+ function ze(p) {
+ var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, S = {}, M = E.iri !== !1 ? k : m;
+ E.reference === "suffix" && (p = (E.scheme ? E.scheme + ":" : "") + "//" + p);
+ var D = p.match(Zt);
if (D) {
- Mt ? (P.scheme = D[1], P.userinfo = D[3], P.host = D[4], P.port = parseInt(D[5], 10), P.path = D[6] || "", P.query = D[7], P.fragment = D[8], isNaN(P.port) && (P.port = D[5])) : (P.scheme = D[1] || void 0, P.userinfo = h.indexOf("@") !== -1 ? D[3] : void 0, P.host = h.indexOf("//") !== -1 ? D[4] : void 0, P.port = parseInt(D[5], 10), P.path = D[6] || "", P.query = h.indexOf("?") !== -1 ? D[7] : void 0, P.fragment = h.indexOf("#") !== -1 ? D[8] : void 0, isNaN(P.port) && (P.port = h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? D[4] : void 0)), P.host && (P.host = qe(xe(P.host, M), M)), P.scheme === void 0 && P.userinfo === void 0 && P.host === void 0 && P.port === void 0 && !P.path && P.query === void 0 ? P.reference = "same-document" : P.scheme === void 0 ? P.reference = "relative" : P.fragment === void 0 ? P.reference = "absolute" : P.reference = "uri", $.reference && $.reference !== "suffix" && $.reference !== P.reference && (P.error = P.error || "URI is not a " + $.reference + " reference.");
- var Y = G[($.scheme || P.scheme || "").toLowerCase()];
- if (!$.unicodeSupport && (!Y || !Y.unicodeSupport)) {
- if (P.host && ($.domainHost || Y && Y.domainHost))
+ Yt ? (S.scheme = D[1], S.userinfo = D[3], S.host = D[4], S.port = parseInt(D[5], 10), S.path = D[6] || "", S.query = D[7], S.fragment = D[8], isNaN(S.port) && (S.port = D[5])) : (S.scheme = D[1] || void 0, S.userinfo = p.indexOf("@") !== -1 ? D[3] : void 0, S.host = p.indexOf("//") !== -1 ? D[4] : void 0, S.port = parseInt(D[5], 10), S.path = D[6] || "", S.query = p.indexOf("?") !== -1 ? D[7] : void 0, S.fragment = p.indexOf("#") !== -1 ? D[8] : void 0, isNaN(S.port) && (S.port = p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? D[4] : void 0)), S.host && (S.host = ut(Ae(S.host, M), M)), S.scheme === void 0 && S.userinfo === void 0 && S.host === void 0 && S.port === void 0 && !S.path && S.query === void 0 ? S.reference = "same-document" : S.scheme === void 0 ? S.reference = "relative" : S.fragment === void 0 ? S.reference = "absolute" : S.reference = "uri", E.reference && E.reference !== "suffix" && E.reference !== S.reference && (S.error = S.error || "URI is not a " + E.reference + " reference.");
+ var Q = H[(E.scheme || S.scheme || "").toLowerCase()];
+ if (!E.unicodeSupport && (!Q || !Q.unicodeSupport)) {
+ if (S.host && (E.domainHost || Q && Q.domainHost))
try {
- P.host = R.toASCII(P.host.replace(M.PCT_ENCODED, X).toLowerCase());
- } catch (Z) {
- P.error = P.error || "Host's domain name can not be converted to ASCII via punycode: " + Z;
+ S.host = I.toASCII(S.host.replace(M.PCT_ENCODED, te).toLowerCase());
+ } catch (Y) {
+ S.error = S.error || "Host's domain name can not be converted to ASCII via punycode: " + Y;
}
- ee(P, g);
+ ne(S, m);
} else
- ee(P, M);
- Y && Y.parse && Y.parse(P, $);
+ ne(S, M);
+ Q && Q.parse && Q.parse(S, E);
} else
- P.error = P.error || "URI can not be parsed.";
- return P;
- }
- function Dt(h, $) {
- var P = $.iri !== !1 ? S : g, M = [];
- return h.userinfo !== void 0 && (M.push(h.userinfo), M.push("@")), h.host !== void 0 && M.push(qe(xe(String(h.host), P), P).replace(P.IPV6ADDRESS, function(D, Y, Z) {
- return "[" + Y + (Z ? "%25" + Z : "") + "]";
- })), (typeof h.port == "number" || typeof h.port == "string") && (M.push(":"), M.push(String(h.port))), M.length ? M.join("") : void 0;
- }
- var $t = /^\.\.?\//, kt = /^\/\.(\/|$)/, Et = /^\/\.\.(\/|$)/, zt = /^\/?(?:.|\n)*?(?=\/|$)/;
- function ze(h) {
- for (var $ = []; h.length; )
- if (h.match($t))
- h = h.replace($t, "");
- else if (h.match(kt))
- h = h.replace(kt, "/");
- else if (h.match(Et))
- h = h.replace(Et, "/"), $.pop();
- else if (h === "." || h === "..")
- h = "";
+ S.error = S.error || "URI can not be parsed.";
+ return S;
+ }
+ function Qt(p, E) {
+ var S = E.iri !== !1 ? k : m, M = [];
+ return p.userinfo !== void 0 && (M.push(p.userinfo), M.push("@")), p.host !== void 0 && M.push(ut(Ae(String(p.host), S), S).replace(S.IPV6ADDRESS, function(D, Q, Y) {
+ return "[" + Q + (Y ? "%25" + Y : "") + "]";
+ })), (typeof p.port == "number" || typeof p.port == "string") && (M.push(":"), M.push(String(p.port))), M.length ? M.join("") : void 0;
+ }
+ var Lt = /^\.\.?\//, At = /^\/\.(\/|$)/, Rt = /^\/\.\.(\/|$)/, Xt = /^\/?(?:.|\n)*?(?=\/|$)/;
+ function at(p) {
+ for (var E = []; p.length; )
+ if (p.match(Lt))
+ p = p.replace(Lt, "");
+ else if (p.match(At))
+ p = p.replace(At, "/");
+ else if (p.match(Rt))
+ p = p.replace(Rt, "/"), E.pop();
+ else if (p === "." || p === "..")
+ p = "";
else {
- var P = h.match(zt);
- if (P) {
- var M = P[0];
- h = h.slice(M.length), $.push(M);
+ var S = p.match(Xt);
+ if (S) {
+ var M = S[0];
+ p = p.slice(M.length), E.push(M);
} else
throw new Error("Unexpected dot segment condition");
}
- return $.join("");
+ return E.join("");
}
- function Te(h) {
- var $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = $.iri ? S : g, M = [], D = G[($.scheme || h.scheme || "").toLowerCase()];
- if (D && D.serialize && D.serialize(h, $), h.host && !P.IPV6ADDRESS.test(h.host) && ($.domainHost || D && D.domainHost))
+ function Re(p) {
+ var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, S = E.iri ? k : m, M = [], D = H[(E.scheme || p.scheme || "").toLowerCase()];
+ if (D && D.serialize && D.serialize(p, E), p.host && !S.IPV6ADDRESS.test(p.host) && (E.domainHost || D && D.domainHost))
try {
- h.host = $.iri ? R.toUnicode(h.host) : R.toASCII(h.host.replace(P.PCT_ENCODED, X).toLowerCase());
- } catch (re) {
- h.error = h.error || "Host's domain name can not be converted to " + ($.iri ? "Unicode" : "ASCII") + " via punycode: " + re;
+ p.host = E.iri ? I.toUnicode(p.host) : I.toASCII(p.host.replace(S.PCT_ENCODED, te).toLowerCase());
+ } catch (ue) {
+ p.error = p.error || "Host's domain name can not be converted to " + (E.iri ? "Unicode" : "ASCII") + " via punycode: " + ue;
}
- ee(h, P), $.reference !== "suffix" && h.scheme && (M.push(h.scheme), M.push(":"));
- var Y = Dt(h, $);
- if (Y !== void 0 && ($.reference !== "suffix" && M.push("//"), M.push(Y), h.path && h.path.charAt(0) !== "/" && M.push("/")), h.path !== void 0) {
- var Z = h.path;
- !$.absolutePath && (!D || !D.absolutePath) && (Z = ze(Z)), Y === void 0 && (Z = Z.replace(/^\/\//, "/%2F")), M.push(Z);
+ ne(p, S), E.reference !== "suffix" && p.scheme && (M.push(p.scheme), M.push(":"));
+ var Q = Qt(p, E);
+ if (Q !== void 0 && (E.reference !== "suffix" && M.push("//"), M.push(Q), p.path && p.path.charAt(0) !== "/" && M.push("/")), p.path !== void 0) {
+ var Y = p.path;
+ !E.absolutePath && (!D || !D.absolutePath) && (Y = at(Y)), Q === void 0 && (Y = Y.replace(/^\/\//, "/%2F")), M.push(Y);
}
- return h.query !== void 0 && (M.push("?"), M.push(h.query)), h.fragment !== void 0 && (M.push("#"), M.push(h.fragment)), M.join("");
+ return p.query !== void 0 && (M.push("?"), M.push(p.query)), p.fragment !== void 0 && (M.push("#"), M.push(p.fragment)), M.join("");
}
- function Pt(h, $) {
- var P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], D = {};
- return M || (h = je(Te(h, P), P), $ = je(Te($, P), P)), P = P || {}, !P.tolerant && $.scheme ? (D.scheme = $.scheme, D.userinfo = $.userinfo, D.host = $.host, D.port = $.port, D.path = ze($.path || ""), D.query = $.query) : ($.userinfo !== void 0 || $.host !== void 0 || $.port !== void 0 ? (D.userinfo = $.userinfo, D.host = $.host, D.port = $.port, D.path = ze($.path || ""), D.query = $.query) : ($.path ? ($.path.charAt(0) === "/" ? D.path = ze($.path) : ((h.userinfo !== void 0 || h.host !== void 0 || h.port !== void 0) && !h.path ? D.path = "/" + $.path : h.path ? D.path = h.path.slice(0, h.path.lastIndexOf("/") + 1) + $.path : D.path = $.path, D.path = ze(D.path)), D.query = $.query) : (D.path = h.path, $.query !== void 0 ? D.query = $.query : D.query = h.query), D.userinfo = h.userinfo, D.host = h.host, D.port = h.port), D.scheme = h.scheme), D.fragment = $.fragment, D;
+ function It(p, E) {
+ var S = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], D = {};
+ return M || (p = ze(Re(p, S), S), E = ze(Re(E, S), S)), S = S || {}, !S.tolerant && E.scheme ? (D.scheme = E.scheme, D.userinfo = E.userinfo, D.host = E.host, D.port = E.port, D.path = at(E.path || ""), D.query = E.query) : (E.userinfo !== void 0 || E.host !== void 0 || E.port !== void 0 ? (D.userinfo = E.userinfo, D.host = E.host, D.port = E.port, D.path = at(E.path || ""), D.query = E.query) : (E.path ? (E.path.charAt(0) === "/" ? D.path = at(E.path) : ((p.userinfo !== void 0 || p.host !== void 0 || p.port !== void 0) && !p.path ? D.path = "/" + E.path : p.path ? D.path = p.path.slice(0, p.path.lastIndexOf("/") + 1) + E.path : D.path = E.path, D.path = at(D.path)), D.query = E.query) : (D.path = p.path, E.query !== void 0 ? D.query = E.query : D.query = p.query), D.userinfo = p.userinfo, D.host = p.host, D.port = p.port), D.scheme = p.scheme), D.fragment = E.fragment, D;
}
- function Bt(h, $, P) {
- var M = _({ scheme: "null" }, P);
- return Te(Pt(je(h, M), je($, M), M, !0), M);
+ function er(p, E, S) {
+ var M = _({ scheme: "null" }, S);
+ return Re(It(ze(p, M), ze(E, M), M, !0), M);
}
- function ot(h, $) {
- return typeof h == "string" ? h = Te(je(h, $), $) : c(h) === "object" && (h = je(Te(h, $), $)), h;
+ function wt(p, E) {
+ return typeof p == "string" ? p = Re(ze(p, E), E) : l(p) === "object" && (p = ze(Re(p, E), E)), p;
}
- function Vt(h, $, P) {
- return typeof h == "string" ? h = Te(je(h, P), P) : c(h) === "object" && (h = Te(h, P)), typeof $ == "string" ? $ = Te(je($, P), P) : c($) === "object" && ($ = Te($, P)), h === $;
+ function tr(p, E, S) {
+ return typeof p == "string" ? p = Re(ze(p, S), S) : l(p) === "object" && (p = Re(p, S)), typeof E == "string" ? E = Re(ze(E, S), S) : l(E) === "object" && (E = Re(E, S)), p === E;
}
- function ur(h, $) {
- return h && h.toString().replace(!$ || !$.iri ? g.ESCAPE : S.ESCAPE, K);
+ function kr(p, E) {
+ return p && p.toString().replace(!E || !E.iri ? m.ESCAPE : k.ESCAPE, K);
}
- function Le(h, $) {
- return h && h.toString().replace(!$ || !$.iri ? g.PCT_ENCODED : S.PCT_ENCODED, X);
+ function Ve(p, E) {
+ return p && p.toString().replace(!E || !E.iri ? m.PCT_ENCODED : k.PCT_ENCODED, te);
}
- var st = {
+ var vt = {
scheme: "http",
domainHost: !0,
- parse: function(h, $) {
- return h.host || (h.error = h.error || "HTTP URIs must have a host."), h;
+ parse: function(p, E) {
+ return p.host || (p.error = p.error || "HTTP URIs must have a host."), p;
},
- serialize: function(h, $) {
- var P = String(h.scheme).toLowerCase() === "https";
- return (h.port === (P ? 443 : 80) || h.port === "") && (h.port = void 0), h.path || (h.path = "/"), h;
+ serialize: function(p, E) {
+ var S = String(p.scheme).toLowerCase() === "https";
+ return (p.port === (S ? 443 : 80) || p.port === "") && (p.port = void 0), p.path || (p.path = "/"), p;
}
- }, fa = {
+ }, ln = {
scheme: "https",
- domainHost: st.domainHost,
- parse: st.parse,
- serialize: st.serialize
+ domainHost: vt.domainHost,
+ parse: vt.parse,
+ serialize: vt.serialize
};
- function ma(h) {
- return typeof h.secure == "boolean" ? h.secure : String(h.scheme).toLowerCase() === "wss";
+ function cn(p) {
+ return typeof p.secure == "boolean" ? p.secure : String(p.scheme).toLowerCase() === "wss";
}
- var Ft = {
+ var rr = {
scheme: "ws",
domainHost: !0,
- parse: function(h, $) {
- var P = h;
- return P.secure = ma(P), P.resourceName = (P.path || "/") + (P.query ? "?" + P.query : ""), P.path = void 0, P.query = void 0, P;
+ parse: function(p, E) {
+ var S = p;
+ return S.secure = cn(S), S.resourceName = (S.path || "/") + (S.query ? "?" + S.query : ""), S.path = void 0, S.query = void 0, S;
},
- serialize: function(h, $) {
- if ((h.port === (ma(h) ? 443 : 80) || h.port === "") && (h.port = void 0), typeof h.secure == "boolean" && (h.scheme = h.secure ? "wss" : "ws", h.secure = void 0), h.resourceName) {
- var P = h.resourceName.split("?"), M = L(P, 2), D = M[0], Y = M[1];
- h.path = D && D !== "/" ? D : void 0, h.query = Y, h.resourceName = void 0;
+ serialize: function(p, E) {
+ if ((p.port === (cn(p) ? 443 : 80) || p.port === "") && (p.port = void 0), typeof p.secure == "boolean" && (p.scheme = p.secure ? "wss" : "ws", p.secure = void 0), p.resourceName) {
+ var S = p.resourceName.split("?"), M = N(S, 2), D = M[0], Q = M[1];
+ p.path = D && D !== "/" ? D : void 0, p.query = Q, p.resourceName = void 0;
}
- return h.fragment = void 0, h;
+ return p.fragment = void 0, p;
}
- }, ga = {
+ }, un = {
scheme: "wss",
- domainHost: Ft.domainHost,
- parse: Ft.parse,
- serialize: Ft.serialize
- }, Yn = {}, ya = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", Be = "[0-9A-Fa-f]", Qn = s(s("%[EFef]" + Be + "%" + Be + Be + "%" + Be + Be) + "|" + s("%[89A-Fa-f]" + Be + "%" + Be + Be) + "|" + s("%" + Be + Be)), Xn = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", eo = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", to = n(eo, '[\\"\\\\]'), ro = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ao = new RegExp(ya, "g"), St = new RegExp(Qn, "g"), no = new RegExp(n("[^]", Xn, "[\\.]", '[\\"]', to), "g"), ba = new RegExp(n("[^]", ya, ro), "g"), oo = ba;
- function Cr(h) {
- var $ = X(h);
- return $.match(ao) ? $ : h;
- }
- var _a = {
+ domainHost: rr.domainHost,
+ parse: rr.parse,
+ serialize: rr.serialize
+ }, ss = {}, dn = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", nt = "[0-9A-Fa-f]", is = s(s("%[EFef]" + nt + "%" + nt + nt + "%" + nt + nt) + "|" + s("%[89A-Fa-f]" + nt + "%" + nt + nt) + "|" + s("%" + nt + nt)), ls = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cs = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", us = a(cs, '[\\"\\\\]'), ds = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", hs = new RegExp(dn, "g"), Mt = new RegExp(is, "g"), ps = new RegExp(a("[^]", ls, "[\\.]", '[\\"]', us), "g"), hn = new RegExp(a("[^]", dn, ds), "g"), fs = hn;
+ function ta(p) {
+ var E = te(p);
+ return E.match(hs) ? E : p;
+ }
+ var pn = {
scheme: "mailto",
- parse: function(h, $) {
- var P = h, M = P.to = P.path ? P.path.split(",") : [];
- if (P.path = void 0, P.query) {
- for (var D = !1, Y = {}, Z = P.query.split("&"), re = 0, he = Z.length; re < he; ++re) {
- var oe = Z[re].split("=");
- switch (oe[0]) {
+ parse: function(p, E) {
+ var S = p, M = S.to = S.path ? S.path.split(",") : [];
+ if (S.path = void 0, S.query) {
+ for (var D = !1, Q = {}, Y = S.query.split("&"), ue = 0, ke = Y.length; ue < ke; ++ue) {
+ var pe = Y[ue].split("=");
+ switch (pe[0]) {
case "to":
- for (var te = oe[1].split(","), ce = 0, de = te.length; ce < de; ++ce)
- M.push(te[ce]);
+ for (var le = pe[1].split(","), ye = 0, we = le.length; ye < we; ++ye)
+ M.push(le[ye]);
break;
case "subject":
- P.subject = Le(oe[1], $);
+ S.subject = Ve(pe[1], E);
break;
case "body":
- P.body = Le(oe[1], $);
+ S.body = Ve(pe[1], E);
break;
default:
- D = !0, Y[Le(oe[0], $)] = Le(oe[1], $);
+ D = !0, Q[Ve(pe[0], E)] = Ve(pe[1], E);
break;
}
}
- D && (P.headers = Y);
+ D && (S.headers = Q);
}
- P.query = void 0;
- for (var Q = 0, pe = M.length; Q < pe; ++Q) {
- var se = M[Q].split("@");
- if (se[0] = Le(se[0]), $.unicodeSupport)
- se[1] = Le(se[1], $).toLowerCase();
+ S.query = void 0;
+ for (var ee = 0, Ee = M.length; ee < Ee; ++ee) {
+ var fe = M[ee].split("@");
+ if (fe[0] = Ve(fe[0]), E.unicodeSupport)
+ fe[1] = Ve(fe[1], E).toLowerCase();
else
try {
- se[1] = R.toASCII(Le(se[1], $).toLowerCase());
- } catch (Re) {
- P.error = P.error || "Email address's domain name can not be converted to ASCII via punycode: " + Re;
+ fe[1] = I.toASCII(Ve(fe[1], E).toLowerCase());
+ } catch (Fe) {
+ S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Fe;
}
- M[Q] = se.join("@");
+ M[ee] = fe.join("@");
}
- return P;
+ return S;
},
- serialize: function(h, $) {
- var P = h, M = b(h.to);
+ serialize: function(p, E) {
+ var S = p, M = b(p.to);
if (M) {
- for (var D = 0, Y = M.length; D < Y; ++D) {
- var Z = String(M[D]), re = Z.lastIndexOf("@"), he = Z.slice(0, re).replace(St, Cr).replace(St, p).replace(no, K), oe = Z.slice(re + 1);
+ for (var D = 0, Q = M.length; D < Q; ++D) {
+ var Y = String(M[D]), ue = Y.lastIndexOf("@"), ke = Y.slice(0, ue).replace(Mt, ta).replace(Mt, d).replace(ps, K), pe = Y.slice(ue + 1);
try {
- oe = $.iri ? R.toUnicode(oe) : R.toASCII(Le(oe, $).toLowerCase());
- } catch (Q) {
- P.error = P.error || "Email address's domain name can not be converted to " + ($.iri ? "Unicode" : "ASCII") + " via punycode: " + Q;
+ pe = E.iri ? I.toUnicode(pe) : I.toASCII(Ve(pe, E).toLowerCase());
+ } catch (ee) {
+ S.error = S.error || "Email address's domain name can not be converted to " + (E.iri ? "Unicode" : "ASCII") + " via punycode: " + ee;
}
- M[D] = he + "@" + oe;
+ M[D] = ke + "@" + pe;
}
- P.path = M.join(",");
+ S.path = M.join(",");
}
- var te = h.headers = h.headers || {};
- h.subject && (te.subject = h.subject), h.body && (te.body = h.body);
- var ce = [];
- for (var de in te)
- te[de] !== Yn[de] && ce.push(de.replace(St, Cr).replace(St, p).replace(ba, K) + "=" + te[de].replace(St, Cr).replace(St, p).replace(oo, K));
- return ce.length && (P.query = ce.join("&")), P;
- }
- }, so = /^([^\:]+)\:(.*)/, wa = {
+ var le = p.headers = p.headers || {};
+ p.subject && (le.subject = p.subject), p.body && (le.body = p.body);
+ var ye = [];
+ for (var we in le)
+ le[we] !== ss[we] && ye.push(we.replace(Mt, ta).replace(Mt, d).replace(hn, K) + "=" + le[we].replace(Mt, ta).replace(Mt, d).replace(fs, K));
+ return ye.length && (S.query = ye.join("&")), S;
+ }
+ }, ms = /^([^\:]+)\:(.*)/, fn = {
scheme: "urn",
- parse: function(h, $) {
- var P = h.path && h.path.match(so), M = h;
- if (P) {
- var D = $.scheme || M.scheme || "urn", Y = P[1].toLowerCase(), Z = P[2], re = D + ":" + ($.nid || Y), he = G[re];
- M.nid = Y, M.nss = Z, M.path = void 0, he && (M = he.parse(M, $));
+ parse: function(p, E) {
+ var S = p.path && p.path.match(ms), M = p;
+ if (S) {
+ var D = E.scheme || M.scheme || "urn", Q = S[1].toLowerCase(), Y = S[2], ue = D + ":" + (E.nid || Q), ke = H[ue];
+ M.nid = Q, M.nss = Y, M.path = void 0, ke && (M = ke.parse(M, E));
} else
M.error = M.error || "URN can not be parsed.";
return M;
},
- serialize: function(h, $) {
- var P = $.scheme || h.scheme || "urn", M = h.nid, D = P + ":" + ($.nid || M), Y = G[D];
- Y && (h = Y.serialize(h, $));
- var Z = h, re = h.nss;
- return Z.path = (M || $.nid) + ":" + re, Z;
+ serialize: function(p, E) {
+ var S = E.scheme || p.scheme || "urn", M = p.nid, D = S + ":" + (E.nid || M), Q = H[D];
+ Q && (p = Q.serialize(p, E));
+ var Y = p, ue = p.nss;
+ return Y.path = (M || E.nid) + ":" + ue, Y;
}
- }, io = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, va = {
+ }, gs = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, mn = {
scheme: "urn:uuid",
- parse: function(h, $) {
- var P = h;
- return P.uuid = P.nss, P.nss = void 0, !$.tolerant && (!P.uuid || !P.uuid.match(io)) && (P.error = P.error || "UUID is not valid."), P;
+ parse: function(p, E) {
+ var S = p;
+ return S.uuid = S.nss, S.nss = void 0, !E.tolerant && (!S.uuid || !S.uuid.match(gs)) && (S.error = S.error || "UUID is not valid."), S;
},
- serialize: function(h, $) {
- var P = h;
- return P.nss = (h.uuid || "").toLowerCase(), P;
+ serialize: function(p, E) {
+ var S = p;
+ return S.nss = (p.uuid || "").toLowerCase(), S;
}
};
- G[st.scheme] = st, G[fa.scheme] = fa, G[Ft.scheme] = Ft, G[ga.scheme] = ga, G[_a.scheme] = _a, G[wa.scheme] = wa, G[va.scheme] = va, a.SCHEMES = G, a.pctEncChar = K, a.pctDecChars = X, a.parse = je, a.removeDotSegments = ze, a.serialize = Te, a.resolveComponents = Pt, a.resolve = Bt, a.normalize = ot, a.equal = Vt, a.escapeComponent = ur, a.unescapeComponent = Le, Object.defineProperty(a, "__esModule", { value: !0 });
+ H[vt.scheme] = vt, H[ln.scheme] = ln, H[rr.scheme] = rr, H[un.scheme] = un, H[pn.scheme] = pn, H[fn.scheme] = fn, H[mn.scheme] = mn, r.SCHEMES = H, r.pctEncChar = K, r.pctDecChars = te, r.parse = ze, r.removeDotSegments = at, r.serialize = Re, r.resolveComponents = It, r.resolve = er, r.normalize = wt, r.equal = tr, r.escapeComponent = kr, r.unescapeComponent = Ve, Object.defineProperty(r, "__esModule", { value: !0 });
});
-})(Eo, Eo.exports);
-var _h = Eo.exports;
-Object.defineProperty(Ho, "__esModule", { value: !0 });
-const il = _h;
-il.code = 'require("ajv/dist/runtime/uri").default';
-Ho.default = il;
+})(da, da.exports);
+var nl = da.exports;
+Object.defineProperty(Ea, "__esModule", { value: !0 });
+const jo = nl;
+jo.code = 'require("ajv/dist/runtime/uri").default';
+Ea.default = jo;
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0;
- var t = er;
+ var t = rt;
Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() {
return t.KeywordCxt;
} });
- var a = we;
+ var r = ie;
Object.defineProperty(e, "_", { enumerable: !0, get: function() {
- return a._;
+ return r._;
} }), Object.defineProperty(e, "str", { enumerable: !0, get: function() {
- return a.str;
+ return r.str;
} }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() {
- return a.stringify;
+ return r.stringify;
} }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() {
- return a.nil;
+ return r.nil;
} }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() {
- return a.Name;
+ return r.Name;
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
- return a.CodeGen;
+ return r.CodeGen;
} });
- const n = Ja, s = Za, c = Fr, p = wt, b = we, _ = tt, y = Wa, g = $e, S = bh, L = Ho, A = (V, E) => new RegExp(V, E);
+ const a = _r, s = wr, l = Nt, d = Be, b = ie, _ = xe, y = yr, m = ce, k = al, N = Ea, A = (V, P) => new RegExp(V, P);
A.code = "new RegExp";
- const N = ["removeAdditional", "useDefaults", "coerceTypes"], C = /* @__PURE__ */ new Set([
+ const j = ["removeAdditional", "useDefaults", "coerceTypes"], C = /* @__PURE__ */ new Set([
"validate",
"serialize",
"parse",
@@ -2853,7 +2857,7 @@ Ho.default = il;
"func",
"obj",
"Error"
- ]), T = {
+ ]), x = {
errorDataPath: "",
format: "`validateFormats: false` can be used instead.",
nullable: '"nullable" keyword is supported by default.',
@@ -2873,156 +2877,156 @@ Ho.default = il;
ignoreKeywordsWithRef: "",
jsPropertySyntax: "",
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
- }, j = 200;
- function I(V) {
- var E, F, O, d, k, R, G, K, X, ee, ie, xe, qe, At, Mt, je, Dt, $t, kt, Et, zt, ze, Te, Pt, Bt;
- const ot = V.strict, Vt = (E = V.code) === null || E === void 0 ? void 0 : E.optimize, ur = Vt === !0 || Vt === void 0 ? 1 : Vt || 0, Le = (O = (F = V.code) === null || F === void 0 ? void 0 : F.regExp) !== null && O !== void 0 ? O : A, st = (d = V.uriResolver) !== null && d !== void 0 ? d : L.default;
+ }, T = 200;
+ function R(V) {
+ var P, F, L, h, $, I, H, K, te, ne, be, Ae, ut, Zt, Yt, ze, Qt, Lt, At, Rt, Xt, at, Re, It, er;
+ const wt = V.strict, tr = (P = V.code) === null || P === void 0 ? void 0 : P.optimize, kr = tr === !0 || tr === void 0 ? 1 : tr || 0, Ve = (L = (F = V.code) === null || F === void 0 ? void 0 : F.regExp) !== null && L !== void 0 ? L : A, vt = (h = V.uriResolver) !== null && h !== void 0 ? h : N.default;
return {
- strictSchema: (R = (k = V.strictSchema) !== null && k !== void 0 ? k : ot) !== null && R !== void 0 ? R : !0,
- strictNumbers: (K = (G = V.strictNumbers) !== null && G !== void 0 ? G : ot) !== null && K !== void 0 ? K : !0,
- strictTypes: (ee = (X = V.strictTypes) !== null && X !== void 0 ? X : ot) !== null && ee !== void 0 ? ee : "log",
- strictTuples: (xe = (ie = V.strictTuples) !== null && ie !== void 0 ? ie : ot) !== null && xe !== void 0 ? xe : "log",
- strictRequired: (At = (qe = V.strictRequired) !== null && qe !== void 0 ? qe : ot) !== null && At !== void 0 ? At : !1,
- code: V.code ? { ...V.code, optimize: ur, regExp: Le } : { optimize: ur, regExp: Le },
- loopRequired: (Mt = V.loopRequired) !== null && Mt !== void 0 ? Mt : j,
- loopEnum: (je = V.loopEnum) !== null && je !== void 0 ? je : j,
- meta: (Dt = V.meta) !== null && Dt !== void 0 ? Dt : !0,
- messages: ($t = V.messages) !== null && $t !== void 0 ? $t : !0,
- inlineRefs: (kt = V.inlineRefs) !== null && kt !== void 0 ? kt : !0,
- schemaId: (Et = V.schemaId) !== null && Et !== void 0 ? Et : "$id",
- addUsedSchema: (zt = V.addUsedSchema) !== null && zt !== void 0 ? zt : !0,
- validateSchema: (ze = V.validateSchema) !== null && ze !== void 0 ? ze : !0,
- validateFormats: (Te = V.validateFormats) !== null && Te !== void 0 ? Te : !0,
- unicodeRegExp: (Pt = V.unicodeRegExp) !== null && Pt !== void 0 ? Pt : !0,
- int32range: (Bt = V.int32range) !== null && Bt !== void 0 ? Bt : !0,
- uriResolver: st
+ strictSchema: (I = ($ = V.strictSchema) !== null && $ !== void 0 ? $ : wt) !== null && I !== void 0 ? I : !0,
+ strictNumbers: (K = (H = V.strictNumbers) !== null && H !== void 0 ? H : wt) !== null && K !== void 0 ? K : !0,
+ strictTypes: (ne = (te = V.strictTypes) !== null && te !== void 0 ? te : wt) !== null && ne !== void 0 ? ne : "log",
+ strictTuples: (Ae = (be = V.strictTuples) !== null && be !== void 0 ? be : wt) !== null && Ae !== void 0 ? Ae : "log",
+ strictRequired: (Zt = (ut = V.strictRequired) !== null && ut !== void 0 ? ut : wt) !== null && Zt !== void 0 ? Zt : !1,
+ code: V.code ? { ...V.code, optimize: kr, regExp: Ve } : { optimize: kr, regExp: Ve },
+ loopRequired: (Yt = V.loopRequired) !== null && Yt !== void 0 ? Yt : T,
+ loopEnum: (ze = V.loopEnum) !== null && ze !== void 0 ? ze : T,
+ meta: (Qt = V.meta) !== null && Qt !== void 0 ? Qt : !0,
+ messages: (Lt = V.messages) !== null && Lt !== void 0 ? Lt : !0,
+ inlineRefs: (At = V.inlineRefs) !== null && At !== void 0 ? At : !0,
+ schemaId: (Rt = V.schemaId) !== null && Rt !== void 0 ? Rt : "$id",
+ addUsedSchema: (Xt = V.addUsedSchema) !== null && Xt !== void 0 ? Xt : !0,
+ validateSchema: (at = V.validateSchema) !== null && at !== void 0 ? at : !0,
+ validateFormats: (Re = V.validateFormats) !== null && Re !== void 0 ? Re : !0,
+ unicodeRegExp: (It = V.unicodeRegExp) !== null && It !== void 0 ? It : !0,
+ int32range: (er = V.int32range) !== null && er !== void 0 ? er : !0,
+ uriResolver: vt
};
}
- class r {
- constructor(E = {}) {
- this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), E = this.opts = { ...E, ...I(E) };
- const { es5: F, lines: O } = this.opts.code;
- this.scope = new b.ValueScope({ scope: {}, prefixes: C, es5: F, lines: O }), this.logger = B(E.logger);
- const d = E.validateFormats;
- E.validateFormats = !1, this.RULES = (0, c.getRules)(), i.call(this, T, E, "NOT SUPPORTED"), i.call(this, v, E, "DEPRECATED", "warn"), this._metaOpts = f.call(this), E.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), E.keywords && m.call(this, E.keywords), typeof E.meta == "object" && this.addMetaSchema(E.meta), l.call(this), E.validateFormats = d;
+ class n {
+ constructor(P = {}) {
+ this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), P = this.opts = { ...P, ...R(P) };
+ const { es5: F, lines: L } = this.opts.code;
+ this.scope = new b.ValueScope({ scope: {}, prefixes: C, es5: F, lines: L }), this.logger = z(P.logger);
+ const h = P.validateFormats;
+ P.validateFormats = !1, this.RULES = (0, l.getRules)(), i.call(this, x, P, "NOT SUPPORTED"), i.call(this, v, P, "DEPRECATED", "warn"), this._metaOpts = g.call(this), P.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), P.keywords && f.call(this, P.keywords), typeof P.meta == "object" && this.addMetaSchema(P.meta), c.call(this), P.validateFormats = h;
}
_addVocabularies() {
this.addKeyword("$async");
}
_addDefaultMetaSchema() {
- const { $data: E, meta: F, schemaId: O } = this.opts;
- let d = S;
- O === "id" && (d = { ...S }, d.id = d.$id, delete d.$id), F && E && this.addMetaSchema(d, d[O], !1);
+ const { $data: P, meta: F, schemaId: L } = this.opts;
+ let h = k;
+ L === "id" && (h = { ...k }, h.id = h.$id, delete h.$id), F && P && this.addMetaSchema(h, h[L], !1);
}
defaultMeta() {
- const { meta: E, schemaId: F } = this.opts;
- return this.opts.defaultMeta = typeof E == "object" ? E[F] || E : void 0;
- }
- validate(E, F) {
- let O;
- if (typeof E == "string") {
- if (O = this.getSchema(E), !O)
- throw new Error(`no schema with key or ref "${E}"`);
+ const { meta: P, schemaId: F } = this.opts;
+ return this.opts.defaultMeta = typeof P == "object" ? P[F] || P : void 0;
+ }
+ validate(P, F) {
+ let L;
+ if (typeof P == "string") {
+ if (L = this.getSchema(P), !L)
+ throw new Error(`no schema with key or ref "${P}"`);
} else
- O = this.compile(E);
- const d = O(F);
- return "$async" in O || (this.errors = O.errors), d;
+ L = this.compile(P);
+ const h = L(F);
+ return "$async" in L || (this.errors = L.errors), h;
}
- compile(E, F) {
- const O = this._addSchema(E, F);
- return O.validate || this._compileSchemaEnv(O);
+ compile(P, F) {
+ const L = this._addSchema(P, F);
+ return L.validate || this._compileSchemaEnv(L);
}
- compileAsync(E, F) {
+ compileAsync(P, F) {
if (typeof this.opts.loadSchema != "function")
throw new Error("options.loadSchema should be a function");
- const { loadSchema: O } = this.opts;
- return d.call(this, E, F);
- async function d(ee, ie) {
- await k.call(this, ee.$schema);
- const xe = this._addSchema(ee, ie);
- return xe.validate || R.call(this, xe);
+ const { loadSchema: L } = this.opts;
+ return h.call(this, P, F);
+ async function h(ne, be) {
+ await $.call(this, ne.$schema);
+ const Ae = this._addSchema(ne, be);
+ return Ae.validate || I.call(this, Ae);
}
- async function k(ee) {
- ee && !this.getSchema(ee) && await d.call(this, { $ref: ee }, !0);
+ async function $(ne) {
+ ne && !this.getSchema(ne) && await h.call(this, { $ref: ne }, !0);
}
- async function R(ee) {
+ async function I(ne) {
try {
- return this._compileSchemaEnv(ee);
- } catch (ie) {
- if (!(ie instanceof s.default))
- throw ie;
- return G.call(this, ie), await K.call(this, ie.missingSchema), R.call(this, ee);
+ return this._compileSchemaEnv(ne);
+ } catch (be) {
+ if (!(be instanceof s.default))
+ throw be;
+ return H.call(this, be), await K.call(this, be.missingSchema), I.call(this, ne);
}
}
- function G({ missingSchema: ee, missingRef: ie }) {
- if (this.refs[ee])
- throw new Error(`AnySchema ${ee} is loaded but ${ie} cannot be resolved`);
+ function H({ missingSchema: ne, missingRef: be }) {
+ if (this.refs[ne])
+ throw new Error(`AnySchema ${ne} is loaded but ${be} cannot be resolved`);
}
- async function K(ee) {
- const ie = await X.call(this, ee);
- this.refs[ee] || await k.call(this, ie.$schema), this.refs[ee] || this.addSchema(ie, ee, F);
+ async function K(ne) {
+ const be = await te.call(this, ne);
+ this.refs[ne] || await $.call(this, be.$schema), this.refs[ne] || this.addSchema(be, ne, F);
}
- async function X(ee) {
- const ie = this._loading[ee];
- if (ie)
- return ie;
+ async function te(ne) {
+ const be = this._loading[ne];
+ if (be)
+ return be;
try {
- return await (this._loading[ee] = O(ee));
+ return await (this._loading[ne] = L(ne));
} finally {
- delete this._loading[ee];
+ delete this._loading[ne];
}
}
}
// Adds schema to the instance
- addSchema(E, F, O, d = this.opts.validateSchema) {
- if (Array.isArray(E)) {
- for (const R of E)
- this.addSchema(R, void 0, O, d);
+ addSchema(P, F, L, h = this.opts.validateSchema) {
+ if (Array.isArray(P)) {
+ for (const I of P)
+ this.addSchema(I, void 0, L, h);
return this;
}
- let k;
- if (typeof E == "object") {
- const { schemaId: R } = this.opts;
- if (k = E[R], k !== void 0 && typeof k != "string")
- throw new Error(`schema ${R} must be string`);
+ let $;
+ if (typeof P == "object") {
+ const { schemaId: I } = this.opts;
+ if ($ = P[I], $ !== void 0 && typeof $ != "string")
+ throw new Error(`schema ${I} must be string`);
}
- return F = (0, _.normalizeId)(F || k), this._checkUnique(F), this.schemas[F] = this._addSchema(E, O, F, d, !0), this;
+ return F = (0, _.normalizeId)(F || $), this._checkUnique(F), this.schemas[F] = this._addSchema(P, L, F, h, !0), this;
}
// Add schema that will be used to validate other schemas
// options in META_IGNORE_OPTIONS are alway set to false
- addMetaSchema(E, F, O = this.opts.validateSchema) {
- return this.addSchema(E, F, !0, O), this;
+ addMetaSchema(P, F, L = this.opts.validateSchema) {
+ return this.addSchema(P, F, !0, L), this;
}
// Validate schema against its meta-schema
- validateSchema(E, F) {
- if (typeof E == "boolean")
+ validateSchema(P, F) {
+ if (typeof P == "boolean")
return !0;
- let O;
- if (O = E.$schema, O !== void 0 && typeof O != "string")
+ let L;
+ if (L = P.$schema, L !== void 0 && typeof L != "string")
throw new Error("$schema must be a string");
- if (O = O || this.opts.defaultMeta || this.defaultMeta(), !O)
+ if (L = L || this.opts.defaultMeta || this.defaultMeta(), !L)
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
- const d = this.validate(O, E);
- if (!d && F) {
- const k = "schema is invalid: " + this.errorsText();
+ const h = this.validate(L, P);
+ if (!h && F) {
+ const $ = "schema is invalid: " + this.errorsText();
if (this.opts.validateSchema === "log")
- this.logger.error(k);
+ this.logger.error($);
else
- throw new Error(k);
+ throw new Error($);
}
- return d;
+ return h;
}
// Get compiled schema by `key` or `ref`.
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
- getSchema(E) {
+ getSchema(P) {
let F;
- for (; typeof (F = o.call(this, E)) == "string"; )
- E = F;
+ for (; typeof (F = o.call(this, P)) == "string"; )
+ P = F;
if (F === void 0) {
- const { schemaId: O } = this.opts, d = new p.SchemaEnv({ schema: {}, schemaId: O });
- if (F = p.resolveSchema.call(this, d, E), !F)
+ const { schemaId: L } = this.opts, h = new d.SchemaEnv({ schema: {}, schemaId: L });
+ if (F = d.resolveSchema.call(this, h, P), !F)
return;
- this.refs[E] = F;
+ this.refs[P] = F;
}
return F.validate || this._compileSchemaEnv(F);
}
@@ -3030,225 +3034,225 @@ Ho.default = il;
// If no parameter is passed all schemas but meta-schemas are removed.
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
- removeSchema(E) {
- if (E instanceof RegExp)
- return this._removeAllSchemas(this.schemas, E), this._removeAllSchemas(this.refs, E), this;
- switch (typeof E) {
+ removeSchema(P) {
+ if (P instanceof RegExp)
+ return this._removeAllSchemas(this.schemas, P), this._removeAllSchemas(this.refs, P), this;
+ switch (typeof P) {
case "undefined":
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
case "string": {
- const F = o.call(this, E);
- return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[E], delete this.refs[E], this;
+ const F = o.call(this, P);
+ return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[P], delete this.refs[P], this;
}
case "object": {
- const F = E;
+ const F = P;
this._cache.delete(F);
- let O = E[this.opts.schemaId];
- return O && (O = (0, _.normalizeId)(O), delete this.schemas[O], delete this.refs[O]), this;
+ let L = P[this.opts.schemaId];
+ return L && (L = (0, _.normalizeId)(L), delete this.schemas[L], delete this.refs[L]), this;
}
default:
throw new Error("ajv.removeSchema: invalid parameter");
}
}
// add "vocabulary" - a collection of keywords
- addVocabulary(E) {
- for (const F of E)
+ addVocabulary(P) {
+ for (const F of P)
this.addKeyword(F);
return this;
}
- addKeyword(E, F) {
- let O;
- if (typeof E == "string")
- O = E, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = O);
- else if (typeof E == "object" && F === void 0) {
- if (F = E, O = F.keyword, Array.isArray(O) && !O.length)
+ addKeyword(P, F) {
+ let L;
+ if (typeof P == "string")
+ L = P, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = L);
+ else if (typeof P == "object" && F === void 0) {
+ if (F = P, L = F.keyword, Array.isArray(L) && !L.length)
throw new Error("addKeywords: keyword must be string or non-empty array");
} else
throw new Error("invalid addKeywords parameters");
- if (z.call(this, O, F), !F)
- return (0, g.eachItem)(O, (k) => H.call(this, k)), this;
- q.call(this, F);
- const d = {
+ if (B.call(this, L, F), !F)
+ return (0, m.eachItem)(L, ($) => G.call(this, $)), this;
+ U.call(this, F);
+ const h = {
...F,
type: (0, y.getJSONTypes)(F.type),
schemaType: (0, y.getJSONTypes)(F.schemaType)
};
- return (0, g.eachItem)(O, d.type.length === 0 ? (k) => H.call(this, k, d) : (k) => d.type.forEach((R) => H.call(this, k, d, R))), this;
+ return (0, m.eachItem)(L, h.type.length === 0 ? ($) => G.call(this, $, h) : ($) => h.type.forEach((I) => G.call(this, $, h, I))), this;
}
- getKeyword(E) {
- const F = this.RULES.all[E];
+ getKeyword(P) {
+ const F = this.RULES.all[P];
return typeof F == "object" ? F.definition : !!F;
}
// Remove keyword
- removeKeyword(E) {
+ removeKeyword(P) {
const { RULES: F } = this;
- delete F.keywords[E], delete F.all[E];
- for (const O of F.rules) {
- const d = O.rules.findIndex((k) => k.keyword === E);
- d >= 0 && O.rules.splice(d, 1);
+ delete F.keywords[P], delete F.all[P];
+ for (const L of F.rules) {
+ const h = L.rules.findIndex(($) => $.keyword === P);
+ h >= 0 && L.rules.splice(h, 1);
}
return this;
}
// Add format
- addFormat(E, F) {
- return typeof F == "string" && (F = new RegExp(F)), this.formats[E] = F, this;
- }
- errorsText(E = this.errors, { separator: F = ", ", dataVar: O = "data" } = {}) {
- return !E || E.length === 0 ? "No errors" : E.map((d) => `${O}${d.instancePath} ${d.message}`).reduce((d, k) => d + F + k);
- }
- $dataMetaSchema(E, F) {
- const O = this.RULES.all;
- E = JSON.parse(JSON.stringify(E));
- for (const d of F) {
- const k = d.split("/").slice(1);
- let R = E;
- for (const G of k)
- R = R[G];
- for (const G in O) {
- const K = O[G];
+ addFormat(P, F) {
+ return typeof F == "string" && (F = new RegExp(F)), this.formats[P] = F, this;
+ }
+ errorsText(P = this.errors, { separator: F = ", ", dataVar: L = "data" } = {}) {
+ return !P || P.length === 0 ? "No errors" : P.map((h) => `${L}${h.instancePath} ${h.message}`).reduce((h, $) => h + F + $);
+ }
+ $dataMetaSchema(P, F) {
+ const L = this.RULES.all;
+ P = JSON.parse(JSON.stringify(P));
+ for (const h of F) {
+ const $ = h.split("/").slice(1);
+ let I = P;
+ for (const H of $)
+ I = I[H];
+ for (const H in L) {
+ const K = L[H];
if (typeof K != "object")
continue;
- const { $data: X } = K.definition, ee = R[G];
- X && ee && (R[G] = J(ee));
+ const { $data: te } = K.definition, ne = I[H];
+ te && ne && (I[H] = J(ne));
}
}
- return E;
+ return P;
}
- _removeAllSchemas(E, F) {
- for (const O in E) {
- const d = E[O];
- (!F || F.test(O)) && (typeof d == "string" ? delete E[O] : d && !d.meta && (this._cache.delete(d.schema), delete E[O]));
+ _removeAllSchemas(P, F) {
+ for (const L in P) {
+ const h = P[L];
+ (!F || F.test(L)) && (typeof h == "string" ? delete P[L] : h && !h.meta && (this._cache.delete(h.schema), delete P[L]));
}
}
- _addSchema(E, F, O, d = this.opts.validateSchema, k = this.opts.addUsedSchema) {
- let R;
- const { schemaId: G } = this.opts;
- if (typeof E == "object")
- R = E[G];
+ _addSchema(P, F, L, h = this.opts.validateSchema, $ = this.opts.addUsedSchema) {
+ let I;
+ const { schemaId: H } = this.opts;
+ if (typeof P == "object")
+ I = P[H];
else {
if (this.opts.jtd)
throw new Error("schema must be object");
- if (typeof E != "boolean")
+ if (typeof P != "boolean")
throw new Error("schema must be object or boolean");
}
- let K = this._cache.get(E);
+ let K = this._cache.get(P);
if (K !== void 0)
return K;
- O = (0, _.normalizeId)(R || O);
- const X = _.getSchemaRefs.call(this, E, O);
- return K = new p.SchemaEnv({ schema: E, schemaId: G, meta: F, baseId: O, localRefs: X }), this._cache.set(K.schema, K), k && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = K), d && this.validateSchema(E, !0), K;
+ L = (0, _.normalizeId)(I || L);
+ const te = _.getSchemaRefs.call(this, P, L);
+ return K = new d.SchemaEnv({ schema: P, schemaId: H, meta: F, baseId: L, localRefs: te }), this._cache.set(K.schema, K), $ && !L.startsWith("#") && (L && this._checkUnique(L), this.refs[L] = K), h && this.validateSchema(P, !0), K;
}
- _checkUnique(E) {
- if (this.schemas[E] || this.refs[E])
- throw new Error(`schema with key or id "${E}" already exists`);
+ _checkUnique(P) {
+ if (this.schemas[P] || this.refs[P])
+ throw new Error(`schema with key or id "${P}" already exists`);
}
- _compileSchemaEnv(E) {
- if (E.meta ? this._compileMetaSchema(E) : p.compileSchema.call(this, E), !E.validate)
+ _compileSchemaEnv(P) {
+ if (P.meta ? this._compileMetaSchema(P) : d.compileSchema.call(this, P), !P.validate)
throw new Error("ajv implementation error");
- return E.validate;
+ return P.validate;
}
- _compileMetaSchema(E) {
+ _compileMetaSchema(P) {
const F = this.opts;
this.opts = this._metaOpts;
try {
- p.compileSchema.call(this, E);
+ d.compileSchema.call(this, P);
} finally {
this.opts = F;
}
}
}
- e.default = r, r.ValidationError = n.default, r.MissingRefError = s.default;
- function i(V, E, F, O = "error") {
- for (const d in V) {
- const k = d;
- k in E && this.logger[O](`${F}: option ${d}. ${V[k]}`);
+ e.default = n, n.ValidationError = a.default, n.MissingRefError = s.default;
+ function i(V, P, F, L = "error") {
+ for (const h in V) {
+ const $ = h;
+ $ in P && this.logger[L](`${F}: option ${h}. ${V[$]}`);
}
}
function o(V) {
return V = (0, _.normalizeId)(V), this.schemas[V] || this.refs[V];
}
- function l() {
+ function c() {
const V = this.opts.schemas;
if (V)
if (Array.isArray(V))
this.addSchema(V);
else
- for (const E in V)
- this.addSchema(V[E], E);
+ for (const P in V)
+ this.addSchema(V[P], P);
}
function u() {
for (const V in this.opts.formats) {
- const E = this.opts.formats[V];
- E && this.addFormat(V, E);
+ const P = this.opts.formats[V];
+ P && this.addFormat(V, P);
}
}
- function m(V) {
+ function f(V) {
if (Array.isArray(V)) {
this.addVocabulary(V);
return;
}
this.logger.warn("keywords option as map is deprecated, pass array");
- for (const E in V) {
- const F = V[E];
- F.keyword || (F.keyword = E), this.addKeyword(F);
+ for (const P in V) {
+ const F = V[P];
+ F.keyword || (F.keyword = P), this.addKeyword(F);
}
}
- function f() {
+ function g() {
const V = { ...this.opts };
- for (const E of N)
- delete V[E];
+ for (const P of j)
+ delete V[P];
return V;
}
- const x = { log() {
+ const O = { log() {
}, warn() {
}, error() {
} };
- function B(V) {
+ function z(V) {
if (V === !1)
- return x;
+ return O;
if (V === void 0)
return console;
if (V.log && V.warn && V.error)
return V;
throw new Error("logger must implement log, warn and error methods");
}
- const U = /^[a-z_$][a-z0-9_$:-]*$/i;
- function z(V, E) {
+ const q = /^[a-z_$][a-z0-9_$:-]*$/i;
+ function B(V, P) {
const { RULES: F } = this;
- if ((0, g.eachItem)(V, (O) => {
- if (F.keywords[O])
- throw new Error(`Keyword ${O} is already defined`);
- if (!U.test(O))
- throw new Error(`Keyword ${O} has invalid name`);
- }), !!E && E.$data && !("code" in E || "validate" in E))
+ if ((0, m.eachItem)(V, (L) => {
+ if (F.keywords[L])
+ throw new Error(`Keyword ${L} is already defined`);
+ if (!q.test(L))
+ throw new Error(`Keyword ${L} has invalid name`);
+ }), !!P && P.$data && !("code" in P || "validate" in P))
throw new Error('$data keyword must have "code" or "validate" function');
}
- function H(V, E, F) {
- var O;
- const d = E == null ? void 0 : E.post;
- if (F && d)
+ function G(V, P, F) {
+ var L;
+ const h = P == null ? void 0 : P.post;
+ if (F && h)
throw new Error('keyword with "post" flag cannot have "type"');
- const { RULES: k } = this;
- let R = d ? k.post : k.rules.find(({ type: K }) => K === F);
- if (R || (R = { type: F, rules: [] }, k.rules.push(R)), k.keywords[V] = !0, !E)
+ const { RULES: $ } = this;
+ let I = h ? $.post : $.rules.find(({ type: K }) => K === F);
+ if (I || (I = { type: F, rules: [] }, $.rules.push(I)), $.keywords[V] = !0, !P)
return;
- const G = {
+ const H = {
keyword: V,
definition: {
- ...E,
- type: (0, y.getJSONTypes)(E.type),
- schemaType: (0, y.getJSONTypes)(E.schemaType)
+ ...P,
+ type: (0, y.getJSONTypes)(P.type),
+ schemaType: (0, y.getJSONTypes)(P.schemaType)
}
};
- E.before ? w.call(this, R, G, E.before) : R.rules.push(G), k.all[V] = G, (O = E.implements) === null || O === void 0 || O.forEach((K) => this.addKeyword(K));
+ P.before ? w.call(this, I, H, P.before) : I.rules.push(H), $.all[V] = H, (L = P.implements) === null || L === void 0 || L.forEach((K) => this.addKeyword(K));
}
- function w(V, E, F) {
- const O = V.rules.findIndex((d) => d.keyword === F);
- O >= 0 ? V.rules.splice(O, 0, E) : (V.rules.push(E), this.logger.warn(`rule ${F} is not defined`));
+ function w(V, P, F) {
+ const L = V.rules.findIndex((h) => h.keyword === F);
+ L >= 0 ? V.rules.splice(L, 0, P) : (V.rules.push(P), this.logger.warn(`rule ${F} is not defined`));
}
- function q(V) {
- let { metaSchema: E } = V;
- E !== void 0 && (V.$data && this.opts.$data && (E = J(E)), V.validateSchema = this.compile(E, !0));
+ function U(V) {
+ let { metaSchema: P } = V;
+ P !== void 0 && (V.$data && this.opts.$data && (P = J(P)), V.validateSchema = this.compile(P, !0));
}
const W = {
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
@@ -3256,580 +3260,580 @@ Ho.default = il;
function J(V) {
return { anyOf: [V, W] };
}
-})(Ac);
-var Go = {}, Ko = {}, Wo = {};
-Object.defineProperty(Wo, "__esModule", { value: !0 });
-const wh = {
+})(so);
+var $a = {}, Pa = {}, Sa = {};
+Object.defineProperty(Sa, "__esModule", { value: !0 });
+const ol = {
keyword: "id",
code() {
throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID');
}
};
-Wo.default = wh;
-var Ur = {};
-Object.defineProperty(Ur, "__esModule", { value: !0 });
-Ur.callRef = Ur.getValidate = void 0;
-const vh = Za, Ei = be, bt = we, Kr = cr, Pi = wt, an = $e, $h = {
+Sa.default = ol;
+var jt = {};
+Object.defineProperty(jt, "__esModule", { value: !0 });
+jt.callRef = jt.getValidate = void 0;
+const sl = wr, Tn = se, De = ie, zt = ct, Cn = Be, Tr = ce, il = {
keyword: "$ref",
schemaType: "string",
code(e) {
- const { gen: t, schema: a, it: n } = e, { baseId: s, schemaEnv: c, validateName: p, opts: b, self: _ } = n, { root: y } = c;
- if ((a === "#" || a === "#/") && s === y.baseId)
- return S();
- const g = Pi.resolveRef.call(_, y, s, a);
- if (g === void 0)
- throw new vh.default(n.opts.uriResolver, s, a);
- if (g instanceof Pi.SchemaEnv)
- return L(g);
- return A(g);
- function S() {
- if (c === y)
- return bn(e, p, c, c.$async);
- const N = t.scopeValue("root", { ref: y });
- return bn(e, (0, bt._)`${N}.validate`, y, y.$async);
- }
- function L(N) {
- const C = cl(e, N);
- bn(e, C, N, N.$async);
- }
- function A(N) {
- const C = t.scopeValue("schema", b.code.source === !0 ? { ref: N, code: (0, bt.stringify)(N) } : { ref: N }), T = t.name("valid"), v = e.subschema({
- schema: N,
+ const { gen: t, schema: r, it: a } = e, { baseId: s, schemaEnv: l, validateName: d, opts: b, self: _ } = a, { root: y } = l;
+ if ((r === "#" || r === "#/") && s === y.baseId)
+ return k();
+ const m = Cn.resolveRef.call(_, y, s, r);
+ if (m === void 0)
+ throw new sl.default(a.opts.uriResolver, s, r);
+ if (m instanceof Cn.SchemaEnv)
+ return N(m);
+ return A(m);
+ function k() {
+ if (l === y)
+ return Rr(e, d, l, l.$async);
+ const j = t.scopeValue("root", { ref: y });
+ return Rr(e, (0, De._)`${j}.validate`, y, y.$async);
+ }
+ function N(j) {
+ const C = Lo(e, j);
+ Rr(e, C, j, j.$async);
+ }
+ function A(j) {
+ const C = t.scopeValue("schema", b.code.source === !0 ? { ref: j, code: (0, De.stringify)(j) } : { ref: j }), x = t.name("valid"), v = e.subschema({
+ schema: j,
dataTypes: [],
- schemaPath: bt.nil,
+ schemaPath: De.nil,
topSchemaRef: C,
- errSchemaPath: a
- }, T);
- e.mergeEvaluated(v), e.ok(T);
+ errSchemaPath: r
+ }, x);
+ e.mergeEvaluated(v), e.ok(x);
}
}
};
-function cl(e, t) {
- const { gen: a } = e;
- return t.validate ? a.scopeValue("validate", { ref: t.validate }) : (0, bt._)`${a.scopeValue("wrapper", { ref: t })}.validate`;
-}
-Ur.getValidate = cl;
-function bn(e, t, a, n) {
- const { gen: s, it: c } = e, { allErrors: p, schemaEnv: b, opts: _ } = c, y = _.passContext ? Kr.default.this : bt.nil;
- n ? g() : S();
- function g() {
+function Lo(e, t) {
+ const { gen: r } = e;
+ return t.validate ? r.scopeValue("validate", { ref: t.validate }) : (0, De._)`${r.scopeValue("wrapper", { ref: t })}.validate`;
+}
+jt.getValidate = Lo;
+function Rr(e, t, r, a) {
+ const { gen: s, it: l } = e, { allErrors: d, schemaEnv: b, opts: _ } = l, y = _.passContext ? zt.default.this : De.nil;
+ a ? m() : k();
+ function m() {
if (!b.$async)
throw new Error("async schema referenced by sync schema");
- const N = s.let("valid");
+ const j = s.let("valid");
s.try(() => {
- s.code((0, bt._)`await ${(0, Ei.callValidateCode)(e, t, y)}`), A(t), p || s.assign(N, !0);
+ s.code((0, De._)`await ${(0, Tn.callValidateCode)(e, t, y)}`), A(t), d || s.assign(j, !0);
}, (C) => {
- s.if((0, bt._)`!(${C} instanceof ${c.ValidationError})`, () => s.throw(C)), L(C), p || s.assign(N, !1);
- }), e.ok(N);
+ s.if((0, De._)`!(${C} instanceof ${l.ValidationError})`, () => s.throw(C)), N(C), d || s.assign(j, !1);
+ }), e.ok(j);
}
- function S() {
- e.result((0, Ei.callValidateCode)(e, t, y), () => A(t), () => L(t));
+ function k() {
+ e.result((0, Tn.callValidateCode)(e, t, y), () => A(t), () => N(t));
}
- function L(N) {
- const C = (0, bt._)`${N}.errors`;
- s.assign(Kr.default.vErrors, (0, bt._)`${Kr.default.vErrors} === null ? ${C} : ${Kr.default.vErrors}.concat(${C})`), s.assign(Kr.default.errors, (0, bt._)`${Kr.default.vErrors}.length`);
+ function N(j) {
+ const C = (0, De._)`${j}.errors`;
+ s.assign(zt.default.vErrors, (0, De._)`${zt.default.vErrors} === null ? ${C} : ${zt.default.vErrors}.concat(${C})`), s.assign(zt.default.errors, (0, De._)`${zt.default.vErrors}.length`);
}
- function A(N) {
+ function A(j) {
var C;
- if (!c.opts.unevaluated)
+ if (!l.opts.unevaluated)
return;
- const T = (C = a == null ? void 0 : a.validate) === null || C === void 0 ? void 0 : C.evaluated;
- if (c.props !== !0)
- if (T && !T.dynamicProps)
- T.props !== void 0 && (c.props = an.mergeEvaluated.props(s, T.props, c.props));
+ const x = (C = r == null ? void 0 : r.validate) === null || C === void 0 ? void 0 : C.evaluated;
+ if (l.props !== !0)
+ if (x && !x.dynamicProps)
+ x.props !== void 0 && (l.props = Tr.mergeEvaluated.props(s, x.props, l.props));
else {
- const v = s.var("props", (0, bt._)`${N}.evaluated.props`);
- c.props = an.mergeEvaluated.props(s, v, c.props, bt.Name);
+ const v = s.var("props", (0, De._)`${j}.evaluated.props`);
+ l.props = Tr.mergeEvaluated.props(s, v, l.props, De.Name);
}
- if (c.items !== !0)
- if (T && !T.dynamicItems)
- T.items !== void 0 && (c.items = an.mergeEvaluated.items(s, T.items, c.items));
+ if (l.items !== !0)
+ if (x && !x.dynamicItems)
+ x.items !== void 0 && (l.items = Tr.mergeEvaluated.items(s, x.items, l.items));
else {
- const v = s.var("items", (0, bt._)`${N}.evaluated.items`);
- c.items = an.mergeEvaluated.items(s, v, c.items, bt.Name);
+ const v = s.var("items", (0, De._)`${j}.evaluated.items`);
+ l.items = Tr.mergeEvaluated.items(s, v, l.items, De.Name);
}
}
}
-Ur.callRef = bn;
-Ur.default = $h;
-Object.defineProperty(Ko, "__esModule", { value: !0 });
-const kh = Wo, Eh = Ur, Ph = [
+jt.callRef = Rr;
+jt.default = il;
+Object.defineProperty(Pa, "__esModule", { value: !0 });
+const ll = Sa, cl = jt, ul = [
"$schema",
"$id",
"$defs",
"$vocabulary",
{ keyword: "$comment" },
"definitions",
- kh.default,
- Eh.default
+ ll.default,
+ cl.default
];
-Ko.default = Ph;
-var Jo = {}, Zo = {};
-Object.defineProperty(Zo, "__esModule", { value: !0 });
-const Tn = we, wr = Tn.operators, jn = {
- maximum: { okStr: "<=", ok: wr.LTE, fail: wr.GT },
- minimum: { okStr: ">=", ok: wr.GTE, fail: wr.LT },
- exclusiveMaximum: { okStr: "<", ok: wr.LT, fail: wr.GTE },
- exclusiveMinimum: { okStr: ">", ok: wr.GT, fail: wr.LTE }
-}, Sh = {
- message: ({ keyword: e, schemaCode: t }) => (0, Tn.str)`must be ${jn[e].okStr} ${t}`,
- params: ({ keyword: e, schemaCode: t }) => (0, Tn._)`{comparison: ${jn[e].okStr}, limit: ${t}}`
-}, xh = {
- keyword: Object.keys(jn),
+Pa.default = ul;
+var Ta = {}, Ca = {};
+Object.defineProperty(Ca, "__esModule", { value: !0 });
+const Vr = ie, gt = Vr.operators, Fr = {
+ maximum: { okStr: "<=", ok: gt.LTE, fail: gt.GT },
+ minimum: { okStr: ">=", ok: gt.GTE, fail: gt.LT },
+ exclusiveMaximum: { okStr: "<", ok: gt.LT, fail: gt.GTE },
+ exclusiveMinimum: { okStr: ">", ok: gt.GT, fail: gt.LTE }
+}, dl = {
+ message: ({ keyword: e, schemaCode: t }) => (0, Vr.str)`must be ${Fr[e].okStr} ${t}`,
+ params: ({ keyword: e, schemaCode: t }) => (0, Vr._)`{comparison: ${Fr[e].okStr}, limit: ${t}}`
+}, hl = {
+ keyword: Object.keys(Fr),
type: "number",
schemaType: "number",
$data: !0,
- error: Sh,
+ error: dl,
code(e) {
- const { keyword: t, data: a, schemaCode: n } = e;
- e.fail$data((0, Tn._)`${a} ${jn[t].fail} ${n} || isNaN(${a})`);
+ const { keyword: t, data: r, schemaCode: a } = e;
+ e.fail$data((0, Vr._)`${r} ${Fr[t].fail} ${a} || isNaN(${r})`);
}
};
-Zo.default = xh;
-var Yo = {};
-Object.defineProperty(Yo, "__esModule", { value: !0 });
-const Ra = we, Th = {
- message: ({ schemaCode: e }) => (0, Ra.str)`must be multiple of ${e}`,
- params: ({ schemaCode: e }) => (0, Ra._)`{multipleOf: ${e}}`
-}, jh = {
+Ca.default = hl;
+var xa = {};
+Object.defineProperty(xa, "__esModule", { value: !0 });
+const ur = ie, pl = {
+ message: ({ schemaCode: e }) => (0, ur.str)`must be multiple of ${e}`,
+ params: ({ schemaCode: e }) => (0, ur._)`{multipleOf: ${e}}`
+}, fl = {
keyword: "multipleOf",
type: "number",
schemaType: "number",
$data: !0,
- error: Th,
+ error: pl,
code(e) {
- const { gen: t, data: a, schemaCode: n, it: s } = e, c = s.opts.multipleOfPrecision, p = t.let("res"), b = c ? (0, Ra._)`Math.abs(Math.round(${p}) - ${p}) > 1e-${c}` : (0, Ra._)`${p} !== parseInt(${p})`;
- e.fail$data((0, Ra._)`(${n} === 0 || (${p} = ${a}/${n}, ${b}))`);
+ const { gen: t, data: r, schemaCode: a, it: s } = e, l = s.opts.multipleOfPrecision, d = t.let("res"), b = l ? (0, ur._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${l}` : (0, ur._)`${d} !== parseInt(${d})`;
+ e.fail$data((0, ur._)`(${a} === 0 || (${d} = ${r}/${a}, ${b}))`);
}
};
-Yo.default = jh;
-var Qo = {}, Xo = {};
-Object.defineProperty(Xo, "__esModule", { value: !0 });
-function ll(e) {
+xa.default = fl;
+var Oa = {}, Na = {};
+Object.defineProperty(Na, "__esModule", { value: !0 });
+function Ao(e) {
const t = e.length;
- let a = 0, n = 0, s;
- for (; n < t; )
- a++, s = e.charCodeAt(n++), s >= 55296 && s <= 56319 && n < t && (s = e.charCodeAt(n), (s & 64512) === 56320 && n++);
- return a;
-}
-Xo.default = ll;
-ll.code = 'require("ajv/dist/runtime/ucs2length").default';
-Object.defineProperty(Qo, "__esModule", { value: !0 });
-const Mr = we, Ch = $e, Oh = Xo, Nh = {
+ let r = 0, a = 0, s;
+ for (; a < t; )
+ r++, s = e.charCodeAt(a++), s >= 55296 && s <= 56319 && a < t && (s = e.charCodeAt(a), (s & 64512) === 56320 && a++);
+ return r;
+}
+Na.default = Ao;
+Ao.code = 'require("ajv/dist/runtime/ucs2length").default';
+Object.defineProperty(Oa, "__esModule", { value: !0 });
+const xt = ie, ml = ce, gl = Na, bl = {
message({ keyword: e, schemaCode: t }) {
- const a = e === "maxLength" ? "more" : "fewer";
- return (0, Mr.str)`must NOT have ${a} than ${t} characters`;
+ const r = e === "maxLength" ? "more" : "fewer";
+ return (0, xt.str)`must NOT have ${r} than ${t} characters`;
},
- params: ({ schemaCode: e }) => (0, Mr._)`{limit: ${e}}`
-}, Lh = {
+ params: ({ schemaCode: e }) => (0, xt._)`{limit: ${e}}`
+}, yl = {
keyword: ["maxLength", "minLength"],
type: "string",
schemaType: "number",
$data: !0,
- error: Nh,
+ error: bl,
code(e) {
- const { keyword: t, data: a, schemaCode: n, it: s } = e, c = t === "maxLength" ? Mr.operators.GT : Mr.operators.LT, p = s.opts.unicode === !1 ? (0, Mr._)`${a}.length` : (0, Mr._)`${(0, Ch.useFunc)(e.gen, Oh.default)}(${a})`;
- e.fail$data((0, Mr._)`${p} ${c} ${n}`);
+ const { keyword: t, data: r, schemaCode: a, it: s } = e, l = t === "maxLength" ? xt.operators.GT : xt.operators.LT, d = s.opts.unicode === !1 ? (0, xt._)`${r}.length` : (0, xt._)`${(0, ml.useFunc)(e.gen, gl.default)}(${r})`;
+ e.fail$data((0, xt._)`${d} ${l} ${a}`);
}
};
-Qo.default = Lh;
-var es = {};
-Object.defineProperty(es, "__esModule", { value: !0 });
-const Rh = be, Cn = we, Ih = {
- message: ({ schemaCode: e }) => (0, Cn.str)`must match pattern "${e}"`,
- params: ({ schemaCode: e }) => (0, Cn._)`{pattern: ${e}}`
-}, Ah = {
+Oa.default = yl;
+var ja = {};
+Object.defineProperty(ja, "__esModule", { value: !0 });
+const _l = se, qr = ie, wl = {
+ message: ({ schemaCode: e }) => (0, qr.str)`must match pattern "${e}"`,
+ params: ({ schemaCode: e }) => (0, qr._)`{pattern: ${e}}`
+}, vl = {
keyword: "pattern",
type: "string",
schemaType: "string",
$data: !0,
- error: Ih,
+ error: wl,
code(e) {
- const { data: t, $data: a, schema: n, schemaCode: s, it: c } = e, p = c.opts.unicodeRegExp ? "u" : "", b = a ? (0, Cn._)`(new RegExp(${s}, ${p}))` : (0, Rh.usePattern)(e, n);
- e.fail$data((0, Cn._)`!${b}.test(${t})`);
+ const { data: t, $data: r, schema: a, schemaCode: s, it: l } = e, d = l.opts.unicodeRegExp ? "u" : "", b = r ? (0, qr._)`(new RegExp(${s}, ${d}))` : (0, _l.usePattern)(e, a);
+ e.fail$data((0, qr._)`!${b}.test(${t})`);
}
};
-es.default = Ah;
-var ts = {};
-Object.defineProperty(ts, "__esModule", { value: !0 });
-const Ia = we, Mh = {
+ja.default = vl;
+var La = {};
+Object.defineProperty(La, "__esModule", { value: !0 });
+const dr = ie, kl = {
message({ keyword: e, schemaCode: t }) {
- const a = e === "maxProperties" ? "more" : "fewer";
- return (0, Ia.str)`must NOT have ${a} than ${t} properties`;
+ const r = e === "maxProperties" ? "more" : "fewer";
+ return (0, dr.str)`must NOT have ${r} than ${t} properties`;
},
- params: ({ schemaCode: e }) => (0, Ia._)`{limit: ${e}}`
-}, Dh = {
+ params: ({ schemaCode: e }) => (0, dr._)`{limit: ${e}}`
+}, El = {
keyword: ["maxProperties", "minProperties"],
type: "object",
schemaType: "number",
$data: !0,
- error: Mh,
+ error: kl,
code(e) {
- const { keyword: t, data: a, schemaCode: n } = e, s = t === "maxProperties" ? Ia.operators.GT : Ia.operators.LT;
- e.fail$data((0, Ia._)`Object.keys(${a}).length ${s} ${n}`);
+ const { keyword: t, data: r, schemaCode: a } = e, s = t === "maxProperties" ? dr.operators.GT : dr.operators.LT;
+ e.fail$data((0, dr._)`Object.keys(${r}).length ${s} ${a}`);
}
};
-ts.default = Dh;
-var rs = {};
-Object.defineProperty(rs, "__esModule", { value: !0 });
-const Sa = be, Aa = we, zh = $e, Bh = {
- message: ({ params: { missingProperty: e } }) => (0, Aa.str)`must have required property '${e}'`,
- params: ({ params: { missingProperty: e } }) => (0, Aa._)`{missingProperty: ${e}}`
-}, Vh = {
+La.default = El;
+var Aa = {};
+Object.defineProperty(Aa, "__esModule", { value: !0 });
+const or = se, hr = ie, $l = ce, Pl = {
+ message: ({ params: { missingProperty: e } }) => (0, hr.str)`must have required property '${e}'`,
+ params: ({ params: { missingProperty: e } }) => (0, hr._)`{missingProperty: ${e}}`
+}, Sl = {
keyword: "required",
type: "object",
schemaType: "array",
$data: !0,
- error: Bh,
+ error: Pl,
code(e) {
- const { gen: t, schema: a, schemaCode: n, data: s, $data: c, it: p } = e, { opts: b } = p;
- if (!c && a.length === 0)
+ const { gen: t, schema: r, schemaCode: a, data: s, $data: l, it: d } = e, { opts: b } = d;
+ if (!l && r.length === 0)
return;
- const _ = a.length >= b.loopRequired;
- if (p.allErrors ? y() : g(), b.strictRequired) {
- const A = e.parentSchema.properties, { definedProperties: N } = e.it;
- for (const C of a)
- if ((A == null ? void 0 : A[C]) === void 0 && !N.has(C)) {
- const T = p.schemaEnv.baseId + p.errSchemaPath, v = `required property "${C}" is not defined at "${T}" (strictRequired)`;
- (0, zh.checkStrictMode)(p, v, p.opts.strictRequired);
+ const _ = r.length >= b.loopRequired;
+ if (d.allErrors ? y() : m(), b.strictRequired) {
+ const A = e.parentSchema.properties, { definedProperties: j } = e.it;
+ for (const C of r)
+ if ((A == null ? void 0 : A[C]) === void 0 && !j.has(C)) {
+ const x = d.schemaEnv.baseId + d.errSchemaPath, v = `required property "${C}" is not defined at "${x}" (strictRequired)`;
+ (0, $l.checkStrictMode)(d, v, d.opts.strictRequired);
}
}
function y() {
- if (_ || c)
- e.block$data(Aa.nil, S);
+ if (_ || l)
+ e.block$data(hr.nil, k);
else
- for (const A of a)
- (0, Sa.checkReportMissingProp)(e, A);
+ for (const A of r)
+ (0, or.checkReportMissingProp)(e, A);
}
- function g() {
+ function m() {
const A = t.let("missing");
- if (_ || c) {
- const N = t.let("valid", !0);
- e.block$data(N, () => L(A, N)), e.ok(N);
+ if (_ || l) {
+ const j = t.let("valid", !0);
+ e.block$data(j, () => N(A, j)), e.ok(j);
} else
- t.if((0, Sa.checkMissingProp)(e, a, A)), (0, Sa.reportMissingProp)(e, A), t.else();
+ t.if((0, or.checkMissingProp)(e, r, A)), (0, or.reportMissingProp)(e, A), t.else();
}
- function S() {
- t.forOf("prop", n, (A) => {
- e.setParams({ missingProperty: A }), t.if((0, Sa.noPropertyInData)(t, s, A, b.ownProperties), () => e.error());
+ function k() {
+ t.forOf("prop", a, (A) => {
+ e.setParams({ missingProperty: A }), t.if((0, or.noPropertyInData)(t, s, A, b.ownProperties), () => e.error());
});
}
- function L(A, N) {
- e.setParams({ missingProperty: A }), t.forOf(A, n, () => {
- t.assign(N, (0, Sa.propertyInData)(t, s, A, b.ownProperties)), t.if((0, Aa.not)(N), () => {
+ function N(A, j) {
+ e.setParams({ missingProperty: A }), t.forOf(A, a, () => {
+ t.assign(j, (0, or.propertyInData)(t, s, A, b.ownProperties)), t.if((0, hr.not)(j), () => {
e.error(), t.break();
});
- }, Aa.nil);
+ }, hr.nil);
}
}
};
-rs.default = Vh;
-var as = {};
-Object.defineProperty(as, "__esModule", { value: !0 });
-const Ma = we, Fh = {
+Aa.default = Sl;
+var Ra = {};
+Object.defineProperty(Ra, "__esModule", { value: !0 });
+const pr = ie, Tl = {
message({ keyword: e, schemaCode: t }) {
- const a = e === "maxItems" ? "more" : "fewer";
- return (0, Ma.str)`must NOT have ${a} than ${t} items`;
+ const r = e === "maxItems" ? "more" : "fewer";
+ return (0, pr.str)`must NOT have ${r} than ${t} items`;
},
- params: ({ schemaCode: e }) => (0, Ma._)`{limit: ${e}}`
-}, Uh = {
+ params: ({ schemaCode: e }) => (0, pr._)`{limit: ${e}}`
+}, Cl = {
keyword: ["maxItems", "minItems"],
type: "array",
schemaType: "number",
$data: !0,
- error: Fh,
+ error: Tl,
code(e) {
- const { keyword: t, data: a, schemaCode: n } = e, s = t === "maxItems" ? Ma.operators.GT : Ma.operators.LT;
- e.fail$data((0, Ma._)`${a}.length ${s} ${n}`);
+ const { keyword: t, data: r, schemaCode: a } = e, s = t === "maxItems" ? pr.operators.GT : pr.operators.LT;
+ e.fail$data((0, pr._)`${r}.length ${s} ${a}`);
}
};
-as.default = Uh;
-var ns = {}, Ya = {};
-Object.defineProperty(Ya, "__esModule", { value: !0 });
-const ul = qc;
-ul.code = 'require("ajv/dist/runtime/equal").default';
-Ya.default = ul;
-Object.defineProperty(ns, "__esModule", { value: !0 });
-const ho = Wa, Xe = we, qh = $e, Hh = Ya, Gh = {
- message: ({ params: { i: e, j: t } }) => (0, Xe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,
- params: ({ params: { i: e, j: t } }) => (0, Xe._)`{i: ${e}, j: ${t}}`
-}, Kh = {
+Ra.default = Cl;
+var Ia = {}, vr = {};
+Object.defineProperty(vr, "__esModule", { value: !0 });
+const Ro = mo;
+Ro.code = 'require("ajv/dist/runtime/equal").default';
+vr.default = Ro;
+Object.defineProperty(Ia, "__esModule", { value: !0 });
+const oa = yr, Ce = ie, xl = ce, Ol = vr, Nl = {
+ message: ({ params: { i: e, j: t } }) => (0, Ce.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,
+ params: ({ params: { i: e, j: t } }) => (0, Ce._)`{i: ${e}, j: ${t}}`
+}, jl = {
keyword: "uniqueItems",
type: "array",
schemaType: "boolean",
$data: !0,
- error: Gh,
+ error: Nl,
code(e) {
- const { gen: t, data: a, $data: n, schema: s, parentSchema: c, schemaCode: p, it: b } = e;
- if (!n && !s)
+ const { gen: t, data: r, $data: a, schema: s, parentSchema: l, schemaCode: d, it: b } = e;
+ if (!a && !s)
return;
- const _ = t.let("valid"), y = c.items ? (0, ho.getSchemaTypes)(c.items) : [];
- e.block$data(_, g, (0, Xe._)`${p} === false`), e.ok(_);
- function g() {
- const N = t.let("i", (0, Xe._)`${a}.length`), C = t.let("j");
- e.setParams({ i: N, j: C }), t.assign(_, !0), t.if((0, Xe._)`${N} > 1`, () => (S() ? L : A)(N, C));
- }
- function S() {
- return y.length > 0 && !y.some((N) => N === "object" || N === "array");
- }
- function L(N, C) {
- const T = t.name("item"), v = (0, ho.checkDataTypes)(y, T, b.opts.strictNumbers, ho.DataType.Wrong), j = t.const("indices", (0, Xe._)`{}`);
- t.for((0, Xe._)`;${N}--;`, () => {
- t.let(T, (0, Xe._)`${a}[${N}]`), t.if(v, (0, Xe._)`continue`), y.length > 1 && t.if((0, Xe._)`typeof ${T} == "string"`, (0, Xe._)`${T} += "_"`), t.if((0, Xe._)`typeof ${j}[${T}] == "number"`, () => {
- t.assign(C, (0, Xe._)`${j}[${T}]`), e.error(), t.assign(_, !1).break();
- }).code((0, Xe._)`${j}[${T}] = ${N}`);
+ const _ = t.let("valid"), y = l.items ? (0, oa.getSchemaTypes)(l.items) : [];
+ e.block$data(_, m, (0, Ce._)`${d} === false`), e.ok(_);
+ function m() {
+ const j = t.let("i", (0, Ce._)`${r}.length`), C = t.let("j");
+ e.setParams({ i: j, j: C }), t.assign(_, !0), t.if((0, Ce._)`${j} > 1`, () => (k() ? N : A)(j, C));
+ }
+ function k() {
+ return y.length > 0 && !y.some((j) => j === "object" || j === "array");
+ }
+ function N(j, C) {
+ const x = t.name("item"), v = (0, oa.checkDataTypes)(y, x, b.opts.strictNumbers, oa.DataType.Wrong), T = t.const("indices", (0, Ce._)`{}`);
+ t.for((0, Ce._)`;${j}--;`, () => {
+ t.let(x, (0, Ce._)`${r}[${j}]`), t.if(v, (0, Ce._)`continue`), y.length > 1 && t.if((0, Ce._)`typeof ${x} == "string"`, (0, Ce._)`${x} += "_"`), t.if((0, Ce._)`typeof ${T}[${x}] == "number"`, () => {
+ t.assign(C, (0, Ce._)`${T}[${x}]`), e.error(), t.assign(_, !1).break();
+ }).code((0, Ce._)`${T}[${x}] = ${j}`);
});
}
- function A(N, C) {
- const T = (0, qh.useFunc)(t, Hh.default), v = t.name("outer");
- t.label(v).for((0, Xe._)`;${N}--;`, () => t.for((0, Xe._)`${C} = ${N}; ${C}--;`, () => t.if((0, Xe._)`${T}(${a}[${N}], ${a}[${C}])`, () => {
+ function A(j, C) {
+ const x = (0, xl.useFunc)(t, Ol.default), v = t.name("outer");
+ t.label(v).for((0, Ce._)`;${j}--;`, () => t.for((0, Ce._)`${C} = ${j}; ${C}--;`, () => t.if((0, Ce._)`${x}(${r}[${j}], ${r}[${C}])`, () => {
e.error(), t.assign(_, !1).break(v);
})));
}
}
};
-ns.default = Kh;
-var os = {};
-Object.defineProperty(os, "__esModule", { value: !0 });
-const Po = we, Wh = $e, Jh = Ya, Zh = {
+Ia.default = jl;
+var Ma = {};
+Object.defineProperty(Ma, "__esModule", { value: !0 });
+const ha = ie, Ll = ce, Al = vr, Rl = {
message: "must be equal to constant",
- params: ({ schemaCode: e }) => (0, Po._)`{allowedValue: ${e}}`
-}, Yh = {
+ params: ({ schemaCode: e }) => (0, ha._)`{allowedValue: ${e}}`
+}, Il = {
keyword: "const",
$data: !0,
- error: Zh,
+ error: Rl,
code(e) {
- const { gen: t, data: a, $data: n, schemaCode: s, schema: c } = e;
- n || c && typeof c == "object" ? e.fail$data((0, Po._)`!${(0, Wh.useFunc)(t, Jh.default)}(${a}, ${s})`) : e.fail((0, Po._)`${c} !== ${a}`);
+ const { gen: t, data: r, $data: a, schemaCode: s, schema: l } = e;
+ a || l && typeof l == "object" ? e.fail$data((0, ha._)`!${(0, Ll.useFunc)(t, Al.default)}(${r}, ${s})`) : e.fail((0, ha._)`${l} !== ${r}`);
}
};
-os.default = Yh;
-var ss = {};
-Object.defineProperty(ss, "__esModule", { value: !0 });
-const Oa = we, Qh = $e, Xh = Ya, ep = {
+Ma.default = Il;
+var Da = {};
+Object.defineProperty(Da, "__esModule", { value: !0 });
+const lr = ie, Ml = ce, Dl = vr, Bl = {
message: "must be equal to one of the allowed values",
- params: ({ schemaCode: e }) => (0, Oa._)`{allowedValues: ${e}}`
-}, tp = {
+ params: ({ schemaCode: e }) => (0, lr._)`{allowedValues: ${e}}`
+}, zl = {
keyword: "enum",
schemaType: "array",
$data: !0,
- error: ep,
+ error: Bl,
code(e) {
- const { gen: t, data: a, $data: n, schema: s, schemaCode: c, it: p } = e;
- if (!n && s.length === 0)
+ const { gen: t, data: r, $data: a, schema: s, schemaCode: l, it: d } = e;
+ if (!a && s.length === 0)
throw new Error("enum must have non-empty array");
- const b = s.length >= p.opts.loopEnum;
+ const b = s.length >= d.opts.loopEnum;
let _;
- const y = () => _ ?? (_ = (0, Qh.useFunc)(t, Xh.default));
- let g;
- if (b || n)
- g = t.let("valid"), e.block$data(g, S);
+ const y = () => _ ?? (_ = (0, Ml.useFunc)(t, Dl.default));
+ let m;
+ if (b || a)
+ m = t.let("valid"), e.block$data(m, k);
else {
if (!Array.isArray(s))
throw new Error("ajv implementation error");
- const A = t.const("vSchema", c);
- g = (0, Oa.or)(...s.map((N, C) => L(A, C)));
+ const A = t.const("vSchema", l);
+ m = (0, lr.or)(...s.map((j, C) => N(A, C)));
}
- e.pass(g);
- function S() {
- t.assign(g, !1), t.forOf("v", c, (A) => t.if((0, Oa._)`${y()}(${a}, ${A})`, () => t.assign(g, !0).break()));
+ e.pass(m);
+ function k() {
+ t.assign(m, !1), t.forOf("v", l, (A) => t.if((0, lr._)`${y()}(${r}, ${A})`, () => t.assign(m, !0).break()));
}
- function L(A, N) {
- const C = s[N];
- return typeof C == "object" && C !== null ? (0, Oa._)`${y()}(${a}, ${A}[${N}])` : (0, Oa._)`${a} === ${C}`;
+ function N(A, j) {
+ const C = s[j];
+ return typeof C == "object" && C !== null ? (0, lr._)`${y()}(${r}, ${A}[${j}])` : (0, lr._)`${r} === ${C}`;
}
}
};
-ss.default = tp;
-Object.defineProperty(Jo, "__esModule", { value: !0 });
-const rp = Zo, ap = Yo, np = Qo, op = es, sp = ts, ip = rs, cp = as, lp = ns, up = os, dp = ss, hp = [
+Da.default = zl;
+Object.defineProperty(Ta, "__esModule", { value: !0 });
+const Vl = Ca, Fl = xa, ql = Oa, Ul = ja, Gl = La, Hl = Aa, Kl = Ra, Wl = Ia, Jl = Ma, Zl = Da, Yl = [
// number
- rp.default,
- ap.default,
+ Vl.default,
+ Fl.default,
// string
- np.default,
- op.default,
+ ql.default,
+ Ul.default,
// object
- sp.default,
- ip.default,
+ Gl.default,
+ Hl.default,
// array
- cp.default,
- lp.default,
+ Kl.default,
+ Wl.default,
// any
{ keyword: "type", schemaType: ["string", "array"] },
{ keyword: "nullable", schemaType: "boolean" },
- up.default,
- dp.default
+ Jl.default,
+ Zl.default
];
-Jo.default = hp;
-var is = {}, ua = {};
-Object.defineProperty(ua, "__esModule", { value: !0 });
-ua.validateAdditionalItems = void 0;
-const Dr = we, So = $e, pp = {
- message: ({ params: { len: e } }) => (0, Dr.str)`must NOT have more than ${e} items`,
- params: ({ params: { len: e } }) => (0, Dr._)`{limit: ${e}}`
-}, fp = {
+Ta.default = Yl;
+var Ba = {}, Wt = {};
+Object.defineProperty(Wt, "__esModule", { value: !0 });
+Wt.validateAdditionalItems = void 0;
+const Ot = ie, pa = ce, Ql = {
+ message: ({ params: { len: e } }) => (0, Ot.str)`must NOT have more than ${e} items`,
+ params: ({ params: { len: e } }) => (0, Ot._)`{limit: ${e}}`
+}, Xl = {
keyword: "additionalItems",
type: "array",
schemaType: ["boolean", "object"],
before: "uniqueItems",
- error: pp,
+ error: Ql,
code(e) {
- const { parentSchema: t, it: a } = e, { items: n } = t;
- if (!Array.isArray(n)) {
- (0, So.checkStrictMode)(a, '"additionalItems" is ignored when "items" is not an array of schemas');
+ const { parentSchema: t, it: r } = e, { items: a } = t;
+ if (!Array.isArray(a)) {
+ (0, pa.checkStrictMode)(r, '"additionalItems" is ignored when "items" is not an array of schemas');
return;
}
- dl(e, n);
+ Io(e, a);
}
};
-function dl(e, t) {
- const { gen: a, schema: n, data: s, keyword: c, it: p } = e;
- p.items = !0;
- const b = a.const("len", (0, Dr._)`${s}.length`);
- if (n === !1)
- e.setParams({ len: t.length }), e.pass((0, Dr._)`${b} <= ${t.length}`);
- else if (typeof n == "object" && !(0, So.alwaysValidSchema)(p, n)) {
- const y = a.var("valid", (0, Dr._)`${b} <= ${t.length}`);
- a.if((0, Dr.not)(y), () => _(y)), e.ok(y);
+function Io(e, t) {
+ const { gen: r, schema: a, data: s, keyword: l, it: d } = e;
+ d.items = !0;
+ const b = r.const("len", (0, Ot._)`${s}.length`);
+ if (a === !1)
+ e.setParams({ len: t.length }), e.pass((0, Ot._)`${b} <= ${t.length}`);
+ else if (typeof a == "object" && !(0, pa.alwaysValidSchema)(d, a)) {
+ const y = r.var("valid", (0, Ot._)`${b} <= ${t.length}`);
+ r.if((0, Ot.not)(y), () => _(y)), e.ok(y);
}
function _(y) {
- a.forRange("i", t.length, b, (g) => {
- e.subschema({ keyword: c, dataProp: g, dataPropType: So.Type.Num }, y), p.allErrors || a.if((0, Dr.not)(y), () => a.break());
+ r.forRange("i", t.length, b, (m) => {
+ e.subschema({ keyword: l, dataProp: m, dataPropType: pa.Type.Num }, y), d.allErrors || r.if((0, Ot.not)(y), () => r.break());
});
}
}
-ua.validateAdditionalItems = dl;
-ua.default = fp;
-var cs = {}, da = {};
-Object.defineProperty(da, "__esModule", { value: !0 });
-da.validateTuple = void 0;
-const Si = we, _n = $e, mp = be, gp = {
+Wt.validateAdditionalItems = Io;
+Wt.default = Xl;
+var za = {}, Jt = {};
+Object.defineProperty(Jt, "__esModule", { value: !0 });
+Jt.validateTuple = void 0;
+const xn = ie, Ir = ce, ec = se, tc = {
keyword: "items",
type: "array",
schemaType: ["object", "array", "boolean"],
before: "uniqueItems",
code(e) {
- const { schema: t, it: a } = e;
+ const { schema: t, it: r } = e;
if (Array.isArray(t))
- return hl(e, "additionalItems", t);
- a.items = !0, !(0, _n.alwaysValidSchema)(a, t) && e.ok((0, mp.validateArray)(e));
+ return Mo(e, "additionalItems", t);
+ r.items = !0, !(0, Ir.alwaysValidSchema)(r, t) && e.ok((0, ec.validateArray)(e));
}
};
-function hl(e, t, a = e.schema) {
- const { gen: n, parentSchema: s, data: c, keyword: p, it: b } = e;
- g(s), b.opts.unevaluated && a.length && b.items !== !0 && (b.items = _n.mergeEvaluated.items(n, a.length, b.items));
- const _ = n.name("valid"), y = n.const("len", (0, Si._)`${c}.length`);
- a.forEach((S, L) => {
- (0, _n.alwaysValidSchema)(b, S) || (n.if((0, Si._)`${y} > ${L}`, () => e.subschema({
- keyword: p,
- schemaProp: L,
- dataProp: L
+function Mo(e, t, r = e.schema) {
+ const { gen: a, parentSchema: s, data: l, keyword: d, it: b } = e;
+ m(s), b.opts.unevaluated && r.length && b.items !== !0 && (b.items = Ir.mergeEvaluated.items(a, r.length, b.items));
+ const _ = a.name("valid"), y = a.const("len", (0, xn._)`${l}.length`);
+ r.forEach((k, N) => {
+ (0, Ir.alwaysValidSchema)(b, k) || (a.if((0, xn._)`${y} > ${N}`, () => e.subschema({
+ keyword: d,
+ schemaProp: N,
+ dataProp: N
}, _)), e.ok(_));
});
- function g(S) {
- const { opts: L, errSchemaPath: A } = b, N = a.length, C = N === S.minItems && (N === S.maxItems || S[t] === !1);
- if (L.strictTuples && !C) {
- const T = `"${p}" is ${N}-tuple, but minItems or maxItems/${t} are not specified or different at path "${A}"`;
- (0, _n.checkStrictMode)(b, T, L.strictTuples);
+ function m(k) {
+ const { opts: N, errSchemaPath: A } = b, j = r.length, C = j === k.minItems && (j === k.maxItems || k[t] === !1);
+ if (N.strictTuples && !C) {
+ const x = `"${d}" is ${j}-tuple, but minItems or maxItems/${t} are not specified or different at path "${A}"`;
+ (0, Ir.checkStrictMode)(b, x, N.strictTuples);
}
}
}
-da.validateTuple = hl;
-da.default = gp;
-Object.defineProperty(cs, "__esModule", { value: !0 });
-const yp = da, bp = {
+Jt.validateTuple = Mo;
+Jt.default = tc;
+Object.defineProperty(za, "__esModule", { value: !0 });
+const rc = Jt, ac = {
keyword: "prefixItems",
type: "array",
schemaType: ["array"],
before: "uniqueItems",
- code: (e) => (0, yp.validateTuple)(e, "items")
+ code: (e) => (0, rc.validateTuple)(e, "items")
};
-cs.default = bp;
-var ls = {};
-Object.defineProperty(ls, "__esModule", { value: !0 });
-const xi = we, _p = $e, wp = be, vp = ua, $p = {
- message: ({ params: { len: e } }) => (0, xi.str)`must NOT have more than ${e} items`,
- params: ({ params: { len: e } }) => (0, xi._)`{limit: ${e}}`
-}, kp = {
+za.default = ac;
+var Va = {};
+Object.defineProperty(Va, "__esModule", { value: !0 });
+const On = ie, nc = ce, oc = se, sc = Wt, ic = {
+ message: ({ params: { len: e } }) => (0, On.str)`must NOT have more than ${e} items`,
+ params: ({ params: { len: e } }) => (0, On._)`{limit: ${e}}`
+}, lc = {
keyword: "items",
type: "array",
schemaType: ["object", "boolean"],
before: "uniqueItems",
- error: $p,
+ error: ic,
code(e) {
- const { schema: t, parentSchema: a, it: n } = e, { prefixItems: s } = a;
- n.items = !0, !(0, _p.alwaysValidSchema)(n, t) && (s ? (0, vp.validateAdditionalItems)(e, s) : e.ok((0, wp.validateArray)(e)));
+ const { schema: t, parentSchema: r, it: a } = e, { prefixItems: s } = r;
+ a.items = !0, !(0, nc.alwaysValidSchema)(a, t) && (s ? (0, sc.validateAdditionalItems)(e, s) : e.ok((0, oc.validateArray)(e)));
}
};
-ls.default = kp;
-var us = {};
-Object.defineProperty(us, "__esModule", { value: !0 });
-const Rt = we, nn = $e, Ep = {
- message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, Rt.str)`must contain at least ${e} valid item(s)` : (0, Rt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,
- params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, Rt._)`{minContains: ${e}}` : (0, Rt._)`{minContains: ${e}, maxContains: ${t}}`
-}, Pp = {
+Va.default = lc;
+var Fa = {};
+Object.defineProperty(Fa, "__esModule", { value: !0 });
+const We = ie, Cr = ce, cc = {
+ message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, We.str)`must contain at least ${e} valid item(s)` : (0, We.str)`must contain at least ${e} and no more than ${t} valid item(s)`,
+ params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, We._)`{minContains: ${e}}` : (0, We._)`{minContains: ${e}, maxContains: ${t}}`
+}, uc = {
keyword: "contains",
type: "array",
schemaType: ["object", "boolean"],
before: "uniqueItems",
trackErrors: !0,
- error: Ep,
+ error: cc,
code(e) {
- const { gen: t, schema: a, parentSchema: n, data: s, it: c } = e;
- let p, b;
- const { minContains: _, maxContains: y } = n;
- c.opts.next ? (p = _ === void 0 ? 1 : _, b = y) : p = 1;
- const g = t.const("len", (0, Rt._)`${s}.length`);
- if (e.setParams({ min: p, max: b }), b === void 0 && p === 0) {
- (0, nn.checkStrictMode)(c, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
+ const { gen: t, schema: r, parentSchema: a, data: s, it: l } = e;
+ let d, b;
+ const { minContains: _, maxContains: y } = a;
+ l.opts.next ? (d = _ === void 0 ? 1 : _, b = y) : d = 1;
+ const m = t.const("len", (0, We._)`${s}.length`);
+ if (e.setParams({ min: d, max: b }), b === void 0 && d === 0) {
+ (0, Cr.checkStrictMode)(l, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
return;
}
- if (b !== void 0 && p > b) {
- (0, nn.checkStrictMode)(c, '"minContains" > "maxContains" is always invalid'), e.fail();
+ if (b !== void 0 && d > b) {
+ (0, Cr.checkStrictMode)(l, '"minContains" > "maxContains" is always invalid'), e.fail();
return;
}
- if ((0, nn.alwaysValidSchema)(c, a)) {
- let C = (0, Rt._)`${g} >= ${p}`;
- b !== void 0 && (C = (0, Rt._)`${C} && ${g} <= ${b}`), e.pass(C);
+ if ((0, Cr.alwaysValidSchema)(l, r)) {
+ let C = (0, We._)`${m} >= ${d}`;
+ b !== void 0 && (C = (0, We._)`${C} && ${m} <= ${b}`), e.pass(C);
return;
}
- c.items = !0;
- const S = t.name("valid");
- b === void 0 && p === 1 ? A(S, () => t.if(S, () => t.break())) : p === 0 ? (t.let(S, !0), b !== void 0 && t.if((0, Rt._)`${s}.length > 0`, L)) : (t.let(S, !1), L()), e.result(S, () => e.reset());
- function L() {
- const C = t.name("_valid"), T = t.let("count", 0);
- A(C, () => t.if(C, () => N(T)));
+ l.items = !0;
+ const k = t.name("valid");
+ b === void 0 && d === 1 ? A(k, () => t.if(k, () => t.break())) : d === 0 ? (t.let(k, !0), b !== void 0 && t.if((0, We._)`${s}.length > 0`, N)) : (t.let(k, !1), N()), e.result(k, () => e.reset());
+ function N() {
+ const C = t.name("_valid"), x = t.let("count", 0);
+ A(C, () => t.if(C, () => j(x)));
}
- function A(C, T) {
- t.forRange("i", 0, g, (v) => {
+ function A(C, x) {
+ t.forRange("i", 0, m, (v) => {
e.subschema({
keyword: "contains",
dataProp: v,
- dataPropType: nn.Type.Num,
+ dataPropType: Cr.Type.Num,
compositeRule: !0
- }, C), T();
+ }, C), x();
});
}
- function N(C) {
- t.code((0, Rt._)`${C}++`), b === void 0 ? t.if((0, Rt._)`${C} >= ${p}`, () => t.assign(S, !0).break()) : (t.if((0, Rt._)`${C} > ${b}`, () => t.assign(S, !1).break()), p === 1 ? t.assign(S, !0) : t.if((0, Rt._)`${C} >= ${p}`, () => t.assign(S, !0)));
+ function j(C) {
+ t.code((0, We._)`${C}++`), b === void 0 ? t.if((0, We._)`${C} >= ${d}`, () => t.assign(k, !0).break()) : (t.if((0, We._)`${C} > ${b}`, () => t.assign(k, !1).break()), d === 1 ? t.assign(k, !0) : t.if((0, We._)`${C} >= ${d}`, () => t.assign(k, !0)));
}
}
};
-us.default = Pp;
-var pl = {};
+Fa.default = uc;
+var Do = {};
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0;
- const t = we, a = $e, n = be;
+ const t = ie, r = ce, a = se;
e.error = {
- message: ({ params: { property: _, depsCount: y, deps: g } }) => {
- const S = y === 1 ? "property" : "properties";
- return (0, t.str)`must have ${S} ${g} when property ${_} is present`;
+ message: ({ params: { property: _, depsCount: y, deps: m } }) => {
+ const k = y === 1 ? "property" : "properties";
+ return (0, t.str)`must have ${k} ${m} when property ${_} is present`;
},
- params: ({ params: { property: _, depsCount: y, deps: g, missingProperty: S } }) => (0, t._)`{property: ${_},
- missingProperty: ${S},
+ params: ({ params: { property: _, depsCount: y, deps: m, missingProperty: k } }) => (0, t._)`{property: ${_},
+ missingProperty: ${k},
depsCount: ${y},
- deps: ${g}}`
+ deps: ${m}}`
// TODO change to reference
};
const s = {
@@ -3838,233 +3842,233 @@ var pl = {};
schemaType: "object",
error: e.error,
code(_) {
- const [y, g] = c(_);
- p(_, y), b(_, g);
+ const [y, m] = l(_);
+ d(_, y), b(_, m);
}
};
- function c({ schema: _ }) {
- const y = {}, g = {};
- for (const S in _) {
- if (S === "__proto__")
+ function l({ schema: _ }) {
+ const y = {}, m = {};
+ for (const k in _) {
+ if (k === "__proto__")
continue;
- const L = Array.isArray(_[S]) ? y : g;
- L[S] = _[S];
+ const N = Array.isArray(_[k]) ? y : m;
+ N[k] = _[k];
}
- return [y, g];
+ return [y, m];
}
- function p(_, y = _.schema) {
- const { gen: g, data: S, it: L } = _;
+ function d(_, y = _.schema) {
+ const { gen: m, data: k, it: N } = _;
if (Object.keys(y).length === 0)
return;
- const A = g.let("missing");
- for (const N in y) {
- const C = y[N];
+ const A = m.let("missing");
+ for (const j in y) {
+ const C = y[j];
if (C.length === 0)
continue;
- const T = (0, n.propertyInData)(g, S, N, L.opts.ownProperties);
+ const x = (0, a.propertyInData)(m, k, j, N.opts.ownProperties);
_.setParams({
- property: N,
+ property: j,
depsCount: C.length,
deps: C.join(", ")
- }), L.allErrors ? g.if(T, () => {
+ }), N.allErrors ? m.if(x, () => {
for (const v of C)
- (0, n.checkReportMissingProp)(_, v);
- }) : (g.if((0, t._)`${T} && (${(0, n.checkMissingProp)(_, C, A)})`), (0, n.reportMissingProp)(_, A), g.else());
+ (0, a.checkReportMissingProp)(_, v);
+ }) : (m.if((0, t._)`${x} && (${(0, a.checkMissingProp)(_, C, A)})`), (0, a.reportMissingProp)(_, A), m.else());
}
}
- e.validatePropertyDeps = p;
+ e.validatePropertyDeps = d;
function b(_, y = _.schema) {
- const { gen: g, data: S, keyword: L, it: A } = _, N = g.name("valid");
+ const { gen: m, data: k, keyword: N, it: A } = _, j = m.name("valid");
for (const C in y)
- (0, a.alwaysValidSchema)(A, y[C]) || (g.if(
- (0, n.propertyInData)(g, S, C, A.opts.ownProperties),
+ (0, r.alwaysValidSchema)(A, y[C]) || (m.if(
+ (0, a.propertyInData)(m, k, C, A.opts.ownProperties),
() => {
- const T = _.subschema({ keyword: L, schemaProp: C }, N);
- _.mergeValidEvaluated(T, N);
+ const x = _.subschema({ keyword: N, schemaProp: C }, j);
+ _.mergeValidEvaluated(x, j);
},
- () => g.var(N, !0)
+ () => m.var(j, !0)
// TODO var
- ), _.ok(N));
+ ), _.ok(j));
}
e.validateSchemaDeps = b, e.default = s;
-})(pl);
-var ds = {};
-Object.defineProperty(ds, "__esModule", { value: !0 });
-const fl = we, Sp = $e, xp = {
+})(Do);
+var qa = {};
+Object.defineProperty(qa, "__esModule", { value: !0 });
+const Bo = ie, dc = ce, hc = {
message: "property name must be valid",
- params: ({ params: e }) => (0, fl._)`{propertyName: ${e.propertyName}}`
-}, Tp = {
+ params: ({ params: e }) => (0, Bo._)`{propertyName: ${e.propertyName}}`
+}, pc = {
keyword: "propertyNames",
type: "object",
schemaType: ["object", "boolean"],
- error: xp,
+ error: hc,
code(e) {
- const { gen: t, schema: a, data: n, it: s } = e;
- if ((0, Sp.alwaysValidSchema)(s, a))
+ const { gen: t, schema: r, data: a, it: s } = e;
+ if ((0, dc.alwaysValidSchema)(s, r))
return;
- const c = t.name("valid");
- t.forIn("key", n, (p) => {
- e.setParams({ propertyName: p }), e.subschema({
+ const l = t.name("valid");
+ t.forIn("key", a, (d) => {
+ e.setParams({ propertyName: d }), e.subschema({
keyword: "propertyNames",
- data: p,
+ data: d,
dataTypes: ["string"],
- propertyName: p,
+ propertyName: d,
compositeRule: !0
- }, c), t.if((0, fl.not)(c), () => {
+ }, l), t.if((0, Bo.not)(l), () => {
e.error(!0), s.allErrors || t.break();
});
- }), e.ok(c);
+ }), e.ok(l);
}
};
-ds.default = Tp;
-var Hn = {};
-Object.defineProperty(Hn, "__esModule", { value: !0 });
-const on = be, Gt = we, jp = cr, sn = $e, Cp = {
+qa.default = pc;
+var Xr = {};
+Object.defineProperty(Xr, "__esModule", { value: !0 });
+const xr = se, Ye = ie, fc = ct, Or = ce, mc = {
message: "must NOT have additional properties",
- params: ({ params: e }) => (0, Gt._)`{additionalProperty: ${e.additionalProperty}}`
-}, Op = {
+ params: ({ params: e }) => (0, Ye._)`{additionalProperty: ${e.additionalProperty}}`
+}, gc = {
keyword: "additionalProperties",
type: ["object"],
schemaType: ["boolean", "object"],
allowUndefined: !0,
trackErrors: !0,
- error: Cp,
+ error: mc,
code(e) {
- const { gen: t, schema: a, parentSchema: n, data: s, errsCount: c, it: p } = e;
- if (!c)
+ const { gen: t, schema: r, parentSchema: a, data: s, errsCount: l, it: d } = e;
+ if (!l)
throw new Error("ajv implementation error");
- const { allErrors: b, opts: _ } = p;
- if (p.props = !0, _.removeAdditional !== "all" && (0, sn.alwaysValidSchema)(p, a))
+ const { allErrors: b, opts: _ } = d;
+ if (d.props = !0, _.removeAdditional !== "all" && (0, Or.alwaysValidSchema)(d, r))
return;
- const y = (0, on.allSchemaProperties)(n.properties), g = (0, on.allSchemaProperties)(n.patternProperties);
- S(), e.ok((0, Gt._)`${c} === ${jp.default.errors}`);
- function S() {
- t.forIn("key", s, (T) => {
- !y.length && !g.length ? N(T) : t.if(L(T), () => N(T));
+ const y = (0, xr.allSchemaProperties)(a.properties), m = (0, xr.allSchemaProperties)(a.patternProperties);
+ k(), e.ok((0, Ye._)`${l} === ${fc.default.errors}`);
+ function k() {
+ t.forIn("key", s, (x) => {
+ !y.length && !m.length ? j(x) : t.if(N(x), () => j(x));
});
}
- function L(T) {
+ function N(x) {
let v;
if (y.length > 8) {
- const j = (0, sn.schemaRefOrVal)(p, n.properties, "properties");
- v = (0, on.isOwnProperty)(t, j, T);
+ const T = (0, Or.schemaRefOrVal)(d, a.properties, "properties");
+ v = (0, xr.isOwnProperty)(t, T, x);
} else
- y.length ? v = (0, Gt.or)(...y.map((j) => (0, Gt._)`${T} === ${j}`)) : v = Gt.nil;
- return g.length && (v = (0, Gt.or)(v, ...g.map((j) => (0, Gt._)`${(0, on.usePattern)(e, j)}.test(${T})`))), (0, Gt.not)(v);
+ y.length ? v = (0, Ye.or)(...y.map((T) => (0, Ye._)`${x} === ${T}`)) : v = Ye.nil;
+ return m.length && (v = (0, Ye.or)(v, ...m.map((T) => (0, Ye._)`${(0, xr.usePattern)(e, T)}.test(${x})`))), (0, Ye.not)(v);
}
- function A(T) {
- t.code((0, Gt._)`delete ${s}[${T}]`);
+ function A(x) {
+ t.code((0, Ye._)`delete ${s}[${x}]`);
}
- function N(T) {
- if (_.removeAdditional === "all" || _.removeAdditional && a === !1) {
- A(T);
+ function j(x) {
+ if (_.removeAdditional === "all" || _.removeAdditional && r === !1) {
+ A(x);
return;
}
- if (a === !1) {
- e.setParams({ additionalProperty: T }), e.error(), b || t.break();
+ if (r === !1) {
+ e.setParams({ additionalProperty: x }), e.error(), b || t.break();
return;
}
- if (typeof a == "object" && !(0, sn.alwaysValidSchema)(p, a)) {
+ if (typeof r == "object" && !(0, Or.alwaysValidSchema)(d, r)) {
const v = t.name("valid");
- _.removeAdditional === "failing" ? (C(T, v, !1), t.if((0, Gt.not)(v), () => {
- e.reset(), A(T);
- })) : (C(T, v), b || t.if((0, Gt.not)(v), () => t.break()));
+ _.removeAdditional === "failing" ? (C(x, v, !1), t.if((0, Ye.not)(v), () => {
+ e.reset(), A(x);
+ })) : (C(x, v), b || t.if((0, Ye.not)(v), () => t.break()));
}
}
- function C(T, v, j) {
- const I = {
+ function C(x, v, T) {
+ const R = {
keyword: "additionalProperties",
- dataProp: T,
- dataPropType: sn.Type.Str
+ dataProp: x,
+ dataPropType: Or.Type.Str
};
- j === !1 && Object.assign(I, {
+ T === !1 && Object.assign(R, {
compositeRule: !0,
createErrors: !1,
allErrors: !1
- }), e.subschema(I, v);
+ }), e.subschema(R, v);
}
}
};
-Hn.default = Op;
-var hs = {};
-Object.defineProperty(hs, "__esModule", { value: !0 });
-const Np = er, Ti = be, po = $e, ji = Hn, Lp = {
+Xr.default = gc;
+var Ua = {};
+Object.defineProperty(Ua, "__esModule", { value: !0 });
+const bc = rt, Nn = se, sa = ce, jn = Xr, yc = {
keyword: "properties",
type: "object",
schemaType: "object",
code(e) {
- const { gen: t, schema: a, parentSchema: n, data: s, it: c } = e;
- c.opts.removeAdditional === "all" && n.additionalProperties === void 0 && ji.default.code(new Np.KeywordCxt(c, ji.default, "additionalProperties"));
- const p = (0, Ti.allSchemaProperties)(a);
- for (const S of p)
- c.definedProperties.add(S);
- c.opts.unevaluated && p.length && c.props !== !0 && (c.props = po.mergeEvaluated.props(t, (0, po.toHash)(p), c.props));
- const b = p.filter((S) => !(0, po.alwaysValidSchema)(c, a[S]));
+ const { gen: t, schema: r, parentSchema: a, data: s, it: l } = e;
+ l.opts.removeAdditional === "all" && a.additionalProperties === void 0 && jn.default.code(new bc.KeywordCxt(l, jn.default, "additionalProperties"));
+ const d = (0, Nn.allSchemaProperties)(r);
+ for (const k of d)
+ l.definedProperties.add(k);
+ l.opts.unevaluated && d.length && l.props !== !0 && (l.props = sa.mergeEvaluated.props(t, (0, sa.toHash)(d), l.props));
+ const b = d.filter((k) => !(0, sa.alwaysValidSchema)(l, r[k]));
if (b.length === 0)
return;
const _ = t.name("valid");
- for (const S of b)
- y(S) ? g(S) : (t.if((0, Ti.propertyInData)(t, s, S, c.opts.ownProperties)), g(S), c.allErrors || t.else().var(_, !0), t.endIf()), e.it.definedProperties.add(S), e.ok(_);
- function y(S) {
- return c.opts.useDefaults && !c.compositeRule && a[S].default !== void 0;
+ for (const k of b)
+ y(k) ? m(k) : (t.if((0, Nn.propertyInData)(t, s, k, l.opts.ownProperties)), m(k), l.allErrors || t.else().var(_, !0), t.endIf()), e.it.definedProperties.add(k), e.ok(_);
+ function y(k) {
+ return l.opts.useDefaults && !l.compositeRule && r[k].default !== void 0;
}
- function g(S) {
+ function m(k) {
e.subschema({
keyword: "properties",
- schemaProp: S,
- dataProp: S
+ schemaProp: k,
+ dataProp: k
}, _);
}
}
};
-hs.default = Lp;
-var ps = {};
-Object.defineProperty(ps, "__esModule", { value: !0 });
-const Ci = be, cn = we, Oi = $e, Ni = $e, Rp = {
+Ua.default = yc;
+var Ga = {};
+Object.defineProperty(Ga, "__esModule", { value: !0 });
+const Ln = se, Nr = ie, An = ce, Rn = ce, _c = {
keyword: "patternProperties",
type: "object",
schemaType: "object",
code(e) {
- const { gen: t, schema: a, data: n, parentSchema: s, it: c } = e, { opts: p } = c, b = (0, Ci.allSchemaProperties)(a), _ = b.filter((C) => (0, Oi.alwaysValidSchema)(c, a[C]));
- if (b.length === 0 || _.length === b.length && (!c.opts.unevaluated || c.props === !0))
+ const { gen: t, schema: r, data: a, parentSchema: s, it: l } = e, { opts: d } = l, b = (0, Ln.allSchemaProperties)(r), _ = b.filter((C) => (0, An.alwaysValidSchema)(l, r[C]));
+ if (b.length === 0 || _.length === b.length && (!l.opts.unevaluated || l.props === !0))
return;
- const y = p.strictSchema && !p.allowMatchingProperties && s.properties, g = t.name("valid");
- c.props !== !0 && !(c.props instanceof cn.Name) && (c.props = (0, Ni.evaluatedPropsToName)(t, c.props));
- const { props: S } = c;
- L();
- function L() {
+ const y = d.strictSchema && !d.allowMatchingProperties && s.properties, m = t.name("valid");
+ l.props !== !0 && !(l.props instanceof Nr.Name) && (l.props = (0, Rn.evaluatedPropsToName)(t, l.props));
+ const { props: k } = l;
+ N();
+ function N() {
for (const C of b)
- y && A(C), c.allErrors ? N(C) : (t.var(g, !0), N(C), t.if(g));
+ y && A(C), l.allErrors ? j(C) : (t.var(m, !0), j(C), t.if(m));
}
function A(C) {
- for (const T in y)
- new RegExp(C).test(T) && (0, Oi.checkStrictMode)(c, `property ${T} matches pattern ${C} (use allowMatchingProperties)`);
+ for (const x in y)
+ new RegExp(C).test(x) && (0, An.checkStrictMode)(l, `property ${x} matches pattern ${C} (use allowMatchingProperties)`);
}
- function N(C) {
- t.forIn("key", n, (T) => {
- t.if((0, cn._)`${(0, Ci.usePattern)(e, C)}.test(${T})`, () => {
+ function j(C) {
+ t.forIn("key", a, (x) => {
+ t.if((0, Nr._)`${(0, Ln.usePattern)(e, C)}.test(${x})`, () => {
const v = _.includes(C);
v || e.subschema({
keyword: "patternProperties",
schemaProp: C,
- dataProp: T,
- dataPropType: Ni.Type.Str
- }, g), c.opts.unevaluated && S !== !0 ? t.assign((0, cn._)`${S}[${T}]`, !0) : !v && !c.allErrors && t.if((0, cn.not)(g), () => t.break());
+ dataProp: x,
+ dataPropType: Rn.Type.Str
+ }, m), l.opts.unevaluated && k !== !0 ? t.assign((0, Nr._)`${k}[${x}]`, !0) : !v && !l.allErrors && t.if((0, Nr.not)(m), () => t.break());
});
});
}
}
};
-ps.default = Rp;
-var fs = {};
-Object.defineProperty(fs, "__esModule", { value: !0 });
-const Ip = $e, Ap = {
+Ga.default = _c;
+var Ha = {};
+Object.defineProperty(Ha, "__esModule", { value: !0 });
+const wc = ce, vc = {
keyword: "not",
schemaType: ["object", "boolean"],
trackErrors: !0,
code(e) {
- const { gen: t, schema: a, it: n } = e;
- if ((0, Ip.alwaysValidSchema)(n, a)) {
+ const { gen: t, schema: r, it: a } = e;
+ if ((0, wc.alwaysValidSchema)(a, r)) {
e.fail();
return;
}
@@ -4078,218 +4082,218 @@ const Ip = $e, Ap = {
},
error: { message: "must NOT be valid" }
};
-fs.default = Ap;
-var ms = {};
-Object.defineProperty(ms, "__esModule", { value: !0 });
-const Mp = be, Dp = {
+Ha.default = vc;
+var Ka = {};
+Object.defineProperty(Ka, "__esModule", { value: !0 });
+const kc = se, Ec = {
keyword: "anyOf",
schemaType: "array",
trackErrors: !0,
- code: Mp.validateUnion,
+ code: kc.validateUnion,
error: { message: "must match a schema in anyOf" }
};
-ms.default = Dp;
-var gs = {};
-Object.defineProperty(gs, "__esModule", { value: !0 });
-const wn = we, zp = $e, Bp = {
+Ka.default = Ec;
+var Wa = {};
+Object.defineProperty(Wa, "__esModule", { value: !0 });
+const Mr = ie, $c = ce, Pc = {
message: "must match exactly one schema in oneOf",
- params: ({ params: e }) => (0, wn._)`{passingSchemas: ${e.passing}}`
-}, Vp = {
+ params: ({ params: e }) => (0, Mr._)`{passingSchemas: ${e.passing}}`
+}, Sc = {
keyword: "oneOf",
schemaType: "array",
trackErrors: !0,
- error: Bp,
+ error: Pc,
code(e) {
- const { gen: t, schema: a, parentSchema: n, it: s } = e;
- if (!Array.isArray(a))
+ const { gen: t, schema: r, parentSchema: a, it: s } = e;
+ if (!Array.isArray(r))
throw new Error("ajv implementation error");
- if (s.opts.discriminator && n.discriminator)
+ if (s.opts.discriminator && a.discriminator)
return;
- const c = a, p = t.let("valid", !1), b = t.let("passing", null), _ = t.name("_valid");
- e.setParams({ passing: b }), t.block(y), e.result(p, () => e.reset(), () => e.error(!0));
+ const l = r, d = t.let("valid", !1), b = t.let("passing", null), _ = t.name("_valid");
+ e.setParams({ passing: b }), t.block(y), e.result(d, () => e.reset(), () => e.error(!0));
function y() {
- c.forEach((g, S) => {
- let L;
- (0, zp.alwaysValidSchema)(s, g) ? t.var(_, !0) : L = e.subschema({
+ l.forEach((m, k) => {
+ let N;
+ (0, $c.alwaysValidSchema)(s, m) ? t.var(_, !0) : N = e.subschema({
keyword: "oneOf",
- schemaProp: S,
+ schemaProp: k,
compositeRule: !0
- }, _), S > 0 && t.if((0, wn._)`${_} && ${p}`).assign(p, !1).assign(b, (0, wn._)`[${b}, ${S}]`).else(), t.if(_, () => {
- t.assign(p, !0), t.assign(b, S), L && e.mergeEvaluated(L, wn.Name);
+ }, _), k > 0 && t.if((0, Mr._)`${_} && ${d}`).assign(d, !1).assign(b, (0, Mr._)`[${b}, ${k}]`).else(), t.if(_, () => {
+ t.assign(d, !0), t.assign(b, k), N && e.mergeEvaluated(N, Mr.Name);
});
});
}
}
};
-gs.default = Vp;
-var ys = {};
-Object.defineProperty(ys, "__esModule", { value: !0 });
-const Fp = $e, Up = {
+Wa.default = Sc;
+var Ja = {};
+Object.defineProperty(Ja, "__esModule", { value: !0 });
+const Tc = ce, Cc = {
keyword: "allOf",
schemaType: "array",
code(e) {
- const { gen: t, schema: a, it: n } = e;
- if (!Array.isArray(a))
+ const { gen: t, schema: r, it: a } = e;
+ if (!Array.isArray(r))
throw new Error("ajv implementation error");
const s = t.name("valid");
- a.forEach((c, p) => {
- if ((0, Fp.alwaysValidSchema)(n, c))
+ r.forEach((l, d) => {
+ if ((0, Tc.alwaysValidSchema)(a, l))
return;
- const b = e.subschema({ keyword: "allOf", schemaProp: p }, s);
+ const b = e.subschema({ keyword: "allOf", schemaProp: d }, s);
e.ok(s), e.mergeEvaluated(b);
});
}
};
-ys.default = Up;
-var bs = {};
-Object.defineProperty(bs, "__esModule", { value: !0 });
-const On = we, ml = $e, qp = {
- message: ({ params: e }) => (0, On.str)`must match "${e.ifClause}" schema`,
- params: ({ params: e }) => (0, On._)`{failingKeyword: ${e.ifClause}}`
-}, Hp = {
+Ja.default = Cc;
+var Za = {};
+Object.defineProperty(Za, "__esModule", { value: !0 });
+const Ur = ie, zo = ce, xc = {
+ message: ({ params: e }) => (0, Ur.str)`must match "${e.ifClause}" schema`,
+ params: ({ params: e }) => (0, Ur._)`{failingKeyword: ${e.ifClause}}`
+}, Oc = {
keyword: "if",
schemaType: ["object", "boolean"],
trackErrors: !0,
- error: qp,
+ error: xc,
code(e) {
- const { gen: t, parentSchema: a, it: n } = e;
- a.then === void 0 && a.else === void 0 && (0, ml.checkStrictMode)(n, '"if" without "then" and "else" is ignored');
- const s = Li(n, "then"), c = Li(n, "else");
- if (!s && !c)
+ const { gen: t, parentSchema: r, it: a } = e;
+ r.then === void 0 && r.else === void 0 && (0, zo.checkStrictMode)(a, '"if" without "then" and "else" is ignored');
+ const s = In(a, "then"), l = In(a, "else");
+ if (!s && !l)
return;
- const p = t.let("valid", !0), b = t.name("_valid");
- if (_(), e.reset(), s && c) {
- const g = t.let("ifClause");
- e.setParams({ ifClause: g }), t.if(b, y("then", g), y("else", g));
+ const d = t.let("valid", !0), b = t.name("_valid");
+ if (_(), e.reset(), s && l) {
+ const m = t.let("ifClause");
+ e.setParams({ ifClause: m }), t.if(b, y("then", m), y("else", m));
} else
- s ? t.if(b, y("then")) : t.if((0, On.not)(b), y("else"));
- e.pass(p, () => e.error(!0));
+ s ? t.if(b, y("then")) : t.if((0, Ur.not)(b), y("else"));
+ e.pass(d, () => e.error(!0));
function _() {
- const g = e.subschema({
+ const m = e.subschema({
keyword: "if",
compositeRule: !0,
createErrors: !1,
allErrors: !1
}, b);
- e.mergeEvaluated(g);
+ e.mergeEvaluated(m);
}
- function y(g, S) {
+ function y(m, k) {
return () => {
- const L = e.subschema({ keyword: g }, b);
- t.assign(p, b), e.mergeValidEvaluated(L, p), S ? t.assign(S, (0, On._)`${g}`) : e.setParams({ ifClause: g });
+ const N = e.subschema({ keyword: m }, b);
+ t.assign(d, b), e.mergeValidEvaluated(N, d), k ? t.assign(k, (0, Ur._)`${m}`) : e.setParams({ ifClause: m });
};
}
}
};
-function Li(e, t) {
- const a = e.schema[t];
- return a !== void 0 && !(0, ml.alwaysValidSchema)(e, a);
+function In(e, t) {
+ const r = e.schema[t];
+ return r !== void 0 && !(0, zo.alwaysValidSchema)(e, r);
}
-bs.default = Hp;
-var _s = {};
-Object.defineProperty(_s, "__esModule", { value: !0 });
-const Gp = $e, Kp = {
+Za.default = Oc;
+var Ya = {};
+Object.defineProperty(Ya, "__esModule", { value: !0 });
+const Nc = ce, jc = {
keyword: ["then", "else"],
schemaType: ["object", "boolean"],
- code({ keyword: e, parentSchema: t, it: a }) {
- t.if === void 0 && (0, Gp.checkStrictMode)(a, `"${e}" without "if" is ignored`);
+ code({ keyword: e, parentSchema: t, it: r }) {
+ t.if === void 0 && (0, Nc.checkStrictMode)(r, `"${e}" without "if" is ignored`);
}
};
-_s.default = Kp;
-Object.defineProperty(is, "__esModule", { value: !0 });
-const Wp = ua, Jp = cs, Zp = da, Yp = ls, Qp = us, Xp = pl, ef = ds, tf = Hn, rf = hs, af = ps, nf = fs, of = ms, sf = gs, cf = ys, lf = bs, uf = _s;
-function df(e = !1) {
+Ya.default = jc;
+Object.defineProperty(Ba, "__esModule", { value: !0 });
+const Lc = Wt, Ac = za, Rc = Jt, Ic = Va, Mc = Fa, Dc = Do, Bc = qa, zc = Xr, Vc = Ua, Fc = Ga, qc = Ha, Uc = Ka, Gc = Wa, Hc = Ja, Kc = Za, Wc = Ya;
+function Jc(e = !1) {
const t = [
// any
- nf.default,
- of.default,
- sf.default,
- cf.default,
- lf.default,
- uf.default,
+ qc.default,
+ Uc.default,
+ Gc.default,
+ Hc.default,
+ Kc.default,
+ Wc.default,
// object
- ef.default,
- tf.default,
- Xp.default,
- rf.default,
- af.default
+ Bc.default,
+ zc.default,
+ Dc.default,
+ Vc.default,
+ Fc.default
];
- return e ? t.push(Jp.default, Yp.default) : t.push(Wp.default, Zp.default), t.push(Qp.default), t;
-}
-is.default = df;
-var ws = {}, vs = {};
-Object.defineProperty(vs, "__esModule", { value: !0 });
-const Fe = we, hf = {
- message: ({ schemaCode: e }) => (0, Fe.str)`must match format "${e}"`,
- params: ({ schemaCode: e }) => (0, Fe._)`{format: ${e}}`
-}, pf = {
+ return e ? t.push(Ac.default, Ic.default) : t.push(Lc.default, Rc.default), t.push(Mc.default), t;
+}
+Ba.default = Jc;
+var Qa = {}, Xa = {};
+Object.defineProperty(Xa, "__esModule", { value: !0 });
+const ve = ie, Zc = {
+ message: ({ schemaCode: e }) => (0, ve.str)`must match format "${e}"`,
+ params: ({ schemaCode: e }) => (0, ve._)`{format: ${e}}`
+}, Yc = {
keyword: "format",
type: ["number", "string"],
schemaType: "string",
$data: !0,
- error: hf,
+ error: Zc,
code(e, t) {
- const { gen: a, data: n, $data: s, schema: c, schemaCode: p, it: b } = e, { opts: _, errSchemaPath: y, schemaEnv: g, self: S } = b;
+ const { gen: r, data: a, $data: s, schema: l, schemaCode: d, it: b } = e, { opts: _, errSchemaPath: y, schemaEnv: m, self: k } = b;
if (!_.validateFormats)
return;
- s ? L() : A();
- function L() {
- const N = a.scopeValue("formats", {
- ref: S.formats,
+ s ? N() : A();
+ function N() {
+ const j = r.scopeValue("formats", {
+ ref: k.formats,
code: _.code.formats
- }), C = a.const("fDef", (0, Fe._)`${N}[${p}]`), T = a.let("fType"), v = a.let("format");
- a.if((0, Fe._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`, () => a.assign(T, (0, Fe._)`${C}.type || "string"`).assign(v, (0, Fe._)`${C}.validate`), () => a.assign(T, (0, Fe._)`"string"`).assign(v, C)), e.fail$data((0, Fe.or)(j(), I()));
- function j() {
- return _.strictSchema === !1 ? Fe.nil : (0, Fe._)`${p} && !${v}`;
+ }), C = r.const("fDef", (0, ve._)`${j}[${d}]`), x = r.let("fType"), v = r.let("format");
+ r.if((0, ve._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`, () => r.assign(x, (0, ve._)`${C}.type || "string"`).assign(v, (0, ve._)`${C}.validate`), () => r.assign(x, (0, ve._)`"string"`).assign(v, C)), e.fail$data((0, ve.or)(T(), R()));
+ function T() {
+ return _.strictSchema === !1 ? ve.nil : (0, ve._)`${d} && !${v}`;
}
- function I() {
- const r = g.$async ? (0, Fe._)`(${C}.async ? await ${v}(${n}) : ${v}(${n}))` : (0, Fe._)`${v}(${n})`, i = (0, Fe._)`(typeof ${v} == "function" ? ${r} : ${v}.test(${n}))`;
- return (0, Fe._)`${v} && ${v} !== true && ${T} === ${t} && !${i}`;
+ function R() {
+ const n = m.$async ? (0, ve._)`(${C}.async ? await ${v}(${a}) : ${v}(${a}))` : (0, ve._)`${v}(${a})`, i = (0, ve._)`(typeof ${v} == "function" ? ${n} : ${v}.test(${a}))`;
+ return (0, ve._)`${v} && ${v} !== true && ${x} === ${t} && !${i}`;
}
}
function A() {
- const N = S.formats[c];
- if (!N) {
- j();
+ const j = k.formats[l];
+ if (!j) {
+ T();
return;
}
- if (N === !0)
+ if (j === !0)
return;
- const [C, T, v] = I(N);
- C === t && e.pass(r());
- function j() {
+ const [C, x, v] = R(j);
+ C === t && e.pass(n());
+ function T() {
if (_.strictSchema === !1) {
- S.logger.warn(i());
+ k.logger.warn(i());
return;
}
throw new Error(i());
function i() {
- return `unknown format "${c}" ignored in schema at path "${y}"`;
+ return `unknown format "${l}" ignored in schema at path "${y}"`;
}
}
- function I(i) {
- const o = i instanceof RegExp ? (0, Fe.regexpCode)(i) : _.code.formats ? (0, Fe._)`${_.code.formats}${(0, Fe.getProperty)(c)}` : void 0, l = a.scopeValue("formats", { key: c, ref: i, code: o });
- return typeof i == "object" && !(i instanceof RegExp) ? [i.type || "string", i.validate, (0, Fe._)`${l}.validate`] : ["string", i, l];
+ function R(i) {
+ const o = i instanceof RegExp ? (0, ve.regexpCode)(i) : _.code.formats ? (0, ve._)`${_.code.formats}${(0, ve.getProperty)(l)}` : void 0, c = r.scopeValue("formats", { key: l, ref: i, code: o });
+ return typeof i == "object" && !(i instanceof RegExp) ? [i.type || "string", i.validate, (0, ve._)`${c}.validate`] : ["string", i, c];
}
- function r() {
- if (typeof N == "object" && !(N instanceof RegExp) && N.async) {
- if (!g.$async)
+ function n() {
+ if (typeof j == "object" && !(j instanceof RegExp) && j.async) {
+ if (!m.$async)
throw new Error("async format in sync schema");
- return (0, Fe._)`await ${v}(${n})`;
+ return (0, ve._)`await ${v}(${a})`;
}
- return typeof T == "function" ? (0, Fe._)`${v}(${n})` : (0, Fe._)`${v}.test(${n})`;
+ return typeof x == "function" ? (0, ve._)`${v}(${a})` : (0, ve._)`${v}.test(${a})`;
}
}
}
};
-vs.default = pf;
-Object.defineProperty(ws, "__esModule", { value: !0 });
-const ff = vs, mf = [ff.default];
-ws.default = mf;
-var ia = {};
-Object.defineProperty(ia, "__esModule", { value: !0 });
-ia.contentVocabulary = ia.metadataVocabulary = void 0;
-ia.metadataVocabulary = [
+Xa.default = Yc;
+Object.defineProperty(Qa, "__esModule", { value: !0 });
+const Qc = Xa, Xc = [Qc.default];
+Qa.default = Xc;
+var Kt = {};
+Object.defineProperty(Kt, "__esModule", { value: !0 });
+Kt.contentVocabulary = Kt.metadataVocabulary = void 0;
+Kt.metadataVocabulary = [
"title",
"description",
"default",
@@ -4298,97 +4302,97 @@ ia.metadataVocabulary = [
"writeOnly",
"examples"
];
-ia.contentVocabulary = [
+Kt.contentVocabulary = [
"contentMediaType",
"contentEncoding",
"contentSchema"
];
-Object.defineProperty(Go, "__esModule", { value: !0 });
-const gf = Ko, yf = Jo, bf = is, _f = ws, Ri = ia, wf = [
- gf.default,
- yf.default,
- (0, bf.default)(),
- _f.default,
- Ri.metadataVocabulary,
- Ri.contentVocabulary
+Object.defineProperty($a, "__esModule", { value: !0 });
+const eu = Pa, tu = Ta, ru = Ba, au = Qa, Mn = Kt, nu = [
+ eu.default,
+ tu.default,
+ (0, ru.default)(),
+ au.default,
+ Mn.metadataVocabulary,
+ Mn.contentVocabulary
];
-Go.default = wf;
-var $s = {}, gl = {};
+$a.default = nu;
+var en = {}, Vo = {};
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0, function(t) {
t.Tag = "tag", t.Mapping = "mapping";
}(e.DiscrError || (e.DiscrError = {}));
-})(gl);
-Object.defineProperty($s, "__esModule", { value: !0 });
-const Zr = we, xo = gl, Ii = wt, vf = $e, $f = {
- message: ({ params: { discrError: e, tagName: t } }) => e === xo.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`,
- params: ({ params: { discrError: e, tag: t, tagName: a } }) => (0, Zr._)`{error: ${e}, tag: ${a}, tagValue: ${t}}`
-}, kf = {
+})(Vo);
+Object.defineProperty(en, "__esModule", { value: !0 });
+const Vt = ie, fa = Vo, Dn = Be, ou = ce, su = {
+ message: ({ params: { discrError: e, tagName: t } }) => e === fa.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`,
+ params: ({ params: { discrError: e, tag: t, tagName: r } }) => (0, Vt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`
+}, iu = {
keyword: "discriminator",
type: "object",
schemaType: "object",
- error: $f,
+ error: su,
code(e) {
- const { gen: t, data: a, schema: n, parentSchema: s, it: c } = e, { oneOf: p } = s;
- if (!c.opts.discriminator)
+ const { gen: t, data: r, schema: a, parentSchema: s, it: l } = e, { oneOf: d } = s;
+ if (!l.opts.discriminator)
throw new Error("discriminator: requires discriminator option");
- const b = n.propertyName;
+ const b = a.propertyName;
if (typeof b != "string")
throw new Error("discriminator: requires propertyName");
- if (n.mapping)
+ if (a.mapping)
throw new Error("discriminator: mapping is not supported");
- if (!p)
+ if (!d)
throw new Error("discriminator: requires oneOf keyword");
- const _ = t.let("valid", !1), y = t.const("tag", (0, Zr._)`${a}${(0, Zr.getProperty)(b)}`);
- t.if((0, Zr._)`typeof ${y} == "string"`, () => g(), () => e.error(!1, { discrError: xo.DiscrError.Tag, tag: y, tagName: b })), e.ok(_);
- function g() {
- const A = L();
+ const _ = t.let("valid", !1), y = t.const("tag", (0, Vt._)`${r}${(0, Vt.getProperty)(b)}`);
+ t.if((0, Vt._)`typeof ${y} == "string"`, () => m(), () => e.error(!1, { discrError: fa.DiscrError.Tag, tag: y, tagName: b })), e.ok(_);
+ function m() {
+ const A = N();
t.if(!1);
- for (const N in A)
- t.elseIf((0, Zr._)`${y} === ${N}`), t.assign(_, S(A[N]));
- t.else(), e.error(!1, { discrError: xo.DiscrError.Mapping, tag: y, tagName: b }), t.endIf();
+ for (const j in A)
+ t.elseIf((0, Vt._)`${y} === ${j}`), t.assign(_, k(A[j]));
+ t.else(), e.error(!1, { discrError: fa.DiscrError.Mapping, tag: y, tagName: b }), t.endIf();
}
- function S(A) {
- const N = t.name("valid"), C = e.subschema({ keyword: "oneOf", schemaProp: A }, N);
- return e.mergeEvaluated(C, Zr.Name), N;
+ function k(A) {
+ const j = t.name("valid"), C = e.subschema({ keyword: "oneOf", schemaProp: A }, j);
+ return e.mergeEvaluated(C, Vt.Name), j;
}
- function L() {
+ function N() {
var A;
- const N = {}, C = v(s);
- let T = !0;
- for (let r = 0; r < p.length; r++) {
- let i = p[r];
- i != null && i.$ref && !(0, vf.schemaHasRulesButRef)(i, c.self.RULES) && (i = Ii.resolveRef.call(c.self, c.schemaEnv.root, c.baseId, i == null ? void 0 : i.$ref), i instanceof Ii.SchemaEnv && (i = i.schema));
+ const j = {}, C = v(s);
+ let x = !0;
+ for (let n = 0; n < d.length; n++) {
+ let i = d[n];
+ i != null && i.$ref && !(0, ou.schemaHasRulesButRef)(i, l.self.RULES) && (i = Dn.resolveRef.call(l.self, l.schemaEnv.root, l.baseId, i == null ? void 0 : i.$ref), i instanceof Dn.SchemaEnv && (i = i.schema));
const o = (A = i == null ? void 0 : i.properties) === null || A === void 0 ? void 0 : A[b];
if (typeof o != "object")
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${b}"`);
- T = T && (C || v(i)), j(o, r);
+ x = x && (C || v(i)), T(o, n);
}
- if (!T)
+ if (!x)
throw new Error(`discriminator: "${b}" must be required`);
- return N;
- function v({ required: r }) {
- return Array.isArray(r) && r.includes(b);
- }
- function j(r, i) {
- if (r.const)
- I(r.const, i);
- else if (r.enum)
- for (const o of r.enum)
- I(o, i);
+ return j;
+ function v({ required: n }) {
+ return Array.isArray(n) && n.includes(b);
+ }
+ function T(n, i) {
+ if (n.const)
+ R(n.const, i);
+ else if (n.enum)
+ for (const o of n.enum)
+ R(o, i);
else
throw new Error(`discriminator: "properties/${b}" must have "const" or "enum"`);
}
- function I(r, i) {
- if (typeof r != "string" || r in N)
+ function R(n, i) {
+ if (typeof n != "string" || n in j)
throw new Error(`discriminator: "${b}" values must be unique strings`);
- N[r] = i;
+ j[n] = i;
}
}
}
};
-$s.default = kf;
-const Ef = "http://json-schema.org/draft-07/schema#", Pf = "http://json-schema.org/draft-07/schema#", Sf = "Core schema meta-schema", xf = {
+en.default = iu;
+const lu = "http://json-schema.org/draft-07/schema#", cu = "http://json-schema.org/draft-07/schema#", uu = "Core schema meta-schema", du = {
schemaArray: {
type: "array",
minItems: 1,
@@ -4429,10 +4433,10 @@ const Ef = "http://json-schema.org/draft-07/schema#", Pf = "http://json-schema.o
uniqueItems: !0,
default: []
}
-}, Tf = [
+}, hu = [
"object",
"boolean"
-], jf = {
+], pu = {
$id: {
type: "string",
format: "uri-reference"
@@ -4620,78 +4624,78 @@ const Ef = "http://json-schema.org/draft-07/schema#", Pf = "http://json-schema.o
not: {
$ref: "#"
}
-}, Cf = {
- $schema: Ef,
- $id: Pf,
- title: Sf,
- definitions: xf,
- type: Tf,
- properties: jf,
+}, fu = {
+ $schema: lu,
+ $id: cu,
+ title: uu,
+ definitions: du,
+ type: hu,
+ properties: pu,
default: !0
};
(function(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.MissingRefError = t.ValidationError = t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = void 0;
- const a = Ac, n = Go, s = $s, c = Cf, p = ["/properties"], b = "http://json-schema.org/draft-07/schema";
- class _ extends a.default {
+ const r = so, a = $a, s = en, l = fu, d = ["/properties"], b = "http://json-schema.org/draft-07/schema";
+ class _ extends r.default {
_addVocabularies() {
- super._addVocabularies(), n.default.forEach((N) => this.addVocabulary(N)), this.opts.discriminator && this.addKeyword(s.default);
+ super._addVocabularies(), a.default.forEach((j) => this.addVocabulary(j)), this.opts.discriminator && this.addKeyword(s.default);
}
_addDefaultMetaSchema() {
if (super._addDefaultMetaSchema(), !this.opts.meta)
return;
- const N = this.opts.$data ? this.$dataMetaSchema(c, p) : c;
- this.addMetaSchema(N, b, !1), this.refs["http://json-schema.org/schema"] = b;
+ const j = this.opts.$data ? this.$dataMetaSchema(l, d) : l;
+ this.addMetaSchema(j, b, !1), this.refs["http://json-schema.org/schema"] = b;
}
defaultMeta() {
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(b) ? b : void 0);
}
}
e.exports = t = _, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = _;
- var y = er;
+ var y = rt;
Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() {
return y.KeywordCxt;
} });
- var g = we;
+ var m = ie;
Object.defineProperty(t, "_", { enumerable: !0, get: function() {
- return g._;
+ return m._;
} }), Object.defineProperty(t, "str", { enumerable: !0, get: function() {
- return g.str;
+ return m.str;
} }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() {
- return g.stringify;
+ return m.stringify;
} }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() {
- return g.nil;
+ return m.nil;
} }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() {
- return g.Name;
+ return m.Name;
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
- return g.CodeGen;
+ return m.CodeGen;
} });
- var S = Ja;
+ var k = _r;
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
- return S.default;
+ return k.default;
} });
- var L = Za;
+ var N = wr;
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
- return L.default;
+ return N.default;
} });
-})(vo, vo.exports);
-var Of = vo.exports;
-const Nf = /* @__PURE__ */ Ic(Of);
-class Lf {
+})(la, la.exports);
+var mu = la.exports;
+const gu = /* @__PURE__ */ oo(mu);
+class bu {
constructor() {
- Ye(this, "ajv"), this.ajv = new Nf();
+ Te(this, "ajv"), this.ajv = new gu();
}
- validateJson(t, a) {
- const n = this.ajv.validate(t, a);
- return n ? { valid: n } : { valid: n, error: this.ajv.errorsText() };
+ validateJson(t, r) {
+ const a = this.ajv.validate(t, r);
+ return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() };
}
- validateObjectSchema(t, a) {
- const n = this.ajv.validate(t, a);
- return n ? { valid: n } : { valid: n, error: this.ajv.errorsText() };
+ validateObjectSchema(t, r) {
+ const a = this.ajv.validate(t, r);
+ return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() };
}
}
-class Rf {
+class yu {
constructor() {
- Ye(this, "TIME_SPLIT", " ");
+ Te(this, "TIME_SPLIT", " ");
}
/**
* 给日期添加小时
@@ -4701,8 +4705,8 @@ class Rf {
* @author terwer
* @since 1.0.0
*/
- addHoursToDate(t, a) {
- return t.setTime(t.getTime() + a * 60 * 60 * 1e3), t;
+ addHoursToDate(t, r) {
+ return t.setTime(t.getTime() + r * 60 * 60 * 1e3), t;
}
/**
* 转换ISO日期为中文日期的通用转换方法
@@ -4713,20 +4717,20 @@ class Rf {
* @author terwer
* @since 1.0.0
*/
- formatIsoToZhDateFormat(t, a, n) {
+ formatIsoToZhDateFormat(t, r, a) {
if (!t)
return "";
let s = t;
- const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, p = s.match(c);
- if (p == null)
+ const l = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, d = s.match(l);
+ if (d == null)
return t;
- for (let b = 0; b < p.length; b++) {
- const _ = p[b];
+ for (let b = 0; b < d.length; b++) {
+ const _ = d[b];
let y = _;
- a && (y = this.addHoursToDate(new Date(_), 8).toISOString());
- const g = y.split("T"), S = g[0], L = g[1].split(".")[0];
- let A = S + this.TIME_SPLIT + L;
- n && (A = S), s = s.replace(_, A);
+ r && (y = this.addHoursToDate(new Date(_), 8).toISOString());
+ const m = y.split("T"), k = m[0], N = m[1].split(".")[0];
+ let A = k + this.TIME_SPLIT + N;
+ a && (A = k), s = s.replace(_, A);
}
return s;
}
@@ -4773,7 +4777,7 @@ class Rf {
return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0).split(this.TIME_SPLIT)[1];
}
}
-class If {
+class _u {
/**
* 格式化字符串
*
@@ -4782,13 +4786,13 @@ class If {
* @author terwer
* @since 0.0.1
*/
- f(t, ...a) {
- let n = t;
- for (let s = 0; s < a.length; s++) {
- const c = a[s];
- typeof c == "string" ? n = n.replace(`{${s}}`, c) : n = n.replace(`{${s}}`, c.toString());
+ f(t, ...r) {
+ let a = t;
+ for (let s = 0; s < r.length; s++) {
+ const l = r[s];
+ typeof l == "string" ? a = a.replace(`{${s}}`, l) : a = a.replace(`{${s}}`, l.toString());
}
- return n;
+ return a;
}
/**
* 字符串拼接
@@ -4804,13 +4808,13 @@ class If {
* @param str - 字符串
* @param arr - 字符串数组
*/
- includeInArray(t, a) {
- let n = !1;
- for (let s = 0; s < a.length; s++) {
- const c = a[s];
- t.includes(c) && (n = !0);
+ includeInArray(t, r) {
+ let a = !1;
+ for (let s = 0; s < r.length; s++) {
+ const l = r[s];
+ t.includes(l) && (a = !0);
}
- return n;
+ return a;
}
/**
* 截取指定长度的字符串
@@ -4819,9 +4823,9 @@ class If {
* @param length - 长度
* @param ignore - 不要结尾省略号
*/
- getByLength(t, a, n) {
+ getByLength(t, r, a) {
const s = t;
- return s.length < a ? s : n ? s.substring(0, a) : s.substring(0, a) + "...";
+ return s.length < r ? s : a ? s.substring(0, r) : s.substring(0, r) + "...";
}
/**
* 字符串空值检测
@@ -4837,10 +4841,10 @@ class If {
* @param path1 - 路径1
* @param path2 - 路径2
*/
- pathJoin(t, a) {
- let n = t;
+ pathJoin(t, r) {
+ let a = t;
const s = t.lastIndexOf("/");
- return s + 1 === t.length && (n = t.substring(0, s)), a.indexOf("/") > 0 ? n = n + "/" + a : n = n + a, n;
+ return s + 1 === t.length && (a = t.substring(0, s)), r.indexOf("/") > 0 ? a = a + "/" + r : a = a + r, a;
}
/**
* 强转boolean
@@ -4851,33 +4855,33 @@ class If {
return t || (t = "false"), t.toString().toLowerCase() === "true";
}
}
-const fo = (e, t) => {
- const a = Ai(e), n = Ai(t), s = a.pop(), c = n.pop(), p = zi(a, n);
- return p !== 0 ? p : s && c ? zi(s.split("."), c.split(".")) : s || c ? s ? -1 : 1 : 0;
-}, Af = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ai = (e) => {
+const ia = (e, t) => {
+ const r = Bn(e), a = Bn(t), s = r.pop(), l = a.pop(), d = Fn(r, a);
+ return d !== 0 ? d : s && l ? Fn(s.split("."), l.split(".")) : s || l ? s ? -1 : 1 : 0;
+}, wu = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Bn = (e) => {
if (typeof e != "string")
throw new TypeError("Invalid argument expected string");
- const t = e.match(Af);
+ const t = e.match(wu);
if (!t)
throw new Error(`Invalid argument not valid semver ('${e}' received)`);
return t.shift(), t;
-}, Mi = (e) => e === "*" || e === "x" || e === "X", Di = (e) => {
+}, zn = (e) => e === "*" || e === "x" || e === "X", Vn = (e) => {
const t = parseInt(e, 10);
return isNaN(t) ? e : t;
-}, Mf = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], Df = (e, t) => {
- if (Mi(e) || Mi(t))
+}, vu = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], ku = (e, t) => {
+ if (zn(e) || zn(t))
return 0;
- const [a, n] = Mf(Di(e), Di(t));
- return a > n ? 1 : a < n ? -1 : 0;
-}, zi = (e, t) => {
- for (let a = 0; a < Math.max(e.length, t.length); a++) {
- const n = Df(e[a] || "0", t[a] || "0");
- if (n !== 0)
- return n;
+ const [r, a] = vu(Vn(e), Vn(t));
+ return r > a ? 1 : r < a ? -1 : 0;
+}, Fn = (e, t) => {
+ for (let r = 0; r < Math.max(e.length, t.length); r++) {
+ const a = ku(e[r] || "0", t[r] || "0");
+ if (a !== 0)
+ return a;
}
return 0;
};
-class zf {
+class Eu {
/**
* Compare [semver](https://semver.org/) version strings
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
@@ -4886,8 +4890,8 @@ class zf {
* @param v2 - Second version to compare
* @returns boolean true if v1 is higher than v2
*/
- greater(t, a) {
- return fo(t, a) > 0;
+ greater(t, r) {
+ return ia(t, r) > 0;
}
/**
* Compare [semver](https://semver.org/) version strings
@@ -4897,8 +4901,8 @@ class zf {
* @param v2 - Second version to compare
* @returns boolean true if v1 is equal to v2
*/
- equal(t, a) {
- return fo(t, a) === 0;
+ equal(t, r) {
+ return ia(t, r) === 0;
}
/**
* Compare [semver](https://semver.org/) version strings
@@ -4908,27 +4912,27 @@ class zf {
* @param v2 - Second version to compare
* @returns boolean true if v1 is lesser than v2
*/
- lesser(t, a) {
- return fo(t, a) < 0;
+ lesser(t, r) {
+ return ia(t, r) < 0;
}
}
-var Bf = Object.defineProperty, Vf = (e, t, a) => t in e ? Bf(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, Yr = (e, t, a) => (Vf(e, typeof t != "symbol" ? t + "" : t, a), a);
-let kr = class {
+var $u = Object.defineProperty, Pu = (e, t, r) => t in e ? $u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ft = (e, t, r) => (Pu(e, typeof t != "symbol" ? t + "" : t, r), r);
+let bt = class {
};
-Yr(kr, "NODE_ENV_KEY", "NODE_ENV"), /**
+Ft(bt, "NODE_ENV_KEY", "NODE_ENV"), /**
* 开发环境
*/
-Yr(kr, "NODE_ENV_DEVELOPMENT", "development"), /**
+Ft(bt, "NODE_ENV_DEVELOPMENT", "development"), /**
* 生产环境
*/
-Yr(kr, "NODE_ENV_PRODUCTION", "production"), /**
+Ft(bt, "NODE_ENV_PRODUCTION", "production"), /**
* 测试环境
*/
-Yr(kr, "NODE_ENV_TEST", "test"), /**
+Ft(bt, "NODE_ENV_TEST", "test"), /**
* 是否处于调试模式
*/
-Yr(kr, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE");
-class Ff {
+Ft(bt, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE");
+class Su {
/**
* 环境初始化
*
@@ -4936,31 +4940,31 @@ class Ff {
* @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement}
*/
constructor(t) {
- Yr(this, "envMeta"), this.envMeta = t;
+ Ft(this, "envMeta"), this.envMeta = t;
}
/**
* 是否是开发阶段调试
*/
isNodeDev() {
- return this.getEnv(kr.NODE_ENV_KEY) === kr.NODE_ENV_DEVELOPMENT;
+ return this.getEnv(bt.NODE_ENV_KEY) === bt.NODE_ENV_DEVELOPMENT;
}
/**
* 是否是调试阶段
*/
isDev() {
- return this.isNodeDev() || this.getBooleanEnv(kr.VITE_DEBUG_MODE_KEY);
+ return this.isNodeDev() || this.getBooleanEnv(bt.VITE_DEBUG_MODE_KEY);
}
/**
* 获取环境变量,key不存在返回undefined
* @param key - key
*/
getEnv(t) {
- let a;
+ let r;
try {
- this.envMeta[t] && (a = this.envMeta[t]);
+ this.envMeta[t] && (r = this.envMeta[t]);
} catch {
}
- return a;
+ return r;
}
/**
* 获取String类型的环境变量,key不存在直接返回空值
@@ -4974,8 +4978,8 @@ class Ff {
* @param key - key
*/
getBooleanEnv(t) {
- let a = !1;
- return this.getEnv(t) && (a = this.getStringEnv(t).toLowerCase() === "true"), a;
+ let r = !1;
+ return this.getEnv(t) && (r = this.getStringEnv(t).toLowerCase() === "true"), r;
}
/**
* 获取环境变量,如果未定义或者为空值,用指定的默认值代替
@@ -4985,34 +4989,34 @@ class Ff {
* @since 0.1.0
* @author terwer
*/
- getEnvOrDefault(t, a) {
- const n = this.getStringEnv(t);
- return n.trim().length == 0 ? a : n;
+ getEnvOrDefault(t, r) {
+ const a = this.getStringEnv(t);
+ return a.trim().length == 0 ? r : a;
}
}
-var Uf = Object.defineProperty, qf = (e, t, a) => t in e ? Uf(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, ra = (e, t, a) => (qf(e, typeof t != "symbol" ? t + "" : t, a), a);
-let Nn = class {
-};
-ra(Nn, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), ra(Nn, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX");
-var rr = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(rr || {}), yl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
-function ks(e) {
+var Tu = Object.defineProperty, Cu = (e, t, r) => t in e ? Tu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ut = (e, t, r) => (Cu(e, typeof t != "symbol" ? t + "" : t, r), r);
+class Gr {
+}
+Ut(Gr, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), Ut(Gr, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX");
+var st = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(st || {}), Fo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
+function tn(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
-var bl = { exports: {} };
+var qo = { exports: {} };
(function(e) {
- (function(t, a) {
- e.exports ? e.exports = a() : t.log = a();
- })(yl, function() {
+ (function(t, r) {
+ e.exports ? e.exports = r() : t.log = r();
+ })(Fo, function() {
var t = function() {
- }, a = "undefined", n = typeof window !== a && typeof window.navigator !== a && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
+ }, r = "undefined", a = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
"trace",
"debug",
"info",
"warn",
"error"
];
- function c(C, T) {
- var v = C[T];
+ function l(C, x) {
+ var v = C[x];
if (typeof v.bind == "function")
return v.bind(C);
try {
@@ -5023,196 +5027,196 @@ var bl = { exports: {} };
};
}
}
- function p() {
+ function d() {
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
}
function b(C) {
- return C === "debug" && (C = "log"), typeof console === a ? !1 : C === "trace" && n ? p : console[C] !== void 0 ? c(console, C) : console.log !== void 0 ? c(console, "log") : t;
+ return C === "debug" && (C = "log"), typeof console === r ? !1 : C === "trace" && a ? d : console[C] !== void 0 ? l(console, C) : console.log !== void 0 ? l(console, "log") : t;
}
- function _(C, T) {
+ function _(C, x) {
for (var v = 0; v < s.length; v++) {
- var j = s[v];
- this[j] = v < C ? t : this.methodFactory(j, C, T);
+ var T = s[v];
+ this[T] = v < C ? t : this.methodFactory(T, C, x);
}
this.log = this.debug;
}
- function y(C, T, v) {
+ function y(C, x, v) {
return function() {
- typeof console !== a && (_.call(this, T, v), this[C].apply(this, arguments));
+ typeof console !== r && (_.call(this, x, v), this[C].apply(this, arguments));
};
}
- function g(C, T, v) {
+ function m(C, x, v) {
return b(C) || y.apply(this, arguments);
}
- function S(C, T, v) {
- var j = this, I;
- T = T ?? "WARN";
- var r = "loglevel";
- typeof C == "string" ? r += ":" + C : typeof C == "symbol" && (r = void 0);
- function i(m) {
- var f = (s[m] || "silent").toUpperCase();
- if (!(typeof window === a || !r)) {
+ function k(C, x, v) {
+ var T = this, R;
+ x = x ?? "WARN";
+ var n = "loglevel";
+ typeof C == "string" ? n += ":" + C : typeof C == "symbol" && (n = void 0);
+ function i(f) {
+ var g = (s[f] || "silent").toUpperCase();
+ if (!(typeof window === r || !n)) {
try {
- window.localStorage[r] = f;
+ window.localStorage[n] = g;
return;
} catch {
}
try {
- window.document.cookie = encodeURIComponent(r) + "=" + f + ";";
+ window.document.cookie = encodeURIComponent(n) + "=" + g + ";";
} catch {
}
}
}
function o() {
- var m;
- if (!(typeof window === a || !r)) {
+ var f;
+ if (!(typeof window === r || !n)) {
try {
- m = window.localStorage[r];
+ f = window.localStorage[n];
} catch {
}
- if (typeof m === a)
+ if (typeof f === r)
try {
- var f = window.document.cookie, x = f.indexOf(
- encodeURIComponent(r) + "="
+ var g = window.document.cookie, O = g.indexOf(
+ encodeURIComponent(n) + "="
);
- x !== -1 && (m = /^([^;]+)/.exec(f.slice(x))[1]);
+ O !== -1 && (f = /^([^;]+)/.exec(g.slice(O))[1]);
} catch {
}
- return j.levels[m] === void 0 && (m = void 0), m;
+ return T.levels[f] === void 0 && (f = void 0), f;
}
}
- function l() {
- if (!(typeof window === a || !r)) {
+ function c() {
+ if (!(typeof window === r || !n)) {
try {
- window.localStorage.removeItem(r);
+ window.localStorage.removeItem(n);
return;
} catch {
}
try {
- window.document.cookie = encodeURIComponent(r) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
+ window.document.cookie = encodeURIComponent(n) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
} catch {
}
}
}
- j.name = C, j.levels = {
+ T.name = C, T.levels = {
TRACE: 0,
DEBUG: 1,
INFO: 2,
WARN: 3,
ERROR: 4,
SILENT: 5
- }, j.methodFactory = v || g, j.getLevel = function() {
- return I;
- }, j.setLevel = function(m, f) {
- if (typeof m == "string" && j.levels[m.toUpperCase()] !== void 0 && (m = j.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= j.levels.SILENT) {
- if (I = m, f !== !1 && i(m), _.call(j, m, C), typeof console === a && m < j.levels.SILENT)
+ }, T.methodFactory = v || m, T.getLevel = function() {
+ return R;
+ }, T.setLevel = function(f, g) {
+ if (typeof f == "string" && T.levels[f.toUpperCase()] !== void 0 && (f = T.levels[f.toUpperCase()]), typeof f == "number" && f >= 0 && f <= T.levels.SILENT) {
+ if (R = f, g !== !1 && i(f), _.call(T, f, C), typeof console === r && f < T.levels.SILENT)
return "No console available for logging";
} else
- throw "log.setLevel() called with invalid level: " + m;
- }, j.setDefaultLevel = function(m) {
- T = m, o() || j.setLevel(m, !1);
- }, j.resetLevel = function() {
- j.setLevel(T, !1), l();
- }, j.enableAll = function(m) {
- j.setLevel(j.levels.TRACE, m);
- }, j.disableAll = function(m) {
- j.setLevel(j.levels.SILENT, m);
+ throw "log.setLevel() called with invalid level: " + f;
+ }, T.setDefaultLevel = function(f) {
+ x = f, o() || T.setLevel(f, !1);
+ }, T.resetLevel = function() {
+ T.setLevel(x, !1), c();
+ }, T.enableAll = function(f) {
+ T.setLevel(T.levels.TRACE, f);
+ }, T.disableAll = function(f) {
+ T.setLevel(T.levels.SILENT, f);
};
var u = o();
- u == null && (u = T), j.setLevel(u, !1);
+ u == null && (u = x), T.setLevel(u, !1);
}
- var L = new S(), A = {};
- L.getLogger = function(C) {
+ var N = new k(), A = {};
+ N.getLogger = function(C) {
if (typeof C != "symbol" && typeof C != "string" || C === "")
throw new TypeError("You must supply a name when creating a logger.");
- var T = A[C];
- return T || (T = A[C] = new S(
+ var x = A[C];
+ return x || (x = A[C] = new k(
C,
- L.getLevel(),
- L.methodFactory
- )), T;
+ N.getLevel(),
+ N.methodFactory
+ )), x;
};
- var N = typeof window !== a ? window.log : void 0;
- return L.noConflict = function() {
- return typeof window !== a && window.log === L && (window.log = N), L;
- }, L.getLoggers = function() {
+ var j = typeof window !== r ? window.log : void 0;
+ return N.noConflict = function() {
+ return typeof window !== r && window.log === N && (window.log = j), N;
+ }, N.getLoggers = function() {
return A;
- }, L.default = L, L;
+ }, N.default = N, N;
});
-})(bl);
-var Hf = bl.exports;
-const ln = /* @__PURE__ */ ks(Hf);
-var _l = { exports: {} };
+})(qo);
+var xu = qo.exports;
+const jr = /* @__PURE__ */ tn(xu);
+var Uo = { exports: {} };
(function(e) {
- (function(t, a) {
- e.exports ? e.exports = a() : t.prefix = a(t);
- })(yl, function(t) {
- var a = function(g) {
- for (var S = 1, L = arguments.length, A; S < L; S++)
- for (A in arguments[S])
- Object.prototype.hasOwnProperty.call(arguments[S], A) && (g[A] = arguments[S][A]);
- return g;
- }, n = {
+ (function(t, r) {
+ e.exports ? e.exports = r() : t.prefix = r(t);
+ })(Fo, function(t) {
+ var r = function(m) {
+ for (var k = 1, N = arguments.length, A; k < N; k++)
+ for (A in arguments[k])
+ Object.prototype.hasOwnProperty.call(arguments[k], A) && (m[A] = arguments[k][A]);
+ return m;
+ }, a = {
template: "[%t] %l:",
- levelFormatter: function(g) {
- return g.toUpperCase();
+ levelFormatter: function(m) {
+ return m.toUpperCase();
},
- nameFormatter: function(g) {
- return g || "root";
+ nameFormatter: function(m) {
+ return m || "root";
},
- timestampFormatter: function(g) {
- return g.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
+ timestampFormatter: function(m) {
+ return m.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
},
format: void 0
- }, s, c = {}, p = function(g) {
- if (!g || !g.getLogger)
+ }, s, l = {}, d = function(m) {
+ if (!m || !m.getLogger)
throw new TypeError("Argument is not a root logger");
- s = g;
- }, b = function(g, S) {
- if (!g || !g.setLevel)
+ s = m;
+ }, b = function(m, k) {
+ if (!m || !m.setLevel)
throw new TypeError("Argument is not a logger");
- var L = g.methodFactory, A = g.name || "", N = c[A] || c[""] || n;
- function C(T, v, j) {
- var I = L(T, v, j), r = c[j] || c[""], i = r.template.indexOf("%t") !== -1, o = r.template.indexOf("%l") !== -1, l = r.template.indexOf("%n") !== -1;
+ var N = m.methodFactory, A = m.name || "", j = l[A] || l[""] || a;
+ function C(x, v, T) {
+ var R = N(x, v, T), n = l[T] || l[""], i = n.template.indexOf("%t") !== -1, o = n.template.indexOf("%l") !== -1, c = n.template.indexOf("%n") !== -1;
return function() {
- for (var u = "", m = arguments.length, f = Array(m), x = 0; x < m; x++)
- f[x] = arguments[x];
- if (A || !c[j]) {
- var B = r.timestampFormatter(/* @__PURE__ */ new Date()), U = r.levelFormatter(T), z = r.nameFormatter(j);
- r.format ? u += r.format(U, z, B) : (u += r.template, i && (u = u.replace(/%t/, B)), o && (u = u.replace(/%l/, U)), l && (u = u.replace(/%n/, z))), f.length && typeof f[0] == "string" ? f[0] = u + " " + f[0] : f.unshift(u);
+ for (var u = "", f = arguments.length, g = Array(f), O = 0; O < f; O++)
+ g[O] = arguments[O];
+ if (A || !l[T]) {
+ var z = n.timestampFormatter(/* @__PURE__ */ new Date()), q = n.levelFormatter(x), B = n.nameFormatter(T);
+ n.format ? u += n.format(q, B, z) : (u += n.template, i && (u = u.replace(/%t/, z)), o && (u = u.replace(/%l/, q)), c && (u = u.replace(/%n/, B))), g.length && typeof g[0] == "string" ? g[0] = u + " " + g[0] : g.unshift(u);
}
- I.apply(void 0, f);
+ R.apply(void 0, g);
};
}
- return c[A] || (g.methodFactory = C), S = S || {}, S.template && (S.format = void 0), c[A] = a({}, N, S), g.setLevel(g.getLevel()), s || g.warn(
+ return l[A] || (m.methodFactory = C), k = k || {}, k.template && (k.format = void 0), l[A] = r({}, j, k), m.setLevel(m.getLevel()), s || m.warn(
"It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"
- ), g;
+ ), m;
}, _ = {
- reg: p,
+ reg: d,
apply: b
}, y;
return t && (y = t.prefix, _.noConflict = function() {
return t.prefix === _ && (t.prefix = y), _;
}), _;
});
-})(_l);
-var Gf = _l.exports;
-const Bi = /* @__PURE__ */ ks(Gf);
-function Kf() {
+})(Uo);
+var Ou = Uo.exports;
+const qn = /* @__PURE__ */ tn(Ou);
+function Nu() {
const e = Error.prepareStackTrace;
- Error.prepareStackTrace = (a, n) => n;
+ Error.prepareStackTrace = (r, a) => a;
const t = new Error().stack.slice(1);
return Error.prepareStackTrace = e, t;
}
-let Vi = class wl {
+class Hr {
/**
* 解析日志级别为枚举
*
* @param enumObj - 枚举对象
* @param value - 配置的值
*/
- static stringToEnumValue(t, a) {
- return t[Object.keys(t).filter((n) => t[n].toString() === a)[0]];
+ static stringToEnumValue(t, r) {
+ return t[Object.keys(t).filter((a) => t[a].toString() === r)[0]];
}
/**
* 获取配置的日志级别
@@ -5220,22 +5224,22 @@ let Vi = class wl {
static getEnvLevel(t) {
if (!t)
return;
- const a = t.getEnvOrDefault(Nn.LOG_LEVEL_KEY, rr.LOG_LEVEL_INFO), n = wl.stringToEnumValue(rr, a.toUpperCase());
- return n || console.warn(
+ const r = t.getEnvOrDefault(Gr.LOG_LEVEL_KEY, st.LOG_LEVEL_INFO), a = Hr.stringToEnumValue(st, r.toUpperCase());
+ return a || console.warn(
"[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level"
- ), n;
+ ), a;
}
/**
* 获取默认日志
*/
static getEnvLogger(t) {
- return t ? t.getEnv(Nn.LOG_PREFIX_KEY) : void 0;
+ return t ? t.getEnv(Gr.LOG_PREFIX_KEY) : void 0;
}
-};
-var Es = { exports: {} }, Fi = { exports: {} }, Ui;
-function Wf() {
- return Ui || (Ui = 1, function(e) {
- const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", a = typeof process < "u" && process.platform === "win32", n = typeof process < "u" && process.platform === "linux", s = {
+}
+var rn = { exports: {} }, Un = { exports: {} }, Gn;
+function ju() {
+ return Gn || (Gn = 1, function(e) {
+ const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", r = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", s = {
ballotDisabled: "☒",
ballotOff: "☐",
ballotOn: "☑",
@@ -5262,7 +5266,7 @@ function Wf() {
starsOff: "☆",
starsOn: "★",
upDownArrow: "↕"
- }, c = Object.assign({}, s, {
+ }, l = Object.assign({}, s, {
check: "√",
cross: "×",
ellipsisLarge: "...",
@@ -5274,7 +5278,7 @@ function Wf() {
radioOff: "( )",
radioOn: "(*)",
warning: "‼"
- }), p = Object.assign({}, s, {
+ }), d = Object.assign({}, s, {
ballotCross: "✘",
check: "✔",
cross: "✖",
@@ -5283,169 +5287,169 @@ function Wf() {
info: "ℹ",
questionFull: "?",
questionSmall: "﹖",
- pointer: n ? "▸" : "❯",
- pointerSmall: n ? "‣" : "›",
+ pointer: a ? "▸" : "❯",
+ pointerSmall: a ? "‣" : "›",
radioOff: "◯",
radioOn: "◉",
warning: "⚠"
});
- e.exports = a && !t ? c : p, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: c }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: p });
- }(Fi)), Fi.exports;
+ e.exports = r && !t ? l : d, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: l }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: d });
+ }(Un)), Un.exports;
}
-const Jf = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Zf = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Yf = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, vl = () => {
+const Lu = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Au = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Ru = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, Go = () => {
const e = {
- enabled: Yf(),
+ enabled: Ru(),
visible: !0,
styles: {},
keys: {}
- }, t = (c) => {
- let p = c.open = `\x1B[${c.codes[0]}m`, b = c.close = `\x1B[${c.codes[1]}m`, _ = c.regex = new RegExp(`\\u001b\\[${c.codes[1]}m`, "g");
- return c.wrap = (y, g) => {
- y.includes(b) && (y = y.replace(_, b + p));
- let S = p + y + b;
- return g ? S.replace(/\r*\n/g, `${b}$&${p}`) : S;
- }, c;
- }, a = (c, p, b) => typeof c == "function" ? c(p) : c.wrap(p, b), n = (c, p) => {
- if (c === "" || c == null)
+ }, t = (l) => {
+ let d = l.open = `\x1B[${l.codes[0]}m`, b = l.close = `\x1B[${l.codes[1]}m`, _ = l.regex = new RegExp(`\\u001b\\[${l.codes[1]}m`, "g");
+ return l.wrap = (y, m) => {
+ y.includes(b) && (y = y.replace(_, b + d));
+ let k = d + y + b;
+ return m ? k.replace(/\r*\n/g, `${b}$&${d}`) : k;
+ }, l;
+ }, r = (l, d, b) => typeof l == "function" ? l(d) : l.wrap(d, b), a = (l, d) => {
+ if (l === "" || l == null)
return "";
if (e.enabled === !1)
- return c;
+ return l;
if (e.visible === !1)
return "";
- let b = "" + c, _ = b.includes(`
-`), y = p.length;
- for (y > 0 && p.includes("unstyle") && (p = [.../* @__PURE__ */ new Set(["unstyle", ...p])].reverse()); y-- > 0; )
- b = a(e.styles[p[y]], b, _);
+ let b = "" + l, _ = b.includes(`
+`), y = d.length;
+ for (y > 0 && d.includes("unstyle") && (d = [.../* @__PURE__ */ new Set(["unstyle", ...d])].reverse()); y-- > 0; )
+ b = r(e.styles[d[y]], b, _);
return b;
- }, s = (c, p, b) => {
- e.styles[c] = t({ name: c, codes: p }), (e.keys[b] || (e.keys[b] = [])).push(c), Reflect.defineProperty(e, c, {
+ }, s = (l, d, b) => {
+ e.styles[l] = t({ name: l, codes: d }), (e.keys[b] || (e.keys[b] = [])).push(l), Reflect.defineProperty(e, l, {
configurable: !0,
enumerable: !0,
set(_) {
- e.alias(c, _);
+ e.alias(l, _);
},
get() {
- let _ = (y) => n(y, _.stack);
- return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(c) : [c], _;
+ let _ = (y) => a(y, _.stack);
+ return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(l) : [l], _;
}
});
};
- return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Zf, e.hasColor = e.hasAnsi = (c) => (e.ansiRegex.lastIndex = 0, typeof c == "string" && c !== "" && e.ansiRegex.test(c)), e.alias = (c, p) => {
- let b = typeof p == "string" ? e[p] : p;
+ return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Au, e.hasColor = e.hasAnsi = (l) => (e.ansiRegex.lastIndex = 0, typeof l == "string" && l !== "" && e.ansiRegex.test(l)), e.alias = (l, d) => {
+ let b = typeof d == "string" ? e[d] : d;
if (typeof b != "function")
throw new TypeError("Expected alias to be the name of an existing color (string) or a function");
- b.stack || (Reflect.defineProperty(b, "name", { value: c }), e.styles[c] = b, b.stack = [c]), Reflect.defineProperty(e, c, {
+ b.stack || (Reflect.defineProperty(b, "name", { value: l }), e.styles[l] = b, b.stack = [l]), Reflect.defineProperty(e, l, {
configurable: !0,
enumerable: !0,
set(_) {
- e.alias(c, _);
+ e.alias(l, _);
},
get() {
- let _ = (y) => n(y, _.stack);
+ let _ = (y) => a(y, _.stack);
return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(b.stack) : b.stack, _;
}
});
- }, e.theme = (c) => {
- if (!Jf(c))
+ }, e.theme = (l) => {
+ if (!Lu(l))
throw new TypeError("Expected theme to be an object");
- for (let p of Object.keys(c))
- e.alias(p, c[p]);
+ for (let d of Object.keys(l))
+ e.alias(d, l[d]);
return e;
- }, e.alias("unstyle", (c) => typeof c == "string" && c !== "" ? (e.ansiRegex.lastIndex = 0, c.replace(e.ansiRegex, "")) : ""), e.alias("noop", (c) => c), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = Wf(), e.define = s, e;
+ }, e.alias("unstyle", (l) => typeof l == "string" && l !== "" ? (e.ansiRegex.lastIndex = 0, l.replace(e.ansiRegex, "")) : ""), e.alias("noop", (l) => l), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = ju(), e.define = s, e;
};
-Es.exports = vl();
-Es.exports.create = vl;
-var Qf = Es.exports;
-const Tt = /* @__PURE__ */ ks(Qf);
-let To, $l, kl, El, Pl = !0;
-typeof process < "u" && ({ FORCE_COLOR: To, NODE_DISABLE_COLORS: $l, NO_COLOR: kl, TERM: El } = process.env || {}, Pl = process.stdout && process.stdout.isTTY);
-const fe = {
- enabled: !$l && kl == null && El !== "dumb" && (To != null && To !== "0" || Pl),
+rn.exports = Go();
+rn.exports.create = Go;
+var Iu = rn.exports;
+const Ue = /* @__PURE__ */ tn(Iu);
+let ma, Ho, Ko, Wo, Jo = !0;
+typeof process < "u" && ({ FORCE_COLOR: ma, NODE_DISABLE_COLORS: Ho, NO_COLOR: Ko, TERM: Wo } = process.env || {}, Jo = process.stdout && process.stdout.isTTY);
+const re = {
+ enabled: !Ho && Ko == null && Wo !== "dumb" && (ma != null && ma !== "0" || Jo),
// modifiers
- reset: Ce(0, 0),
- bold: Ce(1, 22),
- dim: Ce(2, 22),
- italic: Ce(3, 23),
- underline: Ce(4, 24),
- inverse: Ce(7, 27),
- hidden: Ce(8, 28),
- strikethrough: Ce(9, 29),
+ reset: me(0, 0),
+ bold: me(1, 22),
+ dim: me(2, 22),
+ italic: me(3, 23),
+ underline: me(4, 24),
+ inverse: me(7, 27),
+ hidden: me(8, 28),
+ strikethrough: me(9, 29),
// colors
- black: Ce(30, 39),
- red: Ce(31, 39),
- green: Ce(32, 39),
- yellow: Ce(33, 39),
- blue: Ce(34, 39),
- magenta: Ce(35, 39),
- cyan: Ce(36, 39),
- white: Ce(37, 39),
- gray: Ce(90, 39),
- grey: Ce(90, 39),
+ black: me(30, 39),
+ red: me(31, 39),
+ green: me(32, 39),
+ yellow: me(33, 39),
+ blue: me(34, 39),
+ magenta: me(35, 39),
+ cyan: me(36, 39),
+ white: me(37, 39),
+ gray: me(90, 39),
+ grey: me(90, 39),
// background colors
- bgBlack: Ce(40, 49),
- bgRed: Ce(41, 49),
- bgGreen: Ce(42, 49),
- bgYellow: Ce(43, 49),
- bgBlue: Ce(44, 49),
- bgMagenta: Ce(45, 49),
- bgCyan: Ce(46, 49),
- bgWhite: Ce(47, 49)
+ bgBlack: me(40, 49),
+ bgRed: me(41, 49),
+ bgGreen: me(42, 49),
+ bgYellow: me(43, 49),
+ bgBlue: me(44, 49),
+ bgMagenta: me(45, 49),
+ bgCyan: me(46, 49),
+ bgWhite: me(47, 49)
};
-function qi(e, t) {
- let a = 0, n, s = "", c = "";
- for (; a < e.length; a++)
- n = e[a], s += n.open, c += n.close, ~t.indexOf(n.close) && (t = t.replace(n.rgx, n.close + n.open));
- return s + t + c;
-}
-function Xf(e, t) {
- let a = { has: e, keys: t };
- return a.reset = fe.reset.bind(a), a.bold = fe.bold.bind(a), a.dim = fe.dim.bind(a), a.italic = fe.italic.bind(a), a.underline = fe.underline.bind(a), a.inverse = fe.inverse.bind(a), a.hidden = fe.hidden.bind(a), a.strikethrough = fe.strikethrough.bind(a), a.black = fe.black.bind(a), a.red = fe.red.bind(a), a.green = fe.green.bind(a), a.yellow = fe.yellow.bind(a), a.blue = fe.blue.bind(a), a.magenta = fe.magenta.bind(a), a.cyan = fe.cyan.bind(a), a.white = fe.white.bind(a), a.gray = fe.gray.bind(a), a.grey = fe.grey.bind(a), a.bgBlack = fe.bgBlack.bind(a), a.bgRed = fe.bgRed.bind(a), a.bgGreen = fe.bgGreen.bind(a), a.bgYellow = fe.bgYellow.bind(a), a.bgBlue = fe.bgBlue.bind(a), a.bgMagenta = fe.bgMagenta.bind(a), a.bgCyan = fe.bgCyan.bind(a), a.bgWhite = fe.bgWhite.bind(a), a;
-}
-function Ce(e, t) {
- let a = {
+function Hn(e, t) {
+ let r = 0, a, s = "", l = "";
+ for (; r < e.length; r++)
+ a = e[r], s += a.open, l += a.close, ~t.indexOf(a.close) && (t = t.replace(a.rgx, a.close + a.open));
+ return s + t + l;
+}
+function Mu(e, t) {
+ let r = { has: e, keys: t };
+ return r.reset = re.reset.bind(r), r.bold = re.bold.bind(r), r.dim = re.dim.bind(r), r.italic = re.italic.bind(r), r.underline = re.underline.bind(r), r.inverse = re.inverse.bind(r), r.hidden = re.hidden.bind(r), r.strikethrough = re.strikethrough.bind(r), r.black = re.black.bind(r), r.red = re.red.bind(r), r.green = re.green.bind(r), r.yellow = re.yellow.bind(r), r.blue = re.blue.bind(r), r.magenta = re.magenta.bind(r), r.cyan = re.cyan.bind(r), r.white = re.white.bind(r), r.gray = re.gray.bind(r), r.grey = re.grey.bind(r), r.bgBlack = re.bgBlack.bind(r), r.bgRed = re.bgRed.bind(r), r.bgGreen = re.bgGreen.bind(r), r.bgYellow = re.bgYellow.bind(r), r.bgBlue = re.bgBlue.bind(r), r.bgMagenta = re.bgMagenta.bind(r), r.bgCyan = re.bgCyan.bind(r), r.bgWhite = re.bgWhite.bind(r), r;
+}
+function me(e, t) {
+ let r = {
open: `\x1B[${e}m`,
close: `\x1B[${t}m`,
rgx: new RegExp(`\\x1b\\[${t}m`, "g")
};
- return function(n) {
- return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(a)), n === void 0 ? this : fe.enabled ? qi(this.keys, n + "") : n + "") : n === void 0 ? Xf([e], [a]) : fe.enabled ? qi([a], n + "") : n + "";
+ return function(a) {
+ return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(r)), a === void 0 ? this : re.enabled ? Hn(this.keys, a + "") : a + "") : a === void 0 ? Mu([e], [r]) : re.enabled ? Hn([r], a + "") : a + "";
};
}
-var em = Object.defineProperty, tm = (e, t, a) => t in e ? em(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, We = (e, t, a) => (tm(e, typeof t != "symbol" ? t + "" : t, a), a);
-const Wt = class {
+var Du = Object.defineProperty, Bu = (e, t, r) => t in e ? Du(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Pe = (e, t, r) => (Bu(e, typeof t != "symbol" ? t + "" : t, r), r);
+const Qe = class {
/**
* 检测是否运行在Chrome插件中
*/
static isInChromeExtension() {
- return Wt.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1;
+ return Qe.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1;
}
};
-let Ee = Wt;
-We(Ee, "isNode", typeof process < "u"), /**
+let de = Qe;
+Pe(de, "isNode", typeof process < "u"), /**
* 是否在浏览器环境
*/
-We(Ee, "isInBrowser", typeof window < "u"), /**
+Pe(de, "isInBrowser", typeof window < "u"), /**
* 浏览器路径分隔符
*/
-We(Ee, "BrowserSeperator", "/"), /**
+Pe(de, "BrowserSeperator", "/"), /**
* 是否是Electron环境
*/
-We(Ee, "isElectron", () => !Wt.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /**
+Pe(de, "isElectron", () => !Qe.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /**
* 是否有Node环境,目前包括 Electron 和 Node
*/
-We(Ee, "hasNodeEnv", () => Wt.isElectron() || Wt.isNode), /**
+Pe(de, "hasNodeEnv", () => Qe.isElectron() || Qe.isNode), /**
* 获取url参数
*
* @param sParam - 参数
*/
-We(Ee, "getQueryString", (e) => {
- if (!Wt.isInBrowser)
+Pe(de, "getQueryString", (e) => {
+ if (!Qe.isInBrowser)
return "";
const t = window.location.search.substring(1).split("&");
- for (let a = 0; a < t.length; a++) {
- const n = t[a].split("=");
- if (n[0] === e)
- return n[1];
+ for (let r = 0; r < t.length; r++) {
+ const a = t[r].split("=");
+ if (a[0] === e)
+ return a[1];
}
return "";
}), /**
@@ -5465,15 +5469,15 @@ We(Ee, "getQueryString", (e) => {
* @param paramName - 参数名
* @param paramValue - 参数值
*/
-We(Ee, "replaceUrlParam", (e, t, a) => {
- a == null && (a = "");
- const n = new RegExp("\\b(" + t + "=).*?(&|#|$)");
- if (e.search(n) >= 0)
- return e.replace(n, "$1" + a + "$2");
- const [s, c] = e.split("#"), [p, b] = s.split("?"), _ = new URLSearchParams(b);
- _.set(t, a);
- const y = _.toString(), g = p + (y ? "?" + y : "");
- return c ? g + "#" + c : g;
+Pe(de, "replaceUrlParam", (e, t, r) => {
+ r == null && (r = "");
+ const a = new RegExp("\\b(" + t + "=).*?(&|#|$)");
+ if (e.search(a) >= 0)
+ return e.replace(a, "$1" + r + "$2");
+ const [s, l] = e.split("#"), [d, b] = s.split("?"), _ = new URLSearchParams(b);
+ _.set(t, r);
+ const y = _.toString(), m = d + (y ? "?" + y : "");
+ return l ? m + "#" + l : m;
}), /**
* 设置url参数
*
@@ -5481,32 +5485,32 @@ We(Ee, "replaceUrlParam", (e, t, a) => {
* @param key - key
* @param value - value
*/
-We(Ee, "setUrlParameter", (e, t, a) => {
+Pe(de, "setUrlParameter", (e, t, r) => {
if (e.includes(t))
- return Wt.replaceUrlParam(e, t, a);
- const n = e.split("#");
- let s = n[0];
- const c = n[1];
- return s.includes("?") ? s += `&${t}=${a}` : s += `?${t}=${a}`, c && (s += "#" + c), s;
+ return Qe.replaceUrlParam(e, t, r);
+ const a = e.split("#");
+ let s = a[0];
+ const l = a[1];
+ return s.includes("?") ? s += `&${t}=${r}` : s += `?${t}=${r}`, l && (s += "#" + l), s;
}), /**
* 重新加载指定tab
*
* @param tabname - tabname
* @param t - 延迟时间
*/
-We(Ee, "reloadTabPage", (e, t = 200) => {
+Pe(de, "reloadTabPage", (e, t = 200) => {
setTimeout(function() {
- if (Wt.isInBrowser) {
- const a = window.location.href;
- window.location.href = Wt.setUrlParameter(a, "tab", e);
+ if (Qe.isInBrowser) {
+ const r = window.location.href;
+ window.location.href = Qe.setUrlParameter(r, "tab", e);
}
}, t);
}), /**
* 刷新当前tab页面
*/
-We(Ee, "reloadPage", () => {
+Pe(de, "reloadPage", () => {
setTimeout(function() {
- Wt.isInBrowser && window.location.reload();
+ Qe.isInBrowser && window.location.reload();
}, 200);
}), /**
* 刷新当前tab页面
@@ -5514,25 +5518,25 @@ We(Ee, "reloadPage", () => {
* @param msg - 消息提示
* @param cb - 回调
*/
-We(Ee, "reloadPageWithMessageCallback", (e, t) => {
+Pe(de, "reloadPageWithMessageCallback", (e, t) => {
t && t(e), setTimeout(function() {
- Wt.isInBrowser && window.location.reload();
+ Qe.isInBrowser && window.location.reload();
}, 200);
});
-var dt = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(dt || {});
-const mt = class {
+var je = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(je || {});
+const Ie = class {
/**
* 检测是否运行在思源打开的浏览器中
*/
static isInSiyuanBrowser() {
- return Ee.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1;
+ return de.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1;
}
/**
* 思源笔记 window 对象
*/
static siyuanWindow() {
- let t;
- return this.isInSiyuanWidget() ? t = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? t = window : t = void 0, t;
+ let e;
+ return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e;
}
// =========================
// require end
@@ -5546,29 +5550,29 @@ const mt = class {
* @param jsPath - js相对路径全路径
* @param type - 类型
*/
- static async importJs(t, a) {
- let n = t;
- switch (a) {
- case dt.BasePathType_Appearance:
- n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), t);
+ static async importJs(e, t) {
+ let r = e;
+ switch (t) {
+ case je.BasePathType_Appearance:
+ r = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e);
break;
- case dt.BasePathType_Data:
- n = this.browserJoinPath(this.siyuanDataRelativePath(), t);
+ case je.BasePathType_Data:
+ r = this.browserJoinPath(this.siyuanDataRelativePath(), e);
break;
- case dt.BasePathType_Themes:
- n = this.browserJoinPath(this.siyuanThemeRelativePath(), t);
+ case je.BasePathType_Themes:
+ r = this.browserJoinPath(this.siyuanThemeRelativePath(), e);
break;
- case dt.BasePathType_ZhiTheme:
- n = this.browserJoinPath(this.zhiThemeRelativePath(), t);
+ case je.BasePathType_ZhiTheme:
+ r = this.browserJoinPath(this.zhiThemeRelativePath(), e);
break;
default:
throw new Error("type must be provided");
}
- const { default: s } = await import(
+ const { default: a } = await import(
/* @vite-ignore */
- n
+ r
);
- return s;
+ return a;
}
/**
* 引入json
@@ -5635,8 +5639,8 @@ const mt = class {
*
* @param jsPath - 相对于 zhi 主题根路径的相对路径
*/
- static async importZhiThemeJs(t) {
- return await this.importJs(t, dt.BasePathType_ZhiTheme);
+ static async importZhiThemeJs(e) {
+ return await this.importJs(e, je.BasePathType_ZhiTheme);
}
// =========================
// import start
@@ -5646,34 +5650,34 @@ const mt = class {
*
* @param paths - 路径数组
*/
- static joinPath(...t) {
- if (Ee.hasNodeEnv()) {
- const a = this.requireLib("path");
- if (a)
- return a.join(...t);
+ static joinPath(...e) {
+ if (de.hasNodeEnv()) {
+ const t = this.requireLib("path");
+ if (t)
+ return t.join(...e);
}
- return this.browserJoinPath(...t);
+ return this.browserJoinPath(...e);
}
- static browserJoinPath(...t) {
- return t.join(Ee.BrowserSeperator);
+ static browserJoinPath(...e) {
+ return e.join(de.BrowserSeperator);
}
/**
* 思源笔记 conf 目录
*/
static siyuanConfPath() {
- const t = this.siyuanWindow();
- if (!t)
+ const e = this.siyuanWindow();
+ if (!e)
throw new Error("Not in siyuan env");
- return t.siyuan.config.system.confDir;
+ return e.siyuan.config.system.confDir;
}
/**
* 思源笔记 data 目录
*/
static siyuanDataPath() {
- const t = this.siyuanWindow();
- if (!t)
+ const e = this.siyuanWindow();
+ if (!e)
throw new Error("Not in siyuan env");
- return t.siyuan.config.system.dataDir;
+ return e.siyuan.config.system.dataDir;
}
/**
* 思源笔记 data 目录-相对路径
@@ -5707,13 +5711,13 @@ const mt = class {
* @since 0.1.0
*/
static siyuanThemePath() {
- if (Ee.hasNodeEnv())
+ if (de.hasNodeEnv())
return this.joinPath(this.siyuanAppearancePath(), "themes");
{
- const t = this.siyuanWindow();
- if (!t)
+ const e = this.siyuanWindow();
+ if (!e)
throw new Error("Not in siyuan env");
- return this.joinPath(t.location.origin, "appearance", "themes");
+ return this.joinPath(e.location.origin, "appearance", "themes");
}
}
/**
@@ -5737,8 +5741,8 @@ const mt = class {
return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi");
}
};
-let Nr = mt;
-We(Nr, "isInSiyuanWidget", () => Ee.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /**
+let St = Ie;
+Pe(St, "isInSiyuanWidget", () => de.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /**
* 思源笔记新窗口
*
* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解
@@ -5746,7 +5750,7 @@ We(Nr, "isInSiyuanWidget", () => Ee.isInBrowser ? window.frameElement != null &&
* @version 0.1.0
* @since 0.0.1
*/
-We(Nr, "isInSiyuanNewWin", () => !Ee.isInBrowser || !Ee.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // =========================
+Pe(St, "isInSiyuanNewWin", () => !de.isInBrowser || !de.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // =========================
// require start
// =========================
/**
@@ -5756,114 +5760,114 @@ We(Nr, "isInSiyuanNewWin", () => !Ee.isInBrowser || !Ee.isElectron() ? !1 : type
* @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效
* @param type - 可选,以谁的基本路径为准
*/
-We(Nr, "requireLib", (e, t = !0, a = dt.BasePathType_None) => {
- if (!Ee.hasNodeEnv())
+Pe(St, "requireLib", (e, t = !0, r = je.BasePathType_None) => {
+ if (!de.hasNodeEnv())
throw new Error("require ony works on node env");
- let n = e;
+ let a = e;
if (!t)
- switch (a) {
- case dt.BasePathType_Appearance:
- n = mt.joinPath(mt.siyuanAppearancePath(), e);
+ switch (r) {
+ case je.BasePathType_Appearance:
+ a = Ie.joinPath(Ie.siyuanAppearancePath(), e);
break;
- case dt.BasePathType_Data:
- n = mt.joinPath(mt.siyuanDataPath(), e);
+ case je.BasePathType_Data:
+ a = Ie.joinPath(Ie.siyuanDataPath(), e);
break;
- case dt.BasePathType_Themes:
- n = mt.joinPath(mt.siyuanAppearancePath(), "themes", e);
+ case je.BasePathType_Themes:
+ a = Ie.joinPath(Ie.siyuanAppearancePath(), "themes", e);
break;
- case dt.BasePathType_ZhiTheme:
- n = mt.joinPath(mt.siyuanAppearancePath(), "themes", "zhi", e);
+ case je.BasePathType_ZhiTheme:
+ a = Ie.joinPath(Ie.siyuanAppearancePath(), "themes", "zhi", e);
break;
default:
throw new Error("type must be provided when not use absolute path");
}
- const s = mt.siyuanWindow();
+ const s = Ie.siyuanWindow();
if (!s)
- return require(n);
+ return require(a);
if (typeof s.require < "u")
- return s.require(n);
+ return s.require(a);
}), /**
* 引入依赖,以 data 的基本路径为准
*
* @param libpath - 相对于 appearance 的相对路径
*/
-We(Nr, "requireAppearanceLib", (e) => mt.requireLib(e, !1, dt.BasePathType_Appearance)), /**
+Pe(St, "requireAppearanceLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Appearance)), /**
* 引入依赖,以 data 的基本路径为准
*
* @param libpath - 相对于 data 的相对路径
*/
-We(Nr, "requireDataLib", (e) => mt.requireLib(e, !1, dt.BasePathType_Data)), /**
+Pe(St, "requireDataLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Data)), /**
* 引入依赖,以 theme 的基本路径为准
*
* @param libpath - 相对于 theme 的相对路径
*/
-We(Nr, "requireThemesLib", (e) => mt.requireLib(e, !1, dt.BasePathType_Themes)), /**
+Pe(St, "requireThemesLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Themes)), /**
* 引入依赖,以 ZhiTheme 的基本路径为准
*
* @param libpath - 相对于 ZhiTheme 的相对路径
*/
-We(Nr, "requireZhiThemeLib", (e) => mt.requireLib(e, !1, dt.BasePathType_ZhiTheme));
-const jt = {
- white: (e) => Ee.isElectron() ? Tt.whiteBright(e) : fe.white(e),
- gray: (e) => Ee.isElectron() ? Tt.gray(e) : fe.gray(e),
- blue: (e) => Ee.isElectron() ? Tt.blue(e) : fe.blue(e),
- green: (e) => Ee.isElectron() ? Tt.green(e) : fe.green(e),
- yellow: (e) => Ee.isElectron() ? Tt.yellow(e) : fe.yellow(e),
- red: (e) => Ee.isElectron() ? Tt.red(e) : fe.red(e),
- bgWhite: (e) => Ee.isElectron() ? Tt.bgWhiteBright(e) : fe.bgWhite(e),
- bgGrey: (e) => Ee.isElectron() ? Tt.bgCyanBright(e) : fe.bgCyan(e),
- bgBlue: (e) => Ee.isElectron() ? Tt.bgBlueBright(e) : fe.bgBlue(e),
- bgGreen: (e) => Ee.isElectron() ? Tt.bgGreenBright(e) : fe.bgGreen(e),
- bgYellow: (e) => Ee.isElectron() ? Tt.bgYellowBright(e) : fe.bgYellow(e),
- bgRed: (e) => Ee.isElectron() ? Tt.bgRedBright(e) : fe.bgRed(e)
+Pe(St, "requireZhiThemeLib", (e) => Ie.requireLib(e, !1, je.BasePathType_ZhiTheme));
+const Ge = {
+ white: (e) => de.isElectron() ? Ue.whiteBright(e) : re.white(e),
+ gray: (e) => de.isElectron() ? Ue.gray(e) : re.gray(e),
+ blue: (e) => de.isElectron() ? Ue.blue(e) : re.blue(e),
+ green: (e) => de.isElectron() ? Ue.green(e) : re.green(e),
+ yellow: (e) => de.isElectron() ? Ue.yellow(e) : re.yellow(e),
+ red: (e) => de.isElectron() ? Ue.red(e) : re.red(e),
+ bgWhite: (e) => de.isElectron() ? Ue.bgWhiteBright(e) : re.bgWhite(e),
+ bgGrey: (e) => de.isElectron() ? Ue.bgCyanBright(e) : re.bgCyan(e),
+ bgBlue: (e) => de.isElectron() ? Ue.bgBlueBright(e) : re.bgBlue(e),
+ bgGreen: (e) => de.isElectron() ? Ue.bgGreenBright(e) : re.bgGreen(e),
+ bgYellow: (e) => de.isElectron() ? Ue.bgYellowBright(e) : re.bgYellow(e),
+ bgRed: (e) => de.isElectron() ? Ue.bgRedBright(e) : re.bgRed(e)
};
-let rm = class {
- constructor(t, a, n) {
- ra(this, "consoleLogger", "console"), ra(this, "stackSize", 1), ra(this, "getLogger", (p) => {
+class zu {
+ constructor(t, r, a) {
+ Ut(this, "consoleLogger", "console"), Ut(this, "stackSize", 1), Ut(this, "getLogger", (d) => {
let b;
- if (p)
- b = p;
+ if (d)
+ b = d;
else {
- const _ = this.getCallStack(), y = [], g = [];
- for (let S = 0; S < _.length; S++) {
- const L = _[S], A = L.getFileName() ?? "none";
- if (S > this.stackSize - 1)
+ const _ = this.getCallStack(), y = [], m = [];
+ for (let k = 0; k < _.length; k++) {
+ const N = _[k], A = N.getFileName() ?? "none";
+ if (k > this.stackSize - 1)
break;
- const N = A + "-" + L.getLineNumber() + ":" + L.getColumnNumber();
- y.push(N);
+ const j = A + "-" + N.getLineNumber() + ":" + N.getColumnNumber();
+ y.push(j);
}
- g.length > 0 && (b = y.join(" -> "));
+ m.length > 0 && (b = y.join(" -> "));
}
- return (!b || b.trim().length === 0) && (b = this.consoleLogger), ln.getLogger(b);
+ return (!b || b.trim().length === 0) && (b = this.consoleLogger), jr.getLogger(b);
}), this.stackSize = 1;
let s;
- t ? s = t : s = Vi.getEnvLevel(n), s = s ?? rr.LOG_LEVEL_INFO, ln.setLevel(s);
- const c = (p, b, _, y) => {
- const g = [], S = a ?? Vi.getEnvLogger(n) ?? "zhi";
- return g.push(jt.gray("[") + y(S) + jt.gray("]")), g.push(jt.gray("[") + jt.gray(_.toString()) + jt.gray("]")), g.push(y(p.toUpperCase().toString())), g.push(y(b)), g.push(jt.gray(":")), g;
+ t ? s = t : s = Hr.getEnvLevel(a), s = s ?? st.LOG_LEVEL_INFO, jr.setLevel(s);
+ const l = (d, b, _, y) => {
+ const m = [], k = r ?? Hr.getEnvLogger(a) ?? "zhi";
+ return m.push(Ge.gray("[") + y(k) + Ge.gray("]")), m.push(Ge.gray("[") + Ge.gray(_.toString()) + Ge.gray("]")), m.push(y(d.toUpperCase().toString())), m.push(y(b)), m.push(Ge.gray(":")), m;
};
- Bi.reg(ln), Bi.apply(ln, {
- format(p, b, _) {
+ qn.reg(jr), qn.apply(jr, {
+ format(d, b, _) {
let y = [];
- const g = b ?? "";
- switch (p) {
- case rr.LOG_LEVEL_TRACE:
- y = c(p, g, _, jt.gray);
+ const m = b ?? "";
+ switch (d) {
+ case st.LOG_LEVEL_TRACE:
+ y = l(d, m, _, Ge.gray);
break;
- case rr.LOG_LEVEL_DEBUG:
- y = c(p, g, _, jt.blue);
+ case st.LOG_LEVEL_DEBUG:
+ y = l(d, m, _, Ge.blue);
break;
- case rr.LOG_LEVEL_INFO:
- y = c(p, g, _, jt.green);
+ case st.LOG_LEVEL_INFO:
+ y = l(d, m, _, Ge.green);
break;
- case rr.LOG_LEVEL_WARN:
- y = c(p, g, _, jt.yellow);
+ case st.LOG_LEVEL_WARN:
+ y = l(d, m, _, Ge.yellow);
break;
- case rr.LOG_LEVEL_ERROR:
- y = c(p, g, _, jt.red);
+ case st.LOG_LEVEL_ERROR:
+ y = l(d, m, _, Ge.red);
break;
default:
- y = c(rr.LOG_LEVEL_INFO, g, _, jt.green);
+ y = l(st.LOG_LEVEL_INFO, m, _, Ge.green);
break;
}
return y.join(" ");
@@ -5887,13 +5891,14 @@ let rm = class {
getCallStack() {
let t;
try {
- t = Kf();
+ t = Nu();
} catch {
t = [];
}
return t;
}
-}, am = class {
+}
+class Vu {
/**
* 默认日志级别
*
@@ -5901,8 +5906,8 @@ let rm = class {
* @param sign - 可选前缀,默认zhi
* @param env - 可选环境变量实例
*/
- constructor(t, a, n) {
- ra(this, "logger"), this.logger = new rm(t, a, n);
+ constructor(t, r, a) {
+ Ut(this, "logger"), this.logger = new zu(t, r, a);
}
/**
* 获取日志记录器
@@ -5911,12 +5916,13 @@ let rm = class {
* @param stackSize - 打印栈的深度
* @protected
*/
- getLogger(t, a) {
- return this.logger.setStackSize(a), this.logger.getLogger(t);
+ getLogger(t, r) {
+ return this.logger.setStackSize(r), this.logger.getLogger(t);
}
-}, Hi = class extends am {
- constructor(t, a, n) {
- super(t, a, n);
+}
+class Kn extends Vu {
+ constructor(t, r, a) {
+ super(t, r, a);
}
/**
* 获取默认的日志记录器
@@ -5924,18 +5930,19 @@ let rm = class {
* @param loggerName - 日志记录器名称
* @param stackSize - 打印栈的深度
*/
- getLogger(t, a) {
- return super.getLogger(t, a);
+ getLogger(t, r) {
+ return super.getLogger(t, r);
}
-}, nm = class Sl {
+}
+class an {
/**
* 默认日志记录器
*
* @param stackSize - 栈的深度
* @param env - 环境变量实例
*/
- static defaultLogger(t, a) {
- return Sl.customLogFactory(void 0, void 0, t).getLogger(void 0, a);
+ static defaultLogger(t, r) {
+ return an.customLogFactory(void 0, void 0, t).getLogger(void 0, r);
}
/**
* 自定义日志工厂
@@ -5944,8 +5951,8 @@ let rm = class {
* @param sign - 标志
* @param env - 环境变量
*/
- static customLogFactory(t, a, n) {
- return new Hi(t, a, n);
+ static customLogFactory(t, r, a) {
+ return new Kn(t, r, a);
}
/**
* 自定义日志工厂,自定义前缀
@@ -5953,12 +5960,12 @@ let rm = class {
* @param sign - 标志
* @param env - 环境变量
*/
- static customSignLogFactory(t, a) {
- return new Hi(void 0, t, a);
+ static customSignLogFactory(t, r) {
+ return new Kn(void 0, t, r);
}
-};
-const om = "zhi";
-let vn = class {
+}
+const Fu = "zhi";
+class Dr {
/**
* 某些情况下,可能需要手动 init 之后才能用
*/
@@ -5986,11 +5993,11 @@ let vn = class {
* @param sign - 标志
* @param loggerName - 日志名称
*/
- static zhiLogWithSign(t, a) {
- if (this.loggerMap[a])
- return this.loggerMap[a].debug("Zhi-log use cache"), this.loggerMap[a];
- const n = this.env, s = nm.customSignLogFactory(t, n).getLogger(a);
- return this.loggerMap[a] = s, s.debug("Zhi-log add new logger"), s;
+ static zhiLogWithSign(t, r) {
+ if (this.loggerMap[r])
+ return this.loggerMap[r].debug("Zhi-log use cache"), this.loggerMap[r];
+ const a = this.env, s = an.customSignLogFactory(t, a).getLogger(r);
+ return this.loggerMap[r] = s, s.debug("Zhi-log add new logger"), s;
}
/**
* 获取 zhi-log 实例
@@ -5998,30 +6005,30 @@ let vn = class {
* @param loggerName - 日志名称
*/
static zhiLog(t) {
- return this.zhiLogWithSign(om, t);
+ return this.zhiLogWithSign(Fu, t);
}
/**
* 获取 zhi-common 实例
*/
static zhiCommon() {
- return this.common || (this.common = new um()), this.common;
+ return this.common || (this.common = new Ku()), this.common;
}
-};
-Ye(vn, "env"), /**
+}
+Te(Dr, "env"), /**
* zhi-util 的日志器缓存
*/
-Ye(vn, "loggerMap", {}), /**
+Te(Dr, "loggerMap", {}), /**
* zhi-util 的通用工具类
*/
-Ye(vn, "common");
-class Ps extends vn {
+Te(Dr, "common");
+class nn extends Dr {
static zhiEnv() {
- return this.env || (this.env = new Ff({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env;
+ return this.env || (this.env = new Su({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env;
}
}
-let Gi = class {
+class Wn {
constructor() {
- Ye(this, "logger"), this.logger = Ps.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!");
+ Te(this, "logger"), this.logger = nn.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!");
}
isAvailable() {
return typeof Lute < "u";
@@ -6033,8 +6040,8 @@ let Gi = class {
* @private
*/
highlightWords(t) {
- const a = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g");
- return t.replace(a, '$1');
+ const r = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g");
+ return t.replace(r, '$1');
}
/**
* 渲染Markdown
@@ -6044,8 +6051,8 @@ let Gi = class {
async renderMarkdownStr(t) {
if (!this.isAvailable())
return this.logger.error("Lute is not available, will return original md"), t;
- const a = Lute, n = a.New(), s = {
- renderText: (c, p) => p ? [this.highlightWords(c.Text()), a.WalkContinue] : ["", a.WalkContinue]
+ const r = Lute, a = r.New(), s = {
+ renderText: (l, d) => d ? [this.highlightWords(l.Text()), r.WalkContinue] : ["", r.WalkContinue]
// renderStrong: (node: any, entering: any) => {
// return ["", luteObj.WalkContinue]
// },
@@ -6053,17 +6060,17 @@ let Gi = class {
// return ["", luteObj.WalkContinue]
// }
};
- return n.SetJSRenderers({
+ return a.SetJSRenderers({
renderers: {
Md2HTML: s
}
- }), this.logger.info("Lute is rendering md to HTML..."), n.MarkdownStr("", t);
+ }), this.logger.info("Lute is rendering md to HTML..."), a.MarkdownStr("", t);
}
-};
-var xl = { exports: {} };
+}
+var Zo = { exports: {} };
(function(e) {
(function() {
- function t(r) {
+ function t(n) {
var i = {
omitExtraWLInCodeBlocks: {
defaultValue: !1,
@@ -6231,20 +6238,20 @@ var xl = { exports: {} };
type: "boolean"
}
};
- if (r === !1)
+ if (n === !1)
return JSON.parse(JSON.stringify(i));
var o = {};
- for (var l in i)
- i.hasOwnProperty(l) && (o[l] = i[l].defaultValue);
+ for (var c in i)
+ i.hasOwnProperty(c) && (o[c] = i[c].defaultValue);
return o;
}
- function a() {
- var r = t(!0), i = {};
- for (var o in r)
- r.hasOwnProperty(o) && (i[o] = !0);
+ function r() {
+ var n = t(!0), i = {};
+ for (var o in n)
+ n.hasOwnProperty(o) && (i[o] = !0);
return i;
}
- var n = {}, s = {}, c = {}, p = t(!0), b = "vanilla", _ = {
+ var a = {}, s = {}, l = {}, d = t(!0), b = "vanilla", _ = {
github: {
omitExtraWLInCodeBlocks: !0,
simplifiedAutoLink: !0,
@@ -6286,209 +6293,209 @@ var xl = { exports: {} };
encodeEmails: !0
},
vanilla: t(!0),
- allOn: a()
+ allOn: r()
};
- n.helper = {}, n.extensions = {}, n.setOption = function(r, i) {
- return p[r] = i, this;
- }, n.getOption = function(r) {
- return p[r];
- }, n.getOptions = function() {
- return p;
- }, n.resetOptions = function() {
- p = t(!0);
- }, n.setFlavor = function(r) {
- if (!_.hasOwnProperty(r))
- throw Error(r + " flavor was not found");
- n.resetOptions();
- var i = _[r];
- b = r;
+ a.helper = {}, a.extensions = {}, a.setOption = function(n, i) {
+ return d[n] = i, this;
+ }, a.getOption = function(n) {
+ return d[n];
+ }, a.getOptions = function() {
+ return d;
+ }, a.resetOptions = function() {
+ d = t(!0);
+ }, a.setFlavor = function(n) {
+ if (!_.hasOwnProperty(n))
+ throw Error(n + " flavor was not found");
+ a.resetOptions();
+ var i = _[n];
+ b = n;
for (var o in i)
- i.hasOwnProperty(o) && (p[o] = i[o]);
- }, n.getFlavor = function() {
+ i.hasOwnProperty(o) && (d[o] = i[o]);
+ }, a.getFlavor = function() {
return b;
- }, n.getFlavorOptions = function(r) {
- if (_.hasOwnProperty(r))
- return _[r];
- }, n.getDefaultOptions = function(r) {
- return t(r);
- }, n.subParser = function(r, i) {
- if (n.helper.isString(r))
+ }, a.getFlavorOptions = function(n) {
+ if (_.hasOwnProperty(n))
+ return _[n];
+ }, a.getDefaultOptions = function(n) {
+ return t(n);
+ }, a.subParser = function(n, i) {
+ if (a.helper.isString(n))
if (typeof i < "u")
- s[r] = i;
+ s[n] = i;
else {
- if (s.hasOwnProperty(r))
- return s[r];
- throw Error("SubParser named " + r + " not registered!");
+ if (s.hasOwnProperty(n))
+ return s[n];
+ throw Error("SubParser named " + n + " not registered!");
}
- }, n.extension = function(r, i) {
- if (!n.helper.isString(r))
+ }, a.extension = function(n, i) {
+ if (!a.helper.isString(n))
throw Error("Extension 'name' must be a string");
- if (r = n.helper.stdExtName(r), n.helper.isUndefined(i)) {
- if (!c.hasOwnProperty(r))
- throw Error("Extension named " + r + " is not registered!");
- return c[r];
+ if (n = a.helper.stdExtName(n), a.helper.isUndefined(i)) {
+ if (!l.hasOwnProperty(n))
+ throw Error("Extension named " + n + " is not registered!");
+ return l[n];
} else {
- typeof i == "function" && (i = i()), n.helper.isArray(i) || (i = [i]);
- var o = y(i, r);
+ typeof i == "function" && (i = i()), a.helper.isArray(i) || (i = [i]);
+ var o = y(i, n);
if (o.valid)
- c[r] = i;
+ l[n] = i;
else
throw Error(o.error);
}
- }, n.getAllExtensions = function() {
- return c;
- }, n.removeExtension = function(r) {
- delete c[r];
- }, n.resetExtensions = function() {
- c = {};
+ }, a.getAllExtensions = function() {
+ return l;
+ }, a.removeExtension = function(n) {
+ delete l[n];
+ }, a.resetExtensions = function() {
+ l = {};
};
- function y(r, i) {
- var o = i ? "Error in " + i + " extension->" : "Error in unnamed extension", l = {
+ function y(n, i) {
+ var o = i ? "Error in " + i + " extension->" : "Error in unnamed extension", c = {
valid: !0,
error: ""
};
- n.helper.isArray(r) || (r = [r]);
- for (var u = 0; u < r.length; ++u) {
- var m = o + " sub-extension " + u + ": ", f = r[u];
- if (typeof f != "object")
- return l.valid = !1, l.error = m + "must be an object, but " + typeof f + " given", l;
- if (!n.helper.isString(f.type))
- return l.valid = !1, l.error = m + 'property "type" must be a string, but ' + typeof f.type + " given", l;
- var x = f.type = f.type.toLowerCase();
- if (x === "language" && (x = f.type = "lang"), x === "html" && (x = f.type = "output"), x !== "lang" && x !== "output" && x !== "listener")
- return l.valid = !1, l.error = m + "type " + x + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', l;
- if (x === "listener") {
- if (n.helper.isUndefined(f.listeners))
- return l.valid = !1, l.error = m + '. Extensions of type "listener" must have a property called "listeners"', l;
- } else if (n.helper.isUndefined(f.filter) && n.helper.isUndefined(f.regex))
- return l.valid = !1, l.error = m + x + ' extensions must define either a "regex" property or a "filter" method', l;
- if (f.listeners) {
- if (typeof f.listeners != "object")
- return l.valid = !1, l.error = m + '"listeners" property must be an object but ' + typeof f.listeners + " given", l;
- for (var B in f.listeners)
- if (f.listeners.hasOwnProperty(B) && typeof f.listeners[B] != "function")
- return l.valid = !1, l.error = m + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + B + " must be a function but " + typeof f.listeners[B] + " given", l;
+ a.helper.isArray(n) || (n = [n]);
+ for (var u = 0; u < n.length; ++u) {
+ var f = o + " sub-extension " + u + ": ", g = n[u];
+ if (typeof g != "object")
+ return c.valid = !1, c.error = f + "must be an object, but " + typeof g + " given", c;
+ if (!a.helper.isString(g.type))
+ return c.valid = !1, c.error = f + 'property "type" must be a string, but ' + typeof g.type + " given", c;
+ var O = g.type = g.type.toLowerCase();
+ if (O === "language" && (O = g.type = "lang"), O === "html" && (O = g.type = "output"), O !== "lang" && O !== "output" && O !== "listener")
+ return c.valid = !1, c.error = f + "type " + O + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', c;
+ if (O === "listener") {
+ if (a.helper.isUndefined(g.listeners))
+ return c.valid = !1, c.error = f + '. Extensions of type "listener" must have a property called "listeners"', c;
+ } else if (a.helper.isUndefined(g.filter) && a.helper.isUndefined(g.regex))
+ return c.valid = !1, c.error = f + O + ' extensions must define either a "regex" property or a "filter" method', c;
+ if (g.listeners) {
+ if (typeof g.listeners != "object")
+ return c.valid = !1, c.error = f + '"listeners" property must be an object but ' + typeof g.listeners + " given", c;
+ for (var z in g.listeners)
+ if (g.listeners.hasOwnProperty(z) && typeof g.listeners[z] != "function")
+ return c.valid = !1, c.error = f + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + z + " must be a function but " + typeof g.listeners[z] + " given", c;
}
- if (f.filter) {
- if (typeof f.filter != "function")
- return l.valid = !1, l.error = m + '"filter" must be a function, but ' + typeof f.filter + " given", l;
- } else if (f.regex) {
- if (n.helper.isString(f.regex) && (f.regex = new RegExp(f.regex, "g")), !(f.regex instanceof RegExp))
- return l.valid = !1, l.error = m + '"regex" property must either be a string or a RegExp object, but ' + typeof f.regex + " given", l;
- if (n.helper.isUndefined(f.replace))
- return l.valid = !1, l.error = m + '"regex" extensions must implement a replace string or function', l;
+ if (g.filter) {
+ if (typeof g.filter != "function")
+ return c.valid = !1, c.error = f + '"filter" must be a function, but ' + typeof g.filter + " given", c;
+ } else if (g.regex) {
+ if (a.helper.isString(g.regex) && (g.regex = new RegExp(g.regex, "g")), !(g.regex instanceof RegExp))
+ return c.valid = !1, c.error = f + '"regex" property must either be a string or a RegExp object, but ' + typeof g.regex + " given", c;
+ if (a.helper.isUndefined(g.replace))
+ return c.valid = !1, c.error = f + '"regex" extensions must implement a replace string or function', c;
}
}
- return l;
+ return c;
}
- n.validateExtension = function(r) {
- var i = y(r, null);
+ a.validateExtension = function(n) {
+ var i = y(n, null);
return i.valid ? !0 : (console.warn(i.error), !1);
- }, n.hasOwnProperty("helper") || (n.helper = {}), n.helper.isString = function(r) {
- return typeof r == "string" || r instanceof String;
- }, n.helper.isFunction = function(r) {
+ }, a.hasOwnProperty("helper") || (a.helper = {}), a.helper.isString = function(n) {
+ return typeof n == "string" || n instanceof String;
+ }, a.helper.isFunction = function(n) {
var i = {};
- return r && i.toString.call(r) === "[object Function]";
- }, n.helper.isArray = function(r) {
- return Array.isArray(r);
- }, n.helper.isUndefined = function(r) {
- return typeof r > "u";
- }, n.helper.forEach = function(r, i) {
- if (n.helper.isUndefined(r))
+ return n && i.toString.call(n) === "[object Function]";
+ }, a.helper.isArray = function(n) {
+ return Array.isArray(n);
+ }, a.helper.isUndefined = function(n) {
+ return typeof n > "u";
+ }, a.helper.forEach = function(n, i) {
+ if (a.helper.isUndefined(n))
throw new Error("obj param is required");
- if (n.helper.isUndefined(i))
+ if (a.helper.isUndefined(i))
throw new Error("callback param is required");
- if (!n.helper.isFunction(i))
+ if (!a.helper.isFunction(i))
throw new Error("callback param must be a function/closure");
- if (typeof r.forEach == "function")
- r.forEach(i);
- else if (n.helper.isArray(r))
- for (var o = 0; o < r.length; o++)
- i(r[o], o, r);
- else if (typeof r == "object")
- for (var l in r)
- r.hasOwnProperty(l) && i(r[l], l, r);
+ if (typeof n.forEach == "function")
+ n.forEach(i);
+ else if (a.helper.isArray(n))
+ for (var o = 0; o < n.length; o++)
+ i(n[o], o, n);
+ else if (typeof n == "object")
+ for (var c in n)
+ n.hasOwnProperty(c) && i(n[c], c, n);
else
throw new Error("obj does not seem to be an array or an iterable object");
- }, n.helper.stdExtName = function(r) {
- return r.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase();
+ }, a.helper.stdExtName = function(n) {
+ return n.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase();
};
- function g(r, i) {
+ function m(n, i) {
var o = i.charCodeAt(0);
return "¨E" + o + "E";
}
- n.helper.escapeCharactersCallback = g, n.helper.escapeCharacters = function(r, i, o) {
- var l = "([" + i.replace(/([\[\]\\])/g, "\\$1") + "])";
- o && (l = "\\\\" + l);
- var u = new RegExp(l, "g");
- return r = r.replace(u, g), r;
- }, n.helper.unescapeHTMLEntities = function(r) {
- return r.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
+ a.helper.escapeCharactersCallback = m, a.helper.escapeCharacters = function(n, i, o) {
+ var c = "([" + i.replace(/([\[\]\\])/g, "\\$1") + "])";
+ o && (c = "\\\\" + c);
+ var u = new RegExp(c, "g");
+ return n = n.replace(u, m), n;
+ }, a.helper.unescapeHTMLEntities = function(n) {
+ return n.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
};
- var S = function(r, i, o, l) {
- var u = l || "", m = u.indexOf("g") > -1, f = new RegExp(i + "|" + o, "g" + u.replace(/g/g, "")), x = new RegExp(i, u.replace(/g/g, "")), B = [], U, z, H, w, q;
+ var k = function(n, i, o, c) {
+ var u = c || "", f = u.indexOf("g") > -1, g = new RegExp(i + "|" + o, "g" + u.replace(/g/g, "")), O = new RegExp(i, u.replace(/g/g, "")), z = [], q, B, G, w, U;
do
- for (U = 0; H = f.exec(r); )
- if (x.test(H[0]))
- U++ || (z = f.lastIndex, w = z - H[0].length);
- else if (U && !--U) {
- q = H.index + H[0].length;
+ for (q = 0; G = g.exec(n); )
+ if (O.test(G[0]))
+ q++ || (B = g.lastIndex, w = B - G[0].length);
+ else if (q && !--q) {
+ U = G.index + G[0].length;
var W = {
- left: { start: w, end: z },
- match: { start: z, end: H.index },
- right: { start: H.index, end: q },
- wholeMatch: { start: w, end: q }
+ left: { start: w, end: B },
+ match: { start: B, end: G.index },
+ right: { start: G.index, end: U },
+ wholeMatch: { start: w, end: U }
};
- if (B.push(W), !m)
- return B;
+ if (z.push(W), !f)
+ return z;
}
- while (U && (f.lastIndex = z));
- return B;
+ while (q && (g.lastIndex = B));
+ return z;
};
- n.helper.matchRecursiveRegExp = function(r, i, o, l) {
- for (var u = S(r, i, o, l), m = [], f = 0; f < u.length; ++f)
- m.push([
- r.slice(u[f].wholeMatch.start, u[f].wholeMatch.end),
- r.slice(u[f].match.start, u[f].match.end),
- r.slice(u[f].left.start, u[f].left.end),
- r.slice(u[f].right.start, u[f].right.end)
+ a.helper.matchRecursiveRegExp = function(n, i, o, c) {
+ for (var u = k(n, i, o, c), f = [], g = 0; g < u.length; ++g)
+ f.push([
+ n.slice(u[g].wholeMatch.start, u[g].wholeMatch.end),
+ n.slice(u[g].match.start, u[g].match.end),
+ n.slice(u[g].left.start, u[g].left.end),
+ n.slice(u[g].right.start, u[g].right.end)
]);
- return m;
- }, n.helper.replaceRecursiveRegExp = function(r, i, o, l, u) {
- if (!n.helper.isFunction(i)) {
- var m = i;
+ return f;
+ }, a.helper.replaceRecursiveRegExp = function(n, i, o, c, u) {
+ if (!a.helper.isFunction(i)) {
+ var f = i;
i = function() {
- return m;
+ return f;
};
}
- var f = S(r, o, l, u), x = r, B = f.length;
- if (B > 0) {
- var U = [];
- f[0].wholeMatch.start !== 0 && U.push(r.slice(0, f[0].wholeMatch.start));
- for (var z = 0; z < B; ++z)
- U.push(
+ var g = k(n, o, c, u), O = n, z = g.length;
+ if (z > 0) {
+ var q = [];
+ g[0].wholeMatch.start !== 0 && q.push(n.slice(0, g[0].wholeMatch.start));
+ for (var B = 0; B < z; ++B)
+ q.push(
i(
- r.slice(f[z].wholeMatch.start, f[z].wholeMatch.end),
- r.slice(f[z].match.start, f[z].match.end),
- r.slice(f[z].left.start, f[z].left.end),
- r.slice(f[z].right.start, f[z].right.end)
+ n.slice(g[B].wholeMatch.start, g[B].wholeMatch.end),
+ n.slice(g[B].match.start, g[B].match.end),
+ n.slice(g[B].left.start, g[B].left.end),
+ n.slice(g[B].right.start, g[B].right.end)
)
- ), z < B - 1 && U.push(r.slice(f[z].wholeMatch.end, f[z + 1].wholeMatch.start));
- f[B - 1].wholeMatch.end < r.length && U.push(r.slice(f[B - 1].wholeMatch.end)), x = U.join("");
+ ), B < z - 1 && q.push(n.slice(g[B].wholeMatch.end, g[B + 1].wholeMatch.start));
+ g[z - 1].wholeMatch.end < n.length && q.push(n.slice(g[z - 1].wholeMatch.end)), O = q.join("");
}
- return x;
- }, n.helper.regexIndexOf = function(r, i, o) {
- if (!n.helper.isString(r))
+ return O;
+ }, a.helper.regexIndexOf = function(n, i, o) {
+ if (!a.helper.isString(n))
throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
if (!(i instanceof RegExp))
throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";
- var l = r.substring(o || 0).search(i);
- return l >= 0 ? l + (o || 0) : l;
- }, n.helper.splitAtIndex = function(r, i) {
- if (!n.helper.isString(r))
+ var c = n.substring(o || 0).search(i);
+ return c >= 0 ? c + (o || 0) : c;
+ }, a.helper.splitAtIndex = function(n, i) {
+ if (!a.helper.isString(n))
throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
- return [r.substring(0, i), r.substring(i)];
- }, n.helper.encodeEmailAddress = function(r) {
+ return [n.substring(0, i), n.substring(i)];
+ }, a.helper.encodeEmailAddress = function(n) {
var i = [
function(o) {
return "" + o.charCodeAt(0) + ";";
@@ -6500,30 +6507,30 @@ var xl = { exports: {} };
return o;
}
];
- return r = r.replace(/./g, function(o) {
+ return n = n.replace(/./g, function(o) {
if (o === "@")
o = i[Math.floor(Math.random() * 2)](o);
else {
- var l = Math.random();
- o = l > 0.9 ? i[2](o) : l > 0.45 ? i[1](o) : i[0](o);
+ var c = Math.random();
+ o = c > 0.9 ? i[2](o) : c > 0.45 ? i[1](o) : i[0](o);
}
return o;
- }), r;
- }, n.helper.padEnd = function(r, i, o) {
- return i = i >> 0, o = String(o || " "), r.length > i ? String(r) : (i = i - r.length, i > o.length && (o += o.repeat(i / o.length)), String(r) + o.slice(0, i));
+ }), n;
+ }, a.helper.padEnd = function(n, i, o) {
+ return i = i >> 0, o = String(o || " "), n.length > i ? String(n) : (i = i - n.length, i > o.length && (o += o.repeat(i / o.length)), String(n) + o.slice(0, i));
}, typeof console > "u" && (console = {
- warn: function(r) {
- alert(r);
+ warn: function(n) {
+ alert(n);
},
- log: function(r) {
- alert(r);
+ log: function(n) {
+ alert(n);
},
- error: function(r) {
- throw r;
+ error: function(n) {
+ throw n;
}
- }), n.helper.regexes = {
+ }), a.helper.regexes = {
asteriskDashAndColon: /([*_:~])/g
- }, n.helper.emojis = {
+ }, a.helper.emojis = {
"+1": "👍",
"-1": "👎",
100: "💯",
@@ -7700,35 +7707,35 @@ var xl = { exports: {} };
/* special emojis :P */
octocat: '',
showdown: `S`
- }, n.Converter = function(r) {
- var i = {}, o = [], l = [], u = {}, m = b, f = {
+ }, a.Converter = function(n) {
+ var i = {}, o = [], c = [], u = {}, f = b, g = {
parsed: {},
raw: "",
format: ""
};
- x();
- function x() {
- r = r || {};
- for (var w in p)
- p.hasOwnProperty(w) && (i[w] = p[w]);
- if (typeof r == "object")
- for (var q in r)
- r.hasOwnProperty(q) && (i[q] = r[q]);
+ O();
+ function O() {
+ n = n || {};
+ for (var w in d)
+ d.hasOwnProperty(w) && (i[w] = d[w]);
+ if (typeof n == "object")
+ for (var U in n)
+ n.hasOwnProperty(U) && (i[U] = n[U]);
else
- throw Error("Converter expects the passed parameter to be an object, but " + typeof r + " was passed instead.");
- i.extensions && n.helper.forEach(i.extensions, B);
+ throw Error("Converter expects the passed parameter to be an object, but " + typeof n + " was passed instead.");
+ i.extensions && a.helper.forEach(i.extensions, z);
}
- function B(w, q) {
- if (q = q || null, n.helper.isString(w))
- if (w = n.helper.stdExtName(w), q = w, n.extensions[w]) {
- console.warn("DEPRECATION WARNING: " + w + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), U(n.extensions[w], w);
+ function z(w, U) {
+ if (U = U || null, a.helper.isString(w))
+ if (w = a.helper.stdExtName(w), U = w, a.extensions[w]) {
+ console.warn("DEPRECATION WARNING: " + w + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), q(a.extensions[w], w);
return;
- } else if (!n.helper.isUndefined(c[w]))
- w = c[w];
+ } else if (!a.helper.isUndefined(l[w]))
+ w = l[w];
else
throw Error('Extension "' + w + '" could not be loaded. It was either not found or is not a valid extension.');
- typeof w == "function" && (w = w()), n.helper.isArray(w) || (w = [w]);
- var W = y(w, q);
+ typeof w == "function" && (w = w()), a.helper.isArray(w) || (w = [w]);
+ var W = y(w, U);
if (!W.valid)
throw Error(W.error);
for (var J = 0; J < w.length; ++J) {
@@ -7737,17 +7744,17 @@ var xl = { exports: {} };
o.push(w[J]);
break;
case "output":
- l.push(w[J]);
+ c.push(w[J]);
break;
}
if (w[J].hasOwnProperty("listeners"))
for (var V in w[J].listeners)
- w[J].listeners.hasOwnProperty(V) && z(V, w[J].listeners[V]);
+ w[J].listeners.hasOwnProperty(V) && B(V, w[J].listeners[V]);
}
}
- function U(w, q) {
- typeof w == "function" && (w = w(new n.Converter())), n.helper.isArray(w) || (w = [w]);
- var W = y(w, q);
+ function q(w, U) {
+ typeof w == "function" && (w = w(new a.Converter())), a.helper.isArray(w) || (w = [w]);
+ var W = y(w, U);
if (!W.valid)
throw Error(W.error);
for (var J = 0; J < w.length; ++J)
@@ -7756,36 +7763,36 @@ var xl = { exports: {} };
o.push(w[J]);
break;
case "output":
- l.push(w[J]);
+ c.push(w[J]);
break;
default:
throw Error("Extension loader error: Type unrecognized!!!");
}
}
- function z(w, q) {
- if (!n.helper.isString(w))
+ function B(w, U) {
+ if (!a.helper.isString(w))
throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof w + " given");
- if (typeof q != "function")
- throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof q + " given");
- u.hasOwnProperty(w) || (u[w] = []), u[w].push(q);
+ if (typeof U != "function")
+ throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof U + " given");
+ u.hasOwnProperty(w) || (u[w] = []), u[w].push(U);
}
- function H(w) {
- var q = w.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + q + "}", "gm");
+ function G(w) {
+ var U = w.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + U + "}", "gm");
return w.replace(W, "");
}
- this._dispatch = function(w, q, W, J) {
+ this._dispatch = function(w, U, W, J) {
if (u.hasOwnProperty(w))
for (var V = 0; V < u[w].length; ++V) {
- var E = u[w][V](w, q, this, W, J);
- E && typeof E < "u" && (q = E);
+ var P = u[w][V](w, U, this, W, J);
+ P && typeof P < "u" && (U = P);
}
- return q;
- }, this.listen = function(w, q) {
- return z(w, q), this;
+ return U;
+ }, this.listen = function(w, U) {
+ return B(w, U), this;
}, this.makeHtml = function(w) {
if (!w)
return w;
- var q = {
+ var U = {
gHtmlBlocks: [],
gHtmlMdBlocks: [],
gHtmlSpans: [],
@@ -7795,7 +7802,7 @@ var xl = { exports: {} };
gListLevel: 0,
hashLinkCounts: {},
langExtensions: o,
- outputModifiers: l,
+ outputModifiers: c,
converter: this,
ghCodeBlocks: [],
metadata: {
@@ -7806,280 +7813,280 @@ var xl = { exports: {} };
};
return w = w.replace(/¨/g, "¨T"), w = w.replace(/\$/g, "¨D"), w = w.replace(/\r\n/g, `
`), w = w.replace(/\r/g, `
-`), w = w.replace(/\u00A0/g, " "), i.smartIndentationFix && (w = H(w)), w = `
+`), w = w.replace(/\u00A0/g, " "), i.smartIndentationFix && (w = G(w)), w = `
` + w + `
-`, w = n.subParser("detab")(w, i, q), w = w.replace(/^[ \t]+$/mg, ""), n.helper.forEach(o, function(W) {
- w = n.subParser("runExtension")(W, w, i, q);
- }), w = n.subParser("metadata")(w, i, q), w = n.subParser("hashPreCodeTags")(w, i, q), w = n.subParser("githubCodeBlocks")(w, i, q), w = n.subParser("hashHTMLBlocks")(w, i, q), w = n.subParser("hashCodeTags")(w, i, q), w = n.subParser("stripLinkDefinitions")(w, i, q), w = n.subParser("blockGamut")(w, i, q), w = n.subParser("unhashHTMLSpans")(w, i, q), w = n.subParser("unescapeSpecialChars")(w, i, q), w = w.replace(/¨D/g, "$$"), w = w.replace(/¨T/g, "¨"), w = n.subParser("completeHTMLDocument")(w, i, q), n.helper.forEach(l, function(W) {
- w = n.subParser("runExtension")(W, w, i, q);
- }), f = q.metadata, w;
- }, this.makeMarkdown = this.makeMd = function(w, q) {
+`, w = a.subParser("detab")(w, i, U), w = w.replace(/^[ \t]+$/mg, ""), a.helper.forEach(o, function(W) {
+ w = a.subParser("runExtension")(W, w, i, U);
+ }), w = a.subParser("metadata")(w, i, U), w = a.subParser("hashPreCodeTags")(w, i, U), w = a.subParser("githubCodeBlocks")(w, i, U), w = a.subParser("hashHTMLBlocks")(w, i, U), w = a.subParser("hashCodeTags")(w, i, U), w = a.subParser("stripLinkDefinitions")(w, i, U), w = a.subParser("blockGamut")(w, i, U), w = a.subParser("unhashHTMLSpans")(w, i, U), w = a.subParser("unescapeSpecialChars")(w, i, U), w = w.replace(/¨D/g, "$$"), w = w.replace(/¨T/g, "¨"), w = a.subParser("completeHTMLDocument")(w, i, U), a.helper.forEach(c, function(W) {
+ w = a.subParser("runExtension")(W, w, i, U);
+ }), g = U.metadata, w;
+ }, this.makeMarkdown = this.makeMd = function(w, U) {
if (w = w.replace(/\r\n/g, `
`), w = w.replace(/\r/g, `
-`), w = w.replace(/>[ \t]+, ">¨NBSP;<"), !q)
+`), w = w.replace(/>[ \t]+, ">¨NBSP;<"), !U)
if (window && window.document)
- q = window.document;
+ U = window.document;
else
throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");
- var W = q.createElement("div");
+ var W = U.createElement("div");
W.innerHTML = w;
var J = {
- preList: d(W)
+ preList: h(W)
};
- O(W);
- for (var V = W.childNodes, E = "", F = 0; F < V.length; F++)
- E += n.subParser("makeMarkdown.node")(V[F], J);
- function O(k) {
- for (var R = 0; R < k.childNodes.length; ++R) {
- var G = k.childNodes[R];
- G.nodeType === 3 ? !/\S/.test(G.nodeValue) && !/^[ ]+$/.test(G.nodeValue) ? (k.removeChild(G), --R) : (G.nodeValue = G.nodeValue.split(`
-`).join(" "), G.nodeValue = G.nodeValue.replace(/(\s)+/g, "$1")) : G.nodeType === 1 && O(G);
+ L(W);
+ for (var V = W.childNodes, P = "", F = 0; F < V.length; F++)
+ P += a.subParser("makeMarkdown.node")(V[F], J);
+ function L($) {
+ for (var I = 0; I < $.childNodes.length; ++I) {
+ var H = $.childNodes[I];
+ H.nodeType === 3 ? !/\S/.test(H.nodeValue) && !/^[ ]+$/.test(H.nodeValue) ? ($.removeChild(H), --I) : (H.nodeValue = H.nodeValue.split(`
+`).join(" "), H.nodeValue = H.nodeValue.replace(/(\s)+/g, "$1")) : H.nodeType === 1 && L(H);
}
}
- function d(k) {
- for (var R = k.querySelectorAll("pre"), G = [], K = 0; K < R.length; ++K)
- if (R[K].childElementCount === 1 && R[K].firstChild.tagName.toLowerCase() === "code") {
- var X = R[K].firstChild.innerHTML.trim(), ee = R[K].firstChild.getAttribute("data-language") || "";
- if (ee === "")
- for (var ie = R[K].firstChild.className.split(" "), xe = 0; xe < ie.length; ++xe) {
- var qe = ie[xe].match(/^language-(.+)$/);
- if (qe !== null) {
- ee = qe[1];
+ function h($) {
+ for (var I = $.querySelectorAll("pre"), H = [], K = 0; K < I.length; ++K)
+ if (I[K].childElementCount === 1 && I[K].firstChild.tagName.toLowerCase() === "code") {
+ var te = I[K].firstChild.innerHTML.trim(), ne = I[K].firstChild.getAttribute("data-language") || "";
+ if (ne === "")
+ for (var be = I[K].firstChild.className.split(" "), Ae = 0; Ae < be.length; ++Ae) {
+ var ut = be[Ae].match(/^language-(.+)$/);
+ if (ut !== null) {
+ ne = ut[1];
break;
}
}
- X = n.helper.unescapeHTMLEntities(X), G.push(X), R[K].outerHTML = '
[^\r]+?<\/pre>)/gm, function(m, f) { - var x = f; - return x = x.replace(/^ /mg, "¨0"), x = x.replace(/¨0/g, ""), x; - }), n.subParser("hashBlock")(`+ var c = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; + return i.splitAdjacentBlockquotes && (c = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), n = n.replace(c, function(u) { + return u = u.replace(/^[ \t]*>[ \t]?/gm, ""), u = u.replace(/¨0/g, ""), u = u.replace(/^[ \t]+$/gm, ""), u = a.subParser("githubCodeBlocks")(u, i, o), u = a.subParser("blockGamut")(u, i, o), u = u.replace(/(^|\n)/g, "$1 "), u = u.replace(/(\s*[^\r]+?<\/pre>)/gm, function(f, g) { + var O = g; + return O = O.replace(/^ /mg, "¨0"), O = O.replace(/¨0/g, ""), O; + }), a.subParser("hashBlock")(`` + u + ``, i, o); - }), r = o.converter._dispatch("blockQuotes.after", r, i, o), r; - }), n.subParser("codeBlocks", function(r, i, o) { - r = o.converter._dispatch("codeBlocks.before", r, i, o), r += "¨0"; - var l = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; - return r = r.replace(l, function(u, m, f) { - var x = m, B = f, U = ` + }), n = o.converter._dispatch("blockQuotes.after", n, i, o), n; + }), a.subParser("codeBlocks", function(n, i, o) { + n = o.converter._dispatch("codeBlocks.before", n, i, o), n += "¨0"; + var c = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; + return n = n.replace(c, function(u, f, g) { + var O = f, z = g, q = ` `; - return x = n.subParser("outdent")(x, i, o), x = n.subParser("encodeCode")(x, i, o), x = n.subParser("detab")(x, i, o), x = x.replace(/^\n+/g, ""), x = x.replace(/\n+$/g, ""), i.omitExtraWLInCodeBlocks && (U = ""), x = "", n.subParser("hashBlock")(x, i, o) + B; - }), r = r.replace(/¨0/, ""), r = o.converter._dispatch("codeBlocks.after", r, i, o), r; - }), n.subParser("codeSpans", function(r, i, o) { - return r = o.converter._dispatch("codeSpans.before", r, i, o), typeof r > "u" && (r = ""), r = r.replace( + return O = a.subParser("outdent")(O, i, o), O = a.subParser("encodeCode")(O, i, o), O = a.subParser("detab")(O, i, o), O = O.replace(/^\n+/g, ""), O = O.replace(/\n+$/g, ""), i.omitExtraWLInCodeBlocks && (q = ""), O = "" + x + U + "
", a.subParser("hashBlock")(O, i, o) + z; + }), n = n.replace(/¨0/, ""), n = o.converter._dispatch("codeBlocks.after", n, i, o), n; + }), a.subParser("codeSpans", function(n, i, o) { + return n = o.converter._dispatch("codeSpans.before", n, i, o), typeof n > "u" && (n = ""), n = n.replace( /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, - function(l, u, m, f) { - var x = f; - return x = x.replace(/^([ \t]*)/g, ""), x = x.replace(/[ \t]*$/g, ""), x = n.subParser("encodeCode")(x, i, o), x = u + "" + O + q + "
" + x + "
", x = n.subParser("hashHTMLSpans")(x, i, o), x; + function(c, u, f, g) { + var O = g; + return O = O.replace(/^([ \t]*)/g, ""), O = O.replace(/[ \t]*$/g, ""), O = a.subParser("encodeCode")(O, i, o), O = u + "" + O + "
", O = a.subParser("hashHTMLSpans")(O, i, o), O; } - ), r = o.converter._dispatch("codeSpans.after", r, i, o), r; - }), n.subParser("completeHTMLDocument", function(r, i, o) { + ), n = o.converter._dispatch("codeSpans.after", n, i, o), n; + }), a.subParser("completeHTMLDocument", function(n, i, o) { if (!i.completeHTMLDocument) - return r; - r = o.converter._dispatch("completeHTMLDocument.before", r, i, o); - var l = "html", u = ` -`, m = "", f = ` -`, x = "", B = ""; + return n; + n = o.converter._dispatch("completeHTMLDocument.before", n, i, o); + var c = "html", u = ` +`, f = "", g = ` +`, O = "", z = ""; typeof o.metadata.parsed.doctype < "u" && (u = " -`, l = o.metadata.parsed.doctype.toString().toLowerCase(), (l === "html" || l === "html5") && (f = '')); - for (var U in o.metadata.parsed) - if (o.metadata.parsed.hasOwnProperty(U)) - switch (U.toLowerCase()) { +`, c = o.metadata.parsed.doctype.toString().toLowerCase(), (c === "html" || c === "html5") && (g = '')); + for (var q in o.metadata.parsed) + if (o.metadata.parsed.hasOwnProperty(q)) + switch (q.toLowerCase()) { case "doctype": break; case "title": - m = "" + o.metadata.parsed.title + ` + f = "" + o.metadata.parsed.title + ` `; break; case "charset": - l === "html" || l === "html5" ? f = ' -` : f = ' + c === "html" || c === "html5" ? g = ' +` : g = ' `; break; case "language": case "lang": - x = ' lang="' + o.metadata.parsed[U] + '"', B += ' + O = ' lang="' + o.metadata.parsed[q] + '"', z += ' `; break; default: - B += ' + z += ' `; } - return r = u + " + return n = u + " -` + m + f + B + ` +` + f + g + z + ` -` + r.trim() + ` +` + n.trim() + ` -`, r = o.converter._dispatch("completeHTMLDocument.after", r, i, o), r; - }), n.subParser("detab", function(r, i, o) { - return r = o.converter._dispatch("detab.before", r, i, o), r = r.replace(/\t(?=\t)/g, " "), r = r.replace(/\t/g, "¨A¨B"), r = r.replace(/¨B(.+?)¨A/g, function(l, u) { - for (var m = u, f = 4 - m.length % 4, x = 0; x < f; x++) - m += " "; - return m; - }), r = r.replace(/¨A/g, " "), r = r.replace(/¨B/g, ""), r = o.converter._dispatch("detab.after", r, i, o), r; - }), n.subParser("ellipsis", function(r, i, o) { - return i.ellipsis && (r = o.converter._dispatch("ellipsis.before", r, i, o), r = r.replace(/\.\.\./g, "…"), r = o.converter._dispatch("ellipsis.after", r, i, o)), r; - }), n.subParser("emoji", function(r, i, o) { +