@innovastudio/contentbuilder-interactive-runtime 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,7 +84,7 @@ function Ce(c, e = "", t = !1) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function Be(c, e = "") {
|
|
88
88
|
if (e === "")
|
|
89
89
|
return c.style.webkitTransform = "", c.style.MozTransform = "", c.style.msTransform = "", c.style.OTransform = "", c.style.transform = "", !1;
|
|
90
90
|
c.style.webkitTransform = e, c.style.MozTransform = e, c.style.msTransform = e, c.style.OTransform = e, c.style.transform = e;
|
|
@@ -415,7 +415,7 @@ class Mi {
|
|
|
415
415
|
function lt(c) {
|
|
416
416
|
const e = xi(), t = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
417
417
|
let i = te(c, "gslide-media") ? c : c.querySelector(".gslide-media"), s = ue(i, ".ginner-container"), n = c.querySelector(".gslide-description");
|
|
418
|
-
t > 769 && (i = s), H(i, "greset"),
|
|
418
|
+
t > 769 && (i = s), H(i, "greset"), Be(i, "translate3d(0, 0, 0)"), oe(e, {
|
|
419
419
|
onElement: i,
|
|
420
420
|
once: !0,
|
|
421
421
|
withCallback: (r, o) => {
|
|
@@ -426,7 +426,7 @@ function lt(c) {
|
|
|
426
426
|
function Ai(c) {
|
|
427
427
|
if (c.events.hasOwnProperty("touch"))
|
|
428
428
|
return !1;
|
|
429
|
-
let e = ti(), t = e.width, i = e.height, s = !1, n = null, r = null, o = null, a = !1, d = 1, u = 4.5, l = 1, h = !1, p = !1, b = null, w = null, _ = null, g = null,
|
|
429
|
+
let e = ti(), t = e.width, i = e.height, s = !1, n = null, r = null, o = null, a = !1, d = 1, u = 4.5, l = 1, h = !1, p = !1, b = null, w = null, _ = null, g = null, y, f, m = 0, v = 0, k = !1, x = !1, S = {}, E = {}, C = 0, A = 0, L;
|
|
430
430
|
const D = document.getElementById("glightbox-slider"), I = document.querySelector(".goverlay"), O = new Mi(D, {
|
|
431
431
|
touchStart: (R) => {
|
|
432
432
|
if (s = !0, (te(R.targetTouches[0].target, "ginner-container") || ue(R.targetTouches[0].target, ".gslide-desc") || R.targetTouches[0].target.nodeName.toLowerCase() == "a") && (s = !1), ue(R.targetTouches[0].target, ".gslide-inline") && !te(R.targetTouches[0].target.parentNode, "gslide-inline") && (s = !1), s) {
|
|
@@ -445,11 +445,11 @@ function Ai(c) {
|
|
|
445
445
|
}
|
|
446
446
|
a = !0;
|
|
447
447
|
let q = R.targetTouches[0].clientX, M = R.targetTouches[0].clientY, T = C - q, $ = A - M;
|
|
448
|
-
Math.abs(T) > Math.abs($) ? (k = !1, x = !0) : (x = !1, k = !0),
|
|
448
|
+
Math.abs(T) > Math.abs($) ? (k = !1, x = !0) : (x = !1, k = !0), y = E.pageX - S.pageX, m = y * 100 / t, f = E.pageY - S.pageY, v = f * 100 / i;
|
|
449
449
|
let N;
|
|
450
|
-
if (k && o && (N = 1 - Math.abs(f) / i, I.style.opacity = N, c.settings.touchFollowAxis && (m = 0)), x && (N = 1 - Math.abs(
|
|
451
|
-
return
|
|
452
|
-
|
|
450
|
+
if (k && o && (N = 1 - Math.abs(f) / i, I.style.opacity = N, c.settings.touchFollowAxis && (m = 0)), x && (N = 1 - Math.abs(y) / t, r.style.opacity = N, c.settings.touchFollowAxis && (v = 0)), !o)
|
|
451
|
+
return Be(r, `translate3d(${m}%, 0, 0)`);
|
|
452
|
+
Be(r, `translate3d(${m}%, ${v}%, 0)`);
|
|
453
453
|
},
|
|
454
454
|
touchEnd: () => {
|
|
455
455
|
if (!s)
|
|
@@ -458,7 +458,7 @@ function Ai(c) {
|
|
|
458
458
|
_ = b, g = w;
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
|
-
const R = Math.abs(parseInt(
|
|
461
|
+
const R = Math.abs(parseInt(v)), q = Math.abs(parseInt(m));
|
|
462
462
|
if (R > 29 && o) {
|
|
463
463
|
c.close();
|
|
464
464
|
return;
|
|
@@ -490,7 +490,7 @@ function Ai(c) {
|
|
|
490
490
|
var q = E.pageX - S.pageX, M = E.pageY - S.pageY;
|
|
491
491
|
_ && (q = q + _), g && (M = M + g), b = q, w = M;
|
|
492
492
|
let T = `translate3d(${q}px, ${M}px, 0)`;
|
|
493
|
-
l && (T += ` scale3d(${l}, ${l}, 1)`),
|
|
493
|
+
l && (T += ` scale3d(${l}, ${l}, 1)`), Be(o, T);
|
|
494
494
|
}
|
|
495
495
|
},
|
|
496
496
|
swipe: (R) => {
|
|
@@ -1666,7 +1666,7 @@ function jt(c, e) {
|
|
|
1666
1666
|
}
|
|
1667
1667
|
return t;
|
|
1668
1668
|
}
|
|
1669
|
-
function
|
|
1669
|
+
function Ft(c) {
|
|
1670
1670
|
for (var e = 1; e < arguments.length; e++) {
|
|
1671
1671
|
var t = arguments[e] != null ? arguments[e] : {};
|
|
1672
1672
|
e % 2 ? jt(Object(t), !0).forEach(function(i) {
|
|
@@ -1737,17 +1737,17 @@ function ji() {
|
|
|
1737
1737
|
return !1;
|
|
1738
1738
|
}
|
|
1739
1739
|
}
|
|
1740
|
-
function
|
|
1740
|
+
function Fi(c) {
|
|
1741
1741
|
if (c === void 0)
|
|
1742
1742
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1743
1743
|
return c;
|
|
1744
1744
|
}
|
|
1745
|
-
function
|
|
1745
|
+
function Bi(c, e) {
|
|
1746
1746
|
if (e && (typeof e == "object" || typeof e == "function"))
|
|
1747
1747
|
return e;
|
|
1748
1748
|
if (e !== void 0)
|
|
1749
1749
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
1750
|
-
return
|
|
1750
|
+
return Fi(c);
|
|
1751
1751
|
}
|
|
1752
1752
|
function Gi(c) {
|
|
1753
1753
|
var e = ji();
|
|
@@ -1758,7 +1758,7 @@ function Gi(c) {
|
|
|
1758
1758
|
s = Reflect.construct(i, arguments, n);
|
|
1759
1759
|
} else
|
|
1760
1760
|
s = i.apply(this, arguments);
|
|
1761
|
-
return
|
|
1761
|
+
return Bi(this, s);
|
|
1762
1762
|
};
|
|
1763
1763
|
}
|
|
1764
1764
|
function Wi(c, e) {
|
|
@@ -2026,7 +2026,7 @@ function pt(c, e) {
|
|
|
2026
2026
|
t.classes = Object.assign({}, c.classes, e.classes);
|
|
2027
2027
|
var i = ["direction", "type", "slide", "arrow", "nav"];
|
|
2028
2028
|
i.forEach(function(s) {
|
|
2029
|
-
e.classes.hasOwnProperty(s) && (t.classes[s] =
|
|
2029
|
+
e.classes.hasOwnProperty(s) && (t.classes[s] = Ft(Ft({}, c.classes[s]), e.classes[s]));
|
|
2030
2030
|
});
|
|
2031
2031
|
}
|
|
2032
2032
|
return e.hasOwnProperty("breakpoints") && (t.breakpoints = Object.assign({}, c.breakpoints, e.breakpoints)), t;
|
|
@@ -2414,14 +2414,14 @@ function Ki(c, e, t) {
|
|
|
2414
2414
|
}
|
|
2415
2415
|
}), i;
|
|
2416
2416
|
}
|
|
2417
|
-
function
|
|
2417
|
+
function Bt() {
|
|
2418
2418
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
2419
2419
|
}
|
|
2420
2420
|
function it(c, e) {
|
|
2421
2421
|
var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, s, n, r, o = 0, a = function() {
|
|
2422
|
-
o = t.leading === !1 ? 0 :
|
|
2422
|
+
o = t.leading === !1 ? 0 : Bt(), i = null, r = c.apply(s, n), i || (s = n = null);
|
|
2423
2423
|
}, d = function() {
|
|
2424
|
-
var l =
|
|
2424
|
+
var l = Bt();
|
|
2425
2425
|
!o && t.leading === !1 && (o = l);
|
|
2426
2426
|
var h = e - (l - o);
|
|
2427
2427
|
return s = this, n = arguments, h <= 0 || h > e ? (i && (clearTimeout(i), i = null), o = l, r = c.apply(s, n), i || (s = n = null)) : !i && t.trailing !== !1 && (i = setTimeout(a, h)), r;
|
|
@@ -2829,8 +2829,8 @@ function ls(c, e, t) {
|
|
|
2829
2829
|
var g = p[_].cloneNode(!0);
|
|
2830
2830
|
g.classList.add(d.slide.clone), n.push(g);
|
|
2831
2831
|
}
|
|
2832
|
-
for (var
|
|
2833
|
-
var f = b[
|
|
2832
|
+
for (var y = 0; y < b.length; y++) {
|
|
2833
|
+
var f = b[y].cloneNode(!0);
|
|
2834
2834
|
f.classList.add(d.slide.clone), n.unshift(f);
|
|
2835
2835
|
}
|
|
2836
2836
|
}
|
|
@@ -3284,8 +3284,8 @@ function ws(c, e, t) {
|
|
|
3284
3284
|
*/
|
|
3285
3285
|
move: function(l) {
|
|
3286
3286
|
if (!c.disabled) {
|
|
3287
|
-
var h = c.settings, p = h.touchAngle, b = h.touchRatio, w = h.classes, _ = this.touches(l), g = Q(_.pageX) - n,
|
|
3288
|
-
if (s = Math.asin(k /
|
|
3287
|
+
var h = c.settings, p = h.touchAngle, b = h.touchRatio, w = h.classes, _ = this.touches(l), g = Q(_.pageX) - n, y = Q(_.pageY) - r, f = Math.abs(g << 2), m = Math.abs(y << 2), v = Math.sqrt(f + m), k = Math.sqrt(m);
|
|
3288
|
+
if (s = Math.asin(k / v), s * 180 / Math.PI < p)
|
|
3289
3289
|
l.stopPropagation(), e.Move.make(g * Yi(b)), e.Html.root.classList.add(w.dragging), t.emit("swipe.move");
|
|
3290
3290
|
else
|
|
3291
3291
|
return !1;
|
|
@@ -3299,8 +3299,8 @@ function ws(c, e, t) {
|
|
|
3299
3299
|
*/
|
|
3300
3300
|
end: function(l) {
|
|
3301
3301
|
if (!c.disabled) {
|
|
3302
|
-
var h = c.settings, p = h.perSwipe, b = h.touchAngle, w = h.classes, _ = this.touches(l), g = this.threshold(l),
|
|
3303
|
-
this.enable(),
|
|
3302
|
+
var h = c.settings, p = h.perSwipe, b = h.touchAngle, w = h.classes, _ = this.touches(l), g = this.threshold(l), y = _.pageX - n, f = s * 180 / Math.PI;
|
|
3303
|
+
this.enable(), y > g && f < b ? e.Run.make(e.Direction.resolve("".concat(p, "<"))) : y < -g && f < b ? e.Run.make(e.Direction.resolve("".concat(p, ">"))) : e.Move.make(), e.Html.root.classList.remove(w.dragging), this.unbindSwipeMove(), this.unbindSwipeEnd(), t.emit("swipe.end");
|
|
3304
3304
|
}
|
|
3305
3305
|
},
|
|
3306
3306
|
/**
|
|
@@ -3911,7 +3911,7 @@ function li(c) {
|
|
|
3911
3911
|
Te = c;
|
|
3912
3912
|
}
|
|
3913
3913
|
const De = { exec: () => null };
|
|
3914
|
-
function
|
|
3914
|
+
function F(c, e = "") {
|
|
3915
3915
|
let t = typeof c == "string" ? c : c.source;
|
|
3916
3916
|
const i = {
|
|
3917
3917
|
replace: (s, n) => {
|
|
@@ -3979,7 +3979,7 @@ const ie = {
|
|
|
3979
3979
|
fencesBeginRegex: (c) => new RegExp(`^ {0,${Math.min(3, c - 1)}}(?:\`\`\`|~~~)`),
|
|
3980
3980
|
headingBeginRegex: (c) => new RegExp(`^ {0,${Math.min(3, c - 1)}}#`),
|
|
3981
3981
|
htmlBeginRegex: (c) => new RegExp(`^ {0,${Math.min(3, c - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
3982
|
-
}, qs = /^(?:[ \t]*(?:\n|$))+/, Ps = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Is = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, He = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Os = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xt = /(?:[*+-]|\d{1,9}[.)])/, ai = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ci =
|
|
3982
|
+
}, qs = /^(?:[ \t]*(?:\n|$))+/, Ps = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Is = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, He = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Os = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xt = /(?:[*+-]|\d{1,9}[.)])/, ai = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ci = F(ai).replace(/bull/g, xt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), $s = F(ai).replace(/bull/g, xt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), kt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ns = /^[^\n]+/, _t = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ds = F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _t).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Hs = F(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, xt).getRegex(), st = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", St = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, zs = F("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", St).replace("tag", st).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ui = F(kt).replace("hr", He).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", st).getRegex(), Us = F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ui).getRegex(), Tt = {
|
|
3983
3983
|
blockquote: Us,
|
|
3984
3984
|
code: Ps,
|
|
3985
3985
|
def: Ds,
|
|
@@ -3993,22 +3993,22 @@ const ie = {
|
|
|
3993
3993
|
paragraph: ui,
|
|
3994
3994
|
table: De,
|
|
3995
3995
|
text: Ns
|
|
3996
|
-
}, Jt =
|
|
3996
|
+
}, Jt = F("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", He).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", st).getRegex(), js = {
|
|
3997
3997
|
...Tt,
|
|
3998
3998
|
lheading: $s,
|
|
3999
3999
|
table: Jt,
|
|
4000
|
-
paragraph:
|
|
4001
|
-
},
|
|
4000
|
+
paragraph: F(kt).replace("hr", He).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Jt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", st).getRegex()
|
|
4001
|
+
}, Fs = {
|
|
4002
4002
|
...Tt,
|
|
4003
|
-
html:
|
|
4003
|
+
html: F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", St).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
4004
4004
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
4005
4005
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
4006
4006
|
fences: De,
|
|
4007
4007
|
// fences not supported
|
|
4008
4008
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
4009
|
-
paragraph:
|
|
4009
|
+
paragraph: F(kt).replace("hr", He).replace("heading", ` *#{1,6} *[^
|
|
4010
4010
|
]`).replace("lheading", ci).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
4011
|
-
},
|
|
4011
|
+
}, Bs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Gs = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, di = /^( {2,}|\\)\n(?!\s*$)/, Ws = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, nt = /[\p{P}\p{S}]/u, Et = /[\s\p{P}\p{S}]/u, hi = /[^\s\p{P}\p{S}]/u, Vs = F(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Et).getRegex(), pi = /(?!~)[\p{P}\p{S}]/u, Ys = /(?!~)[\s\p{P}\p{S}]/u, Xs = /(?:[^\s\p{P}\p{S}]|~)/u, Js = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, fi = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Zs = F(fi, "u").replace(/punct/g, nt).getRegex(), Qs = F(fi, "u").replace(/punct/g, pi).getRegex(), gi = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ks = F(gi, "gu").replace(/notPunctSpace/g, hi).replace(/punctSpace/g, Et).replace(/punct/g, nt).getRegex(), en = F(gi, "gu").replace(/notPunctSpace/g, Xs).replace(/punctSpace/g, Ys).replace(/punct/g, pi).getRegex(), tn = F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, hi).replace(/punctSpace/g, Et).replace(/punct/g, nt).getRegex(), sn = F(/\\(punct)/, "gu").replace(/punct/g, nt).getRegex(), nn = F(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), rn = F(St).replace("(?:-->|$)", "-->").getRegex(), on = F("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", rn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ze = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, ln = F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ze).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), mi = F(/^!?\[(label)\]\[(ref)\]/).replace("label", Ze).replace("ref", _t).getRegex(), bi = F(/^!?\[(ref)\](?:\[\])?/).replace("ref", _t).getRegex(), an = F("reflink|nolink(?!\\()", "g").replace("reflink", mi).replace("nolink", bi).getRegex(), Ct = {
|
|
4012
4012
|
_backpedal: De,
|
|
4013
4013
|
// only used for GFM url
|
|
4014
4014
|
anyPunctuation: sn,
|
|
@@ -4020,7 +4020,7 @@ const ie = {
|
|
|
4020
4020
|
emStrongLDelim: Zs,
|
|
4021
4021
|
emStrongRDelimAst: Ks,
|
|
4022
4022
|
emStrongRDelimUnd: tn,
|
|
4023
|
-
escape:
|
|
4023
|
+
escape: Bs,
|
|
4024
4024
|
link: ln,
|
|
4025
4025
|
nolink: bi,
|
|
4026
4026
|
punctuation: Vs,
|
|
@@ -4031,24 +4031,24 @@ const ie = {
|
|
|
4031
4031
|
url: De
|
|
4032
4032
|
}, cn = {
|
|
4033
4033
|
...Ct,
|
|
4034
|
-
link:
|
|
4035
|
-
reflink:
|
|
4034
|
+
link: F(/^!?\[(label)\]\((.*?)\)/).replace("label", Ze).getRegex(),
|
|
4035
|
+
reflink: F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ze).getRegex()
|
|
4036
4036
|
}, mt = {
|
|
4037
4037
|
...Ct,
|
|
4038
4038
|
emStrongRDelimAst: en,
|
|
4039
4039
|
emStrongLDelim: Qs,
|
|
4040
|
-
url:
|
|
4040
|
+
url: F(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
4041
4041
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
4042
4042
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
4043
4043
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
4044
4044
|
}, un = {
|
|
4045
4045
|
...mt,
|
|
4046
|
-
br:
|
|
4047
|
-
text:
|
|
4048
|
-
},
|
|
4046
|
+
br: F(di).replace("{2,}", "*").getRegex(),
|
|
4047
|
+
text: F(mt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
4048
|
+
}, Fe = {
|
|
4049
4049
|
normal: Tt,
|
|
4050
4050
|
gfm: js,
|
|
4051
|
-
pedantic:
|
|
4051
|
+
pedantic: Fs
|
|
4052
4052
|
}, Oe = {
|
|
4053
4053
|
normal: Ct,
|
|
4054
4054
|
gfm: mt,
|
|
@@ -4288,22 +4288,22 @@ ${l}` : l;
|
|
|
4288
4288
|
break;
|
|
4289
4289
|
u = t[0], e = e.substring(u.length);
|
|
4290
4290
|
let h = t[2].split(`
|
|
4291
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
4291
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (y) => " ".repeat(3 * y.length)), p = e.split(`
|
|
4292
4292
|
`, 1)[0], b = !h.trim(), w = 0;
|
|
4293
4293
|
if (this.options.pedantic ? (w = 2, l = h.trimStart()) : b ? w = t[1].length + 1 : (w = t[2].search(this.rules.other.nonSpaceChar), w = w > 4 ? 1 : w, l = h.slice(w), w += t[1].length), b && this.rules.other.blankLine.test(p) && (u += p + `
|
|
4294
4294
|
`, e = e.substring(p.length + 1), d = !0), !d) {
|
|
4295
|
-
const
|
|
4295
|
+
const y = this.rules.other.nextBulletRegex(w), f = this.rules.other.hrRegex(w), m = this.rules.other.fencesBeginRegex(w), v = this.rules.other.headingBeginRegex(w), k = this.rules.other.htmlBeginRegex(w);
|
|
4296
4296
|
for (; e; ) {
|
|
4297
4297
|
const x = e.split(`
|
|
4298
4298
|
`, 1)[0];
|
|
4299
4299
|
let S;
|
|
4300
|
-
if (p = x, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), S = p) : S = p.replace(this.rules.other.tabCharGlobal, " "), m.test(p) ||
|
|
4300
|
+
if (p = x, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), S = p) : S = p.replace(this.rules.other.tabCharGlobal, " "), m.test(p) || v.test(p) || k.test(p) || y.test(p) || f.test(p))
|
|
4301
4301
|
break;
|
|
4302
4302
|
if (S.search(this.rules.other.nonSpaceChar) >= w || !p.trim())
|
|
4303
4303
|
l += `
|
|
4304
4304
|
` + S.slice(w);
|
|
4305
4305
|
else {
|
|
4306
|
-
if (b || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || m.test(h) ||
|
|
4306
|
+
if (b || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || m.test(h) || v.test(h) || f.test(h))
|
|
4307
4307
|
break;
|
|
4308
4308
|
l += `
|
|
4309
4309
|
` + p;
|
|
@@ -4643,17 +4643,17 @@ class le {
|
|
|
4643
4643
|
};
|
|
4644
4644
|
const t = {
|
|
4645
4645
|
other: ie,
|
|
4646
|
-
block:
|
|
4646
|
+
block: Fe.normal,
|
|
4647
4647
|
inline: Oe.normal
|
|
4648
4648
|
};
|
|
4649
|
-
this.options.pedantic ? (t.block =
|
|
4649
|
+
this.options.pedantic ? (t.block = Fe.pedantic, t.inline = Oe.pedantic) : this.options.gfm && (t.block = Fe.gfm, this.options.breaks ? t.inline = Oe.breaks : t.inline = Oe.gfm), this.tokenizer.rules = t;
|
|
4650
4650
|
}
|
|
4651
4651
|
/**
|
|
4652
4652
|
* Expose Rules
|
|
4653
4653
|
*/
|
|
4654
4654
|
static get rules() {
|
|
4655
4655
|
return {
|
|
4656
|
-
block:
|
|
4656
|
+
block: Fe,
|
|
4657
4657
|
inline: Oe
|
|
4658
4658
|
};
|
|
4659
4659
|
}
|
|
@@ -7004,14 +7004,14 @@ Check the information and return the details.
|
|
|
7004
7004
|
if (f.value instanceof FileList && f.type === "multifile") {
|
|
7005
7005
|
const m = f.value;
|
|
7006
7006
|
if (m.length > 0)
|
|
7007
|
-
for (const
|
|
7008
|
-
d.append("file[]",
|
|
7007
|
+
for (const v of m)
|
|
7008
|
+
d.append("file[]", v), u = !0;
|
|
7009
7009
|
}
|
|
7010
7010
|
if (f.value instanceof FileList && f.type === "file") {
|
|
7011
7011
|
const m = f.value;
|
|
7012
7012
|
if (m.length > 0) {
|
|
7013
|
-
const
|
|
7014
|
-
d.append("file[]",
|
|
7013
|
+
const v = m[0];
|
|
7014
|
+
d.append("file[]", v), u = !0;
|
|
7015
7015
|
}
|
|
7016
7016
|
}
|
|
7017
7017
|
if (typeof f.value == "string" && f.value.indexOf("base64") !== -1) {
|
|
@@ -7047,12 +7047,12 @@ Check the information and return the details.
|
|
|
7047
7047
|
quality: b,
|
|
7048
7048
|
n: w
|
|
7049
7049
|
}, n.model = o, n.customData = this.builder.settings.customData, n.payload = s, this.builder.payloads.push(n), this.builder.settings.consoleLog && console.log(n);
|
|
7050
|
-
const
|
|
7050
|
+
const v = this.builder.settings.generateMediaUrl_OpenAI_CreateImage;
|
|
7051
7051
|
let k = {
|
|
7052
7052
|
"Content-Type": "application/json",
|
|
7053
7053
|
...this.builder.settings.headers
|
|
7054
7054
|
};
|
|
7055
|
-
h = await fetch(
|
|
7055
|
+
h = await fetch(v, {
|
|
7056
7056
|
signal: this.builder.mediaSignal,
|
|
7057
7057
|
method: "POST",
|
|
7058
7058
|
headers: k,
|
|
@@ -7063,13 +7063,13 @@ Check the information and return the details.
|
|
|
7063
7063
|
this.builder.settings.consoleLog && console.log(_), this.builder.isMediaGenerating = !1;
|
|
7064
7064
|
const g = _.data;
|
|
7065
7065
|
this.builder.output.push(_);
|
|
7066
|
-
let
|
|
7066
|
+
let y = this.renderResult(g, t, i);
|
|
7067
7067
|
return {
|
|
7068
7068
|
mediaGenerated: !0,
|
|
7069
7069
|
status: "success",
|
|
7070
|
-
markdown:
|
|
7071
|
-
output:
|
|
7072
|
-
output2:
|
|
7070
|
+
markdown: y.markdown,
|
|
7071
|
+
output: y.output,
|
|
7072
|
+
output2: y.output2
|
|
7073
7073
|
};
|
|
7074
7074
|
}
|
|
7075
7075
|
async generateGoogle(e, t, i) {
|
|
@@ -7095,14 +7095,14 @@ Check the information and return the details.
|
|
|
7095
7095
|
if (!(u && Object.keys(u).length === 0)) {
|
|
7096
7096
|
for (const g of u)
|
|
7097
7097
|
if (g.value instanceof FileList && g.type === "multifile") {
|
|
7098
|
-
const
|
|
7099
|
-
if (
|
|
7100
|
-
for (const f of
|
|
7101
|
-
const m = await new Promise((
|
|
7098
|
+
const y = g.value;
|
|
7099
|
+
if (y.length > 0)
|
|
7100
|
+
for (const f of y) {
|
|
7101
|
+
const m = await new Promise((v, k) => {
|
|
7102
7102
|
const x = new FileReader();
|
|
7103
7103
|
x.onload = (S) => {
|
|
7104
7104
|
const E = S.target.result.split(",")[1];
|
|
7105
|
-
|
|
7105
|
+
v(E);
|
|
7106
7106
|
}, x.onerror = k, x.readAsDataURL(f);
|
|
7107
7107
|
});
|
|
7108
7108
|
d.push({
|
|
@@ -7156,18 +7156,18 @@ Check the information and return the details.
|
|
|
7156
7156
|
status: "error",
|
|
7157
7157
|
message: this.out("Please input a prompt.")
|
|
7158
7158
|
};
|
|
7159
|
-
let _ = e.width || 1280, g = e.height || 768,
|
|
7160
|
-
if (f > 4 && (f = 4),
|
|
7159
|
+
let _ = e.width || 1280, g = e.height || 768, y = e.aspect_ratio, f = e.num_images || 1;
|
|
7160
|
+
if (f > 4 && (f = 4), y) {
|
|
7161
7161
|
let {
|
|
7162
7162
|
w: U,
|
|
7163
|
-
h:
|
|
7164
|
-
} = this.getDimension(
|
|
7165
|
-
_ = U, g =
|
|
7163
|
+
h: B
|
|
7164
|
+
} = this.getDimension(y);
|
|
7165
|
+
_ = U, g = B;
|
|
7166
7166
|
}
|
|
7167
|
-
let m = e.color1_red,
|
|
7168
|
-
m &&
|
|
7167
|
+
let m = e.color1_red, v = e.color1_green, k = e.color1_blue, x = e.color2_red, S = e.color2_green, E = e.color2_blue, C = e.color3_red, A = e.color3_green, L = e.color3_blue, D = e.color4_red, I = e.color4_green, O = e.color4_blue, R = e.color5_red, q = e.color5_green, M = e.color5_blue, T = [];
|
|
7168
|
+
m && v && k && !(m === "0" && v === "0" && k === "0") && T.push({
|
|
7169
7169
|
r: m,
|
|
7170
|
-
g:
|
|
7170
|
+
g: v,
|
|
7171
7171
|
b: k
|
|
7172
7172
|
}), x && S && E && !(x === "0" && S === "0" && E === "0") && T.push({
|
|
7173
7173
|
r: x,
|
|
@@ -7187,8 +7187,8 @@ Check the information and return the details.
|
|
|
7187
7187
|
b: M
|
|
7188
7188
|
});
|
|
7189
7189
|
let N = await (async () => {
|
|
7190
|
-
let U = [],
|
|
7191
|
-
for (const V of
|
|
7190
|
+
let U = [], B = this.builder.getFormValues();
|
|
7191
|
+
for (const V of B)
|
|
7192
7192
|
if (V.value instanceof FileList && V.type === "multifile") {
|
|
7193
7193
|
const de = V.value;
|
|
7194
7194
|
if (de.length > 0) {
|
|
@@ -7221,9 +7221,9 @@ Check the information and return the details.
|
|
|
7221
7221
|
}, b.indexOf("gemini") !== -1 && (n = {
|
|
7222
7222
|
prompt: w,
|
|
7223
7223
|
input_image_urls: N
|
|
7224
|
-
}), b === "fal-ai/ideogram/v2a" && (
|
|
7224
|
+
}), b === "fal-ai/ideogram/v2a" && (y = this.getClosestAspectRatio(_, g), n = {
|
|
7225
7225
|
prompt: w,
|
|
7226
|
-
aspect_ratio:
|
|
7226
|
+
aspect_ratio: y,
|
|
7227
7227
|
num_images: f
|
|
7228
7228
|
}), b.indexOf("recraft") !== -1 && (n = {
|
|
7229
7229
|
prompt: w,
|
|
@@ -7263,15 +7263,15 @@ Check the information and return the details.
|
|
|
7263
7263
|
status: "error",
|
|
7264
7264
|
message: g.error
|
|
7265
7265
|
};
|
|
7266
|
-
let
|
|
7266
|
+
let y = g[e.image_url], f = g[e.image_url + "_mask"];
|
|
7267
7267
|
if (n = {
|
|
7268
|
-
image_url:
|
|
7268
|
+
image_url: y,
|
|
7269
7269
|
mask_url: f,
|
|
7270
7270
|
prompt: w
|
|
7271
7271
|
// num_images,
|
|
7272
7272
|
}, r.model = b, !f) {
|
|
7273
7273
|
n = {
|
|
7274
|
-
image_url:
|
|
7274
|
+
image_url: y,
|
|
7275
7275
|
prompt: w
|
|
7276
7276
|
};
|
|
7277
7277
|
let m = this.validateModel(e.model, s, "edit_image");
|
|
@@ -7293,11 +7293,11 @@ Check the information and return the details.
|
|
|
7293
7293
|
status: "error",
|
|
7294
7294
|
message: this.out("Please input a prompt.")
|
|
7295
7295
|
};
|
|
7296
|
-
let _ = e.width || 1280, g = e.height || 768,
|
|
7297
|
-
|
|
7298
|
-
let f = e.style || "any", m = e.style_id || this.builder.settings._2dIllustrationStyleId,
|
|
7299
|
-
|
|
7300
|
-
r:
|
|
7296
|
+
let _ = e.width || 1280, g = e.height || 768, y = e.num_images || 1;
|
|
7297
|
+
y > 4 && (y = 4);
|
|
7298
|
+
let f = e.style || "any", m = e.style_id || this.builder.settings._2dIllustrationStyleId, v = e.color1_red, k = e.color1_green, x = e.color1_blue, S = e.color2_red, E = e.color2_green, C = e.color2_blue, A = e.color3_red, L = e.color3_green, D = e.color3_blue, I = e.color4_red, O = e.color4_green, R = e.color4_blue, q = e.color5_red, M = e.color5_green, T = e.color5_blue, $ = [];
|
|
7299
|
+
v && k && x && !(v === "0" && k === "0" && x === "0") && $.push({
|
|
7300
|
+
r: v,
|
|
7301
7301
|
g: k,
|
|
7302
7302
|
b: x
|
|
7303
7303
|
}), S && E && C && !(S === "0" && E === "0" && C === "0") && $.push({
|
|
@@ -7322,7 +7322,7 @@ Check the information and return the details.
|
|
|
7322
7322
|
width: _,
|
|
7323
7323
|
height: g
|
|
7324
7324
|
},
|
|
7325
|
-
num_images:
|
|
7325
|
+
num_images: y,
|
|
7326
7326
|
style: f,
|
|
7327
7327
|
style_id: m,
|
|
7328
7328
|
colors: $
|
|
@@ -7342,12 +7342,12 @@ Check the information and return the details.
|
|
|
7342
7342
|
status: "error",
|
|
7343
7343
|
message: this.out("Please input a prompt.")
|
|
7344
7344
|
};
|
|
7345
|
-
let _ = e.width || 1280, g = e.height || 768,
|
|
7346
|
-
|
|
7347
|
-
let f = e.style || "digital_illustration", m = e.color1_red,
|
|
7348
|
-
m &&
|
|
7345
|
+
let _ = e.width || 1280, g = e.height || 768, y = e.num_images || 1;
|
|
7346
|
+
y > 4 && (y = 4);
|
|
7347
|
+
let f = e.style || "digital_illustration", m = e.color1_red, v = e.color1_green, k = e.color1_blue, x = e.color2_red, S = e.color2_green, E = e.color2_blue, C = e.color3_red, A = e.color3_green, L = e.color3_blue, D = e.color4_red, I = e.color4_green, O = e.color4_blue, R = e.color5_red, q = e.color5_green, M = e.color5_blue, T = [];
|
|
7348
|
+
m && v && k && !(m === "0" && v === "0" && k === "0") && T.push({
|
|
7349
7349
|
r: m,
|
|
7350
|
-
g:
|
|
7350
|
+
g: v,
|
|
7351
7351
|
b: k
|
|
7352
7352
|
}), x && S && E && !(x === "0" && S === "0" && E === "0") && T.push({
|
|
7353
7353
|
r: x,
|
|
@@ -7371,7 +7371,7 @@ Check the information and return the details.
|
|
|
7371
7371
|
width: _,
|
|
7372
7372
|
height: g
|
|
7373
7373
|
},
|
|
7374
|
-
num_images:
|
|
7374
|
+
num_images: y,
|
|
7375
7375
|
style: f,
|
|
7376
7376
|
// style_id,
|
|
7377
7377
|
colors: T
|
|
@@ -7391,12 +7391,12 @@ Check the information and return the details.
|
|
|
7391
7391
|
status: "error",
|
|
7392
7392
|
message: this.out("Please input a prompt.")
|
|
7393
7393
|
};
|
|
7394
|
-
let _ = e.width || 1024, g = e.height || 1365,
|
|
7395
|
-
|
|
7396
|
-
let f = "digital_illustration/cover", m = e.color1_red,
|
|
7397
|
-
m &&
|
|
7394
|
+
let _ = e.width || 1024, g = e.height || 1365, y = e.num_images || 1;
|
|
7395
|
+
y > 4 && (y = 1);
|
|
7396
|
+
let f = "digital_illustration/cover", m = e.color1_red, v = e.color1_green, k = e.color1_blue, x = e.color2_red, S = e.color2_green, E = e.color2_blue, C = e.color3_red, A = e.color3_green, L = e.color3_blue, D = e.color4_red, I = e.color4_green, O = e.color4_blue, R = e.color5_red, q = e.color5_green, M = e.color5_blue, T = [];
|
|
7397
|
+
m && v && k && !(m === "0" && v === "0" && k === "0") && T.push({
|
|
7398
7398
|
r: m,
|
|
7399
|
-
g:
|
|
7399
|
+
g: v,
|
|
7400
7400
|
b: k
|
|
7401
7401
|
}), x && S && E && !(x === "0" && S === "0" && E === "0") && T.push({
|
|
7402
7402
|
r: x,
|
|
@@ -7420,7 +7420,7 @@ Check the information and return the details.
|
|
|
7420
7420
|
width: _,
|
|
7421
7421
|
height: g
|
|
7422
7422
|
},
|
|
7423
|
-
num_images:
|
|
7423
|
+
num_images: y,
|
|
7424
7424
|
style: f,
|
|
7425
7425
|
// style_id,
|
|
7426
7426
|
colors: T
|
|
@@ -7485,15 +7485,15 @@ Check the information and return the details.
|
|
|
7485
7485
|
status: "error",
|
|
7486
7486
|
message: g.error
|
|
7487
7487
|
};
|
|
7488
|
-
let
|
|
7489
|
-
if (!
|
|
7488
|
+
let y = g[e.image_url];
|
|
7489
|
+
if (!y)
|
|
7490
7490
|
return {
|
|
7491
7491
|
mediaGenerated: !1,
|
|
7492
7492
|
status: "error",
|
|
7493
7493
|
message: this.out("Image not provided.")
|
|
7494
7494
|
};
|
|
7495
7495
|
n = {
|
|
7496
|
-
image_url:
|
|
7496
|
+
image_url: y,
|
|
7497
7497
|
prompt: `${w}. No talk. Answer only.`
|
|
7498
7498
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7499
7499
|
} else if (e.image_to_video_generation) {
|
|
@@ -7515,8 +7515,8 @@ Check the information and return the details.
|
|
|
7515
7515
|
status: "error",
|
|
7516
7516
|
message: g.error
|
|
7517
7517
|
};
|
|
7518
|
-
let
|
|
7519
|
-
if (!
|
|
7518
|
+
let y = g[e.image_url];
|
|
7519
|
+
if (!y)
|
|
7520
7520
|
return {
|
|
7521
7521
|
mediaGenerated: !1,
|
|
7522
7522
|
status: "error",
|
|
@@ -7524,7 +7524,7 @@ Check the information and return the details.
|
|
|
7524
7524
|
};
|
|
7525
7525
|
n = {
|
|
7526
7526
|
prompt: w,
|
|
7527
|
-
image_url:
|
|
7527
|
+
image_url: y,
|
|
7528
7528
|
duration: _,
|
|
7529
7529
|
aspect_ratio: "16:9"
|
|
7530
7530
|
// 9:16, 1:1
|
|
@@ -7718,17 +7718,17 @@ Check the information and return the details.
|
|
|
7718
7718
|
message: this.out("Please provide model information in the context.")
|
|
7719
7719
|
};
|
|
7720
7720
|
let h = await this.uploadMultiple();
|
|
7721
|
-
((g,
|
|
7721
|
+
((g, y) => {
|
|
7722
7722
|
const f = (m) => {
|
|
7723
7723
|
if (Array.isArray(m)) {
|
|
7724
|
-
const
|
|
7725
|
-
if (k && m.every((x) => x ===
|
|
7724
|
+
const v = m[0], k = y.find((x) => x.name === v);
|
|
7725
|
+
if (k && m.every((x) => x === v))
|
|
7726
7726
|
return k.files;
|
|
7727
7727
|
for (let x = 0; x < m.length; x++)
|
|
7728
7728
|
m[x] = f(m[x]);
|
|
7729
7729
|
} else if (typeof m == "object" && m !== null)
|
|
7730
|
-
for (let
|
|
7731
|
-
m[
|
|
7730
|
+
for (let v in m)
|
|
7731
|
+
m[v] = f(m[v]);
|
|
7732
7732
|
return m;
|
|
7733
7733
|
};
|
|
7734
7734
|
return f(g);
|
|
@@ -7741,40 +7741,40 @@ Check the information and return the details.
|
|
|
7741
7741
|
message: w.error
|
|
7742
7742
|
};
|
|
7743
7743
|
Object.keys(u).forEach((g) => {
|
|
7744
|
-
Object.keys(w).forEach((
|
|
7745
|
-
if (u[g] ===
|
|
7746
|
-
let f = w[
|
|
7744
|
+
Object.keys(w).forEach((y) => {
|
|
7745
|
+
if (u[g] === y) {
|
|
7746
|
+
let f = w[y];
|
|
7747
7747
|
u[g] = f;
|
|
7748
7748
|
}
|
|
7749
7749
|
if (Array.isArray(u[g])) {
|
|
7750
7750
|
for (let f = 0; f < u[g].length; f++)
|
|
7751
|
-
if (u[g][f] ===
|
|
7752
|
-
let m = w[
|
|
7751
|
+
if (u[g][f] === y) {
|
|
7752
|
+
let m = w[y];
|
|
7753
7753
|
u[g][f] = m;
|
|
7754
7754
|
}
|
|
7755
7755
|
}
|
|
7756
7756
|
});
|
|
7757
7757
|
}), Object.keys(u).forEach((g) => {
|
|
7758
|
-
let
|
|
7759
|
-
if (b(
|
|
7760
|
-
for (const f in
|
|
7761
|
-
Object.prototype.hasOwnProperty.call(
|
|
7762
|
-
if (
|
|
7763
|
-
let
|
|
7764
|
-
|
|
7758
|
+
let y = u[g];
|
|
7759
|
+
if (b(y))
|
|
7760
|
+
for (const f in y)
|
|
7761
|
+
Object.prototype.hasOwnProperty.call(y, f) && Object.keys(w).forEach((m) => {
|
|
7762
|
+
if (y[f] === m) {
|
|
7763
|
+
let v = w[m];
|
|
7764
|
+
y[f] = v, m === v && !v.startsWith("http") && (y[f] = "");
|
|
7765
7765
|
}
|
|
7766
7766
|
});
|
|
7767
|
-
if (Array.isArray(
|
|
7768
|
-
for (let f = 0; f <
|
|
7769
|
-
if (b(
|
|
7770
|
-
for (const m in
|
|
7771
|
-
Object.prototype.hasOwnProperty.call(
|
|
7772
|
-
if (
|
|
7773
|
-
let k = w[
|
|
7774
|
-
|
|
7767
|
+
if (Array.isArray(y)) {
|
|
7768
|
+
for (let f = 0; f < y.length; f++)
|
|
7769
|
+
if (b(y[f]))
|
|
7770
|
+
for (const m in y[f])
|
|
7771
|
+
Object.prototype.hasOwnProperty.call(y[f], m) && Object.keys(w).forEach((v) => {
|
|
7772
|
+
if (y[f][m] === v) {
|
|
7773
|
+
let k = w[v];
|
|
7774
|
+
y[f][m] = k, v === k && !k.startsWith("http") && (y[f][m] = "");
|
|
7775
7775
|
}
|
|
7776
7776
|
});
|
|
7777
|
-
u[g] = [...
|
|
7777
|
+
u[g] = [...y.filter((f) => f !== "")];
|
|
7778
7778
|
}
|
|
7779
7779
|
});
|
|
7780
7780
|
let _ = {};
|
|
@@ -7841,22 +7841,22 @@ Check the information and return the details.
|
|
|
7841
7841
|
//this.out('Request failed.')
|
|
7842
7842
|
};
|
|
7843
7843
|
{
|
|
7844
|
-
const
|
|
7844
|
+
const y = g.url, f = `
|
|
7845
7845
|
<div class="image-container">
|
|
7846
7846
|
<div>
|
|
7847
|
-
<img src="${
|
|
7847
|
+
<img src="${y}" />
|
|
7848
7848
|
<div>
|
|
7849
|
-
<a class="link-view" href="${
|
|
7850
|
-
<a class="link-download" href="${
|
|
7849
|
+
<a class="link-view" href="${y}" target="_blank" rel="noopener noreferrer">${this.out("View")}</a>
|
|
7850
|
+
<a class="link-download" href="${y}" download>${this.out("Download")}</a>
|
|
7851
7851
|
</div>
|
|
7852
7852
|
</div>
|
|
7853
7853
|
</div>`;
|
|
7854
|
-
let m = ``;
|
|
7855
7855
|
return o ? (r.innerHTML = "", r.remove()) : (r.innerHTML = f, this.builder.outputHtml += `<div class="result-container">${f}</div>`), this.builder.isMediaGenerating = !1, {
|
|
7856
7856
|
mediaGenerated: !0,
|
|
7857
7857
|
status: "success",
|
|
7858
7858
|
markdown: m,
|
|
7859
|
-
output: [
|
|
7859
|
+
output: [y]
|
|
7860
7860
|
};
|
|
7861
7861
|
}
|
|
7862
7862
|
} else {
|
|
@@ -8288,18 +8288,18 @@ class bn {
|
|
|
8288
8288
|
willReadFrequently: !0
|
|
8289
8289
|
}), _ = document.createElement("canvas"), g = _.getContext("2d", {
|
|
8290
8290
|
willReadFrequently: !0
|
|
8291
|
-
}),
|
|
8291
|
+
}), y = this.element.querySelector(".inp-imagemask"), f = (T) => {
|
|
8292
8292
|
const $ = document.createElement("canvas"), N = $.getContext("2d", {
|
|
8293
8293
|
willReadFrequently: !0
|
|
8294
8294
|
});
|
|
8295
8295
|
$.width = T.width, $.height = T.height, N.clearRect(0, 0, T.width, T.height), N.fillStyle = "black", N.fillRect(0, 0, T.width, T.height), N.drawImage(T, 0, 0);
|
|
8296
8296
|
const U = $.toDataURL("image/png");
|
|
8297
|
-
let
|
|
8298
|
-
|
|
8297
|
+
let B = document.querySelector(".imagemask-output");
|
|
8298
|
+
B || (B = document.createElement("img"), B.className = "imagemask-output", document.body.appendChild(B)), B.src = U, this.empty || (y.value = U);
|
|
8299
8299
|
};
|
|
8300
|
-
let m = [],
|
|
8300
|
+
let m = [], v = [];
|
|
8301
8301
|
const k = () => {
|
|
8302
|
-
m.push(_.toDataURL()), m.length > 10 && m.shift(),
|
|
8302
|
+
m.push(_.toDataURL()), m.length > 10 && m.shift(), v = [];
|
|
8303
8303
|
}, x = (T) => {
|
|
8304
8304
|
const $ = new Image();
|
|
8305
8305
|
$.src = T, $.onload = () => {
|
|
@@ -8309,15 +8309,15 @@ class bn {
|
|
|
8309
8309
|
b.addEventListener("mousedown", () => {
|
|
8310
8310
|
k();
|
|
8311
8311
|
}), d.addEventListener("click", (T) => {
|
|
8312
|
-
T.preventDefault(), m.length > 0 && (
|
|
8312
|
+
T.preventDefault(), m.length > 0 && (v.push(b.toDataURL()), x(m.pop()));
|
|
8313
8313
|
}), u.addEventListener("click", (T) => {
|
|
8314
|
-
T.preventDefault(),
|
|
8314
|
+
T.preventDefault(), v.length > 0 && (m.push(b.toDataURL()), x(v.pop()));
|
|
8315
8315
|
});
|
|
8316
8316
|
const S = document.createElement("img");
|
|
8317
8317
|
n.appendChild(S), n.appendChild(b), this.loaded = () => {
|
|
8318
8318
|
n.style.display = "flex";
|
|
8319
8319
|
const T = document.querySelector(".imagemask-controls");
|
|
8320
|
-
T.style.display = "flex", e.style.display = "flex", A(), m = [],
|
|
8320
|
+
T.style.display = "flex", e.style.display = "flex", A(), m = [], v = [], w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0, y.value = "";
|
|
8321
8321
|
try {
|
|
8322
8322
|
f(_);
|
|
8323
8323
|
} catch {
|
|
@@ -8330,8 +8330,8 @@ class bn {
|
|
|
8330
8330
|
b.width > 0 && b.height > 0 && (E = w.getImageData(0, 0, b.width, b.height), C = g.getImageData(0, 0, _.width, _.height));
|
|
8331
8331
|
const T = S.offsetWidth, $ = S.offsetHeight, N = window.devicePixelRatio || 1;
|
|
8332
8332
|
b.width = T * N, b.height = $ * N, w.scale(N, N), b.style.width = `${T}px`, b.style.height = `${$}px`;
|
|
8333
|
-
const U = S.naturalWidth,
|
|
8334
|
-
if (_.width = U * N, _.height =
|
|
8333
|
+
const U = S.naturalWidth, B = S.naturalHeight;
|
|
8334
|
+
if (_.width = U * N, _.height = B * N, g.scale(N, N), _.style.width = `${U}px`, _.style.height = `${B}px`, E) {
|
|
8335
8335
|
const V = document.createElement("canvas");
|
|
8336
8336
|
V.width = E.width, V.height = E.height, V.getContext("2d").putImageData(E, 0, 0);
|
|
8337
8337
|
const ne = document.createElement("canvas");
|
|
@@ -8364,7 +8364,7 @@ class bn {
|
|
|
8364
8364
|
const {
|
|
8365
8365
|
x: $,
|
|
8366
8366
|
y: N
|
|
8367
|
-
} = I(T), U = _.width / b.width,
|
|
8367
|
+
} = I(T), U = _.width / b.width, B = _.height / b.height, V = $ * U, de = N * B;
|
|
8368
8368
|
w.fillStyle = "rgb(255, 255, 255)", w.beginPath(), w.arc($, N, D / 2, 0, Math.PI * 2), w.fill(), g.fillStyle = "rgb(255, 255, 255)", g.beginPath(), g.arc(V, de, D / 2 * U, 0, Math.PI * 2), g.fill();
|
|
8369
8369
|
};
|
|
8370
8370
|
b.addEventListener("mousedown", O), b.addEventListener("mouseup", R), b.addEventListener("mousemove", q), b.addEventListener("touchstart", (T) => {
|
|
@@ -8378,7 +8378,7 @@ class bn {
|
|
|
8378
8378
|
}, {
|
|
8379
8379
|
passive: !1
|
|
8380
8380
|
}), l.addEventListener("click", (T) => {
|
|
8381
|
-
T.preventDefault(), k(), w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0,
|
|
8381
|
+
T.preventDefault(), k(), w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0, y.value = "", f(_);
|
|
8382
8382
|
}), window.addEventListener("resize", A);
|
|
8383
8383
|
const M = (T) => {
|
|
8384
8384
|
T ? (e.setAttribute("aria-modal", "true"), e.setAttribute("role", "dialog"), e.classList.add("fullscreen"), t.style.display = "block", i.style.display = "flex", h.style.display = "none") : (e.removeAttribute("aria-modal"), e.removeAttribute("role"), e.classList.remove("fullscreen"), t.style.display = "none", i.style.display = "none", h.style.display = ""), A();
|
|
@@ -8901,8 +8901,8 @@ class yn {
|
|
|
8901
8901
|
} else if (l.tag === "audio") {
|
|
8902
8902
|
const g = document.createElement("audio");
|
|
8903
8903
|
g.controls = !0;
|
|
8904
|
-
let
|
|
8905
|
-
|
|
8904
|
+
let y = document.createElement("source");
|
|
8905
|
+
y.src = l.url, y.type = "audio/mp3", g.appendChild(y), l.displayInOutput || r.appendChild(g);
|
|
8906
8906
|
} else if (l.tag === "img") {
|
|
8907
8907
|
const g = document.createElement("img");
|
|
8908
8908
|
g.src = l.url, g.setAttribute("alt", this.out("Output Image")), l.displayInOutput || r.appendChild(g);
|
|
@@ -8917,15 +8917,15 @@ class yn {
|
|
|
8917
8917
|
if (l.type === "video") {
|
|
8918
8918
|
const g = document.createElement("video");
|
|
8919
8919
|
g.style.width = "100%", g.style.height = "auto", g.controls = !0;
|
|
8920
|
-
let
|
|
8921
|
-
|
|
8920
|
+
let y = document.createElement("source");
|
|
8921
|
+
y.src = l.url, y.type = "video/mp4", g.appendChild(y), l.displayInOutput || r.appendChild(g);
|
|
8922
8922
|
return;
|
|
8923
8923
|
}
|
|
8924
8924
|
if (l.type === "audio") {
|
|
8925
8925
|
const g = document.createElement("audio");
|
|
8926
8926
|
g.controls = !0;
|
|
8927
|
-
let
|
|
8928
|
-
|
|
8927
|
+
let y = document.createElement("source");
|
|
8928
|
+
y.src = l.url, y.type = "audio/mp3", g.appendChild(y), l.displayInOutput || r.appendChild(g);
|
|
8929
8929
|
return;
|
|
8930
8930
|
}
|
|
8931
8931
|
const p = document.createElement("div");
|
|
@@ -8934,8 +8934,8 @@ class yn {
|
|
|
8934
8934
|
let w = l.name;
|
|
8935
8935
|
if (r.querySelector(`[name="${w}"]`) && (o++, w = w + "_" + o), b === "short-text") {
|
|
8936
8936
|
let g = this.getId();
|
|
8937
|
-
const
|
|
8938
|
-
if (
|
|
8937
|
+
const y = document.createElement("label");
|
|
8938
|
+
if (y.setAttribute("for", `short_text_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8939
8939
|
const m = document.createElement("div");
|
|
8940
8940
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8941
8941
|
}
|
|
@@ -8944,8 +8944,8 @@ class yn {
|
|
|
8944
8944
|
}
|
|
8945
8945
|
if (b === "long-text") {
|
|
8946
8946
|
let g = this.getId();
|
|
8947
|
-
const
|
|
8948
|
-
if (
|
|
8947
|
+
const y = document.createElement("label");
|
|
8948
|
+
if (y.setAttribute("for", `long_text_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8949
8949
|
const m = document.createElement("div");
|
|
8950
8950
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8951
8951
|
}
|
|
@@ -8954,8 +8954,8 @@ class yn {
|
|
|
8954
8954
|
}
|
|
8955
8955
|
if (b === "number") {
|
|
8956
8956
|
let g = this.getId();
|
|
8957
|
-
const
|
|
8958
|
-
if (
|
|
8957
|
+
const y = document.createElement("label");
|
|
8958
|
+
if (y.setAttribute("for", `number_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8959
8959
|
const m = document.createElement("div");
|
|
8960
8960
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8961
8961
|
}
|
|
@@ -8965,8 +8965,8 @@ class yn {
|
|
|
8965
8965
|
if (b === "slider") {
|
|
8966
8966
|
p.classList.add("input-slider");
|
|
8967
8967
|
let g = this.getId();
|
|
8968
|
-
const
|
|
8969
|
-
if (
|
|
8968
|
+
const y = document.createElement("label");
|
|
8969
|
+
if (y.setAttribute("for", `number_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8970
8970
|
const E = document.createElement("div");
|
|
8971
8971
|
E.className = "field-note", E.innerHTML = l.fieldNote, p.appendChild(E);
|
|
8972
8972
|
}
|
|
@@ -8974,8 +8974,8 @@ class yn {
|
|
|
8974
8974
|
f.className = "slider-container", p.appendChild(f);
|
|
8975
8975
|
const m = document.createElement("div");
|
|
8976
8976
|
m.className = "slider-values", f.appendChild(m);
|
|
8977
|
-
const
|
|
8978
|
-
m.appendChild(
|
|
8977
|
+
const v = document.createElement("span");
|
|
8978
|
+
m.appendChild(v), v.innerText = l.minValue;
|
|
8979
8979
|
const k = document.createElement("span");
|
|
8980
8980
|
m.appendChild(k), k.innerText = l.maxValue;
|
|
8981
8981
|
const x = document.createElement("input");
|
|
@@ -8987,30 +8987,30 @@ class yn {
|
|
|
8987
8987
|
}
|
|
8988
8988
|
if (b === "select") {
|
|
8989
8989
|
let g = this.getId();
|
|
8990
|
-
const
|
|
8991
|
-
if (
|
|
8990
|
+
const y = document.createElement("div");
|
|
8991
|
+
if (y.id = `radio_group_label_${g}`, y.className = "field-label-normal", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8992
8992
|
const m = document.createElement("div");
|
|
8993
8993
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8994
8994
|
}
|
|
8995
8995
|
const f = document.createElement("div");
|
|
8996
|
-
if (f.setAttribute("aria-labelledby", `radio_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m,
|
|
8996
|
+
if (f.setAttribute("aria-labelledby", `radio_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m, v) => {
|
|
8997
8997
|
let k = m;
|
|
8998
|
-
l.choicesText && (k = l.choicesText[
|
|
8998
|
+
l.choicesText && (k = l.choicesText[v] || m);
|
|
8999
8999
|
const x = document.createElement("label");
|
|
9000
|
-
x.setAttribute("for", `${g}_${
|
|
9000
|
+
x.setAttribute("for", `${g}_${v}`), x.className = "option-label", f.appendChild(x);
|
|
9001
9001
|
const S = document.createElement("input");
|
|
9002
|
-
S.type = "radio", S.className = "peer", S.id = `${g}_${
|
|
9002
|
+
S.type = "radio", S.className = "peer", S.id = `${g}_${v}`, S.name = w, S.value = m, x.appendChild(S), v === l.selected && (S.checked = !0);
|
|
9003
9003
|
const E = document.createElement("span");
|
|
9004
9004
|
E.className = "peer-span-rounded", x.appendChild(E);
|
|
9005
9005
|
const C = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 7a5 5 0 1 1 -4.995 5.217l-.005 -.217l.005 -.217a5 5 0 0 1 4.995 -4.783z"></path></svg>';
|
|
9006
|
-
E.innerHTML = C,
|
|
9006
|
+
E.innerHTML = C, v === 0 && l.isRequired && S.setAttribute("required", "required");
|
|
9007
9007
|
const A = document.createElement("span");
|
|
9008
9008
|
A.innerText = k, x.appendChild(A), S.addEventListener("change", this.changeListener);
|
|
9009
9009
|
}), l.showOtherItem) {
|
|
9010
9010
|
const m = document.createElement("label");
|
|
9011
9011
|
m.setAttribute("for", g + "_other"), m.className = "option-label", f.appendChild(m);
|
|
9012
|
-
const
|
|
9013
|
-
|
|
9012
|
+
const v = document.createElement("input");
|
|
9013
|
+
v.type = "radio", v.className = "peer", v.id = g + "_other", v.name = w, v.value = "other", m.appendChild(v);
|
|
9014
9014
|
const k = document.createElement("span");
|
|
9015
9015
|
k.className = "peer-span-rounded", m.appendChild(k);
|
|
9016
9016
|
const x = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 7a5 5 0 1 1 -4.995 5.217l-.005 -.217l.005 -.217a5 5 0 0 1 4.995 -4.783z"></path></svg>';
|
|
@@ -9020,24 +9020,24 @@ class yn {
|
|
|
9020
9020
|
const E = document.createElement("div");
|
|
9021
9021
|
p.appendChild(E);
|
|
9022
9022
|
const C = document.createElement("input");
|
|
9023
|
-
C.type = "text", C.name = w + "_other", C.className = "inp-base", E.appendChild(C),
|
|
9023
|
+
C.type = "text", C.name = w + "_other", C.className = "inp-base", E.appendChild(C), v.addEventListener("change", this.changeListener), C.addEventListener("input", this.inputListener);
|
|
9024
9024
|
}
|
|
9025
9025
|
}
|
|
9026
9026
|
if (b === "multi-select") {
|
|
9027
9027
|
let g = this.getId();
|
|
9028
|
-
const
|
|
9029
|
-
if (
|
|
9028
|
+
const y = document.createElement("div");
|
|
9029
|
+
if (y.id = `checkbox_group_label_${g}`, y.className = "field-label-normal", y.innerHTML = l.title + (l.isRequired ? ` <span class="text-red-500" aria-hidden="true">*</span><span style="position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;white-space:nowrap;">(${this.out("required")})</span>` : ""), p.appendChild(y), l.fieldNote) {
|
|
9030
9030
|
const m = document.createElement("div");
|
|
9031
9031
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9032
9032
|
}
|
|
9033
9033
|
const f = document.createElement("div");
|
|
9034
|
-
if (f.setAttribute("aria-labelledby", `checkbox_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m,
|
|
9034
|
+
if (f.setAttribute("aria-labelledby", `checkbox_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m, v) => {
|
|
9035
9035
|
let k = m;
|
|
9036
|
-
l.choicesText && (k = l.choicesText[
|
|
9036
|
+
l.choicesText && (k = l.choicesText[v] || m);
|
|
9037
9037
|
const x = document.createElement("label");
|
|
9038
|
-
x.setAttribute("for", `${g}_${
|
|
9038
|
+
x.setAttribute("for", `${g}_${v}`), x.className = "option-label", f.appendChild(x);
|
|
9039
9039
|
const S = document.createElement("input");
|
|
9040
|
-
S.type = "checkbox", S.className = "peer", S.id = `${g}_${
|
|
9040
|
+
S.type = "checkbox", S.className = "peer", S.id = `${g}_${v}`, S.name = w + "[]", S.value = m, x.appendChild(S);
|
|
9041
9041
|
const E = document.createElement("span");
|
|
9042
9042
|
E.className = "peer-span-square", x.appendChild(E);
|
|
9043
9043
|
const C = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -9049,8 +9049,8 @@ class yn {
|
|
|
9049
9049
|
}), l.showOtherItem) {
|
|
9050
9050
|
const m = document.createElement("label");
|
|
9051
9051
|
m.setAttribute("for", g + "_other"), m.className = "option-label", f.appendChild(m);
|
|
9052
|
-
const
|
|
9053
|
-
|
|
9052
|
+
const v = document.createElement("input");
|
|
9053
|
+
v.type = "checkbox", v.className = "peer", v.id = g + "_other", v.name = w, v.value = "other", m.appendChild(v);
|
|
9054
9054
|
const k = document.createElement("span");
|
|
9055
9055
|
k.className = "peer-span-square", m.appendChild(k);
|
|
9056
9056
|
const x = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -9062,13 +9062,13 @@ class yn {
|
|
|
9062
9062
|
const E = document.createElement("div");
|
|
9063
9063
|
p.appendChild(E);
|
|
9064
9064
|
const C = document.createElement("input");
|
|
9065
|
-
C.type = "text", C.name = w + "_other", C.className = "inp-base", E.appendChild(C),
|
|
9065
|
+
C.type = "text", C.name = w + "_other", C.className = "inp-base", E.appendChild(C), v.addEventListener("change", this.changeListener), C.addEventListener("input", this.inputListener);
|
|
9066
9066
|
}
|
|
9067
9067
|
}
|
|
9068
9068
|
if (b === "switch") {
|
|
9069
9069
|
let g = this.getId();
|
|
9070
|
-
const
|
|
9071
|
-
if (
|
|
9070
|
+
const y = document.createElement("label");
|
|
9071
|
+
if (y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), y.id = `switch_${g}`, p.appendChild(y), l.fieldNote) {
|
|
9072
9072
|
const x = document.createElement("div");
|
|
9073
9073
|
x.className = "field-note", x.innerHTML = l.fieldNote, p.appendChild(x);
|
|
9074
9074
|
}
|
|
@@ -9076,13 +9076,13 @@ class yn {
|
|
|
9076
9076
|
f.className = "switch", f.tabIndex = 0, f.role = "switch", f.setAttribute("aria-labelledby", `switch_${g}`), f.setAttribute("aria-checked", "false"), f.setAttribute("data-checked", "false"), p.appendChild(f);
|
|
9077
9077
|
const m = document.createElement("div");
|
|
9078
9078
|
m.className = "switch-thumb", f.appendChild(m);
|
|
9079
|
-
const
|
|
9080
|
-
|
|
9079
|
+
const v = document.createElement("input");
|
|
9080
|
+
v.id = `switch_input_${g}`, v.setAttribute("aria-hidden", "true"), v.type = "text", v.name = w, v.style.cssText = "position:absolute;bottom:0px;left:25px;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;", v.setAttribute("tabindex", "-1"), l.isRequired && (v.setAttribute("required", "required"), v.setCustomValidity(this.out("Please toggle this switch to proceed.")), f.setAttribute("aria-required", "true")), p.appendChild(v), l.value === "true" ? (f.setAttribute("aria-checked", "true"), f.setAttribute("data-checked", "true"), v.value = "true", l.isRequired && v.setCustomValidity("")) : (f.setAttribute("aria-checked", "false"), f.setAttribute("data-checked", "false"), v.value = "false", l.isRequired && v.setCustomValidity(this.out("Please toggle this switch to proceed."))), y.addEventListener("click", () => {
|
|
9081
9081
|
f.focus();
|
|
9082
9082
|
});
|
|
9083
9083
|
const k = () => {
|
|
9084
9084
|
const x = f.getAttribute("aria-checked") === "true";
|
|
9085
|
-
f.setAttribute("aria-checked", !x), f.setAttribute("data-checked", !x), x ? (
|
|
9085
|
+
f.setAttribute("aria-checked", !x), f.setAttribute("data-checked", !x), x ? (v.value = "false", l.isRequired && v.setCustomValidity(this.out("Please toggle this switch to proceed."))) : (v.value = "true", l.isRequired && v.setCustomValidity(""));
|
|
9086
9086
|
const S = this.getFormValues();
|
|
9087
9087
|
this.settings.onInputChange && this.settings.onInputChange(S);
|
|
9088
9088
|
};
|
|
@@ -9094,8 +9094,8 @@ class yn {
|
|
|
9094
9094
|
}
|
|
9095
9095
|
if (b === "dropdown") {
|
|
9096
9096
|
let g = this.getId();
|
|
9097
|
-
const
|
|
9098
|
-
if (
|
|
9097
|
+
const y = document.createElement("label");
|
|
9098
|
+
if (y.setAttribute("for", `dropdown_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9099
9099
|
const A = document.createElement("div");
|
|
9100
9100
|
A.className = "field-note", A.innerHTML = l.fieldNote, p.appendChild(A);
|
|
9101
9101
|
}
|
|
@@ -9103,17 +9103,17 @@ class yn {
|
|
|
9103
9103
|
f.className = "relative", p.appendChild(f);
|
|
9104
9104
|
const m = document.createElement("div");
|
|
9105
9105
|
m.className = "relative inline-block", f.appendChild(m);
|
|
9106
|
-
const
|
|
9107
|
-
|
|
9106
|
+
const v = document.createElement("select");
|
|
9107
|
+
v.id = `dropdown_${g}`, v.name = w, l.isRequired && v.setAttribute("required", "required"), m.appendChild(v);
|
|
9108
9108
|
const k = document.createElement("option");
|
|
9109
|
-
if (k.setAttribute("selected", "selected"), k.setAttribute("disabled", "disabled"), k.value = "", k.innerText = l.placeholder,
|
|
9109
|
+
if (k.setAttribute("selected", "selected"), k.setAttribute("disabled", "disabled"), k.value = "", k.innerText = l.placeholder, v.appendChild(k), l.choices && l.choices.forEach((A, L) => {
|
|
9110
9110
|
let D = A;
|
|
9111
9111
|
l.choicesText && (D = l.choicesText[L] || A);
|
|
9112
9112
|
const I = document.createElement("option");
|
|
9113
|
-
I.value = A, I.innerText = D,
|
|
9113
|
+
I.value = A, I.innerText = D, v.appendChild(I), L === l.selected && (k.remove(), I.setAttribute("selected", "selected"));
|
|
9114
9114
|
}), l.showOtherItem) {
|
|
9115
9115
|
const A = document.createElement("option");
|
|
9116
|
-
A.value = "other", A.innerText = l.otherText,
|
|
9116
|
+
A.value = "other", A.innerText = l.otherText, v.appendChild(A);
|
|
9117
9117
|
}
|
|
9118
9118
|
const x = document.createElement("div");
|
|
9119
9119
|
x.className = "select-arrow", m.appendChild(x), this.appendHtml(x, `
|
|
@@ -9132,8 +9132,8 @@ class yn {
|
|
|
9132
9132
|
}
|
|
9133
9133
|
if (b === "date") {
|
|
9134
9134
|
let g = this.getId();
|
|
9135
|
-
const
|
|
9136
|
-
if (
|
|
9135
|
+
const y = document.createElement("label");
|
|
9136
|
+
if (y.setAttribute("for", `date_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9137
9137
|
const m = document.createElement("div");
|
|
9138
9138
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9139
9139
|
}
|
|
@@ -9142,8 +9142,8 @@ class yn {
|
|
|
9142
9142
|
}
|
|
9143
9143
|
if (b === "time") {
|
|
9144
9144
|
let g = this.getId();
|
|
9145
|
-
const
|
|
9146
|
-
if (
|
|
9145
|
+
const y = document.createElement("label");
|
|
9146
|
+
if (y.setAttribute("for", `time_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9147
9147
|
const m = document.createElement("div");
|
|
9148
9148
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9149
9149
|
}
|
|
@@ -9152,8 +9152,8 @@ class yn {
|
|
|
9152
9152
|
}
|
|
9153
9153
|
if (b === "datetime") {
|
|
9154
9154
|
let g = this.getId();
|
|
9155
|
-
const
|
|
9156
|
-
if (
|
|
9155
|
+
const y = document.createElement("label");
|
|
9156
|
+
if (y.setAttribute("for", `datetime_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9157
9157
|
const m = document.createElement("div");
|
|
9158
9158
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9159
9159
|
}
|
|
@@ -9162,8 +9162,8 @@ class yn {
|
|
|
9162
9162
|
}
|
|
9163
9163
|
if (b === "color") {
|
|
9164
9164
|
let g = this.getId();
|
|
9165
|
-
const
|
|
9166
|
-
if (
|
|
9165
|
+
const y = document.createElement("label");
|
|
9166
|
+
if (y.setAttribute("for", `color_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9167
9167
|
const m = document.createElement("div");
|
|
9168
9168
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9169
9169
|
}
|
|
@@ -9172,8 +9172,8 @@ class yn {
|
|
|
9172
9172
|
}
|
|
9173
9173
|
if (b === "file" || b === "multifile") {
|
|
9174
9174
|
let g = this.getId();
|
|
9175
|
-
const
|
|
9176
|
-
if (
|
|
9175
|
+
const y = document.createElement("label");
|
|
9176
|
+
if (y.setAttribute("for", `file_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9177
9177
|
const P = document.createElement("div");
|
|
9178
9178
|
P.className = "field-note", P.innerHTML = l.fieldNote, p.appendChild(P);
|
|
9179
9179
|
}
|
|
@@ -9182,10 +9182,10 @@ class yn {
|
|
|
9182
9182
|
const m = document.createElement("input");
|
|
9183
9183
|
m.id = `input_url_label_${g}`, m.type = "text", m.name = w + "__url", m.value = l.value || "", m.className = "inp-base input-file-url", m.placeholder = l.placeholder || this.out("Enter URL."), p.appendChild(m), m.addEventListener("input", () => {
|
|
9184
9184
|
const P = p.querySelector(".btn-clearfile");
|
|
9185
|
-
P && P.click(), this.inputListener(), m.value !== "" ? l.isRequired &&
|
|
9185
|
+
P && P.click(), this.inputListener(), m.value !== "" ? l.isRequired && v.removeAttribute("required") : l.isRequired && v.setAttribute("required", "required"), rt(m.value), this.clearSelectedFiles();
|
|
9186
9186
|
}), l.useURL ? m.style.display = "" : m.style.display = "none";
|
|
9187
|
-
const
|
|
9188
|
-
|
|
9187
|
+
const v = document.createElement("input");
|
|
9188
|
+
v.id = `file_${g}`, v.type = "file", b === "multifile" && (v.multiple = !0), v.name = w, l.isRequired && v.setAttribute("required", "required"), v.className = "peer", f.appendChild(v);
|
|
9189
9189
|
const k = document.createElement("div");
|
|
9190
9190
|
k.className = "file-drop-area", f.appendChild(k);
|
|
9191
9191
|
const x = document.createElement("div");
|
|
@@ -9210,7 +9210,7 @@ class yn {
|
|
|
9210
9210
|
A.className = "file-preview-container", f.appendChild(A);
|
|
9211
9211
|
const L = document.createElement("div");
|
|
9212
9212
|
L.className = "file-drop-info-highlight", L.id = `file_name_${g}`, f.appendChild(L), E && E.addEventListener("click", (P) => {
|
|
9213
|
-
P.preventDefault(),
|
|
9213
|
+
P.preventDefault(), v.click();
|
|
9214
9214
|
}), f.classList.add("disabledrop"), (!l.source || l.source && l.source === "local" || l.source && l.source === "local_and_camera") && (f.classList.remove("disabledrop"), f.addEventListener("dragover", (P) => {
|
|
9215
9215
|
P.preventDefault(), Array.from(P.dataTransfer.items).some((se) => se.kind === "file") && f.classList.add("drag-over");
|
|
9216
9216
|
}), f.addEventListener("dragleave", () => {
|
|
@@ -9219,22 +9219,22 @@ class yn {
|
|
|
9219
9219
|
if (P.preventDefault(), P.dataTransfer.files && P.dataTransfer.files.length > 0) {
|
|
9220
9220
|
f.classList.remove("drag-over");
|
|
9221
9221
|
const Y = P.dataTransfer.files[0];
|
|
9222
|
-
Y && (
|
|
9222
|
+
Y && (v.files = P.dataTransfer.files, qe(Y), this.clearSelectedFiles());
|
|
9223
9223
|
}
|
|
9224
9224
|
}) : b === "multifile" && f.addEventListener("drop", (P) => {
|
|
9225
9225
|
if (P.preventDefault(), P.dataTransfer.files && P.dataTransfer.files.length > 0) {
|
|
9226
9226
|
f.classList.remove("drag-over"), A.innerHTML = "";
|
|
9227
9227
|
const Y = P.dataTransfer.files;
|
|
9228
|
-
Y.length > 0 && (
|
|
9228
|
+
Y.length > 0 && (v.files = Y, Array.from(Y).forEach((se) => {
|
|
9229
9229
|
Pe(se);
|
|
9230
9230
|
}), this.clearSelectedFiles());
|
|
9231
9231
|
}
|
|
9232
|
-
})), b === "file" ?
|
|
9233
|
-
const P =
|
|
9232
|
+
})), b === "file" ? v.addEventListener("change", () => {
|
|
9233
|
+
const P = v.files[0];
|
|
9234
9234
|
P && (qe(P), this.clearSelectedFiles());
|
|
9235
|
-
}) : b === "multifile" &&
|
|
9235
|
+
}) : b === "multifile" && v.addEventListener("change", () => {
|
|
9236
9236
|
A.innerHTML = "";
|
|
9237
|
-
const P =
|
|
9237
|
+
const P = v.files;
|
|
9238
9238
|
Array.from(P).forEach((Y) => {
|
|
9239
9239
|
Y && (Pe(Y), this.clearSelectedFiles());
|
|
9240
9240
|
});
|
|
@@ -9327,7 +9327,7 @@ class yn {
|
|
|
9327
9327
|
}
|
|
9328
9328
|
});
|
|
9329
9329
|
const R = I.map((P) => P.type).join(",");
|
|
9330
|
-
|
|
9330
|
+
v.setAttribute("accept", R);
|
|
9331
9331
|
let q;
|
|
9332
9332
|
if (l.useImageMask) {
|
|
9333
9333
|
p.classList.add("image-mask");
|
|
@@ -9376,7 +9376,7 @@ class yn {
|
|
|
9376
9376
|
</div>
|
|
9377
9377
|
`;
|
|
9378
9378
|
this.appendHtml(f, T);
|
|
9379
|
-
const $ = p.querySelector(".livevideo"), N = p.querySelector(".photo-captured"), U = p.querySelector(".btn-selectfile2"),
|
|
9379
|
+
const $ = p.querySelector(".livevideo"), N = p.querySelector(".photo-captured"), U = p.querySelector(".btn-selectfile2"), B = p.querySelector(".btn-takephoto2"), V = p.querySelector(".btn-capturephoto"), de = p.querySelector(".btn-clearphoto"), ne = p.querySelector(".btn-stopcamera");
|
|
9380
9380
|
this.photoBlob = {};
|
|
9381
9381
|
let be;
|
|
9382
9382
|
U && U.addEventListener("click", (P) => {
|
|
@@ -9393,26 +9393,26 @@ class yn {
|
|
|
9393
9393
|
alert("Unable to access the camera."), $.style.display = "none", V.style.display = "none", ne.style.display = "none", x.style.display = "none", L.style.display = "none";
|
|
9394
9394
|
}
|
|
9395
9395
|
setTimeout(() => {
|
|
9396
|
-
|
|
9396
|
+
B.style.display = "none", N.style.display = "none", $.style.display = "", V.style.display = "", de.style.display = "none", U && (U.style.display = "none"), B.style.display = "none", ne.style.display = "", x.style.display = "none", L.style.display = "none";
|
|
9397
9397
|
}, 100);
|
|
9398
9398
|
};
|
|
9399
9399
|
C && C.addEventListener("click", async (P) => {
|
|
9400
9400
|
P.preventDefault(), Ee();
|
|
9401
|
-
}),
|
|
9401
|
+
}), B.addEventListener("click", async (P) => {
|
|
9402
9402
|
P.preventDefault(), Ee();
|
|
9403
9403
|
}), ne.addEventListener("click", () => {
|
|
9404
|
-
be && be.getTracks().forEach((P) => P.stop()), $.style.display = "none", V.style.display = "none", ne.style.display = "none",
|
|
9404
|
+
be && be.getTracks().forEach((P) => P.stop()), $.style.display = "none", V.style.display = "none", ne.style.display = "none", B.style.display = "none", x.style.display = "", L.style.display = "";
|
|
9405
9405
|
}), V.addEventListener("click", (P) => {
|
|
9406
|
-
if (P.preventDefault(), N.style.display = "", N.width = $.videoWidth, N.height = $.videoHeight, N.getContext("2d").drawImage($, 0, 0, N.width, N.height), be.getTracks().forEach((Y) => Y.stop()), $.style.display = "none", V.style.display = "none", de.style.display = "", U && (U.style.display = ""),
|
|
9407
|
-
this.photoBlob[w] = Y,
|
|
9408
|
-
}, "image/jpeg"),
|
|
9406
|
+
if (P.preventDefault(), N.style.display = "", N.width = $.videoWidth, N.height = $.videoHeight, N.getContext("2d").drawImage($, 0, 0, N.width, N.height), be.getTracks().forEach((Y) => Y.stop()), $.style.display = "none", V.style.display = "none", de.style.display = "", U && (U.style.display = ""), B.style.display = "", ne.style.display = "none", N.toBlob((Y) => {
|
|
9407
|
+
this.photoBlob[w] = Y, v.removeAttribute("required");
|
|
9408
|
+
}, "image/jpeg"), B.style.display = "", l.useImageMask) {
|
|
9409
9409
|
const Y = N.toDataURL("image/jpeg");
|
|
9410
9410
|
q.setImage(Y);
|
|
9411
9411
|
}
|
|
9412
9412
|
this.clearSelectedFiles();
|
|
9413
9413
|
});
|
|
9414
9414
|
const Ae = () => {
|
|
9415
|
-
this.photoBlob[w] = null, N.style.display = "none", N.getContext("2d").clearRect(0, 0, N.width, N.height), m.value !== "" ? l.isRequired &&
|
|
9415
|
+
this.photoBlob[w] = null, N.style.display = "none", N.getContext("2d").clearRect(0, 0, N.width, N.height), m.value !== "" ? l.isRequired && v.removeAttribute("required") : l.isRequired && v.setAttribute("required", "required"), de.style.display = "none", U && (U.style.display = "none"), B.style.display = "none", x.style.display = "", L.style.display = "";
|
|
9416
9416
|
};
|
|
9417
9417
|
de.addEventListener("click", () => {
|
|
9418
9418
|
Ae();
|
|
@@ -9437,7 +9437,7 @@ class yn {
|
|
|
9437
9437
|
</svg>
|
|
9438
9438
|
`, L.appendChild(K), K.addEventListener("click", (j) => {
|
|
9439
9439
|
let ke = K.closest(".form-field").querySelector(".img-preview");
|
|
9440
|
-
ke && ke.remove(), m.value = "",
|
|
9440
|
+
ke && ke.remove(), m.value = "", v.value = "", L.innerHTML = "", S.innerText = this.out(this.settings.fileUploadText), l.useImageMask && q.clearImage();
|
|
9441
9441
|
const Ie = document.querySelector(".formview-container .submit-container");
|
|
9442
9442
|
Ie && setTimeout(() => {
|
|
9443
9443
|
this.stickyElement(Ie);
|
|
@@ -9480,7 +9480,7 @@ class yn {
|
|
|
9480
9480
|
</svg>
|
|
9481
9481
|
`, L.appendChild(ce), ce.addEventListener("click", (K) => {
|
|
9482
9482
|
let j = ce.closest(".form-field").querySelector(".img-preview");
|
|
9483
|
-
j && j.remove(),
|
|
9483
|
+
j && j.remove(), v.value = "", L.innerHTML = "", S.innerText = this.out(this.settings.fileUploadText), l.useImageMask && q.clearImage();
|
|
9484
9484
|
const ve = document.querySelector(".formview-container .submit-container");
|
|
9485
9485
|
ve && setTimeout(() => {
|
|
9486
9486
|
this.stickyElement(ve);
|
|
@@ -9520,10 +9520,10 @@ class yn {
|
|
|
9520
9520
|
`, ce.appendChild(he), he.addEventListener("click", (j) => {
|
|
9521
9521
|
const ve = he.closest(".image-item");
|
|
9522
9522
|
ve && ve.remove(), ((yi) => {
|
|
9523
|
-
const Rt = new DataTransfer(), vi =
|
|
9523
|
+
const Rt = new DataTransfer(), vi = v.files;
|
|
9524
9524
|
Array.from(vi).forEach((Mt) => {
|
|
9525
9525
|
Mt !== yi && Rt.items.add(Mt);
|
|
9526
|
-
}),
|
|
9526
|
+
}), v.files = Rt.files;
|
|
9527
9527
|
})(P);
|
|
9528
9528
|
const Ie = document.querySelector(".formview-container .submit-container");
|
|
9529
9529
|
Ie && setTimeout(() => {
|
|
@@ -9547,8 +9547,8 @@ class yn {
|
|
|
9547
9547
|
}
|
|
9548
9548
|
if (b === "email") {
|
|
9549
9549
|
let g = this.getId();
|
|
9550
|
-
const
|
|
9551
|
-
if (
|
|
9550
|
+
const y = document.createElement("label");
|
|
9551
|
+
if (y.setAttribute("for", `email_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9552
9552
|
const m = document.createElement("div");
|
|
9553
9553
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9554
9554
|
}
|
|
@@ -9557,8 +9557,8 @@ class yn {
|
|
|
9557
9557
|
}
|
|
9558
9558
|
if (b === "phone") {
|
|
9559
9559
|
let g = this.getId();
|
|
9560
|
-
const
|
|
9561
|
-
if (
|
|
9560
|
+
const y = document.createElement("label");
|
|
9561
|
+
if (y.setAttribute("for", `phone_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9562
9562
|
const m = document.createElement("div");
|
|
9563
9563
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9564
9564
|
}
|
|
@@ -9567,8 +9567,8 @@ class yn {
|
|
|
9567
9567
|
}
|
|
9568
9568
|
if (b === "url") {
|
|
9569
9569
|
let g = this.getId();
|
|
9570
|
-
const
|
|
9571
|
-
if (
|
|
9570
|
+
const y = document.createElement("label");
|
|
9571
|
+
if (y.setAttribute("for", `url_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9572
9572
|
const m = document.createElement("div");
|
|
9573
9573
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9574
9574
|
}
|
|
@@ -9577,8 +9577,8 @@ class yn {
|
|
|
9577
9577
|
}
|
|
9578
9578
|
if (b === "hidden") {
|
|
9579
9579
|
let g = this.getId();
|
|
9580
|
-
const
|
|
9581
|
-
|
|
9580
|
+
const y = document.createElement("label");
|
|
9581
|
+
y.setAttribute("for", `hidden_label_${g}`), y.className = "field-label hidden", y.innerText = l.title, p.appendChild(y);
|
|
9582
9582
|
const f = document.createElement("input");
|
|
9583
9583
|
f.id = `hidden_label_${g}`, f.type = "hidden", f.name = w, f.value = l.value, p.appendChild(f);
|
|
9584
9584
|
}
|
|
@@ -9622,18 +9622,18 @@ class yn {
|
|
|
9622
9622
|
_.setAttribute("for", `short_text_label_${w}`), _.className = "field-label", _.innerHTML = l, b.appendChild(_);
|
|
9623
9623
|
const g = document.createElement("input");
|
|
9624
9624
|
if (g.id = `short_text_label_${w}`, g.type = "text", g.name = h, g.autocomplete = "off", g.setAttribute("aria-hidden", "true"), g.setAttribute("tabindex", "-1"), g.className = "inp-base", b.appendChild(g), this.settings.captchaContainer) {
|
|
9625
|
-
const
|
|
9626
|
-
f.className = "captcha-container",
|
|
9625
|
+
const y = this.settings.captchaContainerClassName, f = document.createElement("div");
|
|
9626
|
+
f.className = "captcha-container", y && f.classList.add(y), r.appendChild(f);
|
|
9627
9627
|
}
|
|
9628
9628
|
if (t.useSubmitButton) {
|
|
9629
|
-
const
|
|
9630
|
-
|
|
9629
|
+
const y = document.createElement("div");
|
|
9630
|
+
y.className = "submit-container", r.appendChild(y);
|
|
9631
9631
|
let f = !0;
|
|
9632
9632
|
if ("hideReset" in t && (f = t.hideReset), !f) {
|
|
9633
9633
|
const S = document.createElement("button");
|
|
9634
9634
|
S.className = "btn-resetform";
|
|
9635
9635
|
const E = t.resetText || this.settings.resetText;
|
|
9636
|
-
S.innerText = E,
|
|
9636
|
+
S.innerText = E, y.appendChild(S), S.addEventListener("click", (A) => {
|
|
9637
9637
|
A.preventDefault();
|
|
9638
9638
|
const L = S.closest("form");
|
|
9639
9639
|
L && (L.reset(), L.querySelectorAll(".btn-clearfile").forEach((O) => {
|
|
@@ -9646,8 +9646,8 @@ class yn {
|
|
|
9646
9646
|
}
|
|
9647
9647
|
const m = document.createElement("button");
|
|
9648
9648
|
m.className = "btn-submitform";
|
|
9649
|
-
const
|
|
9650
|
-
m.innerText =
|
|
9649
|
+
const v = t.submitText;
|
|
9650
|
+
m.innerText = v, y.appendChild(m), (t.fullWidthButton || !1) && m.classList.add("w-full"), this.settings.alwaysVisibleSubmit && y.classList.add("always-visible"), this.stickyElement(y), m.addEventListener("click", async (S) => {
|
|
9651
9651
|
this.trigger("submit", S);
|
|
9652
9652
|
});
|
|
9653
9653
|
const x = r.closest("form");
|
|
@@ -9951,8 +9951,8 @@ ${e}`);
|
|
|
9951
9951
|
let u = await this.search(e);
|
|
9952
9952
|
const l = this.settings.scrapeExclude;
|
|
9953
9953
|
let h = u.filter((g) => {
|
|
9954
|
-
let
|
|
9955
|
-
return !l.some((f) =>
|
|
9954
|
+
let y = new URL(g.link).hostname;
|
|
9955
|
+
return !l.some((f) => y.includes(f));
|
|
9956
9956
|
});
|
|
9957
9957
|
const p = this.settings.scrapeLimit, b = h.slice(0, p);
|
|
9958
9958
|
s.innerHTML = "", d = document.createElement("p"), d.innerHTML = this.out("Getting more information..."), s.appendChild(d);
|
|
@@ -10089,18 +10089,18 @@ ${e}`);
|
|
|
10089
10089
|
</span>
|
|
10090
10090
|
${this.out("Abort")}
|
|
10091
10091
|
`, this.isNormal = !0), this.isGenerating = !0;
|
|
10092
|
-
let u = (m,
|
|
10092
|
+
let u = (m, v) => {
|
|
10093
10093
|
if (m === void 0) return "";
|
|
10094
10094
|
if (!isNaN(m)) return m;
|
|
10095
10095
|
let k = m;
|
|
10096
|
-
return
|
|
10096
|
+
return v && v.trim().startsWith("{") && (k = JSON.stringify(m).slice(1, -1)), k;
|
|
10097
10097
|
};
|
|
10098
10098
|
t.innerHTML = "";
|
|
10099
10099
|
let l = JSON.parse(JSON.stringify(this.steps)), h = this.getFormValues();
|
|
10100
10100
|
if (!h) return;
|
|
10101
10101
|
if (!(h && Object.keys(h).length === 0)) {
|
|
10102
10102
|
for (const m of l) {
|
|
10103
|
-
let
|
|
10103
|
+
let v = m.prompt;
|
|
10104
10104
|
if (m.provider === "google") {
|
|
10105
10105
|
for (const x of h)
|
|
10106
10106
|
if (x.value instanceof FileList && x.value.length > 0) {
|
|
@@ -10113,30 +10113,30 @@ ${e}`);
|
|
|
10113
10113
|
A(O);
|
|
10114
10114
|
}, D.onerror = L, D.readAsDataURL(E);
|
|
10115
10115
|
});
|
|
10116
|
-
|
|
10116
|
+
v = v.replaceAll(`{{${x.name}}}`, C), v = v.replaceAll(`{{${x.name.toUpperCase()}}}`, C);
|
|
10117
10117
|
}
|
|
10118
10118
|
}
|
|
10119
|
-
m.prompt =
|
|
10119
|
+
m.prompt = v;
|
|
10120
10120
|
}
|
|
10121
10121
|
l.forEach((m) => {
|
|
10122
|
-
let
|
|
10122
|
+
let v = m.prompt;
|
|
10123
10123
|
h.forEach((k) => {
|
|
10124
10124
|
if (k.value === void 0 && (k.value = ""), typeof k.value == "object" && Array.isArray(k.value)) {
|
|
10125
10125
|
const x = k.value.join(", ");
|
|
10126
|
-
|
|
10127
|
-
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (
|
|
10128
|
-
}), m.prompt =
|
|
10126
|
+
v = v.replaceAll(`{{${k.name}}}`, x), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, x);
|
|
10127
|
+
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (v = v.replaceAll(`{{${k.name}}}`, k.name), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (v = v.replaceAll(`{{${k.name}}}`, u(k.value, m.prompt)), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, u(k.value, m.prompt)));
|
|
10128
|
+
}), m.prompt = v;
|
|
10129
10129
|
}), l.forEach((m) => {
|
|
10130
|
-
let
|
|
10130
|
+
let v = m.context;
|
|
10131
10131
|
h.forEach((k) => {
|
|
10132
10132
|
if (k.value || (k.value = ""), typeof k.value == "object" && Array.isArray(k.value)) {
|
|
10133
10133
|
const x = k.value.join(", ");
|
|
10134
|
-
|
|
10135
|
-
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (
|
|
10136
|
-
}), m.context =
|
|
10134
|
+
v = v.replaceAll(`{{${k.name}}}`, x), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, x);
|
|
10135
|
+
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (v = v.replaceAll(`{{${k.name}}}`, k.name), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (v = v.replaceAll(`{{${k.name}}}`, u(k.value, m.prompt)), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, u(k.value, m.prompt)));
|
|
10136
|
+
}), m.context = v;
|
|
10137
10137
|
});
|
|
10138
10138
|
}
|
|
10139
|
-
const p = async (m,
|
|
10139
|
+
const p = async (m, v, k, x, S, E, C, A) => {
|
|
10140
10140
|
const L = document.createElement("div");
|
|
10141
10141
|
L.classList.add("result-container"), t.appendChild(L), L.innerHTML = `
|
|
10142
10142
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 20" width="27" height="20" fill="currentColor">
|
|
@@ -10168,12 +10168,12 @@ ${e}`);
|
|
|
10168
10168
|
|
|
10169
10169
|
`, o.setAttribute("disabled", "")));
|
|
10170
10170
|
let O = "", R = "", q;
|
|
10171
|
-
if (C && C.search && (q = await this.getRelevantInfo(m,
|
|
10171
|
+
if (C && C.search && (q = await this.getRelevantInfo(m, v, L), q.data !== "" && (v += `
|
|
10172
10172
|
Use the following information to answer the request:
|
|
10173
10173
|
|
|
10174
10174
|
${q.data}
|
|
10175
10175
|
`)), C && (C.image || C.video || C.audio) || D) {
|
|
10176
|
-
const M = await this.media.generate(m,
|
|
10176
|
+
const M = await this.media.generate(m, v, k, x, C, L, A);
|
|
10177
10177
|
return this.needCleanup = !0, this.settings.consoleLog && console.log(M), M.mediaGenerated ? {
|
|
10178
10178
|
media: M.output,
|
|
10179
10179
|
media2: M.output2,
|
|
@@ -10182,7 +10182,7 @@ ${q.data}
|
|
|
10182
10182
|
}
|
|
10183
10183
|
if (this.settings.assistantId) {
|
|
10184
10184
|
if (this.settings.assistantStreamUrl)
|
|
10185
|
-
await this.assistantStream(m,
|
|
10185
|
+
await this.assistantStream(m, v, S, E, async (M) => {
|
|
10186
10186
|
if (!(M && typeof M == "object")) {
|
|
10187
10187
|
if (O += M, !A) {
|
|
10188
10188
|
const T = z.parse(O);
|
|
@@ -10196,7 +10196,7 @@ ${q.data}
|
|
|
10196
10196
|
}, 10);
|
|
10197
10197
|
}), A && (L.innerHTML = "", L.remove()), this.outputHtml += `<div class="result-container">${R}</div>`;
|
|
10198
10198
|
else if (this.settings.assistantUrl) {
|
|
10199
|
-
let M = await this.assistant(m,
|
|
10199
|
+
let M = await this.assistant(m, v, S, E);
|
|
10200
10200
|
if (!M)
|
|
10201
10201
|
return !1;
|
|
10202
10202
|
if (O = M, A)
|
|
@@ -10209,24 +10209,24 @@ ${q.data}
|
|
|
10209
10209
|
} else if (this.settings.sendCommandStreamUrl) {
|
|
10210
10210
|
let M = "", T = "", $ = "";
|
|
10211
10211
|
const N = async (U) => {
|
|
10212
|
-
let
|
|
10213
|
-
for (;
|
|
10214
|
-
if ($ = M.slice(0, $.length + 1),
|
|
10212
|
+
let B = 0;
|
|
10213
|
+
for (; B < U.length; ) {
|
|
10214
|
+
if ($ = M.slice(0, $.length + 1), B++, !A) {
|
|
10215
10215
|
const V = z.parse($);
|
|
10216
10216
|
L.innerHTML = V, T = V;
|
|
10217
10217
|
}
|
|
10218
10218
|
await new Promise((V) => setTimeout(V, 50));
|
|
10219
10219
|
}
|
|
10220
10220
|
};
|
|
10221
|
-
await this.sendStream(m,
|
|
10221
|
+
await this.sendStream(m, v, S, x, E, async (U) => {
|
|
10222
10222
|
O += U, M += U, await N(U);
|
|
10223
10223
|
}), await new Promise((U) => {
|
|
10224
|
-
const
|
|
10225
|
-
$.length === M.length && (clearInterval(
|
|
10224
|
+
const B = setInterval(() => {
|
|
10225
|
+
$.length === M.length && (clearInterval(B), U());
|
|
10226
10226
|
}, 10);
|
|
10227
10227
|
}), A && (L.innerHTML = "", L.remove()), this.outputHtml += `<div class="result-container">${T}</div>`;
|
|
10228
10228
|
} else {
|
|
10229
|
-
let M = await this.send(m,
|
|
10229
|
+
let M = await this.send(m, v, S, x, E);
|
|
10230
10230
|
if (!M)
|
|
10231
10231
|
return !1;
|
|
10232
10232
|
if (O = M, A)
|
|
@@ -10251,7 +10251,7 @@ ${q.data}
|
|
|
10251
10251
|
}
|
|
10252
10252
|
return this.payloads.push({
|
|
10253
10253
|
prompt: m,
|
|
10254
|
-
context:
|
|
10254
|
+
context: v
|
|
10255
10255
|
}), this.output.push(O), {
|
|
10256
10256
|
media: [],
|
|
10257
10257
|
markdown: O
|
|
@@ -10259,7 +10259,7 @@ ${q.data}
|
|
|
10259
10259
|
};
|
|
10260
10260
|
d || await (async (m) => {
|
|
10261
10261
|
this.previousResults = [], this.outputHtml = "";
|
|
10262
|
-
for (let
|
|
10262
|
+
for (let v = 0; v < m.length; v++) {
|
|
10263
10263
|
if (!this.isGenerating)
|
|
10264
10264
|
return;
|
|
10265
10265
|
let {
|
|
@@ -10271,7 +10271,7 @@ ${q.data}
|
|
|
10271
10271
|
functs: A,
|
|
10272
10272
|
tools: L,
|
|
10273
10273
|
hideOutput: D
|
|
10274
|
-
} = m[
|
|
10274
|
+
} = m[v];
|
|
10275
10275
|
S = S || "", x = x || "", C = C || "You are an assistant", A = A || [];
|
|
10276
10276
|
let I = k;
|
|
10277
10277
|
this.previousResults.forEach((R, q) => {
|
|
@@ -10286,11 +10286,11 @@ ${q.data}
|
|
|
10286
10286
|
break;
|
|
10287
10287
|
if (this.mediaGenerated.push(...O.media), O.media && O.media.length === 1) {
|
|
10288
10288
|
let R = O.media[0], q = O.media2 && O.media2.length === 1 && O.media2[0];
|
|
10289
|
-
this.previousResults.push(q || R), D && (this.filesUploaded[`output_step_${
|
|
10289
|
+
this.previousResults.push(q || R), D && (this.filesUploaded[`output_step_${v}`] = R);
|
|
10290
10290
|
} else
|
|
10291
10291
|
this.previousResults.push(O.markdown);
|
|
10292
10292
|
}
|
|
10293
|
-
})(l), d && (e === 0 && (this.previousResults = []), await (async (
|
|
10293
|
+
})(l), d && (e === 0 && (this.previousResults = []), await (async (v, k) => {
|
|
10294
10294
|
if (!this.isGenerating)
|
|
10295
10295
|
return;
|
|
10296
10296
|
let {
|
|
@@ -10302,7 +10302,7 @@ ${q.data}
|
|
|
10302
10302
|
functs: L,
|
|
10303
10303
|
tools: D,
|
|
10304
10304
|
hideOutput: I
|
|
10305
|
-
} =
|
|
10305
|
+
} = v[k];
|
|
10306
10306
|
S = S || "", A = A || "You are an assistant", L = L || [];
|
|
10307
10307
|
let O = x;
|
|
10308
10308
|
this.previousResults && this.previousResults.forEach((q, M) => {
|
|
@@ -10322,7 +10322,7 @@ ${q.data}
|
|
|
10322
10322
|
})(l, e)), o.innerHTML = a, o.removeAttribute("disabled"), this.isGenerating = !1;
|
|
10323
10323
|
const w = this.calculateCost();
|
|
10324
10324
|
this.settings.onUsage && this.settings.onUsage(w), this.trigger("usage", w), this.isNormal = !1, this.isSingle = !1;
|
|
10325
|
-
const _ = (m,
|
|
10325
|
+
const _ = (m, v = 100) => {
|
|
10326
10326
|
const k = document.createElement("div");
|
|
10327
10327
|
if (k.innerHTML = m, k.querySelector("video"))
|
|
10328
10328
|
return "Video";
|
|
@@ -10331,7 +10331,7 @@ ${q.data}
|
|
|
10331
10331
|
if (k.querySelector("audio"))
|
|
10332
10332
|
return "Audio";
|
|
10333
10333
|
const x = k.textContent.trim();
|
|
10334
|
-
return x.length >
|
|
10334
|
+
return x.length > v ? x.substring(0, v) + "..." : x;
|
|
10335
10335
|
}, g = Object.keys(this.filesUploaded).length === 0 && this.filesUploaded.constructor === Object;
|
|
10336
10336
|
if (this.needCleanup && !g) {
|
|
10337
10337
|
this.settings.consoleLog && (console.log("Cleanup"), console.log(this.filesUploaded));
|
|
@@ -10345,19 +10345,19 @@ ${q.data}
|
|
|
10345
10345
|
body: JSON.stringify(this.filesUploaded)
|
|
10346
10346
|
});
|
|
10347
10347
|
}
|
|
10348
|
-
let
|
|
10349
|
-
this.mediaGenerated = this.mediaGenerated.filter((m) =>
|
|
10350
|
-
previewText: _(
|
|
10348
|
+
let y = this.outputHtml;
|
|
10349
|
+
this.mediaGenerated = this.mediaGenerated.filter((m) => y.indexOf(m) !== -1), this.trigger("resultReady", {
|
|
10350
|
+
previewText: _(y),
|
|
10351
10351
|
markdown: this.previousResults,
|
|
10352
|
-
html:
|
|
10352
|
+
html: y,
|
|
10353
10353
|
media: this.mediaGenerated,
|
|
10354
10354
|
// return the collected generated media from all steps
|
|
10355
10355
|
input: this.payloads,
|
|
10356
10356
|
output: this.output
|
|
10357
|
-
}), this.settings.saveResults && (localStorage.setItem("_results", JSON.stringify(this.previousResults)), localStorage.setItem("_results_html",
|
|
10358
|
-
m.addEventListener("click", async (
|
|
10359
|
-
|
|
10360
|
-
const k =
|
|
10357
|
+
}), this.settings.saveResults && (localStorage.setItem("_results", JSON.stringify(this.previousResults)), localStorage.setItem("_results_html", y)), this.addResultTool(), t.querySelectorAll(".link-download").forEach((m) => {
|
|
10358
|
+
m.addEventListener("click", async (v) => {
|
|
10359
|
+
v.preventDefault();
|
|
10360
|
+
const k = v.target.href;
|
|
10361
10361
|
try {
|
|
10362
10362
|
const x = await fetch(k, {
|
|
10363
10363
|
mode: "cors"
|
|
@@ -10557,17 +10557,17 @@ ${q.data}
|
|
|
10557
10557
|
for (; !_; ) {
|
|
10558
10558
|
const {
|
|
10559
10559
|
done: g,
|
|
10560
|
-
value:
|
|
10560
|
+
value: y
|
|
10561
10561
|
} = await p.read();
|
|
10562
10562
|
if (_ = g, _) break;
|
|
10563
|
-
const f = b.decode(
|
|
10563
|
+
const f = b.decode(y, {
|
|
10564
10564
|
stream: !0
|
|
10565
10565
|
});
|
|
10566
10566
|
w += f;
|
|
10567
10567
|
const m = w.split(`
|
|
10568
10568
|
`);
|
|
10569
10569
|
w = "";
|
|
10570
|
-
let
|
|
10570
|
+
let v = 0, k = 0;
|
|
10571
10571
|
for (const x of m)
|
|
10572
10572
|
if (x.trim() !== "" && x.startsWith("data:")) {
|
|
10573
10573
|
const S = x.slice(5).trim();
|
|
@@ -10577,7 +10577,7 @@ ${q.data}
|
|
|
10577
10577
|
}
|
|
10578
10578
|
try {
|
|
10579
10579
|
const E = JSON.parse(S);
|
|
10580
|
-
if (E.usage && (
|
|
10580
|
+
if (E.usage && (v = E.usage.prompt_tokens, k = E.usage.completion_tokens), E.choices && E.choices[0].delta && E.choices[0].delta.content) {
|
|
10581
10581
|
const C = E.choices[0].delta.content;
|
|
10582
10582
|
r && r(C);
|
|
10583
10583
|
}
|
|
@@ -10586,7 +10586,7 @@ ${q.data}
|
|
|
10586
10586
|
`;
|
|
10587
10587
|
}
|
|
10588
10588
|
}
|
|
10589
|
-
this.tokenInput +=
|
|
10589
|
+
this.tokenInput += v, this.tokenOutput += k;
|
|
10590
10590
|
}
|
|
10591
10591
|
return !0;
|
|
10592
10592
|
} catch (l) {
|
|
@@ -10666,20 +10666,20 @@ ${q.data}
|
|
|
10666
10666
|
value: g
|
|
10667
10667
|
} = await h.read();
|
|
10668
10668
|
if (w = _, w) break;
|
|
10669
|
-
const
|
|
10669
|
+
const y = p.decode(g, {
|
|
10670
10670
|
stream: !0
|
|
10671
10671
|
});
|
|
10672
|
-
b +=
|
|
10672
|
+
b += y;
|
|
10673
10673
|
const f = b.split(`
|
|
10674
10674
|
`);
|
|
10675
10675
|
b = "";
|
|
10676
10676
|
for (const m of f)
|
|
10677
10677
|
if (m.trim() !== "")
|
|
10678
10678
|
if (m.startsWith("data:")) {
|
|
10679
|
-
const
|
|
10680
|
-
|
|
10679
|
+
const v = m.slice(5).trim();
|
|
10680
|
+
v === "[DONE]" && this.settings.consoleLog && console.log("Stream completed.");
|
|
10681
10681
|
try {
|
|
10682
|
-
const k = JSON.parse(
|
|
10682
|
+
const k = JSON.parse(v);
|
|
10683
10683
|
if (k.choices && k.choices[0].delta && k.choices[0].delta.content) {
|
|
10684
10684
|
const x = k.choices[0].delta.content;
|
|
10685
10685
|
n && n(x);
|
|
@@ -10689,8 +10689,8 @@ ${q.data}
|
|
|
10689
10689
|
`;
|
|
10690
10690
|
}
|
|
10691
10691
|
} else {
|
|
10692
|
-
const
|
|
10693
|
-
this.tokenInput +=
|
|
10692
|
+
const v = JSON.parse(m);
|
|
10693
|
+
this.tokenInput += v.prompt_tokens, this.tokenOutput += v.completion_tokens;
|
|
10694
10694
|
break;
|
|
10695
10695
|
}
|
|
10696
10696
|
}
|
|
@@ -10750,6 +10750,10 @@ class vn {
|
|
|
10750
10750
|
// Plugin registry
|
|
10751
10751
|
autoLoad: !0,
|
|
10752
10752
|
pluginBaseUrl: "",
|
|
10753
|
+
autoRegisterPlugins: !0,
|
|
10754
|
+
// Load a plugin found in the content even when it is not registered
|
|
10755
|
+
pluginFolder: "",
|
|
10756
|
+
// Folder holding the plugins (<folder><name>/index.js); found from the registered plugins when empty
|
|
10753
10757
|
allowExternalPlugins: !0,
|
|
10754
10758
|
// Simple on/off for external plugins
|
|
10755
10759
|
trustedDomains: [],
|
|
@@ -10757,18 +10761,54 @@ class vn {
|
|
|
10757
10761
|
onReInit: () => {
|
|
10758
10762
|
},
|
|
10759
10763
|
...e
|
|
10760
|
-
}, this.plugins = /* @__PURE__ */ new Map(), this.loadedStyles = /* @__PURE__ */ new
|
|
10764
|
+
}, this.plugins = /* @__PURE__ */ new Map(), this.loadedStyles = /* @__PURE__ */ new Map(), this.components = /* @__PURE__ */ new Map(), this.externalPlugins = /* @__PURE__ */ new Map(), this.autoPlugins = {}, this.missingPlugins = /* @__PURE__ */ new Set();
|
|
10765
|
+
}
|
|
10766
|
+
/**
|
|
10767
|
+
* Whether a plugin can be loaded. A plugin that is not registered is registered
|
|
10768
|
+
* from the plugins folder (<folder><name>/index.js and style.css), when
|
|
10769
|
+
* autoRegisterPlugins is on. Only a plain name is accepted, so the file always
|
|
10770
|
+
* comes from the plugins folder.
|
|
10771
|
+
*/
|
|
10772
|
+
canLoad(e) {
|
|
10773
|
+
if (this.config.plugins[e] || this.autoPlugins[e]) return !0;
|
|
10774
|
+
if (!this.config.autoRegisterPlugins || e === "code" || this.missingPlugins.has(e) || !/^[a-z0-9][a-z0-9-]*$/.test(e)) return !1;
|
|
10775
|
+
const t = this.getPluginFolder();
|
|
10776
|
+
return t ? (this.autoPlugins[e] = { url: t + e + "/index.js", css: t + e + "/style.css", auto: !0 }, !0) : !1;
|
|
10777
|
+
}
|
|
10778
|
+
/**
|
|
10779
|
+
* The plugins folder: the pluginFolder setting, or the folder of the registered
|
|
10780
|
+
* plugins (a plugin registered as name: { url: '<folder><name>/index.js' }).
|
|
10781
|
+
*/
|
|
10782
|
+
getPluginFolder() {
|
|
10783
|
+
let e = this.config.pluginFolder;
|
|
10784
|
+
if (!e)
|
|
10785
|
+
for (const [t, i] of Object.entries(this.config.plugins)) {
|
|
10786
|
+
if (!i || typeof i.url != "string") continue;
|
|
10787
|
+
const s = "/" + t + "/index.js";
|
|
10788
|
+
if (i.url.endsWith(s)) {
|
|
10789
|
+
e = i.url.slice(0, -s.length + 1);
|
|
10790
|
+
break;
|
|
10791
|
+
}
|
|
10792
|
+
}
|
|
10793
|
+
return e && !e.endsWith("/") && (e += "/"), e || "";
|
|
10794
|
+
}
|
|
10795
|
+
/**
|
|
10796
|
+
* Plugin names written in the content (data-cb-type)
|
|
10797
|
+
*/
|
|
10798
|
+
contentTypes(e = document) {
|
|
10799
|
+
const t = /* @__PURE__ */ new Set();
|
|
10800
|
+
return e.nodeType === 1 && e.dataset.cbType && t.add(e.dataset.cbType), e.querySelectorAll("[data-cb-type]").forEach((i) => t.add(i.dataset.cbType)), t;
|
|
10761
10801
|
}
|
|
10762
10802
|
/**
|
|
10763
10803
|
* Auto-detect and load plugins based on DOM elements
|
|
10764
10804
|
*/
|
|
10765
10805
|
async autoLoadPlugins() {
|
|
10766
|
-
const
|
|
10767
|
-
(
|
|
10806
|
+
const e = this.detectComponentTypes(), t = this.contentTypes(), i = e.filter(
|
|
10807
|
+
(s) => !this.plugins.has(s) && (this.config.plugins[s] || t.has(s) && this.canLoad(s))
|
|
10768
10808
|
);
|
|
10769
|
-
return
|
|
10770
|
-
|
|
10771
|
-
),
|
|
10809
|
+
return i.length > 0 && await Promise.all(
|
|
10810
|
+
i.map((s) => this.loadPlugin(s))
|
|
10811
|
+
), i;
|
|
10772
10812
|
}
|
|
10773
10813
|
/**
|
|
10774
10814
|
* Detect all component types used in the page
|
|
@@ -10792,7 +10832,7 @@ class vn {
|
|
|
10792
10832
|
async loadPlugin(e) {
|
|
10793
10833
|
if (this.plugins.has(e))
|
|
10794
10834
|
return this.plugins.get(e);
|
|
10795
|
-
const t = this.config.plugins[e];
|
|
10835
|
+
const t = this.config.plugins[e] || (this.canLoad(e) ? this.autoPlugins[e] : null);
|
|
10796
10836
|
if (!t)
|
|
10797
10837
|
return console.warn(`[PluginManager] Plugin "${e}" not found in registry`), null;
|
|
10798
10838
|
if (e === "code") {
|
|
@@ -10806,11 +10846,12 @@ class vn {
|
|
|
10806
10846
|
return this.plugins.set(e, i), this.emit("plugin-loaded", { name: e, plugin: i }), i;
|
|
10807
10847
|
}
|
|
10808
10848
|
try {
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10849
|
+
let i = null;
|
|
10850
|
+
t.css && !t.auto && (i = this.loadCSS(this.resolveUrl(t.css)));
|
|
10851
|
+
const s = this.resolveUrl(t.url), n = await this.importModule(s), r = n.default || n;
|
|
10852
|
+
return t.css && t.auto && (i = this.loadCSS(this.resolveUrl(t.css))), i && await i, this.plugins.set(e, r), typeof r.init == "function" && await r.init(this), this.emit("plugin-loaded", { name: e, plugin: r }), r;
|
|
10812
10853
|
} catch (i) {
|
|
10813
|
-
return console.error(`[PluginManager] Failed to load plugin "${e}":`, i), null;
|
|
10854
|
+
return t.auto ? (delete this.autoPlugins[e], this.missingPlugins.add(e), null) : (console.error(`[PluginManager] Failed to load plugin "${e}":`, i), null);
|
|
10814
10855
|
}
|
|
10815
10856
|
}
|
|
10816
10857
|
/**
|
|
@@ -10827,13 +10868,17 @@ class vn {
|
|
|
10827
10868
|
* Load CSS file
|
|
10828
10869
|
*/
|
|
10829
10870
|
loadCSS(e) {
|
|
10830
|
-
if (this.loadedStyles.has(e)) return;
|
|
10871
|
+
if (this.loadedStyles.has(e)) return this.loadedStyles.get(e);
|
|
10831
10872
|
const t = document.createElement("link");
|
|
10832
|
-
t.rel = "stylesheet", t.href = e
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10873
|
+
t.rel = "stylesheet", t.href = e;
|
|
10874
|
+
const i = new Promise((s) => {
|
|
10875
|
+
t.onload = () => {
|
|
10876
|
+
this.emit("css-loaded", { url: e }), s();
|
|
10877
|
+
}, t.onerror = () => {
|
|
10878
|
+
console.error(`[PluginManager] Failed to load CSS: ${e}`), s();
|
|
10879
|
+
};
|
|
10880
|
+
});
|
|
10881
|
+
return document.head.appendChild(t), this.loadedStyles.set(e, i), i;
|
|
10837
10882
|
}
|
|
10838
10883
|
/**
|
|
10839
10884
|
* Resolve URL (handle relative paths)
|
|
@@ -11014,48 +11059,48 @@ class vn {
|
|
|
11014
11059
|
this.reinitializeInProgress = !0;
|
|
11015
11060
|
try {
|
|
11016
11061
|
const t = [];
|
|
11017
|
-
this.components.forEach((
|
|
11018
|
-
(e === document || e.contains(
|
|
11019
|
-
}), t.forEach(({ element:
|
|
11020
|
-
const
|
|
11021
|
-
|
|
11062
|
+
this.components.forEach((a, d) => {
|
|
11063
|
+
(e === document || e.contains(d)) && t.push({ element: d, instance: a });
|
|
11064
|
+
}), t.forEach(({ element: a, instance: d }) => {
|
|
11065
|
+
const u = a.dataset.cbType, l = this.plugins.get(u);
|
|
11066
|
+
l && typeof l.unmount == "function" && l.unmount(a, d), this.components.delete(a);
|
|
11022
11067
|
});
|
|
11023
|
-
const
|
|
11024
|
-
(
|
|
11068
|
+
const i = this.detectComponentTypesInContainer(e), s = this.contentTypes(e), n = i.filter(
|
|
11069
|
+
(a) => !this.plugins.has(a) && (this.config.plugins[a] || s.has(a) && this.canLoad(a))
|
|
11025
11070
|
);
|
|
11026
|
-
|
|
11027
|
-
|
|
11071
|
+
n.length > 0 && await Promise.all(
|
|
11072
|
+
n.map((a) => this.loadPlugin(a))
|
|
11028
11073
|
);
|
|
11029
|
-
const
|
|
11030
|
-
let
|
|
11031
|
-
for (const
|
|
11032
|
-
const
|
|
11033
|
-
if (
|
|
11074
|
+
const r = e.querySelectorAll("[data-cb-type]");
|
|
11075
|
+
let o = 0;
|
|
11076
|
+
for (const a of r) {
|
|
11077
|
+
const d = a.dataset.cbType, u = this.plugins.get(d);
|
|
11078
|
+
if (u && typeof u.mount == "function")
|
|
11034
11079
|
try {
|
|
11035
|
-
const
|
|
11036
|
-
let
|
|
11037
|
-
if (
|
|
11038
|
-
|
|
11039
|
-
}),
|
|
11040
|
-
const
|
|
11041
|
-
|
|
11042
|
-
}), !
|
|
11043
|
-
|
|
11080
|
+
const l = this.parseOptions(a);
|
|
11081
|
+
let h = a.querySelector(".grid-sortable");
|
|
11082
|
+
if (h || a.classList.contains("grid-sortable") && (h = a), h && Array.from(h.children).forEach((w, _) => {
|
|
11083
|
+
w.nodeType === 1 && w.tagName !== "STYLE" && w.tagName !== "SCRIPT" && w.setAttribute("data-index", _);
|
|
11084
|
+
}), a.querySelectorAll(".edit").forEach((w, _) => {
|
|
11085
|
+
const g = `content-${Date.now()}-${o}-${_}`;
|
|
11086
|
+
w.setAttribute("data-edit-id", g);
|
|
11087
|
+
}), !a.hasAttribute("data-cb-original-content"))
|
|
11088
|
+
a.setAttribute("data-cb-original-content", a.innerHTML);
|
|
11044
11089
|
else {
|
|
11045
|
-
let
|
|
11046
|
-
|
|
11047
|
-
let
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
}),
|
|
11090
|
+
let w = document.createRange();
|
|
11091
|
+
a.innerHTML = "", a.appendChild(w.createContextualFragment(a.getAttribute("data-cb-original-content")));
|
|
11092
|
+
let _ = !1;
|
|
11093
|
+
a.querySelectorAll(".edit:not([data-edit-id])").forEach((g, y) => {
|
|
11094
|
+
g.setAttribute("data-edit-id", `content-${Date.now()}-${o}-new-${y}`), _ = !0;
|
|
11095
|
+
}), _ && a.setAttribute("data-cb-original-content", a.innerHTML);
|
|
11051
11096
|
}
|
|
11052
|
-
const
|
|
11053
|
-
this.components.set(
|
|
11054
|
-
} catch (
|
|
11055
|
-
console.error(`[PluginManager] Failed to mount component "${
|
|
11097
|
+
const b = await u.mount(a, l);
|
|
11098
|
+
this.components.set(a, b), this.setupInlineEditing(a, l), a.setAttribute("data-cb-loaded", "true"), typeof a.mount == "function" && a.mount(), o++;
|
|
11099
|
+
} catch (l) {
|
|
11100
|
+
console.error(`[PluginManager] Failed to mount component "${d}":`, l);
|
|
11056
11101
|
}
|
|
11057
11102
|
}
|
|
11058
|
-
return typeof this.config.onReInit == "function" && this.config.onReInit(), this.emit("reinitialized", { container: e, count:
|
|
11103
|
+
return typeof this.config.onReInit == "function" && this.config.onReInit(), this.emit("reinitialized", { container: e, count: o }), o;
|
|
11059
11104
|
} finally {
|
|
11060
11105
|
this.reinitializeInProgress = !1;
|
|
11061
11106
|
}
|
|
@@ -11231,6 +11276,10 @@ class wn {
|
|
|
11231
11276
|
// Plugin registry: { 'plugin-name': { url: '...', css: '...' } }
|
|
11232
11277
|
autoLoadPlugins: !0,
|
|
11233
11278
|
// Auto-load plugins based on detected components
|
|
11279
|
+
autoRegisterPlugins: !0,
|
|
11280
|
+
// Load a plugin found in the content even when it is not registered (from pluginFolder)
|
|
11281
|
+
pluginFolder: "",
|
|
11282
|
+
// Folder holding the plugins (<folder><name>/index.js); found from the registered plugins when empty
|
|
11234
11283
|
pluginBaseUrl: "",
|
|
11235
11284
|
// Base URL for plugins if using relative paths
|
|
11236
11285
|
allowExternalPlugins: !0,
|
|
@@ -11241,6 +11290,8 @@ class wn {
|
|
|
11241
11290
|
this.settings = { ...t, ...e }, this.initialized = !1, this.pluginManager = new vn({
|
|
11242
11291
|
plugins: this.settings.plugins,
|
|
11243
11292
|
autoLoad: this.settings.autoLoadPlugins,
|
|
11293
|
+
autoRegisterPlugins: this.settings.autoRegisterPlugins,
|
|
11294
|
+
pluginFolder: this.settings.pluginFolder,
|
|
11244
11295
|
pluginBaseUrl: this.settings.pluginBaseUrl,
|
|
11245
11296
|
allowExternalPlugins: this.settings.allowExternalPlugins,
|
|
11246
11297
|
trustedDomains: this.settings.trustedDomains
|