tms-vue3-ui
Version:
Vue3基础UI库,提供JSONSchema编辑器,支持基于JSONSchema生成表单。
1,609 lines • 343 kB
JavaScript
var Wi = Object.defineProperty;
var Ji = (e, t, n) => t in e ? Wi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var Z = (e, t, n) => Ji(e, typeof t != "symbol" ? t + "" : t, n);
import { defineComponent as se, h as te, resolveComponent as J, createElementBlock as X, openBlock as j, createVNode as w, withCtx as N, ref as Ee, createElementVNode as $, Fragment as Se, renderList as Ie, createBlock as W, createTextVNode as Pe, unref as mi, createCommentVNode as F, reactive as Ki, computed as le, toRaw as ne, watch as kt, onMounted as zi, normalizeClass as Qi, toDisplayString as Zi, resolveDynamicComponent as De, renderSlot as Yi } from "vue";
const he = {
formItem: se({
props: ["label"],
render() {
var e, t;
return te("div", {}, [
te("div", { class: ["tvu-jse__label"] }, this.label),
(t = (e = this.$slots).default) == null ? void 0 : t.call(e)
]);
}
}),
input: se({
props: ["modelValue"],
emits: ["update:modelValue"],
render() {
return te("input", {
value: this.modelValue,
class: ["tvu-input"],
onInput: (e) => {
this.$emit("update:modelValue", e.target.value);
}
});
}
}),
textarea: se({
props: ["modelValue"],
emits: ["update:modelValue"],
render() {
return te("textarea", {
value: this.modelValue,
class: ["tvu-input"],
onInput: (e) => {
this.$emit("update:modelValue", e.target.value);
}
});
}
}),
json: se({
props: ["modelValue"],
emits: ["update:modelValue"],
render() {
return te("textarea", {
value: JSON.stringify(this.modelValue, null, 2),
class: ["tvu-input"],
onInput: (e) => {
try {
let t = JSON.parse(e.target.value);
this.$emit("update:modelValue", t);
} catch {
}
}
});
}
}),
upload: se({
props: ["fileList", "uploadFile", "removeFile"],
render() {
var t, n, r;
let e = (t = this.fileList) == null ? void 0 : t.map((l) => te("div", { class: "tvu-jse__attachment" }, [
te("div", l.name),
te(
"button",
{
onClick: () => {
this.removeFile(l);
}
},
"删除文件"
)
]));
return e ?? (e = []), te("div", { class: ["tvu-jse__upload"] }, [
...e,
te(
"div",
{
onClick: () => {
const l = document.createElement("input");
l.setAttribute("type", "file"), document.body.appendChild(l), l.addEventListener("change", async (o) => {
const h = o.target;
if (h.files) {
const c = h.files[0];
this.uploadFile(c);
}
}), l.click();
}
},
(r = (n = this.$slots).default) == null ? void 0 : r.call(n)
)
]);
}
}),
checkbox: se({
props: ["label", "value", "modelValue"],
render() {
let e = {
type: "checkbox",
value: this.value,
onChange: () => {
Array.isArray(this.modelValue) ? this.modelValue.includes(this.value) ? this.modelValue.splice(this.modelValue.indexOf(this.value), 1) : this.modelValue.push(this.value) : typeof this.modelValue == "boolean" ? this.$emit("update:modelValue", !this.modelValue) : this.$emit("update:modelValue", !0);
}
};
return Array.isArray(this.modelValue) ? this.modelValue.includes(this.value) && (e.checked = !0) : this.modelValue === !0 && (e.checked = !0), te("div", { class: ["tvu-jse__checkbox"] }, [
te("div", te("input", e)),
te("div", {}, this.label)
]);
}
}),
select: se({
props: ["modelValue"],
emits: ["update:modelValue"],
render() {
var e, t;
return te(
"select",
{
value: this.modelValue,
class: ["tvu-input"],
onChange: (n) => {
this.$emit("update:modelValue", n.target.value);
}
},
(t = (e = this.$slots).default) == null ? void 0 : t.call(e)
);
}
}),
option: se({
render() {
return te("option", {});
}
}),
button: se({
render() {
var e, t;
return te(
"button",
{ class: ["tvu-button"], ...this.$attrs },
(t = (e = this.$slots).default) == null ? void 0 : t.call(e)
);
}
})
}, Xi = {
"tvu-form-item": {
...he.formItem
},
"tvu-input": {
...he.input
},
"tvu-textarea": {
...he.textarea
},
"tvu-json": {
...he.json
},
"tvu-input-number": {
...he.input
},
"tvu-upload": {
...he.upload
},
"tvu-checkbox": {
...he.checkbox
},
"tvu-select": {
...he.select
},
"tvu-option": {
...he.option
},
"tvu-button": {
...he.button
}
}, $i = { class: "tvu-jse__field__file-attrs" }, es = /* @__PURE__ */ se({
__name: "File",
props: {
formatAttrs: { type: Object, required: !0 }
},
setup(e) {
return (t, n) => {
const r = J("tvu-input"), l = J("tvu-form-item");
return j(), X("div", $i, [
w(l, {
class: "tvu-jse__field",
label: "文件类型"
}, {
default: N(() => [
w(r, {
modelValue: e.formatAttrs.accept,
"onUpdate:modelValue": n[0] || (n[0] = (o) => e.formatAttrs.accept = o),
placeholder: "标准格式,如'png,jpeg'"
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
w(l, {
class: "tvu-jse__field",
label: "文件最大"
}, {
default: N(() => [
w(r, {
modelValue: e.formatAttrs.size,
"onUpdate:modelValue": n[1] || (n[1] = (o) => e.formatAttrs.size = o),
modelModifiers: { number: !0 },
placeholder: "请输入数字,默认以MB为单位"
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
w(l, {
class: "tvu-jse__field",
label: "文件个数"
}, {
default: N(() => [
w(r, {
modelValue: e.formatAttrs.limit,
"onUpdate:modelValue": n[2] || (n[2] = (o) => e.formatAttrs.limit = o),
modelModifiers: { number: !0 },
placeholder: "请输入数字,0无意义"
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
})
]);
};
}
}), ts = { class: "tvu-jse__enum-config" }, rs = { class: "tvu-jse__enum-groups" }, ns = { class: "tvu-jse__enum-options" }, is = { class: "tvu-jse__enum-default" }, ss = { class: "tvu-jse__enum-range" }, as = /* @__PURE__ */ se({
__name: "EnumConfig",
props: {
fieldAttrs: { type: Object, required: !0 },
fieldAttrsType: { type: String, default: "oneOf", required: !0 }
},
setup(e) {
const t = e, n = Ee(t.fieldAttrs.default), r = () => {
n.value ? t.fieldAttrs.default = n.value : delete t.fieldAttrs.default;
}, l = () => {
var f, a, d;
let p = { id: `g${Date.now()}`, label: "newGroup", assocEnum: { property: "", value: "" } };
Array.isArray((f = t.fieldAttrs) == null ? void 0 : f.enumGroups) || (t.fieldAttrs.enumGroups = []), (d = (a = t.fieldAttrs) == null ? void 0 : a.enumGroups) == null || d.push(p);
}, o = (p, f) => {
var a, d;
(d = (a = t.fieldAttrs) == null ? void 0 : a.enumGroups) == null || d.splice(f, 1);
}, h = () => {
var p;
(p = t.fieldAttrs[t.fieldAttrsType]) == null || p.push({
label: "新选项",
value: "newKey"
});
}, c = (p, f) => {
var a;
(a = t.fieldAttrs[t.fieldAttrsType]) == null || a.splice(f, 1);
};
return (p, f) => {
const a = J("tvu-input"), d = J("tvu-button"), u = J("tvu-form-item"), s = J("tvu-option"), i = J("tvu-select"), m = J("tvu-input-number");
return j(), X("div", ts, [
$("div", rs, [
(j(!0), X(
Se,
null,
Ie(e.fieldAttrs.enumGroups, (v, y) => (j(), W(
u,
{
class: "tvu-jse__enum-group tvu-jse__field",
key: y
},
{
default: N(() => [
f[4] || (f[4] = $(
"div",
null,
"分组ID",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.id,
"onUpdate:modelValue": (_) => v.id = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
f[5] || (f[5] = $(
"div",
null,
"分组名称",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.label,
"onUpdate:modelValue": (_) => v.label = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
f[6] || (f[6] = $(
"div",
null,
"分组生效属性名",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.assocEnum.property,
"onUpdate:modelValue": (_) => v.assocEnum.property = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
f[7] || (f[7] = $(
"div",
null,
"分组生效属性值",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.assocEnum.value,
"onUpdate:modelValue": (_) => v.assocEnum.value = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
w(d, {
onClick: (_) => o(v, y)
}, {
default: N(() => f[3] || (f[3] = [
Pe("删除分组")
])),
_: 2
/* DYNAMIC */
}, 1032, ["onClick"])
]),
_: 2
/* DYNAMIC */
},
1024
/* DYNAMIC_SLOTS */
))),
128
/* KEYED_FRAGMENT */
)),
w(d, { onClick: l }, {
default: N(() => f[8] || (f[8] = [
Pe("新增分组")
])),
_: 1
/* STABLE */
})
]),
$("div", ns, [
(j(!0), X(
Se,
null,
Ie(e.fieldAttrs[e.fieldAttrsType], (v, y) => (j(), W(
u,
{
class: "tvu-jse__enum-option tvu-jse__field",
key: y
},
{
default: N(() => [
f[10] || (f[10] = $(
"div",
null,
"选项值",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.value,
"onUpdate:modelValue": (_) => v.value = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
f[11] || (f[11] = $(
"div",
null,
"选项显示内容",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.label,
"onUpdate:modelValue": (_) => v.label = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
f[12] || (f[12] = $(
"div",
null,
"选项所属分组",
-1
/* HOISTED */
)),
w(a, {
modelValue: v.group,
"onUpdate:modelValue": (_) => v.group = _
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
w(d, {
onClick: (_) => c(v, y)
}, {
default: N(() => f[9] || (f[9] = [
Pe("删除选项")
])),
_: 2
/* DYNAMIC */
}, 1032, ["onClick"])
]),
_: 2
/* DYNAMIC */
},
1024
/* DYNAMIC_SLOTS */
))),
128
/* KEYED_FRAGMENT */
)),
w(d, { onClick: h }, {
default: N(() => f[13] || (f[13] = [
Pe("新增选项")
])),
_: 1
/* STABLE */
})
]),
$("div", is, [
w(u, {
class: "tvu-jse__field",
label: "默认选项"
}, {
default: N(() => [
w(i, {
modelValue: n.value,
"onUpdate:modelValue": f[0] || (f[0] = (v) => n.value = v),
onChange: r
}, {
default: N(() => [
w(s, {
label: "无",
value: ""
}),
(j(!0), X(
Se,
null,
Ie(e.fieldAttrs[e.fieldAttrsType], (v, y) => (j(), W(s, {
label: v.label,
value: v.value
}, null, 8, ["label", "value"]))),
256
/* UNKEYED_FRAGMENT */
))
]),
_: 1
/* STABLE */
}, 8, ["modelValue"])
]),
_: 1
/* STABLE */
})
]),
$("div", ss, [
w(u, {
class: "tvu-jse__field",
label: "至少选"
}, {
default: N(() => [
w(m, {
modelValue: e.fieldAttrs.minItems,
"onUpdate:modelValue": f[1] || (f[1] = (v) => e.fieldAttrs.minItems = v),
modelModifiers: { number: !0 }
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
w(u, {
class: "tvu-jse__field",
label: "最多选"
}, {
default: N(() => [
w(m, {
modelValue: e.fieldAttrs.maxItems,
"onUpdate:modelValue": f[2] || (f[2] = (v) => e.fieldAttrs.maxItems = v),
modelModifiers: { number: !0 }
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
})
])
]);
};
}
}), os = /* @__PURE__ */ se({
__name: "Attachment",
props: {
schemaProp: { type: Object, required: !0 },
onUpload: { type: Function }
},
setup(e) {
const t = e, { schemaProp: n, onUpload: r } = t, l = (h) => {
let c = n.attachment;
c.splice(
c.indexOf(c.find((p) => p.name === h.name)),
1
);
}, o = (h) => {
var d;
const { accept: c, size: p, limit: f } = (d = n.items) == null ? void 0 : d.formatAttrs, a = h.name.split(".").pop();
if (!c.split(",").includes(a)) {
alert(`不支持文件${h.name}的格式,仅支持${c}`);
return;
}
if (f && n.attachment.length >= f) {
alert(`只允许上传${f}个文件`);
return;
}
if (p && h.size / 1024 / 1024 > p) {
alert(`上传文件大小过大,超过${p}M`);
return;
}
n.attachment || (n.attachment = []), r == null || r(h).then((u) => {
n.attachment.push(u);
});
};
return (h, c) => {
const p = J("tvu-button"), f = J("tvu-upload"), a = J("tvu-form-item");
return j(), W(a, { label: "上传模板" }, {
default: N(() => [
w(f, {
action: "#",
multiple: "",
"file-list": mi(n).attachment,
"upload-file": o,
"remove-file": l
}, {
default: N(() => [
w(p, null, {
default: N(() => c[0] || (c[0] = [
Pe("上传文件")
])),
_: 1
/* STABLE */
})
]),
_: 1
/* STABLE */
}, 8, ["file-list"])
]),
_: 1
/* STABLE */
});
};
}
}), us = /* @__PURE__ */ se({
__name: "Autofill",
props: {
autofill: { type: Object, required: !0 }
},
setup(e) {
return (t, n) => {
const r = J("tvu-input"), l = J("tvu-form-item"), o = J("tvu-option"), h = J("tvu-select"), c = J("tvu-json");
return j(), X(
Se,
null,
[
w(l, {
class: "tvu-jse__field",
label: "获取填充值地址"
}, {
default: N(() => [
w(r, {
modelValue: e.autofill.url,
"onUpdate:modelValue": n[0] || (n[0] = (p) => e.autofill.url = p)
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
w(l, {
class: "tvu-jse__field",
label: "HTTP方法"
}, {
default: N(() => [
w(h, {
modelValue: e.autofill.method,
"onUpdate:modelValue": n[1] || (n[1] = (p) => e.autofill.method = p)
}, {
default: N(() => [
w(o, {
label: "GET",
value: "GET"
}),
w(o, {
label: "POST",
value: "POST"
})
]),
_: 1
/* STABLE */
}, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
w(l, {
class: "tvu-jse__field tvu-jse__field--json",
label: "查询参数"
}, {
default: N(() => [
w(c, {
modelValue: e.autofill.params,
"onUpdate:modelValue": n[2] || (n[2] = (p) => e.autofill.params = p)
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
e.autofill.method === "POST" ? (j(), W(l, {
key: 0,
class: "tvu-jse__field tvu-jse__field--json",
label: "POST请求消息体"
}, {
default: N(() => [
w(c, {
modelValue: e.autofill.body,
"onUpdate:modelValue": n[3] || (n[3] = (p) => e.autofill.body = p)
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
})) : F("v-if", !0),
w(l, {
class: "tvu-jse__field",
label: "填充位置"
}, {
default: N(() => [
w(h, {
modelValue: e.autofill.target,
"onUpdate:modelValue": n[4] || (n[4] = (p) => e.autofill.target = p)
}, {
default: N(() => [
w(o, {
label: "作为填入值",
value: "value"
}),
w(o, {
label: "作为可选项",
value: "items"
})
]),
_: 1
/* STABLE */
}, 8, ["modelValue"])
]),
_: 1
/* STABLE */
}),
w(l, {
class: "tvu-jse__field",
label: "执行策略"
}, {
default: N(() => [
w(h, {
modelValue: e.autofill.runPolicy,
"onUpdate:modelValue": n[5] || (n[5] = (p) => e.autofill.runPolicy = p)
}, {
default: N(() => [
w(o, {
label: "表单创建时执行1次",
value: "onCreate"
}),
w(o, {
label: "依赖参数更新时执行1次",
value: "onParamChange"
}),
w(o, {
label: "用户执行",
value: "onUser"
})
]),
_: 1
/* STABLE */
}, 8, ["modelValue"])
]),
_: 1
/* STABLE */
})
],
64
/* STABLE_FRAGMENT */
);
};
}
}), ls = /* @__PURE__ */ se({
__name: "Lookup",
props: {
prop: { type: Object, required: !0 }
},
setup(e) {
return (t, n) => {
const r = J("tvu-json"), l = J("tvu-form-item");
return j(), W(l, {
class: "tvu-jse__field",
label: "获取填充值地址"
}, {
default: N(() => [
w(r, {
modelValue: e.prop.lookup,
"onUpdate:modelValue": n[0] || (n[0] = (o) => e.prop.lookup = o)
}, null, 8, ["modelValue"])
]),
_: 1
/* STABLE */
});
};
}
});
function ge(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var He = { exports: {} }, wt = {}, Ot, Ar;
function xt() {
return Ar || (Ar = 1, Ot = {
ROOT: 0,
GROUP: 1,
POSITION: 2,
SET: 3,
RANGE: 4,
REPETITION: 5,
REFERENCE: 6,
CHAR: 7
}), Ot;
}
var me = {}, Er;
function vi() {
if (Er) return me;
Er = 1;
const e = xt(), t = () => [{ type: e.RANGE, from: 48, to: 57 }], n = () => [
{ type: e.CHAR, value: 95 },
{ type: e.RANGE, from: 97, to: 122 },
{ type: e.RANGE, from: 65, to: 90 }
].concat(t()), r = () => [
{ type: e.CHAR, value: 9 },
{ type: e.CHAR, value: 10 },
{ type: e.CHAR, value: 11 },
{ type: e.CHAR, value: 12 },
{ type: e.CHAR, value: 13 },
{ type: e.CHAR, value: 32 },
{ type: e.CHAR, value: 160 },
{ type: e.CHAR, value: 5760 },
{ type: e.RANGE, from: 8192, to: 8202 },
{ type: e.CHAR, value: 8232 },
{ type: e.CHAR, value: 8233 },
{ type: e.CHAR, value: 8239 },
{ type: e.CHAR, value: 8287 },
{ type: e.CHAR, value: 12288 },
{ type: e.CHAR, value: 65279 }
], l = () => [
{ type: e.CHAR, value: 10 },
{ type: e.CHAR, value: 13 },
{ type: e.CHAR, value: 8232 },
{ type: e.CHAR, value: 8233 }
];
return me.words = () => ({ type: e.SET, set: n(), not: !1 }), me.notWords = () => ({ type: e.SET, set: n(), not: !0 }), me.ints = () => ({ type: e.SET, set: t(), not: !1 }), me.notInts = () => ({ type: e.SET, set: t(), not: !0 }), me.whitespace = () => ({ type: e.SET, set: r(), not: !1 }), me.notWhitespace = () => ({ type: e.SET, set: r(), not: !0 }), me.anyChar = () => ({ type: e.SET, set: l(), not: !0 }), me;
}
var Pr;
function fs() {
return Pr || (Pr = 1, function(e) {
const t = xt(), n = vi(), r = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?", l = { 0: 0, t: 9, n: 10, v: 11, f: 12, r: 13 };
e.strToChars = function(o) {
var h = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;
return o = o.replace(h, function(c, p, f, a, d, u, s, i) {
if (f)
return c;
var m = p ? 8 : a ? parseInt(a, 16) : d ? parseInt(d, 16) : u ? parseInt(u, 8) : s ? r.indexOf(s) : l[i], v = String.fromCharCode(m);
return /[[\]{}^$.|?*+()]/.test(v) && (v = "\\" + v), v;
}), o;
}, e.tokenizeClass = (o, h) => {
for (var c = [], p = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g, f, a; (f = p.exec(o)) != null; )
if (f[1])
c.push(n.words());
else if (f[2])
c.push(n.ints());
else if (f[3])
c.push(n.whitespace());
else if (f[4])
c.push(n.notWords());
else if (f[5])
c.push(n.notInts());
else if (f[6])
c.push(n.notWhitespace());
else if (f[7])
c.push({
type: t.RANGE,
from: (f[8] || f[9]).charCodeAt(0),
to: f[10].charCodeAt(0)
});
else if (a = f[12])
c.push({
type: t.CHAR,
value: a.charCodeAt(0)
});
else
return [c, p.lastIndex];
e.error(h, "Unterminated character class");
}, e.error = (o, h) => {
throw new SyntaxError("Invalid regular expression: /" + o + "/: " + h);
};
}(wt)), wt;
}
var ke = {}, Ir;
function cs() {
if (Ir) return ke;
Ir = 1;
const e = xt();
return ke.wordBoundary = () => ({ type: e.POSITION, value: "b" }), ke.nonWordBoundary = () => ({ type: e.POSITION, value: "B" }), ke.begin = () => ({ type: e.POSITION, value: "^" }), ke.end = () => ({ type: e.POSITION, value: "$" }), ke;
}
var Lr;
function ps() {
if (Lr) return He.exports;
Lr = 1;
const e = fs(), t = xt(), n = vi(), r = cs();
return He.exports = (l) => {
var o = 0, h, c, p = { type: t.ROOT, stack: [] }, f = p, a = p.stack, d = [], u = (b) => {
e.error(l, `Nothing to repeat at column ${b - 1}`);
}, s = e.strToChars(l);
for (h = s.length; o < h; )
switch (c = s[o++], c) {
// Handle escaped characters, inclues a few sets.
case "\\":
switch (c = s[o++], c) {
case "b":
a.push(r.wordBoundary());
break;
case "B":
a.push(r.nonWordBoundary());
break;
case "w":
a.push(n.words());
break;
case "W":
a.push(n.notWords());
break;
case "d":
a.push(n.ints());
break;
case "D":
a.push(n.notInts());
break;
case "s":
a.push(n.whitespace());
break;
case "S":
a.push(n.notWhitespace());
break;
default:
/\d/.test(c) ? a.push({ type: t.REFERENCE, value: parseInt(c, 10) }) : a.push({ type: t.CHAR, value: c.charCodeAt(0) });
}
break;
// Positionals.
case "^":
a.push(r.begin());
break;
case "$":
a.push(r.end());
break;
// Handle custom sets.
case "[":
var i;
s[o] === "^" ? (i = !0, o++) : i = !1;
var m = e.tokenizeClass(s.slice(o), l);
o += m[1], a.push({
type: t.SET,
set: m[0],
not: i
});
break;
// Class of any character except \n.
case ".":
a.push(n.anyChar());
break;
// Push group onto stack.
case "(":
var v = {
type: t.GROUP,
stack: [],
remember: !0
};
c = s[o], c === "?" && (c = s[o + 1], o += 2, c === "=" ? v.followedBy = !0 : c === "!" ? v.notFollowedBy = !0 : c !== ":" && e.error(
l,
`Invalid group, character '${c}' after '?' at column ${o - 1}`
), v.remember = !1), a.push(v), d.push(f), f = v, a = v.stack;
break;
// Pop group out of stack.
case ")":
d.length === 0 && e.error(l, `Unmatched ) at column ${o - 1}`), f = d.pop(), a = f.options ? f.options[f.options.length - 1] : f.stack;
break;
// Use pipe character to give more choices.
case "|":
f.options || (f.options = [f.stack], delete f.stack);
var y = [];
f.options.push(y), a = y;
break;
// Repetition.
// For every repetition, remove last element from last stack
// then insert back a RANGE object.
// This design is chosen because there could be more than
// one repetition symbols in a regex i.e. `a?+{2,3}`.
case "{":
var _ = /^(\d+)(,(\d+)?)?\}/.exec(s.slice(o)), x, g;
_ !== null ? (a.length === 0 && u(o), x = parseInt(_[1], 10), g = _[2] ? _[3] ? parseInt(_[3], 10) : 1 / 0 : x, o += _[0].length, a.push({
type: t.REPETITION,
min: x,
max: g,
value: a.pop()
})) : a.push({
type: t.CHAR,
value: 123
});
break;
case "?":
a.length === 0 && u(o), a.push({
type: t.REPETITION,
min: 0,
max: 1,
value: a.pop()
});
break;
case "+":
a.length === 0 && u(o), a.push({
type: t.REPETITION,
min: 1,
max: 1 / 0,
value: a.pop()
});
break;
case "*":
a.length === 0 && u(o), a.push({
type: t.REPETITION,
min: 0,
max: 1 / 0,
value: a.pop()
});
break;
// Default is a character that is not `\[](){}?+*^$`.
default:
a.push({
type: t.CHAR,
value: c.charCodeAt(0)
});
}
return d.length !== 0 && e.error(l, "Unterminated group"), p;
}, He.exports.types = t, He.exports;
}
var At, Rr;
function hs() {
if (Rr) return At;
Rr = 1;
class e {
constructor(r, l) {
this.low = r, this.high = l, this.length = 1 + l - r;
}
overlaps(r) {
return !(this.high < r.low || this.low > r.high);
}
touches(r) {
return !(this.high + 1 < r.low || this.low - 1 > r.high);
}
// Returns inclusive combination of SubRanges as a SubRange.
add(r) {
return new e(
Math.min(this.low, r.low),
Math.max(this.high, r.high)
);
}
// Returns subtraction of SubRanges as an array of SubRanges.
// (There's a case where subtraction divides it in 2)
subtract(r) {
return r.low <= this.low && r.high >= this.high ? [] : r.low > this.low && r.high < this.high ? [
new e(this.low, r.low - 1),
new e(r.high + 1, this.high)
] : r.low <= this.low ? [new e(r.high + 1, this.high)] : [new e(this.low, r.low - 1)];
}
toString() {
return this.low == this.high ? this.low.toString() : this.low + "-" + this.high;
}
}
class t {
constructor(r, l) {
this.ranges = [], this.length = 0, r != null && this.add(r, l);
}
_update_length() {
this.length = this.ranges.reduce((r, l) => r + l.length, 0);
}
add(r, l) {
var o = (h) => {
for (var c = 0; c < this.ranges.length && !h.touches(this.ranges[c]); )
c++;
for (var p = this.ranges.slice(0, c); c < this.ranges.length && h.touches(this.ranges[c]); )
h = h.add(this.ranges[c]), c++;
p.push(h), this.ranges = p.concat(this.ranges.slice(c)), this._update_length();
};
return r instanceof t ? r.ranges.forEach(o) : (l == null && (l = r), o(new e(r, l))), this;
}
subtract(r, l) {
var o = (h) => {
for (var c = 0; c < this.ranges.length && !h.overlaps(this.ranges[c]); )
c++;
for (var p = this.ranges.slice(0, c); c < this.ranges.length && h.overlaps(this.ranges[c]); )
p = p.concat(this.ranges[c].subtract(h)), c++;
this.ranges = p.concat(this.ranges.slice(c)), this._update_length();
};
return r instanceof t ? r.ranges.forEach(o) : (l == null && (l = r), o(new e(r, l))), this;
}
intersect(r, l) {
var o = [], h = (c) => {
for (var p = 0; p < this.ranges.length && !c.overlaps(this.ranges[p]); )
p++;
for (; p < this.ranges.length && c.overlaps(this.ranges[p]); ) {
var f = Math.max(this.ranges[p].low, c.low), a = Math.min(this.ranges[p].high, c.high);
o.push(new e(f, a)), p++;
}
};
return r instanceof t ? r.ranges.forEach(h) : (l == null && (l = r), h(new e(r, l))), this.ranges = o, this._update_length(), this;
}
index(r) {
for (var l = 0; l < this.ranges.length && this.ranges[l].length <= r; )
r -= this.ranges[l].length, l++;
return this.ranges[l].low + r;
}
toString() {
return "[ " + this.ranges.join(", ") + " ]";
}
clone() {
return new t(this);
}
numbers() {
return this.ranges.reduce((r, l) => {
for (var o = l.low; o <= l.high; )
r.push(o), o++;
return r;
}, []);
}
subranges() {
return this.ranges.map((r) => ({
low: r.low,
high: r.high,
length: 1 + r.high - r.low
}));
}
}
return At = t, At;
}
var Et, Mr;
function ds() {
if (Mr) return Et;
Mr = 1;
const e = ps(), t = hs(), n = e.types;
return Et = class Fe {
/**
* @constructor
* @param {RegExp|String} regexp
* @param {String} m
*/
constructor(l, o) {
if (this._setDefaults(l), l instanceof RegExp)
this.ignoreCase = l.ignoreCase, this.multiline = l.multiline, l = l.source;
else if (typeof l == "string")
this.ignoreCase = o && o.indexOf("i") !== -1, this.multiline = o && o.indexOf("m") !== -1;
else
throw new Error("Expected a regexp or string");
this.tokens = e(l);
}
/**
* Checks if some custom properties have been set for this regexp.
*
* @param {RandExp} randexp
* @param {RegExp} regexp
*/
_setDefaults(l) {
this.max = l.max != null ? l.max : Fe.prototype.max != null ? Fe.prototype.max : 100, this.defaultRange = l.defaultRange ? l.defaultRange : this.defaultRange.clone(), l.randInt && (this.randInt = l.randInt);
}
/**
* Generates the random string.
*
* @return {String}
*/
gen() {
return this._gen(this.tokens, []);
}
/**
* Generate random string modeled after given tokens.
*
* @param {Object} token
* @param {Array.<String>} groups
* @return {String}
*/
_gen(l, o) {
var h, c, p, f, a;
switch (l.type) {
case n.ROOT:
case n.GROUP:
if (l.followedBy || l.notFollowedBy)
return "";
for (l.remember && l.groupNumber === void 0 && (l.groupNumber = o.push(null) - 1), h = l.options ? this._randSelect(l.options) : l.stack, c = "", f = 0, a = h.length; f < a; f++)
c += this._gen(h[f], o);
return l.remember && (o[l.groupNumber] = c), c;
case n.POSITION:
return "";
case n.SET:
var d = this._expand(l);
return d.length ? String.fromCharCode(this._randSelect(d)) : "";
case n.REPETITION:
for (p = this.randInt(
l.min,
l.max === 1 / 0 ? l.min + this.max : l.max
), c = "", f = 0; f < p; f++)
c += this._gen(l.value, o);
return c;
case n.REFERENCE:
return o[l.value - 1] || "";
case n.CHAR:
var u = this.ignoreCase && this._randBool() ? this._toOtherCase(l.value) : l.value;
return String.fromCharCode(u);
}
}
/**
* If code is alphabetic, converts to other case.
* If not alphabetic, returns back code.
*
* @param {Number} code
* @return {Number}
*/
_toOtherCase(l) {
return l + (97 <= l && l <= 122 ? -32 : 65 <= l && l <= 90 ? 32 : 0);
}
/**
* Randomly returns a true or false value.
*
* @return {Boolean}
*/
_randBool() {
return !this.randInt(0, 1);
}
/**
* Randomly selects and returns a value from the array.
*
* @param {Array.<Object>} arr
* @return {Object}
*/
_randSelect(l) {
return l instanceof t ? l.index(this.randInt(0, l.length - 1)) : l[this.randInt(0, l.length - 1)];
}
/**
* expands a token to a DiscontinuousRange of characters which has a
* length and an index function (for random selecting)
*
* @param {Object} token
* @return {DiscontinuousRange}
*/
_expand(l) {
if (l.type === e.types.CHAR)
return new t(l.value);
if (l.type === e.types.RANGE)
return new t(l.from, l.to);
{
let o = new t();
for (let h = 0; h < l.set.length; h++) {
let c = this._expand(l.set[h]);
if (o.add(c), this.ignoreCase)
for (let p = 0; p < c.length; p++) {
let f = c.index(p), a = this._toOtherCase(f);
f !== a && o.add(a);
}
}
return l.not ? this.defaultRange.clone().subtract(o) : this.defaultRange.clone().intersect(o);
}
}
/**
* Randomly generates and returns a number between a and b (inclusive).
*
* @param {Number} a
* @param {Number} b
* @return {Number}
*/
randInt(l, o) {
return l + Math.floor(Math.random() * (1 + o - l));
}
/**
* Default range of characters to generate from.
*/
get defaultRange() {
return this._range = this._range || new t(32, 126);
}
set defaultRange(l) {
this._range = l;
}
/**
*
* Enables use of randexp with a shorter call.
*
* @param {RegExp|String| regexp}
* @param {String} m
* @return {String}
*/
static randexp(l, o) {
var h;
return typeof l == "string" && (l = new RegExp(l, o)), l._randexp === void 0 ? (h = new Fe(l, o), l._randexp = h) : (h = l._randexp, h._setDefaults(l)), h.gen();
}
/**
* Enables sugary /regexp/.gen syntax.
*/
static sugar() {
RegExp.prototype.gen = function() {
return Fe.randexp(this);
};
}
}, Et;
}
ds();
var Ue = { exports: {} }, Pt, Nr;
function ms() {
if (Nr) return Pt;
Nr = 1;
var e = 1e3, t = e * 60, n = t * 60, r = n * 24, l = r * 7, o = r * 365.25;
Pt = function(a, d) {
d = d || {};
var u = typeof a;
if (u === "string" && a.length > 0)
return h(a);
if (u === "number" && isFinite(a))
return d.long ? p(a) : c(a);
throw new Error(
"val is not a non-empty string or a valid number. val=" + JSON.stringify(a)
);
};
function h(a) {
if (a = String(a), !(a.length > 100)) {
var d = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
a
);
if (d) {
var u = parseFloat(d[1]), s = (d[2] || "ms").toLowerCase();
switch (s) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return u * o;
case "weeks":
case "week":
case "w":
return u * l;
case "days":
case "day":
case "d":
return u * r;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return u * n;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return u * t;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return u * e;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return u;
default:
return;
}
}
}
}
function c(a) {
var d = Math.abs(a);
return d >= r ? Math.round(a / r) + "d" : d >= n ? Math.round(a / n) + "h" : d >= t ? Math.round(a / t) + "m" : d >= e ? Math.round(a / e) + "s" : a + "ms";
}
function p(a) {
var d = Math.abs(a);
return d >= r ? f(a, d, r, "day") : d >= n ? f(a, d, n, "hour") : d >= t ? f(a, d, t, "minute") : d >= e ? f(a, d, e, "second") : a + " ms";
}
function f(a, d, u, s) {
var i = d >= u * 1.5;
return Math.round(a / u) + " " + s + (i ? "s" : "");
}
return Pt;
}
var It, jr;
function vs() {
if (jr) return It;
jr = 1;
function e(t) {
r.debug = r, r.default = r, r.coerce = f, r.disable = c, r.enable = o, r.enabled = p, r.humanize = ms(), r.destroy = a, Object.keys(t).forEach((d) => {
r[d] = t[d];
}), r.names = [], r.skips = [], r.formatters = {};
function n(d) {
let u = 0;
for (let s = 0; s < d.length; s++)
u = (u << 5) - u + d.charCodeAt(s), u |= 0;
return r.colors[Math.abs(u) % r.colors.length];
}
r.selectColor = n;
function r(d) {
let u, s = null, i, m;
function v(...y) {
if (!v.enabled)
return;
const _ = v, x = Number(/* @__PURE__ */ new Date()), g = x - (u || x);
_.diff = g, _.prev = u, _.curr = x, u = x, y[0] = r.coerce(y[0]), typeof y[0] != "string" && y.unshift("%O");
let b = 0;
y[0] = y[0].replace(/%([a-zA-Z%])/g, (k, O) => {
if (k === "%%")
return "%";
b++;
const V = r.formatters[O];
if (typeof V == "function") {
const P = y[b];
k = V.call(_, P), y.splice(b, 1), b--;
}
return k;
}), r.formatArgs.call(_, y), (_.log || r.log).apply(_, y);
}
return v.namespace = d, v.useColors = r.useColors(), v.color = r.selectColor(d), v.extend = l, v.destroy = r.destroy, Object.defineProperty(v, "enabled", {
enumerable: !0,
configurable: !1,
get: () => s !== null ? s : (i !== r.namespaces && (i = r.namespaces, m = r.enabled(d)), m),
set: (y) => {
s = y;
}
}), typeof r.init == "function" && r.init(v), v;
}
function l(d, u) {
const s = r(this.namespace + (typeof u > "u" ? ":" : u) + d);
return s.log = this.log, s;
}
function o(d) {
r.save(d), r.namespaces = d, r.names = [], r.skips = [];
const u = (typeof d == "string" ? d : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
for (const s of u)
s[0] === "-" ? r.skips.push(s.slice(1)) : r.names.push(s);
}
function h(d, u) {
let s = 0, i = 0, m = -1, v = 0;
for (; s < d.length; )
if (i < u.length && (u[i] === d[s] || u[i] === "*"))
u[i] === "*" ? (m = i, v = s, i++) : (s++, i++);
else if (m !== -1)
i = m + 1, v++, s = v;
else
return !1;
for (; i < u.length && u[i] === "*"; )
i++;
return i === u.length;
}
function c() {
const d = [
...r.names,
...r.skips.map((u) => "-" + u)
].join(",");
return r.enable(""), d;
}
function p(d) {
for (const u of r.skips)
if (h(d, u))
return !1;
for (const u of r.names)
if (h(d, u))
return !0;
return !1;
}
function f(d) {
return d instanceof Error ? d.stack || d.message : d;
}
function a() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}
return r.enable(r.load()), r;
}
return It = e, It;
}
var Vr;
function gs() {
return Vr || (Vr = 1, function(e, t) {
t.formatArgs = r, t.save = l, t.load = o, t.useColors = n, t.storage = h(), t.destroy = /* @__PURE__ */ (() => {
let p = !1;
return () => {
p || (p = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
};
})(), t.colors = [
"#0000CC",
"#0000FF",
"#0033CC",
"#0033FF",
"#0066CC",
"#0066FF",
"#0099CC",
"#0099FF",
"#00CC00",
"#00CC33",
"#00CC66",
"#00CC99",
"#00CCCC",
"#00CCFF",
"#3300CC",
"#3300FF",
"#3333CC",
"#3333FF",
"#3366CC",
"#3366FF",
"#3399CC",
"#3399FF",
"#33CC00",
"#33CC33",
"#33CC66",
"#33CC99",
"#33CCCC",
"#33CCFF",
"#6600CC",
"#6600FF",
"#6633CC",
"#6633FF",
"#66CC00",
"#66CC33",
"#9900CC",
"#9900FF",
"#9933CC",
"#9933FF",
"#99CC00",
"#99CC33",
"#CC0000",
"#CC0033",
"#CC0066",
"#CC0099",
"#CC00CC",
"#CC00FF",
"#CC3300",
"#CC3333",
"#CC3366",
"#CC3399",
"#CC33CC",
"#CC33FF",
"#CC6600",
"#CC6633",
"#CC9900",
"#CC9933",
"#CCCC00",
"#CCCC33",
"#FF0000",
"#FF0033",
"#FF0066",
"#FF0099",
"#FF00CC",
"#FF00FF",
"#FF3300",
"#FF3333",
"#FF3366",
"#FF3399",
"#FF33CC",
"#FF33FF",
"#FF6600",
"#FF6633",
"#FF9900",
"#FF9933",
"#FFCC00",
"#FFCC33"
];
function n() {
if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs))
return !0;
if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))
return !1;
let p;
return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator < "u" && navigator.userAgent && (p = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(p[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
function r(p) {
if (p[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + p[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors)
return;
const f = "color: " + this.color;
p.splice(1, 0, f, "color: inherit");
let a = 0, d = 0;
p[0].replace(/%[a-zA-Z%]/g, (u) => {
u !== "%%" && (a++, u === "%c" && (d = a));
}), p.splice(d, 0, f);
}
t.log = console.debug || console.log || (() => {
});
function l(p) {
try {
p ? t.storage.setItem("debug", p) : t.storage.removeItem("debug");
} catch {
}
}
function o() {
let p;
try {
p = t.storage.getItem("debug") || t.storage.getItem("DEBUG");
} catch {
}
return !p && typeof process < "u" && "env" in process && (p = process.env.DEBUG), p;
}
function h() {
try {
return localStorage;
} catch {
}
}
e.exports = vs()(t);
const { formatters: c } = e.exports;
c.j = function(p) {
try {
return JSON.stringify(p);
} catch (f) {
return "[UnexpectedJSONParseError]: " + f.message;
}
};
}(Ue, Ue.exports)), Ue.exports;
}
var ys = gs();
const ye = /* @__PURE__ */ ge(ys), _s = ye("json-schema:model");
var _r;
(function(e) {
e.value = "value", e.items = "items";
})(_r || (_r = {}));
var br;
(function(e) {
e.onCreate = "onCreate", e.onParamChange = "onParamChange", e.onUser = "onUser";
})(br || (br = {}));
class _t {
constructor(t, n, r) {
Z(this, "_parent");
Z(this, "_path");
Z(this, "_name");
Z(this, "attrs");
Z(this, "existIf");
Z(this, "lookup");
Z(this, "items");
Z(this, "attachment");
Z(this, "isPattern", !1);
Z(this, "children");
Z(this, "patternChildren");
Z(this, "isOneOf", !1);
Z(this, "isOneOfDefault", !1);
Z(this, "isOneOfInclusiveGroup", "");
Z(this, "isOneOfExclusiveGroup", "");
Z(this, "isOneOfChildren", /* @__PURE__ */ new Map());
this._path = t, this._name = n, this.attrs = { type: r ?? "" };
}
get title() {
return this.attrs.title ?? this.name;
}
get fullTitle() {
if (this.parent) {
let t = this.parent.fullTitle;
return this.parent.attrs.type === "array" && (t += "[*]"), t ? t + "." + this.title : this.title;
}
return this.title;
}
get parent() {
return this._parent;
}
set parent(t) {
this._parent = t;
}
get path() {
if (this._parent) {
let t = this._parent.fullname;
return this._parent.attrs.type === "array" && (t += "[*]"), t;
}
return this._path;
}
set path(t) {
this._path = t;
}
get name() {
return this._name;
}
set name(t) {
this._name = t;
}
get fullname() {
return this.name ? this.path ? this.path + (this.name === "[*]" ? "" : ".") + this.name : this.name : this.path;
}
get fullRegExp() {
var r, l, o;
let { fullname: t } = this, n = t.replace(/^\^/, "").replace(/\$$/, "").replace(/\.\^/g, ".").replace(/\$\./g, ".").replace(/\$\[/g, "[").replaceAll("[*]", "\\[\\d+\\]").replace(new RegExp("\\.", "g"), "\\.");
return this.attrs.type === "array" && ((r = this.items) == null ? void 0 : r.type) !== "object" && ((l = this.items) == null ? void 0 : l.type) !== "array" ? ((o = this.items) == null ? void 0 : o.type) === "json" ? n += "(\\[\\d+\\])?([.\\[].*)?" : n += "(\\[\\d+\\])?" : this.attrs.type === "json" && (n += "([.\\[].*)?"), n = "^" + n + "$", new RegExp(n);
}
get fullRegExpNoChild() {
let { fullname: t } = this, n = t.replace(/^\^/, "").replace(/\$$/, "").replace(/\.\^/g, ".").replace(/\$\./g, ".").replace(/\$\[/g, "[").replaceAll("[*]", "\\[\\d+\\]").replace(new RegExp("\\.", "g"), "\\.");
return n = "^" + n + "$", new RegExp(n);
}
get parentFullname() {
return this.path.replace(/\[\*\]$/, "");
}
get isArrayItem() {
return /\[\*\]$/.test(this.path);
}
get isSingleValue() {
return !this.isPattern && this.attrs.ty